diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index a32c4b0..0000000 --- a/.dockerignore +++ /dev/null @@ -1,18 +0,0 @@ -.git -.github -.next -.vercel -node_modules -coverage -site-work -*.log -.DS_Store -.env -.env.local -.env.development.local -.env.test.local -.env.production.local -npm-debug.log* -yarn-debug.log* -yarn-error.log* -.pnpm-debug.log* diff --git a/.env.example b/.env.example index 31a4ae6..1d720c4 100644 --- a/.env.example +++ b/.env.example @@ -2,7 +2,11 @@ # Copy to .env and adjust values for your machine. # Required: local database -DATABASE_URL=postgres://postgres:postgres@localhost:5432/synapsis +# Embedded Turso database file. Relative paths resolve from the app directory. +DATABASE_PATH=./data/synapsis.db + +# Synapsis' standard local bind port. Override it if this port is already in use. +PORT=43821 # Required: used for sessions, node key encryption, and bot API key encryption AUTH_SECRET=replace-with-a-long-random-secret @@ -11,8 +15,8 @@ AUTH_SECRET=replace-with-a-long-random-secret ADMIN_EMAILS=admin@example.com # Recommended: local node identity -NEXT_PUBLIC_NODE_DOMAIN=localhost:3000 -NEXT_PUBLIC_APP_URL=http://localhost:3000 +NEXT_PUBLIC_NODE_DOMAIN=localhost:43821 +NEXT_PUBLIC_APP_URL=http://localhost:43821 # Optional: node metadata shown before a node record exists in the database # NEXT_PUBLIC_NODE_NAME=Synapsis Local diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c7db2df..8134c0d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,21 +36,12 @@ jobs: src/lib/bots/mentionHandler.property.test.ts src/lib/bots/scheduler.test.ts + - name: Embedded database smoke test + run: DATABASE_PATH=/tmp/synapsis-ci.db npm run db:migrate + - name: Production build run: npm run build - - docker-validation: - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Validate production compose config - run: docker compose --env-file docker/.env.example config > /tmp/synapsis-compose.txt - - - name: Validate source-build compose config - run: docker compose -f docker/docker-compose.yml --env-file docker/.env.example config > /tmp/synapsis-build-compose.txt - - - name: Build application image - run: docker build -f docker/Dockerfile . + env: + AUTH_SECRET: ci-test-secret + DATABASE_PATH: /tmp/synapsis-ci.db + NEXT_PUBLIC_NODE_DOMAIN: localhost:43821 diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml deleted file mode 100644 index 9edbfed..0000000 --- a/.github/workflows/docker.yml +++ /dev/null @@ -1,62 +0,0 @@ -name: Build and Push Docker Image to GHCR - -on: - workflow_dispatch: - inputs: - tag: - description: 'Optional explicit version tag (for example 2026.03.09.10). Leave blank to auto-increment.' - required: false - default: '' - # Also build on version tags - push: - tags: - - 'v*' - -env: - REGISTRY: ghcr.io - IMAGE_NAME: gnosyslabs/synapsis - -jobs: - build-and-push: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - id-token: write - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Log in to Container Registry - uses: docker/login-action@v3 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Build and push Docker image - env: - IMAGE_REPO: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - PLATFORMS: linux/amd64,linux/arm64 - PRUNE_BUILD_CACHE: '0' - APP_VERSION: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || '' }} - EXTRA_TAGS: ${{ startsWith(github.ref, 'refs/tags/v') && github.ref_name || '' }} - run: | - if [ -n "$EXTRA_TAGS" ]; then - EXTRA_TAGS="${EXTRA_TAGS#v}" - export EXTRA_TAGS - if [ -z "$APP_VERSION" ]; then - APP_VERSION="$EXTRA_TAGS" - export APP_VERSION - fi - fi - - chmod +x ./scripts/docker-publish.sh - ./scripts/docker-publish.sh diff --git a/.gitignore b/.gitignore index 6af1c13..0092eda 100644 --- a/.gitignore +++ b/.gitignore @@ -47,6 +47,12 @@ next-env.d.ts # uploads /public/uploads/ +# embedded Turso / SQLite data +/data/ +*.db +*.db-shm +*.db-wal + # IDE .vscode/ .kiro/ diff --git a/.tmp/remote-docker-doc.mdx b/.tmp/remote-docker-doc.mdx deleted file mode 100644 index 6618fa4..0000000 --- a/.tmp/remote-docker-doc.mdx +++ /dev/null @@ -1,247 +0,0 @@ -# Quick Start with Docker - -Get your Synapsis node running in under 10 minutes with Docker. This is the **recommended and easiest** way to self-host. - -## Prerequisites - -- A Linux server with a domain pointed to it -- A domain name pointed to your server - -## Quick Start (5 Minutes) - -```bash -# 1. Bootstrap the deployment directory -curl -fsSL https://synapsis.social/install.sh | bash - -# 2. Review the generated config -nano /opt/synapsis/.env - -# 3. Start your node -cd /opt/synapsis -docker compose up -d -``` - -Done! Your node is live at `https://your-domain.com` with automatic SSL. - -## Existing nginx / reverse proxy host - -If your server already has nginx, Traefik, or another reverse proxy using `80/443`, use proxyless mode instead: - -```bash -curl -fsSL https://synapsis.social/install.sh | PROXY=none bash -nano /opt/synapsis/.env -cd /opt/synapsis -docker compose up -d -``` - -In `PROXY=none` mode: - -- Synapsis skips the bundled Caddy service -- the app binds to `127.0.0.1:${PORT}` -- your existing reverse proxy should forward traffic to that localhost port - -Example nginx upstream: - -```nginx -location / { - proxy_pass http://127.0.0.1:3000; - proxy_http_version 1.1; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "upgrade"; -} -``` - -## Detailed Setup - -### 1. Bootstrap the Deployment Directory - -```bash -curl -fsSL https://synapsis.social/install.sh | bash -``` - -If Docker is missing, the installer will install it for you on supported Linux hosts. - -This downloads: - -- `docker-compose.yml` -- `Caddyfile` -- `caddy-entrypoint.sh` -- `.env.example` -- `.env` - -The installer also generates `AUTH_SECRET` and `DB_PASSWORD` if `openssl` is available. - -### 2. Configure Environment - -Edit `/opt/synapsis/.env` with your settings: - -```bash -nano /opt/synapsis/.env -``` - -**Required variables:** - -```env -# Your domain -DOMAIN=your-domain.com - -# Admin email(s) -ADMIN_EMAILS=you@example.com - -# Generate with: openssl rand -hex 32 -AUTH_SECRET=your-secret-key-here - -# Database password -DB_PASSWORD=your-secure-password -``` - -You can also set these before running the installer to prefill `.env`: - -```bash -DOMAIN=your-domain.com -ADMIN_EMAILS=you@example.com -``` - -That’s it. Save and exit. - -### 3. Start Synapsis - -```bash -cd /opt/synapsis -docker compose up -d -``` - -This starts: -- **PostgreSQL** database -- **Synapsis** app (pre-built image from GitHub Container Registry) -- **Caddy** reverse proxy with automatic SSL - -Visit `https://your-domain.com` to create your admin account. - -## Storage Model - -### Node installation - -The node itself only needs Docker, PostgreSQL, and a domain to start. - -### User media storage - -At the moment, new user registration requires each account to provide **its own S3-compatible storage credentials** for media uploads. That requirement is enforced in the app today, so plan onboarding accordingly. - -## Configuration Reference - -### Core Variables - -| Variable | Required | Description | -|----------|----------|-------------| -| `DOMAIN` | Yes | Your domain name | -| `AUTH_SECRET` | Yes | Generate with `openssl rand -hex 32` | -| `ADMIN_EMAILS` | Yes | Comma-separated admin emails | -| `DB_PASSWORD` | Yes | Database password | - -### Optional Variables - -| Variable | Default | Description | -|----------|---------|-------------| -| `BOT_MAX_PER_USER` | 5 | Max AI bots per user | -| `PORT` | auto | Application port. Default installs use `auto` to scan 3000-3020. In `PROXY=none` mode this is the localhost port your reverse proxy should target. | -| `NEXT_PUBLIC_NODE_DOMAIN` | `DOMAIN` | Override node domain if needed | -| `NEXT_PUBLIC_APP_URL` | Derived from domain | Public URL used by background jobs | - -## Updating Synapsis - -Updating is a single command: - -```bash -cd /opt/synapsis -docker compose pull -docker compose up -d -``` - -This will: -- Pull the latest pre-built image from GitHub Container Registry -- Recreate containers if needed -- Run database migrations automatically -- Keep your data volumes intact - -### Check Update Status - -```bash -# See running containers -docker compose ps - -# View logs -docker compose logs -f app -``` - -## Troubleshooting - -### Container won't start - -```bash -# Check logs -docker compose logs app - -# Common issues: -# - Missing required env vars -# - Port 3000 already in use -``` - -### Database connection errors - -```bash -# Check database container -docker compose logs postgres - -# Verify env vars are loaded -docker compose exec app env | grep DATABASE -``` - -### Port already in use - -If `80` or `443` is already in use, your server already has another reverse proxy bound there. Use `PROXY=none` instead of the default Caddy install: - -```bash -curl -fsSL https://synapsis.social/install.sh | PROXY=none bash -``` - -For the application port itself, Synapsis uses `PORT=auto` by default, which automatically finds an available port between 3000-3020. If you need to use a specific port: - -```bash -# Edit .env and set a specific port -PORT=3001 - -# Restart -docker compose down -docker compose up -d -``` - -### Reset everything (data loss!) - -```bash -docker compose down -v # Remove containers AND volumes -docker compose up -d # Start fresh -``` - -### View all logs - -```bash -# All services -docker compose logs -f - -# Just the app -docker compose logs -f app - -# Just the database -docker compose logs -f postgres -``` - -## Next Steps - -- [Configure your node settings](/user-guide) -- [Learn about the Swarm](/swarm) -- [Learn how Synapsis differs from traditional federation](/user-guide/synapsis-difference) diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 16a74e0..0000000 --- a/Dockerfile +++ /dev/null @@ -1,72 +0,0 @@ -# Synapsis Docker Image -# Multi-stage build for production - -# Stage 1: Dependencies -FROM node:20-alpine AS deps -RUN apk add --no-cache libc6-compat -WORKDIR /app - -# Copy package files -COPY package.json package-lock.json* ./ -RUN npm ci --only=production - -# Stage 2: Builder -FROM node:20-alpine AS builder -WORKDIR /app - -# Copy deps from previous stage -COPY --from=deps /app/node_modules ./node_modules -COPY . . - -# Build the application -ENV NEXT_TELEMETRY_DISABLED=1 -ENV NODE_ENV=production -RUN npm run build - -# Stage 3: Runner -FROM node:20-alpine AS runner -WORKDIR /app - -ENV NODE_ENV=production -ENV NEXT_TELEMETRY_DISABLED=1 - -# Install tools needed for port detection and healthchecks -RUN apk add --no-cache netcat-openbsd wget - -# Create non-root user -RUN addgroup --system --gid 1001 nodejs -RUN adduser --system --uid 1001 nextjs - -# Copy necessary files -COPY --from=builder /app/public ./public -COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./ -COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static -COPY --from=builder --chown=nextjs:nodejs /app/node_modules ./node_modules -COPY --from=builder --chown=nextjs:nodejs /app/package.json ./ -COPY --from=builder --chown=nextjs:nodejs /app/drizzle ./drizzle -COPY --from=builder --chown=nextjs:nodejs /app/drizzle.config.ts ./ -COPY --from=builder --chown=nextjs:nodejs /app/src/db/schema.ts ./src/db/schema.ts - -# Copy and set up entrypoint script -COPY --chown=nextjs:nodejs scripts/docker-entrypoint.sh /usr/local/bin/ -RUN chmod +x /usr/local/bin/docker-entrypoint.sh - -# Create shared directory for port file (must be writable by nextjs) -RUN mkdir -p /var/run/synapsis && chown nextjs:nodejs /var/run/synapsis - -# Switch to non-root user -USER nextjs - -# Expose port range for auto-detection -EXPOSE 3000-3020 - -# Set environment variables (can be overridden at runtime) -ENV PORT=3000 -ENV HOSTNAME="0.0.0.0" - -# Health check (reads dynamic port file when PORT=auto) -HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ - CMD sh -c 'PORT_FILE=/var/run/synapsis/port; PORT=3000; if [ -f "$PORT_FILE" ]; then PORT=$(cat "$PORT_FILE"); fi; case "$PORT" in ""|*[!0-9]*) PORT=3000;; esac; wget -q --spider "http://127.0.0.1:${PORT}/api/health" || exit 1' - -# Use entrypoint script for port detection -ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"] diff --git a/HOW_TO_WORK_ON_SYNAPIS.md b/HOW_TO_WORK_ON_SYNAPIS.md index e228548..e1bab69 100644 --- a/HOW_TO_WORK_ON_SYNAPIS.md +++ b/HOW_TO_WORK_ON_SYNAPIS.md @@ -1,159 +1,38 @@ -# How To Work On Synapsis -This is the practical workflow for developing Synapsis without turning every bugfix into a full Docker release. +# Working on Synapsis -## Basic Rule -Use three different loops for three different jobs: -1. `npm run dev` for normal feature work and bugfixes -2. local Docker source builds when you need container parity -3. GHCR publish only when you actually want the server to update +Synapsis uses an embedded Turso database and runs as a native Node.js process. Docker and a local PostgreSQL server are not part of the development or deployment workflow. -Do **not** rebuild and push a Docker image for every tiny fix. Batch fixes together, verify them locally, then publish when the server needs the new version. - -## 1. Normal Local Development -Use this for most day-to-day work. +## Local loop ```bash npm install cp .env.example .env -npm run db:push +npm run db:migrate npm run dev ``` -Useful verification commands: +Before handing off a change: ```bash npm run type-check -npm run build npm test +npm run build ``` -Use this loop when: -- changing UI -- fixing API logic -- working on auth, feed logic, posting, bots, or settings -- you do not specifically need to test the Docker runtime - -## 2. Local Docker Parity Test -Use this when you want to know whether the app still works inside the actual container setup. This compose file builds from your local source tree: +When the schema changes, edit `src/db/schema.ts`, generate a migration with `npm run db:generate`, and verify it against a fresh database: ```bash -cd docker -cp .env.example .env -docker compose up --build +DATABASE_PATH=/tmp/synapsis-test.db npm run db:migrate ``` -That uses [docker/docker-compose.yml](/Users/christopher/Dev/Synapsis/Synapsis/docker/docker-compose.yml) and [docker/Dockerfile](/Users/christopher/Dev/Synapsis/Synapsis/docker/Dockerfile). +## VPS workflow -Use this loop when: -- Docker-specific startup behavior matters -- you changed the Dockerfile or entrypoint -- you changed env handling, healthchecks, migrations, ports, or install flow - -## 3. Production Image Publish -Use this only when you want the server or end users to pull a new image. The production install uses [docker-compose.yml](/Users/christopher/Dev/Synapsis/Synapsis/docker-compose.yml) and `ghcr.io/gnosyslabs/synapsis:latest`. - -### First-time GHCR auth on this machine -```bash -gh auth refresh -h github.com -s read:packages -s write:packages -gh auth token | docker login ghcr.io -u YOUR_GITHUB_USERNAME --password-stdin -``` - -### Publish the image -Push code first: +Production runs through `synapsis.service`, listening on `127.0.0.1:43821`. Reverse-proxy configuration belongs to the host operator. ```bash -git push origin main +sudo /opt/synapsis/deploy/update.sh +sudo systemctl status synapsis +sudo journalctl -u synapsis -f ``` -Then build and push the multi-arch image: - -```bash -BUILDER=colima ./scripts/docker-publish.sh -``` - -That publishes: -- `ghcr.io/gnosyslabs/synapsis:latest` -- `ghcr.io/gnosyslabs/synapsis:` -- `ghcr.io/gnosyslabs/synapsis:` - -If you are not on a Mac/Colima setup, set `BUILDER` to your buildx builder or leave it empty to use the default builder. - -To force an explicit version instead of auto-incrementing: - -```bash -APP_VERSION=2026.03.09.10 BUILDER=colima ./scripts/docker-publish.sh -``` - -## 4. Update The Server -Once a new image is published, update the server with: - -```bash -cd /opt/synapsis -docker compose pull -docker compose up -d -``` - -Useful checks: - -```bash -docker compose ps -docker compose logs -f app -docker compose images -``` - -## 5. Which Compose File Is Which -There are two main Docker compose paths in this repo. - -### Local source-build compose -File: [docker/docker-compose.yml](/Users/christopher/Dev/Synapsis/Synapsis/docker/docker-compose.yml) - -Purpose: -- local Docker testing -- builds from your current working tree -- no GHCR push required - -### Production install compose -File: [docker-compose.yml](/Users/christopher/Dev/Synapsis/Synapsis/docker-compose.yml) - -Purpose: -- end-user install -- server deployment -- uses `ghcr.io/gnosyslabs/synapsis:latest` - -Do not confuse them. - -## 6. Recommended Workflow -This is the default path that makes the most sense for Synapsis: -1. Make code changes locally -2. Run `npm run type-check` -3. Run `npm run build` -4. If Docker behavior matters, run `cd docker && docker compose up --build` -5. Keep stacking fixes until the server actually needs them -6. Commit and push -7. Build and push the GHCR image -8. Pull and restart on the server - -## 7. When To Publish A New Docker Image -Publish when: -- you want the fix on the real server -- you changed install/runtime/container behavior -- you finished a coherent batch of fixes - -Do not publish just because: -- one small UI bug was fixed locally -- one small API bug was fixed and not needed on the server yet - -## 8. Current Install Reality -For clean servers, the normal install path is: - -```bash -curl -fsSL https://synapsis.social/install.sh | bash -``` - -For servers that already run nginx or another reverse proxy on `80/443`, use: - -```bash -curl -fsSL https://synapsis.social/install.sh | PROXY=none bash -``` - -In `PROXY=none` mode, Synapsis binds to `127.0.0.1:${PORT}` and your existing reverse proxy should point there. +The updater makes a timestamped database backup, pulls with `--ff-only`, installs dependencies, runs migrations, builds, and restarts the service. diff --git a/README.md b/README.md index 4facf69..183bf03 100644 --- a/README.md +++ b/README.md @@ -2,164 +2,85 @@ **Your node. Your network. Your identity.** -Synapsis is an open-source, federated social network built for the decentralized web. Run your own node, own your identity with DIDs, and communicate across the Swarm network with plain text server-stored messaging. No corporations. No lock-in. Just you and the network. +Synapsis is an open-source federated social network built around sovereign DIDs, portable user-owned media storage, and the Swarm network. ---- +## Run a node on a VPS -## πŸš€ Deploy Your Own Node (5 Minutes) +Synapsis runs directly under systemd. It does not require Docker, PostgreSQL, or a bundled reverse proxy. -Run your personal Synapsis node with a single command: +Prerequisites: + +- A Linux VPS with systemd +- Node.js 20 or newer +- Git, npm, and OpenSSL +- Your own nginx, Caddy, Traefik, or other reverse proxy + +Install from a checkout: ```bash -# 1. Bootstrap the deployment directory -curl -fsSL https://synapsis.social/install.sh | bash - -# 2. Edit /opt/synapsis/.env with your domain and admin email -nano /opt/synapsis/.env - -# 3. Start your node -cd /opt/synapsis -docker compose up -d +sudo bash deploy/install.sh +sudo nano /etc/synapsis.env +sudo bash /opt/synapsis/deploy/update.sh ``` -Done! Your node is live at `https://your-domain.com` with automatic SSL. No build step. No dependencies. No fuss. -Database migrations run automatically on startup and during updates. +The service binds only to `127.0.0.1:43821`. Point your reverse proxy at that address and terminate TLS there. `PORT` can be overridden in `/etc/synapsis.env` if needed. -Set `DOMAIN` to the canonical host you want Synapsis to live on. If you also create a `www` DNS record, the bundled Caddy setup will redirect `www` to that canonical domain automatically. +The installer creates: -If your server already has nginx or another reverse proxy using `80/443`, use the advanced mode instead: +- Application checkout: `/opt/synapsis` +- Environment file: `/etc/synapsis.env` +- Embedded Turso database: `/var/lib/synapsis/synapsis.db` +- Service: `synapsis.service` + +Useful commands: ```bash -curl -fsSL https://synapsis.social/install.sh | PROXY=none bash +sudo systemctl status synapsis +sudo journalctl -u synapsis -f +sudo /opt/synapsis/deploy/update.sh +sudo /opt/synapsis/deploy/uninstall.sh ``` -**Updating (migrations run automatically):** -```bash -curl -fsSL https://synapsis.social/update.sh | bash -``` +Uninstalling preserves the database and environment by default. Pass `--purge-data` only when you intentionally want to remove both. -**Full uninstall:** -```bash -curl -fsSL https://synapsis.social/uninstall.sh | bash -``` +## Storage and account portability -For detailed Docker setup, see [docker/README.md](docker/README.md). +The node database is a local embedded Turso/SQLite file. Media remains in each user's S3-compatible bucket so exported accounts can retain portable media URLs and move between Synapsis nodes without requiring the old node to transfer a shared upload directory. ---- +Supported S3-compatible providers include AWS S3, Cloudflare R2, Backblaze B2, Wasabi, and Contabo. Synapsis stores each user's credentials encrypted with `AUTH_SECRET`. -## ✨ Features - -- **🌐 Swarm Network** β€” Native peer-to-peer network with automatic node discovery and gossip protocol -- **πŸ’¬ Swarm Chat** β€” Direct messaging across the entire network -- **πŸ” Decentralized Identity (DIDs)** β€” Cryptographic identity you truly own, portable between nodes -- **πŸ€– AI Bots** β€” Create AI-powered bot accounts with custom personalities -- **🎨 Modern UI** β€” Clean, responsive interface inspired by Vercel's design system -- **πŸ–ΌοΈ Rich Media** β€” Image uploads, media galleries, and S3-compatible storage -- **πŸ›‘οΈ Built-in Moderation** β€” Admin dashboard for user management and content moderation -- **πŸ“± Auto Port Detection** β€” Runs on the first available port (3000-3020) automatically -- **πŸ“Š Curated Feeds** β€” Smart algorithms highlighting engaging content across the swarm - ---- - -## πŸ“– Documentation - -- **[Docker Deployment Guide](docker/README.md)** β€” Complete production deployment instructions -- **[User Guide](/guide)** β€” Learn how Synapsis works (visit after installing) -- **[API Documentation](https://docs.synapsis.social)** β€” Developer reference - ---- - -## πŸ—οΈ Architecture - -Synapsis differs from traditional social networks by prioritizing **sovereign identity** and **native peer-to-peer communication**. - -### πŸ” Decentralized Identity (DIDs) - -Unlike centralized platforms where your identity is a row in a database owned by a corporation, Synapsis uses a cryptographic identity system: - -| Concept | Description | -|---------|-------------| -| **DID** | A unique, cryptographically-generated identifier (`did:key:...`) assigned to every user. This is your true identity that exists independently of any server. | -| **Handle** | A human-readable username (`@alice`) that points to your DID. Think of it like a domain name pointing to an IP address. | -| **Key Pair** | Every account has a public/private key pair. Your private key proves you are you; your public key lets others verify your identity. | - -**Why this matters:** -- **Ownership** β€” Your identity is cryptographically yours, not controlled by a company -- **Authenticity** β€” Every post is signed with your private key, proving it came from you -- **True Portability** β€” Move your account between nodes without losing followers - -### 🌐 The Swarm Network - -Synapsis operates on the **Swarm** β€” a native peer-to-peer network designed specifically for Synapsis nodes: - -- **Gossip Protocol** β€” Nodes discover each other automatically and exchange information -- **Swarm Timeline** β€” Aggregated feed of posts from across all Synapsis nodes -- **Swarm Chat** β€” Direct messaging between users on any Synapsis node -- **Handle Registry** β€” Distributed directory of user handles across the swarm -- **Instant Interactions** β€” Likes, reposts, follows, and mentions delivered in real-time - -### πŸ†š Synapsis vs. Traditional Federation - -| Feature | Traditional Federation | Synapsis | -|---------|------------------------|----------| -| **Identity** | Server-bound (`@user@server`) | DID-based (cryptographic, portable) | -| **Account Migration** | Limited (followers don't auto-migrate) | **Full** β€” DID-based migration with auto-follow | -| **Cryptographic Signing** | HTTP Signatures only | Full post signing with user keys | -| **Direct Messages** | Posts with limited visibility | Direct messaging between users | -| **Network Discovery** | Manual server discovery | Automatic gossip protocol | -| **AI Bots** | Not supported | Native bot framework with LLM integration | -| **Interactions** | Queue-based, delayed | Instant delivery via Swarm | - ---- - -## πŸ› οΈ Development - -Want to hack on Synapsis? Here's how to run it locally: - -### Prerequisites -- Node.js 20+ -- PostgreSQL 15+ -- S3-compatible storage (AWS S3, Cloudflare R2, Backblaze B2, Wasabi, or Contabo) - -### Local Setup +## Development ```bash -# 1. Clone the repository git clone https://github.com/GnosysLabs/Synapsis.git -cd synapsis - -# 2. Install dependencies +cd Synapsis npm install - -# 3. Configure environment cp .env.example .env -# Edit .env with your local database and storage settings - -# 4. Set up the database -npm run db:push - -# 5. Run the development server +npm run db:migrate npm run dev ``` -Visit `http://localhost:3000` and register with an email listed in `ADMIN_EMAILS`. Local setup no longer uses a dedicated `/install` route. +The development database defaults to `./data/synapsis.db`. No separate database server is needed. -### Tech Stack +Common commands: -- **Framework** β€” [Next.js 15+](https://nextjs.org/) (App Router) -- **Database** β€” PostgreSQL with [Drizzle ORM](https://orm.drizzle.team/) -- **Styling** β€” Tailwind CSS v4 & custom Vercel-like design system -- **Authentication** β€” Auth.js (NextAuth) -- **Type Safety** β€” TypeScript +```bash +npm run type-check +npm test +npm run db:generate +npm run db:migrate +npm run build +``` ---- +## Architecture -## πŸ“œ License +- **Framework:** Next.js 16 and React 19 +- **Database:** embedded Turso with Drizzle ORM's relational-query v2 API +- **Identity:** DIDs and per-user signing keys +- **Media:** user-owned S3-compatible storage +- **Federation:** Synapsis Swarm discovery and signed interactions +- **Deployment:** native Node.js process managed by systemd -Licensed under the **Apache 2.0 License**. See [LICENSE](LICENSE) for details. +## License ---- - -

- Run your node. Join the swarm. Own your social. -

+Licensed under the [Apache License 2.0](LICENSE). diff --git a/deploy/install.sh b/deploy/install.sh new file mode 100755 index 0000000..7d8a03d --- /dev/null +++ b/deploy/install.sh @@ -0,0 +1,65 @@ +#!/usr/bin/env bash +set -euo pipefail + +APP_DIR="${APP_DIR:-/opt/synapsis}" +DATA_DIR="${DATA_DIR:-/var/lib/synapsis}" +ENV_FILE="${ENV_FILE:-/etc/synapsis.env}" +REPO_URL="${REPO_URL:-https://github.com/GnosysLabs/Synapsis.git}" +BRANCH="${BRANCH:-main}" + +if [[ ${EUID} -ne 0 ]]; then + echo "Run this installer as root." >&2 + exit 1 +fi + +for command in git node npm openssl runuser systemctl; do + command -v "$command" >/dev/null || { echo "Missing required command: $command" >&2; exit 1; } +done + +node_major="$(node -p 'process.versions.node.split(`.`)[0]')" +if (( node_major < 20 )); then + echo "Synapsis requires Node.js 20 or newer." >&2 + exit 1 +fi + +if ! id synapsis >/dev/null 2>&1; then + useradd --system --home-dir "$DATA_DIR" --create-home --shell /usr/sbin/nologin synapsis +fi + +install -d -o synapsis -g synapsis -m 0750 "$DATA_DIR" + +if [[ -e "$APP_DIR" ]]; then + echo "$APP_DIR already exists; use deploy/update.sh for an existing installation." >&2 + exit 1 +fi + +git clone --branch "$BRANCH" --single-branch "$REPO_URL" "$APP_DIR" +chown -R synapsis:synapsis "$APP_DIR" + +if [[ ! -e "$ENV_FILE" ]]; then + auth_secret="$(openssl rand -base64 48 | tr -d '\n')" + port="43821" + install -m 0600 -o root -g synapsis /dev/null "$ENV_FILE" + { + echo "DATABASE_PATH=$DATA_DIR/synapsis.db" + echo "PORT=$port" + echo "AUTH_SECRET=$auth_secret" + echo "ADMIN_EMAILS=admin@example.com" + echo "NEXT_PUBLIC_NODE_DOMAIN=localhost:$port" + } > "$ENV_FILE" +fi + +set -a +source "$ENV_FILE" +set +a + +runuser -u synapsis -- npm --prefix "$APP_DIR" ci +runuser -u synapsis -- npm --prefix "$APP_DIR" run db:migrate +runuser -u synapsis -- npm --prefix "$APP_DIR" run build + +install -m 0644 "$APP_DIR/deploy/synapsis.service" /etc/systemd/system/synapsis.service +systemctl daemon-reload +systemctl enable --now synapsis + +echo "Synapsis is listening on http://127.0.0.1:${PORT}" +echo "Edit $ENV_FILE, run $APP_DIR/deploy/update.sh, then configure your own reverse proxy." diff --git a/deploy/synapsis.service b/deploy/synapsis.service new file mode 100644 index 0000000..83f1367 --- /dev/null +++ b/deploy/synapsis.service @@ -0,0 +1,23 @@ +[Unit] +Description=Synapsis node +After=network-online.target +Wants=network-online.target + +[Service] +Type=simple +User=synapsis +Group=synapsis +WorkingDirectory=/opt/synapsis +EnvironmentFile=/etc/synapsis.env +Environment=NODE_ENV=production +ExecStart=/usr/bin/env npm start +Restart=on-failure +RestartSec=5 +NoNewPrivileges=true +PrivateTmp=true +ProtectSystem=strict +ProtectHome=true +ReadWritePaths=/var/lib/synapsis /opt/synapsis/.next + +[Install] +WantedBy=multi-user.target diff --git a/deploy/uninstall.sh b/deploy/uninstall.sh new file mode 100755 index 0000000..b95b1f6 --- /dev/null +++ b/deploy/uninstall.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash +set -euo pipefail + +APP_DIR="${APP_DIR:-/opt/synapsis}" +DATA_DIR="${DATA_DIR:-/var/lib/synapsis}" +ENV_FILE="${ENV_FILE:-/etc/synapsis.env}" + +if [[ ${EUID} -ne 0 ]]; then + echo "Run this uninstaller as root." >&2 + exit 1 +fi + +systemctl disable --now synapsis 2>/dev/null || true +rm -f /etc/systemd/system/synapsis.service +systemctl daemon-reload +rm -rf "$APP_DIR" + +if [[ "${1:-}" == "--purge-data" ]]; then + rm -rf "$DATA_DIR" + rm -f "$ENV_FILE" + userdel synapsis 2>/dev/null || true + echo "Synapsis and its database were removed." +else + echo "Synapsis was removed; $DATA_DIR and $ENV_FILE were preserved." +fi diff --git a/deploy/update.sh b/deploy/update.sh new file mode 100755 index 0000000..924976f --- /dev/null +++ b/deploy/update.sh @@ -0,0 +1,43 @@ +#!/usr/bin/env bash +set -euo pipefail + +APP_DIR="${APP_DIR:-/opt/synapsis}" +DATA_DIR="${DATA_DIR:-/var/lib/synapsis}" +ENV_FILE="${ENV_FILE:-/etc/synapsis.env}" + +if [[ ${EUID} -ne 0 ]]; then + echo "Run this updater as root." >&2 + exit 1 +fi + +[[ -d "$APP_DIR/.git" ]] || { echo "No Synapsis checkout found at $APP_DIR" >&2; exit 1; } +[[ -f "$ENV_FILE" ]] || { echo "Missing $ENV_FILE" >&2; exit 1; } + +set -a +source "$ENV_FILE" +set +a + +systemctl stop synapsis +trap 'systemctl start synapsis' EXIT + +if [[ -f "${DATABASE_PATH:-$DATA_DIR/synapsis.db}" ]]; then + database_file="${DATABASE_PATH:-$DATA_DIR/synapsis.db}" + backup_dir="$DATA_DIR/backups/$(date -u +%Y%m%dT%H%M%SZ)" + install -d -o synapsis -g synapsis -m 0750 "$backup_dir" + cp "$database_file" "$backup_dir/synapsis.db" + for suffix in -wal -shm; do + if [[ -f "${database_file}${suffix}" ]]; then + cp "${database_file}${suffix}" "$backup_dir/synapsis.db${suffix}" + fi + done + chown -R synapsis:synapsis "$backup_dir" +fi + +runuser -u synapsis -- git -C "$APP_DIR" pull --ff-only +runuser -u synapsis -- npm --prefix "$APP_DIR" ci +runuser -u synapsis -- npm --prefix "$APP_DIR" run db:migrate +runuser -u synapsis -- npm --prefix "$APP_DIR" run build + +systemctl start synapsis +trap - EXIT +echo "Synapsis updated successfully." diff --git a/docker-compose.proxyless.yml b/docker-compose.proxyless.yml deleted file mode 100644 index 15a29e3..0000000 --- a/docker-compose.proxyless.yml +++ /dev/null @@ -1,81 +0,0 @@ -# Synapsis - Docker Compose (Production, External Reverse Proxy) -# Uses pre-built image from GitHub Container Registry -# -# Intended for hosts that already run nginx/Traefik/Caddy on 80/443. -# Synapsis binds only to localhost so your existing proxy can forward to it. - -services: - postgres: - image: postgres:16-alpine - container_name: synapsis-db - restart: unless-stopped - environment: - POSTGRES_USER: ${DB_USER:-synapsis} - POSTGRES_PASSWORD: ${DB_PASSWORD:-changeme} - POSTGRES_DB: ${DB_NAME:-synapsis} - PGDATA: /var/lib/postgresql/data/pgdata - volumes: - - postgres_data:/var/lib/postgresql/data - networks: - - synapsis-network - healthcheck: - test: ["CMD-SHELL", "pg_isready -U ${DB_USER:-synapsis} -d ${DB_NAME:-synapsis}"] - interval: 10s - timeout: 5s - retries: 5 - deploy: - resources: - limits: - memory: 1G - reservations: - memory: 256M - - app: - image: ghcr.io/gnosyslabs/synapsis:latest - container_name: synapsis-app - restart: unless-stopped - ports: - - "127.0.0.1:${PORT:-3000}:${PORT:-3000}" - environment: - DATABASE_URL: postgresql://${DB_USER:-synapsis}:${DB_PASSWORD:-changeme}@postgres:5432/${DB_NAME:-synapsis} - AUTH_SECRET: ${AUTH_SECRET} - DOMAIN: ${DOMAIN:-localhost} - NEXT_PUBLIC_NODE_DOMAIN: ${NEXT_PUBLIC_NODE_DOMAIN:-} - NEXT_PUBLIC_APP_URL: ${NEXT_PUBLIC_APP_URL:-} - ALLOW_LOCALHOST: ${ALLOW_LOCALHOST:-} - ADMIN_EMAILS: ${ADMIN_EMAILS} - BOT_MAX_PER_USER: ${BOT_MAX_PER_USER:-5} - HOST_UPDATER_SOCKET: ${HOST_UPDATER_SOCKET:-/var/run/synapsis-updater/updater.sock} - HOST_UPDATER_TOKEN: ${HOST_UPDATER_TOKEN:-} - PORT: ${PORT:-3000} - NODE_ENV: production - volumes: - - uploads_data:/app/uploads - - /var/run/synapsis-updater:/var/run/synapsis-updater - networks: - - synapsis-network - depends_on: - postgres: - condition: service_healthy - healthcheck: - test: ["CMD-SHELL", "wget -q --spider http://127.0.0.1:${PORT:-3000}/api/health || exit 1"] - interval: 30s - timeout: 10s - retries: 3 - start_period: 60s - deploy: - resources: - limits: - memory: 1G - reservations: - memory: 256M - -volumes: - postgres_data: - driver: local - uploads_data: - driver: local - -networks: - synapsis-network: - driver: bridge diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index c190a6a..0000000 --- a/docker-compose.yml +++ /dev/null @@ -1,149 +0,0 @@ -# Synapsis - Docker Compose (Production) -# Uses pre-built image from GitHub Container Registry -# -# Quick Start: -# 1. Bootstrap the deployment directory: -# curl -fsSL https://synapsis.social/install.sh | bash -# 2. Configure (edit with your domain and admin email): nano /opt/synapsis/.env -# 3. Start your node: cd /opt/synapsis && docker compose up -d -# -# Services: -# - Synapsis Next.js application (from GHCR) -# - PostgreSQL database (persistent storage) -# - Caddy reverse proxy with automatic SSL - -services: - # ============================================ - # PostgreSQL Database - # ============================================ - postgres: - image: postgres:16-alpine - container_name: synapsis-db - restart: unless-stopped - environment: - POSTGRES_USER: ${DB_USER:-synapsis} - POSTGRES_PASSWORD: ${DB_PASSWORD:-changeme} - POSTGRES_DB: ${DB_NAME:-synapsis} - PGDATA: /var/lib/postgresql/data/pgdata - volumes: - - postgres_data:/var/lib/postgresql/data - networks: - - synapsis-network - healthcheck: - test: ["CMD-SHELL", "pg_isready -U ${DB_USER:-synapsis} -d ${DB_NAME:-synapsis}"] - interval: 10s - timeout: 5s - retries: 5 - deploy: - resources: - limits: - memory: 1G - reservations: - memory: 256M - - # ============================================ - # Synapsis Application (from GHCR) - # ============================================ - app: - image: ghcr.io/gnosyslabs/synapsis:latest - container_name: synapsis-app - restart: unless-stopped - environment: - # Database connection - DATABASE_URL: postgresql://${DB_USER:-synapsis}:${DB_PASSWORD:-changeme}@postgres:5432/${DB_NAME:-synapsis} - - # Authentication - AUTH_SECRET: ${AUTH_SECRET} - - # Domain configuration - DOMAIN: ${DOMAIN:-localhost} - NEXT_PUBLIC_NODE_DOMAIN: ${NEXT_PUBLIC_NODE_DOMAIN:-} - NEXT_PUBLIC_APP_URL: ${NEXT_PUBLIC_APP_URL:-} - ALLOW_LOCALHOST: ${ALLOW_LOCALHOST:-} - - # Admin emails - ADMIN_EMAILS: ${ADMIN_EMAILS} - - # Optional settings - BOT_MAX_PER_USER: ${BOT_MAX_PER_USER:-5} - HOST_UPDATER_SOCKET: ${HOST_UPDATER_SOCKET:-/var/run/synapsis-updater/updater.sock} - HOST_UPDATER_TOKEN: ${HOST_UPDATER_TOKEN:-} - - # Port configuration (auto or specific port) - PORT: ${PORT:-3000} - - # Node environment - NODE_ENV: production - volumes: - # Uploads directory (if using local file storage) - - uploads_data:/app/uploads - # Shared volume for port coordination with Caddy - - port_data:/var/run/synapsis - - /var/run/synapsis-updater:/var/run/synapsis-updater - networks: - - synapsis-network - depends_on: - postgres: - condition: service_healthy - # Increased start period to allow migrations to run - healthcheck: - test: ["CMD-SHELL", "PORT=$$(cat /var/run/synapsis/port 2>/dev/null || echo 3000); case \"$$PORT\" in ''|*[!0-9]*) PORT=3000;; esac; wget -q --spider http://127.0.0.1:$$PORT/api/health || exit 1"] - interval: 30s - timeout: 10s - retries: 3 - start_period: 60s - deploy: - resources: - limits: - memory: 1G - reservations: - memory: 256M - - # ============================================ - # Caddy Reverse Proxy (Automatic SSL) - # ============================================ - caddy: - image: caddy:2-alpine - container_name: synapsis-caddy - restart: unless-stopped - ports: - - "80:80" - - "443:443" - volumes: - - ./Caddyfile:/etc/caddy/Caddyfile:ro - - ./caddy-entrypoint.sh:/usr/local/bin/caddy-entrypoint.sh:ro - - caddy_data:/data - - caddy_config:/config - # Shared volume for port coordination with app - - port_data:/var/run/synapsis - networks: - - synapsis-network - depends_on: - app: - condition: service_healthy - environment: - - DOMAIN=${DOMAIN:-localhost} - # Use custom entrypoint to read dynamic port from app - entrypoint: ["/usr/local/bin/caddy-entrypoint.sh"] - -# ============================================ -# Persistent Volumes -# ============================================ -volumes: - postgres_data: - driver: local - uploads_data: - driver: local - caddy_data: - driver: local - caddy_config: - driver: local - port_data: - driver: local - -# ============================================ -# Networks -# ============================================ -networks: - synapsis-network: - driver: bridge diff --git a/docker/.dockerignore b/docker/.dockerignore deleted file mode 100644 index 031c9d2..0000000 --- a/docker/.dockerignore +++ /dev/null @@ -1,96 +0,0 @@ -# Dependencies -node_modules -npm-debug.log* -yarn-debug.log* -yarn-error.log* -package-lock.json -yarn.lock -pnpm-lock.yaml - -# Build outputs -.next -out -dist -build -*.tsbuildinfo - -# Environment files (these are passed via docker-compose) -.env -.env.local -.env.*.local -.env.dev -.env.test -.env.production - -# Version control -.git -.gitignore -.gitattributes - -# IDE and editor files -.vscode -.idea -*.swp -*.swo -*~ -.DS_Store -Thumbs.db - -# Testing -coverage -.nyc_output -*.test.ts -*.test.tsx -*.spec.ts -*.spec.tsx -tests -test -__tests__ - -# Documentation (not needed in production image) -*.md -!README.md -LICENSE -CHANGELOG.md -CONTRIBUTING.md - -# Docker files (avoid recursive copy) -docker -docker-compose*.yml -Dockerfile* -.dockerignore - -# CI/CD -.github -.gitlab-ci.yml -.travis.yml -azure-pipelines.yml -Jenkinsfile - -# Logs -logs -*.log - -# Runtime data -pids -*.pid -*.seed -*.pid.lock - -# Misc -.cache -temp -tmp -.tmp -uploads/* -!uploads/.gitkeep - -# Large binary files -*.mp4 -*.mov -*.avi -*.mkv -*.pdf -*.zip -*.tar.gz -*.rar diff --git a/docker/.env.example b/docker/.env.example deleted file mode 100644 index 08c210c..0000000 --- a/docker/.env.example +++ /dev/null @@ -1,51 +0,0 @@ -# =========================================== -# Synapsis Environment Configuration -# =========================================== -# Copy this file to .env and configure your values - -# =========================================== -# REQUIRED: Core Settings -# =========================================== - -# Your domain name (no scheme, no path). Example: synapsis.example.com -DOMAIN=your-domain.com - -# Optional: Override node domain (host only, defaults to DOMAIN) -# NEXT_PUBLIC_NODE_DOMAIN=your-domain.com - -# Optional: Public app URL for background jobs (auto-derived from node domain if unset) -# NEXT_PUBLIC_APP_URL=https://your-domain.com - -# Admin email addresses (comma-separated for multiple) -ADMIN_EMAILS=admin@your-domain.com - -# Authentication secret - generate with: openssl rand -hex 32 -AUTH_SECRET=your-secret-key-here-minimum-32-characters - -# =========================================== -# REQUIRED: Database -# =========================================== - -DB_USER=synapsis -DB_PASSWORD=your-secure-password-here -DB_NAME=synapsis - -# =========================================== -# OPTIONAL: General Settings -# =========================================== - -# Application port. -# Default install (with bundled Caddy): PORT=auto scans 3000-3020 automatically. -# Existing reverse proxy mode (PROXY=none): use a fixed localhost port, e.g. PORT=3000. -PORT=auto - -# Host updater integration for the admin panel. -# These are generated by the installer for Docker installs. -# HOST_UPDATER_SOCKET=/var/run/synapsis-updater/updater.sock -# HOST_UPDATER_TOKEN= - -# Allow localhost domains in production (set only for local testing) -# ALLOW_LOCALHOST=1 - -# Maximum AI bots per user (default: 5) -# BOT_MAX_PER_USER=5 diff --git a/docker/Caddyfile b/docker/Caddyfile deleted file mode 100644 index 909e2d8..0000000 --- a/docker/Caddyfile +++ /dev/null @@ -1,44 +0,0 @@ -# Caddyfile for Synapsis -# Automatic HTTPS via Let's Encrypt - -www.{$DOMAIN} { - redir https://{$DOMAIN}{uri} permanent -} - -{$DOMAIN} { - # Reverse proxy to Synapsis app (port is set via APP_PORT env var) - reverse_proxy app:{$APP_PORT:3000} - - # Enable compression - encode gzip - - # Security headers - header { - # Enable HSTS - Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" - # Prevent clickjacking - X-Frame-Options "SAMEORIGIN" - # Prevent MIME type sniffing - X-Content-Type-Options "nosniff" - # XSS protection - X-XSS-Protection "1; mode=block" - # Referrer policy - Referrer-Policy "strict-origin-when-cross-origin" - } - - # Logging - log { - output file /data/access.log - format json - } - - # Increase max body size for uploads (20MB) - request_body { - max_size 20MB - } -} - -# Health check endpoint for Docker -:8080 { - respond /health "healthy" 200 -} diff --git a/docker/Dockerfile b/docker/Dockerfile deleted file mode 100644 index d8e15f6..0000000 --- a/docker/Dockerfile +++ /dev/null @@ -1,133 +0,0 @@ -# Synapsis - Multi-stage Production Dockerfile -# This Dockerfile creates a production-ready image that: -# - Keeps source files immutable (prevents accidental modifications) -# - Optimizes build size with multi-stage approach -# - Runs as non-root user for security - -# ============================================ -# Stage 1: Dependencies -# ============================================ -FROM node:22-alpine AS deps -RUN apk add --no-cache libc6-compat openssl - -WORKDIR /app - -# Copy package files for efficient layer caching -COPY package.json package-lock.json* ./ - -# Install all dependencies (production + dev all in dependencies now) -RUN npm ci --ignore-scripts && npm cache clean --force - -# ============================================ -# Stage 2: Builder -# ============================================ -FROM node:22-alpine AS builder -RUN apk add --no-cache libc6-compat openssl - -WORKDIR /app - -# Copy dependencies from deps stage -COPY --from=deps /app/node_modules ./node_modules - -# Copy all source files -COPY . . - -# Set environment variables for build -ARG APP_VERSION=dev -ARG APP_COMMIT=unknown -ARG APP_BUILD_DATE= -ARG APP_GITHUB_URL= -ARG APP_IMAGE_REPO=ghcr.io/gnosyslabs/synapsis -ARG APP_SOURCE_REPO=https://github.com/GnosysLabs/Synapsis - -ENV NODE_ENV=production -ENV NEXT_TELEMETRY_DISABLED=1 -ENV APP_VERSION=${APP_VERSION} -ENV APP_COMMIT=${APP_COMMIT} -ENV APP_BUILD_DATE=${APP_BUILD_DATE} -ENV APP_GITHUB_URL=${APP_GITHUB_URL} -ENV APP_IMAGE_REPO=${APP_IMAGE_REPO} -ENV APP_SOURCE_REPO=${APP_SOURCE_REPO} - -# Build the Next.js application -RUN npm run build - -# ============================================ -# Stage 3: Production Dependencies -# ============================================ -FROM deps AS prod-deps -RUN npm prune --omit=dev && npm cache clean --force - -# ============================================ -# Stage 4: Production Runner -# ============================================ -FROM node:22-alpine AS runner -RUN apk add --no-cache libc6-compat openssl netcat-openbsd wget - -WORKDIR /app - -ARG APP_VERSION=dev -ARG APP_COMMIT=unknown -ARG APP_BUILD_DATE= -ARG APP_GITHUB_URL= -ARG APP_IMAGE_REPO=ghcr.io/gnosyslabs/synapsis -ARG APP_SOURCE_REPO=https://github.com/GnosysLabs/Synapsis - -LABEL org.opencontainers.image.source="${APP_SOURCE_REPO}" -LABEL org.opencontainers.image.description="Synapsis self-hosted social node" -LABEL org.opencontainers.image.version="${APP_VERSION}" -LABEL org.opencontainers.image.revision="${APP_COMMIT}" -LABEL org.opencontainers.image.created="${APP_BUILD_DATE}" - -# Create non-root user for security -RUN addgroup --system --gid 1001 nodejs && \ - adduser --system --uid 1001 nextjs - -# Create shared directory for port file (must be writable by nextjs) -RUN mkdir -p /var/run/synapsis && chown nextjs:nodejs /var/run/synapsis - -# Set production environment -ENV NODE_ENV=production -ENV NEXT_TELEMETRY_DISABLED=1 -ENV PORT=3000 -ENV HOSTNAME="0.0.0.0" -ENV APP_VERSION=${APP_VERSION} -ENV APP_COMMIT=${APP_COMMIT} -ENV APP_BUILD_DATE=${APP_BUILD_DATE} -ENV APP_GITHUB_URL=${APP_GITHUB_URL} -ENV APP_IMAGE_REPO=${APP_IMAGE_REPO} -ENV APP_SOURCE_REPO=${APP_SOURCE_REPO} - -# Copy public assets -COPY --from=builder /app/public ./public - -# Copy Next.js build output -COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./ -COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static - -# Copy pruned runtime dependencies -COPY --from=prod-deps --chown=nextjs:nodejs /app/node_modules ./node_modules - -# Copy drizzle migrations, config, and schema (needed for migrations) -COPY --from=builder --chown=nextjs:nodejs /app/drizzle ./drizzle -COPY --from=builder --chown=nextjs:nodejs /app/drizzle.config.ts ./ -COPY --from=builder --chown=nextjs:nodejs /app/package.json ./ -COPY --from=builder --chown=nextjs:nodejs /app/src/db/schema.ts ./src/db/schema.ts - -# Copy entrypoint script -COPY --from=builder --chown=nextjs:nodejs /app/docker/docker-entrypoint.sh ./ -RUN chmod +x ./docker-entrypoint.sh - -# Switch to non-root user -USER nextjs - -# Expose port range for auto-detection -EXPOSE 3000-3020 - -# Health check - longer start period to allow migrations to run -# Reads dynamic port file when PORT=auto -HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=5 \ - CMD sh -c 'PORT_FILE=/var/run/synapsis/port; PORT=3000; if [ -f "$PORT_FILE" ]; then PORT=$(cat "$PORT_FILE"); fi; case "$PORT" in ""|*[!0-9]*) PORT=3000;; esac; wget -q --spider "http://127.0.0.1:${PORT}/api/health" || exit 1' - -# Set the entrypoint -ENTRYPOINT ["./docker-entrypoint.sh"] diff --git a/docker/README.md b/docker/README.md deleted file mode 100644 index 7d9d774..0000000 --- a/docker/README.md +++ /dev/null @@ -1,250 +0,0 @@ -# Synapsis Docker Deployment - -Production Docker deployment using pre-built images from GitHub Container Registry. - ---- - -## πŸš€ Quick Start - -This is the default install path for a fresh VPS where Synapsis should manage its own HTTPS with Caddy. - -```bash -curl -fsSL https://synapsis.social/install.sh | bash -nano /opt/synapsis/.env # Add your domain and admin email -cd /opt/synapsis -docker compose up -d -``` - -Your node is live at `https://your-domain.com` with automatic SSL. - ---- - -## πŸ“‹ What You Need - -| Requirement | Details | -|-------------|---------| -| **Server** | 2GB RAM, 2 CPU cores, 20GB SSD (minimum) | -| **Domain** | A domain or subdomain pointing to your server | -| **Docker** | Installed automatically by `install.sh` when missing on supported Linux hosts | -| **Ports** | `80` and `443` must be free for the default Caddy install | - ---- - -## βš™οΈ Configuration - -Edit `.env` and set these required values (domain should be host only, no scheme or path): - -| Variable | What to put | -|----------|-------------| -| `DOMAIN` | Your domain (e.g., `synapsis.example.com`) | -| `DB_PASSWORD` | Strong password for PostgreSQL | -| `AUTH_SECRET` | Run: `openssl rand -hex 32` | -| `ADMIN_EMAILS` | Your email address | - -Use the bare/canonical host in `DOMAIN`. Example: set `DOMAIN=synapsis.example.com`, not `www.synapsis.example.com`. -If you also want `www.synapsis.example.com` to work, create a DNS record for `www` pointing to the same server. The bundled Caddy config will redirect `www` to the canonical `DOMAIN`. - -Optional (advanced): -- `NEXT_PUBLIC_NODE_DOMAIN` to override the node domain (defaults to `DOMAIN`) -- `NEXT_PUBLIC_APP_URL` to override the public app URL used by background jobs (auto-derived from the node domain) -- `ALLOW_LOCALHOST=1` to allow `localhost` in production containers for local testing - -**Port Configuration:** -- `PORT=auto` (default) β€” Automatically finds an available port between 3000-3020 -- `PORT=3000` β€” Use a specific port instead - ---- - -## Advanced: Existing nginx/Traefik/Caddy Host - -If your server already runs a reverse proxy on `80/443`, use the advanced mode: - -```bash -curl -fsSL https://synapsis.social/install.sh | PROXY=none bash -nano /opt/synapsis/.env -cd /opt/synapsis -docker compose up -d -``` - -This mode: -- skips the bundled Caddy service -- binds Synapsis to `127.0.0.1:${PORT:-3000}` -- expects your existing reverse proxy to forward traffic there - -In `PROXY=none` mode, `PORT` is the localhost port your reverse proxy should target. The installer automatically changes `PORT=auto` to `PORT=3000` unless you override it. - -Example nginx site: - -```nginx -server { - server_name node.example.com; - - location / { - proxy_pass http://127.0.0.1:3000; - proxy_http_version 1.1; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "upgrade"; - } -} -``` - ---- - -## πŸ”„ Updates (migrations run automatically) - -Use the updater for existing installs. It preserves `.env`, refreshes the installed compose/proxy files, pulls the latest published image, and restarts the stack. - -```bash -curl -fsSL https://synapsis.social/update.sh | bash -``` - -If the host was installed with `PROXY=none`, the updater detects that and keeps using the proxyless compose file automatically. - -Manual update still works if you only want to restart with the already-installed files: - -```bash -cd /opt/synapsis -docker compose pull -docker compose up -d -``` - -## πŸ—‘οΈ Full Uninstall - -To remove Synapsis completely from a host and start over: - -```bash -curl -fsSL https://synapsis.social/uninstall.sh | bash -``` - -The uninstaller destroys the Synapsis containers, volumes, network, cached Synapsis images, and `/opt/synapsis`. It requires typing `DELETE` unless you set `FORCE=1`. - ---- - -## πŸ› οΈ Common Commands - -```bash -# View logs -docker compose logs -f app - -# Restart services -docker compose restart app - -# Stop everything -docker compose down - -# Database backup -docker compose exec postgres pg_dump -U synapsis synapsis > backup.sql - -# Access database -docker compose exec postgres psql -U synapsis -d synapsis -``` - ---- - -## πŸ” Troubleshooting - -### Container won't start -```bash -docker compose config # Validate config -docker compose logs app --tail=50 # Check errors -``` - -### Port already in use -If the installer says `80` or `443` is already in use, another reverse proxy is already bound there. - -Use a fresh VPS for the default Caddy install, or rerun the installer in advanced mode: - -```bash -curl -fsSL https://synapsis.social/install.sh | PROXY=none bash -``` - -For the application port itself, `PORT=auto` (default) automatically finds an available port. If you set a specific port that's taken: -```bash -# Check what's using the port -sudo netstat -tlnp | grep :3000 - -# Choose a different fixed port in /opt/synapsis/.env -# Example: PORT=3013 -``` - -### Database connection failed -```bash -# Check database health -docker compose ps - -# Verify environment variables loaded -docker compose exec app env | grep DATABASE -``` - -### SSL certificate issues -```bash -# Check Caddy logs -docker compose logs caddy - -# Test Caddy config -docker compose exec caddy caddy validate --config /etc/caddy/Caddyfile -``` - -### Image pull fails -```bash -# Verify image exists -docker pull ghcr.io/gnosyslabs/synapsis:latest - -# Check the published package tags in GitHub Container Registry -``` - ---- - -## πŸ’Ύ Backup Strategy - -Create `/opt/synapsis/backup.sh`: - -```bash -#!/bin/bash -BACKUP_DIR="/var/backups/synapsis" -DATE=$(date +%Y%m%d_%H%M%S) -mkdir -p $BACKUP_DIR - -# Database backup -docker compose exec -T postgres pg_dump -U synapsis synapsis > "$BACKUP_DIR/db_$DATE.sql" - -echo "βœ… Backup complete: $DATE" -``` - -Schedule daily backups: -```bash -chmod +x /opt/synapsis/backup.sh -echo "0 2 * * * /opt/synapsis/backup.sh" | sudo crontab - -``` - ---- - -## πŸ—οΈ Building from Source - -To build locally instead of using pre-built images: - -```bash -git clone https://github.com/GnosysLabs/Synapsis.git -cd synapsis/docker -docker compose up -d --build -``` - -To publish a stamped GHCR image with embedded app version, commit, and build date: - -```bash -cd /path/to/Synapsis -./scripts/docker-publish.sh -``` - -That script automatically publishes: -- `ghcr.io/gnosyslabs/synapsis:latest` -- `ghcr.io/gnosyslabs/synapsis:` -- `ghcr.io/gnosyslabs/synapsis:` - ---- - -For full documentation, visit [docs.synapsis.social](https://docs.synapsis.social) diff --git a/docker/__pycache__/host-updater.cpython-314.pyc b/docker/__pycache__/host-updater.cpython-314.pyc deleted file mode 100644 index 70eccda..0000000 Binary files a/docker/__pycache__/host-updater.cpython-314.pyc and /dev/null differ diff --git a/docker/caddy-entrypoint.sh b/docker/caddy-entrypoint.sh deleted file mode 100755 index 6d236ed..0000000 --- a/docker/caddy-entrypoint.sh +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/sh -# Caddy Entrypoint Script for Synapsis -# Reads the dynamic port from the shared file and starts Caddy - -set -e - -SHARED_PORT_FILE="/var/run/synapsis/port" -DEFAULT_PORT=3000 - -# Normalize DOMAIN (strip scheme/path) to avoid invalid Caddyfile hostnames -sanitize_domain() { - echo "$1" | sed -E 's#^[a-zA-Z]+://##; s#/.*$##' -} - -if [ -n "$DOMAIN" ]; then - CLEAN_DOMAIN=$(sanitize_domain "$DOMAIN") - if [ "$CLEAN_DOMAIN" != "$DOMAIN" ]; then - export DOMAIN="$CLEAN_DOMAIN" - echo "🌐 DOMAIN normalized to $DOMAIN" - fi -fi - -if [ -z "$DOMAIN" ]; then - echo "❌ DOMAIN is not set. Exiting." - exit 1 -fi - -# Wait for the port file to exist (with timeout) -echo "⏳ Waiting for Synapsis app to announce its port..." -TIMEOUT=60 -ELAPSED=0 - -while [ ! -f "$SHARED_PORT_FILE" ] && [ $ELAPSED -lt $TIMEOUT ]; do - sleep 1 - ELAPSED=$((ELAPSED + 1)) -done - -if [ -f "$SHARED_PORT_FILE" ]; then - APP_PORT=$(cat "$SHARED_PORT_FILE") - echo "βœ… Found Synapsis app on port: $APP_PORT" -else - echo "⚠️ Port file not found after ${TIMEOUT}s, using default port: $DEFAULT_PORT" - APP_PORT=$DEFAULT_PORT -fi - -export APP_PORT - -# Validate that APP_PORT is a number -if ! echo "$APP_PORT" | grep -qE '^[0-9]+$'; then - echo "❌ Invalid port number: $APP_PORT" - exit 1 -fi - -echo "🌐 Starting Caddy reverse proxy to app:$APP_PORT..." -echo "" - -# Start Caddy with the environment variable set -exec caddy run --config /etc/caddy/Caddyfile --adapter caddyfile diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml deleted file mode 100644 index 44eb14d..0000000 --- a/docker/docker-compose.yml +++ /dev/null @@ -1,144 +0,0 @@ -# Synapsis - Docker Compose -# One-command deployment: docker-compose up -d -# -# Services: -# - Synapsis Next.js application -# - PostgreSQL database (persistent storage) -# - Caddy reverse proxy with automatic SSL -# -# All state is stored in Docker volumes - source code is immutable in the image - -services: - # ============================================ - # PostgreSQL Database - # ============================================ - postgres: - image: postgres:16-alpine - container_name: synapsis-db - restart: unless-stopped - environment: - POSTGRES_USER: ${DB_USER:-synapsis} - POSTGRES_PASSWORD: ${DB_PASSWORD:-changeme} - POSTGRES_DB: ${DB_NAME:-synapsis} - PGDATA: /var/lib/postgresql/data/pgdata - volumes: - - postgres_data:/var/lib/postgresql/data - networks: - - synapsis-network - healthcheck: - test: ["CMD-SHELL", "pg_isready -U ${DB_USER:-synapsis} -d ${DB_NAME:-synapsis}"] - interval: 10s - timeout: 5s - retries: 5 - deploy: - resources: - limits: - memory: 1G - reservations: - memory: 256M - - # ============================================ - # Synapsis Application - # ============================================ - app: - build: - context: .. - dockerfile: docker/Dockerfile - image: synapsis:latest - container_name: synapsis-app - restart: unless-stopped - environment: - # Database connection - DATABASE_URL: postgresql://${DB_USER:-synapsis}:${DB_PASSWORD:-changeme}@postgres:5432/${DB_NAME:-synapsis} - - # Authentication - AUTH_SECRET: ${AUTH_SECRET} - - # Domain configuration - DOMAIN: ${DOMAIN:-localhost} - NEXT_PUBLIC_NODE_DOMAIN: ${NEXT_PUBLIC_NODE_DOMAIN:-} - NEXT_PUBLIC_APP_URL: ${NEXT_PUBLIC_APP_URL:-} - ALLOW_LOCALHOST: ${ALLOW_LOCALHOST:-} - - # Admin emails - ADMIN_EMAILS: ${ADMIN_EMAILS} - - # Optional settings - BOT_MAX_PER_USER: ${BOT_MAX_PER_USER:-5} - - # Port configuration (auto or specific port) - PORT: ${PORT:-3000} - - # Node environment - NODE_ENV: production - volumes: - # Uploads directory (if using local file storage) - - uploads_data:/app/uploads - # Shared volume for port coordination with Caddy - - port_data:/var/run/synapsis - networks: - - synapsis-network - depends_on: - postgres: - condition: service_healthy - healthcheck: - test: ["CMD-SHELL", "PORT=$$(cat /var/run/synapsis/port 2>/dev/null || echo 3000); case \"$$PORT\" in ''|*[!0-9]*) PORT=3000;; esac; wget -q --spider http://127.0.0.1:$$PORT/api/health || exit 1"] - interval: 30s - timeout: 10s - retries: 3 - start_period: 40s - deploy: - resources: - limits: - memory: 1G - reservations: - memory: 256M - - # ============================================ - # Caddy Reverse Proxy (Automatic SSL) - # ============================================ - caddy: - image: caddy:2-alpine - container_name: synapsis-caddy - restart: unless-stopped - ports: - - "80:80" - - "443:443" - volumes: - - ./Caddyfile:/etc/caddy/Caddyfile:ro - - ./caddy-entrypoint.sh:/usr/local/bin/caddy-entrypoint.sh:ro - - caddy_data:/data - - caddy_config:/config - # Shared volume for port coordination with app - - port_data:/var/run/synapsis - networks: - - synapsis-network - depends_on: - app: - condition: service_healthy - environment: - - DOMAIN=${DOMAIN:-localhost} - # Use custom entrypoint to read dynamic port from app - entrypoint: ["/usr/local/bin/caddy-entrypoint.sh"] - -# ============================================ -# Persistent Volumes -# ============================================ -volumes: - postgres_data: - driver: local - uploads_data: - driver: local - caddy_data: - driver: local - caddy_config: - driver: local - port_data: - driver: local - -# ============================================ -# Networks -# ============================================ -networks: - synapsis-network: - driver: bridge diff --git a/docker/docker-entrypoint.sh b/docker/docker-entrypoint.sh deleted file mode 100755 index 1597a31..0000000 --- a/docker/docker-entrypoint.sh +++ /dev/null @@ -1,213 +0,0 @@ -#!/bin/sh -# Synapsis Docker Entrypoint Script -# Handles database migrations, port detection, and application startup - -set -e - -# ============================================ -# Port Detection Configuration -# ============================================ -PORT_START=${PORT_START:-3000} -PORT_END=${PORT_END:-3020} - -# Function to check if a port is available -check_port_available() { - local port=$1 - if ! nc -z localhost "$port" 2>/dev/null; then - return 0 # Port is available - else - return 1 # Port is in use - fi -} - -# Function to find first available port in range -find_available_port() { - local start=$1 - local end=$2 - - for port in $(seq "$start" "$end"); do - if check_port_available "$port"; then - echo "$port" - return 0 - fi - done - - echo "ERROR: No available ports found in range $start-$end" >&2 - return 1 -} - -# Handle PORT=auto -if [ "${PORT}" = "auto" ]; then - echo "πŸ” PORT=auto detected, scanning for available port in range ${PORT_START}-${PORT_END}..." - - DETECTED_PORT=$(find_available_port "$PORT_START" "$PORT_END") - - if [ $? -ne 0 ]; then - echo "❌ Failed to find an available port. Exiting." - exit 1 - fi - - export PORT="$DETECTED_PORT" - echo "βœ… Using automatically detected port: $PORT" -else - echo "πŸ“‘ Using configured port: $PORT" -fi - -# Ensure PORT is set -if [ -z "$PORT" ]; then - echo "⚠️ PORT not set, defaulting to 3000" - export PORT=3000 -fi - -# Write port to shared file for Caddy to read -SHARED_PORT_FILE="/var/run/synapsis/port" -mkdir -p "$(dirname "$SHARED_PORT_FILE")" -echo "$PORT" > "$SHARED_PORT_FILE" -echo "πŸ“ Port $PORT written to $SHARED_PORT_FILE" - -# Export HOSTNAME for Next.js -export HOSTNAME="0.0.0.0" - -# ============================================ -# Database Migrations -# ============================================ - -echo "" -echo "========================================" -echo " Synapsis - Starting Application" -echo "========================================" -echo " Time: $(date)" -echo " Working Dir: $(pwd)" -echo " Database URL: ${DATABASE_URL%%:*}://***@***" -echo " Port: $PORT" -echo "========================================" - -# Ensure DATABASE_URL is set -if [ -z "$DATABASE_URL" ]; then - echo "❌ DATABASE_URL is not set. Exiting." - exit 1 -fi - -# Normalize domain inputs (strip scheme/path) to avoid localhost/protocol issues -sanitize_domain() { - echo "$1" | sed -E 's#^[a-zA-Z]+://##; s#/.*$##' -} - -# Normalize DOMAIN if provided -if [ -n "$DOMAIN" ]; then - CLEAN_DOMAIN=$(sanitize_domain "$DOMAIN") - if [ "$CLEAN_DOMAIN" != "$DOMAIN" ]; then - export DOMAIN="$CLEAN_DOMAIN" - echo "🌐 DOMAIN normalized to $DOMAIN" - fi -fi - -# Normalize NEXT_PUBLIC_NODE_DOMAIN if provided -if [ -n "$NEXT_PUBLIC_NODE_DOMAIN" ]; then - CLEAN_NODE_DOMAIN=$(sanitize_domain "$NEXT_PUBLIC_NODE_DOMAIN") - if [ "$CLEAN_NODE_DOMAIN" != "$NEXT_PUBLIC_NODE_DOMAIN" ]; then - export NEXT_PUBLIC_NODE_DOMAIN="$CLEAN_NODE_DOMAIN" - echo "🌐 NEXT_PUBLIC_NODE_DOMAIN normalized to $NEXT_PUBLIC_NODE_DOMAIN" - fi -fi - -# Ensure NEXT_PUBLIC_NODE_DOMAIN is set (fallback to DOMAIN) -if [ -z "$NEXT_PUBLIC_NODE_DOMAIN" ] && [ -n "$DOMAIN" ]; then - export NEXT_PUBLIC_NODE_DOMAIN="$DOMAIN" - echo "🌐 NEXT_PUBLIC_NODE_DOMAIN set to $NEXT_PUBLIC_NODE_DOMAIN" -fi - -# Fail fast if running in production with localhost domain -if [ "$NODE_ENV" = "production" ]; then - case "$NEXT_PUBLIC_NODE_DOMAIN" in - ""|localhost|localhost:*|127.0.0.1|127.0.0.1:*) - if [ -z "$ALLOW_LOCALHOST" ]; then - echo "❌ NEXT_PUBLIC_NODE_DOMAIN is set to localhost in production." - echo " Set DOMAIN to your public domain in .env, or set ALLOW_LOCALHOST=1 to bypass." - exit 1 - fi - ;; - esac -fi - -# Ensure NEXT_PUBLIC_APP_URL is set for background jobs -if [ -z "$NEXT_PUBLIC_APP_URL" ] && [ -n "$NEXT_PUBLIC_NODE_DOMAIN" ]; then - case "$NEXT_PUBLIC_NODE_DOMAIN" in - http://*|https://*) - NEXT_PUBLIC_APP_URL="$NEXT_PUBLIC_NODE_DOMAIN" - ;; - localhost*|127.0.0.1*) - NEXT_PUBLIC_APP_URL="http://$NEXT_PUBLIC_NODE_DOMAIN" - ;; - *) - NEXT_PUBLIC_APP_URL="https://$NEXT_PUBLIC_NODE_DOMAIN" - ;; - esac - export NEXT_PUBLIC_APP_URL - echo "🌐 NEXT_PUBLIC_APP_URL set to $NEXT_PUBLIC_APP_URL" -fi - -# Function to wait for database -wait_for_db() { - echo "" - echo "⏳ Waiting for PostgreSQL..." - - # Extract host and port from DATABASE_URL - DB_HOST=$(echo "$DATABASE_URL" | sed -n 's#.*@\([^/:]*\).*#\1#p') - DB_PORT=$(echo "$DATABASE_URL" | sed -n 's#.*:\([0-9][0-9]*\)/.*#\1#p') - DB_HOST=${DB_HOST:-postgres} - DB_PORT=${DB_PORT:-5432} - - max_retries=30 - retry_count=0 - - while ! nc -z "$DB_HOST" "$DB_PORT" 2>/dev/null; do - retry_count=$((retry_count + 1)) - if [ $retry_count -ge $max_retries ]; then - echo "❌ Failed to connect to database after $max_retries attempts" - exit 1 - fi - echo " Attempt $retry_count/$max_retries - waiting for $DB_HOST:$DB_PORT..." - sleep 2 - done - - echo "βœ… Database is ready!" -} - -# Function to run database migrations -run_migrations() { - echo "" - echo "πŸ”„ Running database migrations..." - echo " Current directory: $(pwd)" - echo " Drizzle directory contents:" - ls -la drizzle/ 2>/dev/null || echo " (drizzle dir not found or empty)" - - # Run migrations using npm script - echo " Executing: npm run db:push" - if npm run db:push 2>&1; then - echo "βœ… Migration step complete" - else - echo "❌ Migration failed" - exit 1 - fi -} - -# Wait for database -wait_for_db - -# Run migrations -run_migrations - -# Final startup message -echo "" -echo "========================================" -echo " πŸš€ Starting Synapsis Server" -echo "========================================" -echo " Environment: $NODE_ENV" -echo " Port: $PORT" -echo " Node Version: $(node --version)" -echo "========================================" -echo "" - -# Start the application -exec node server.js diff --git a/docker/host-updater.py b/docker/host-updater.py deleted file mode 100755 index 66d0856..0000000 --- a/docker/host-updater.py +++ /dev/null @@ -1,357 +0,0 @@ -#!/usr/bin/env python3 - -import json -import os -import signal -import socketserver -import subprocess -import threading -import time -from datetime import datetime, timezone -from http import HTTPStatus -from http.server import BaseHTTPRequestHandler - -SOCKET_PATH = os.environ.get("HOST_UPDATER_SOCKET", "/var/run/synapsis-updater/updater.sock") -TOKEN = os.environ.get("HOST_UPDATER_TOKEN", "") -STATUS_FILE = os.environ.get("HOST_UPDATER_STATUS_FILE", "/opt/synapsis/updater-status.json") -CONFIG_FILE = os.environ.get("HOST_UPDATER_CONFIG_FILE", "/opt/synapsis/updater-config.json") -LOG_FILE = os.environ.get("HOST_UPDATER_LOG_FILE", "/opt/synapsis/updater.log") -UPDATE_SCRIPT = os.environ.get("HOST_UPDATER_SCRIPT", "/opt/synapsis/update-local.sh") -INSTALL_DIR = os.environ.get("INSTALL_DIR", "/opt/synapsis") -AUTO_UPDATE_INTERVAL_MINUTES = max(5, int(os.environ.get("HOST_UPDATER_INTERVAL_MINUTES", "30"))) - -status_lock = threading.RLock() -current_process = None -last_auto_trigger_at = 0.0 - - -def now_iso(): - return datetime.now(timezone.utc).isoformat() - - -def ensure_parent_dirs(): - os.makedirs(os.path.dirname(SOCKET_PATH), exist_ok=True) - os.makedirs(os.path.dirname(STATUS_FILE), exist_ok=True) - os.makedirs(os.path.dirname(CONFIG_FILE), exist_ok=True) - os.makedirs(os.path.dirname(LOG_FILE), exist_ok=True) - - -def default_config(): - return { - "autoUpdateEnabled": True, - "intervalMinutes": AUTO_UPDATE_INTERVAL_MINUTES, - } - - -def load_config(): - if not os.path.exists(CONFIG_FILE): - config = default_config() - save_config(config) - return config - - with open(CONFIG_FILE, "r", encoding="utf-8") as handle: - stored = json.load(handle) - - config = default_config() - config.update({ - "autoUpdateEnabled": bool(stored.get("autoUpdateEnabled", True)), - "intervalMinutes": max(5, int(stored.get("intervalMinutes", AUTO_UPDATE_INTERVAL_MINUTES))), - }) - return config - - -def save_config(config): - with open(CONFIG_FILE, "w", encoding="utf-8") as handle: - json.dump(config, handle, indent=2) - - -def update_config(**changes): - config = load_config() - config.update(changes) - config["autoUpdateEnabled"] = bool(config.get("autoUpdateEnabled", True)) - config["intervalMinutes"] = max(5, int(config.get("intervalMinutes", AUTO_UPDATE_INTERVAL_MINUTES))) - save_config(config) - return config - - -def load_status(): - if not os.path.exists(STATUS_FILE): - return { - "available": True, - "status": "idle", - "message": "Ready to update.", - "lastStartedAt": None, - "lastFinishedAt": None, - "lastExitCode": None, - "lastError": None, - "pid": None, - } - - with open(STATUS_FILE, "r", encoding="utf-8") as handle: - return json.load(handle) - - -def normalize_status_on_startup(): - status = load_status() - - if status.get("status") == "error" and status.get("lastExitCode") == -15: - status.update({ - "status": "success", - "message": "Synapsis update completed.", - "lastExitCode": 0, - "lastError": None, - "pid": None, - }) - save_status(status) - - if status.get("status") == "updating": - status.update({ - "status": "idle", - "message": "Ready to update.", - "lastError": None, - "pid": None, - }) - save_status(status) - - -def save_status(status): - with open(STATUS_FILE, "w", encoding="utf-8") as handle: - json.dump(status, handle, indent=2) - - -def update_status(**changes): - with status_lock: - status = load_status() - status.update(changes) - save_status(status) - return status - - -def get_status_payload(): - status = load_status() - status["config"] = load_config() - return status - - -def is_authorized(headers): - expected = f"Bearer {TOKEN}" - return bool(TOKEN) and headers.get("Authorization", "") == expected - - -def watch_process(process): - global current_process - exit_code = process.wait() - with status_lock: - current_process = None - update_status( - status="success" if exit_code == 0 else "error", - message="Synapsis update completed." if exit_code == 0 else "Synapsis update failed.", - lastFinishedAt=now_iso(), - lastExitCode=exit_code, - lastError=None if exit_code == 0 else f"Updater exited with code {exit_code}", - pid=None, - ) - - -def start_update_process(trigger="manual"): - global current_process - - # Give the app enough time to return the 202 response before the container restarts. - time.sleep(2) - - with status_lock: - log_handle = open(LOG_FILE, "a", encoding="utf-8") - current_process = subprocess.Popen( - [UPDATE_SCRIPT], - cwd=INSTALL_DIR, - stdout=log_handle, - stderr=subprocess.STDOUT, - start_new_session=True, - env={ - **os.environ, - "INSTALL_DIR": INSTALL_DIR, - }, - ) - - update_status(pid=current_process.pid, trigger=trigger) - - thread = threading.Thread(target=watch_process, args=(current_process,), daemon=True) - thread.start() - - -def schedule_update(trigger="manual"): - with status_lock: - if current_process and current_process.poll() is None: - return False - - update_status( - status="updating", - message="Synapsis update scheduled." if trigger == "manual" else "Automatic Synapsis update scheduled.", - lastStartedAt=now_iso(), - lastFinishedAt=None, - lastExitCode=None, - lastError=None, - pid=None, - trigger=trigger, - ) - - thread = threading.Thread(target=start_update_process, args=(trigger,), daemon=True) - thread.start() - return True - - -def auto_update_loop(): - global last_auto_trigger_at - while True: - time.sleep(60) - try: - config = load_config() - if not config.get("autoUpdateEnabled", True): - continue - - interval_seconds = max(300, int(config.get("intervalMinutes", AUTO_UPDATE_INTERVAL_MINUTES)) * 60) - now = time.time() - - with status_lock: - if current_process and current_process.poll() is None: - continue - - last_reference = last_auto_trigger_at - status = load_status() - if not last_reference: - last_started = status.get("lastStartedAt") - if last_started: - try: - last_reference = datetime.fromisoformat(last_started).timestamp() - except Exception: - last_reference = 0.0 - - if last_reference and (now - last_reference) < interval_seconds: - continue - - last_auto_trigger_at = now - - schedule_update(trigger="auto") - except Exception as error: - update_status(lastError=f"Auto-update scheduler error: {error}") - - -class ThreadedUnixServer(socketserver.ThreadingMixIn, socketserver.UnixStreamServer): - daemon_threads = True - - -class Handler(BaseHTTPRequestHandler): - server_version = "SynapsisHostUpdater/1.0" - - def log_message(self, format, *args): - return - - def send_json(self, status_code, payload): - body = json.dumps(payload).encode("utf-8") - self.send_response(status_code) - self.send_header("Content-Type", "application/json") - self.send_header("Content-Length", str(len(body))) - self.end_headers() - self.wfile.write(body) - - def do_GET(self): - if self.path == "/health": - self.send_json(HTTPStatus.OK, {"ok": True}) - return - - if self.path == "/status": - if not is_authorized(self.headers): - self.send_json(HTTPStatus.UNAUTHORIZED, {"error": "Unauthorized"}) - return - self.send_json(HTTPStatus.OK, get_status_payload()) - return - - self.send_json(HTTPStatus.NOT_FOUND, {"error": "Not found"}) - - def do_POST(self): - global current_process - - if self.path != "/update": - self.send_json(HTTPStatus.NOT_FOUND, {"error": "Not found"}) - return - - if not is_authorized(self.headers): - self.send_json(HTTPStatus.UNAUTHORIZED, {"error": "Unauthorized"}) - return - - if not schedule_update(trigger="manual"): - self.send_json( - HTTPStatus.CONFLICT, - { - "ok": False, - "status": "updating", - "message": "An update is already running.", - }, - ) - return - - self.send_json( - HTTPStatus.ACCEPTED, - { - "ok": True, - "status": "updating", - "message": "Synapsis update scheduled. The node will restart shortly.", - }, - ) - - def do_PATCH(self): - if self.path != "/config": - self.send_json(HTTPStatus.NOT_FOUND, {"error": "Not found"}) - return - - if not is_authorized(self.headers): - self.send_json(HTTPStatus.UNAUTHORIZED, {"error": "Unauthorized"}) - return - - content_length = int(self.headers.get("Content-Length", "0") or "0") - raw_body = self.rfile.read(content_length) if content_length > 0 else b"{}" - - try: - payload = json.loads(raw_body.decode("utf-8") or "{}") - except json.JSONDecodeError: - self.send_json(HTTPStatus.BAD_REQUEST, {"error": "Invalid JSON"}) - return - - if "autoUpdateEnabled" not in payload: - self.send_json(HTTPStatus.BAD_REQUEST, {"error": "autoUpdateEnabled is required"}) - return - - config = update_config(autoUpdateEnabled=payload.get("autoUpdateEnabled")) - self.send_json(HTTPStatus.OK, {"ok": True, "config": config}) - - -def cleanup_socket(*_args): - try: - if os.path.exists(SOCKET_PATH): - os.remove(SOCKET_PATH) - finally: - raise SystemExit(0) - - -def main(): - ensure_parent_dirs() - - if os.path.exists(SOCKET_PATH): - os.remove(SOCKET_PATH) - - normalize_status_on_startup() - load_config() - - signal.signal(signal.SIGTERM, cleanup_socket) - signal.signal(signal.SIGINT, cleanup_socket) - - update_status(available=True) - threading.Thread(target=auto_update_loop, daemon=True).start() - - with ThreadedUnixServer(SOCKET_PATH, Handler) as server: - os.chmod(SOCKET_PATH, 0o666) - server.serve_forever() - - -if __name__ == "__main__": - main() diff --git a/docker/install.sh b/docker/install.sh deleted file mode 100644 index 0dec411..0000000 --- a/docker/install.sh +++ /dev/null @@ -1,365 +0,0 @@ -#!/bin/sh - -set -eu - -REPO="${REPO:-GnosysLabs/Synapsis}" -REF="${REF:-main}" -INSTALL_DIR="${1:-${INSTALL_DIR:-/opt/synapsis}}" -PUBLIC_INSTALL_URL="${PUBLIC_INSTALL_URL:-https://synapsis.social/install.sh}" -PROXY="${PROXY:-caddy}" -HOST_UPDATER_SOCKET_PATH="${HOST_UPDATER_SOCKET_PATH:-/var/run/synapsis-updater/updater.sock}" - -require_command() { - if ! command -v "$1" >/dev/null 2>&1; then - echo "❌ Required command not found: $1" >&2 - exit 1 - fi -} - -download_file() { - source_path="$1" - target_path="$2" - echo "⬇️ Downloading ${source_path}" - curl -fsSL "${RAW_BASE}/${source_path}" -o "${target_path}" -} - -normalize_proxy_mode() { - case "$1" in - caddy|none) - printf '%s\n' "$1" - ;; - *) - echo "❌ Unsupported PROXY mode: $1" >&2 - echo " Supported values: caddy, none" >&2 - exit 1 - ;; - esac -} - -is_port_in_use() { - port="$1" - - if command -v ss >/dev/null 2>&1; then - ss -tulpn 2>/dev/null | grep -q ":${port} " - return $? - fi - - if command -v lsof >/dev/null 2>&1; then - lsof -iTCP:"${port}" -sTCP:LISTEN >/dev/null 2>&1 - return $? - fi - - if command -v netstat >/dev/null 2>&1; then - netstat -tulpn 2>/dev/null | grep -q ":${port} " - return $? - fi - - return 1 -} - -ensure_caddy_ports_available() { - for port in 80 443; do - if is_port_in_use "$port"; then - echo "❌ Port ${port} is already in use on this host." >&2 - echo " The default Synapsis install includes Caddy and needs ports 80/443." >&2 - echo " If this is a fresh VPS, free those ports and rerun the installer." >&2 - echo " If this host already runs nginx or another reverse proxy, rerun with:" >&2 - echo " curl -fsSL ${PUBLIC_INSTALL_URL} | PROXY=none bash" >&2 - exit 1 - fi - done -} - -set_env_value() { - file="$1" - key="$2" - value="$3" - - escaped_value=$(printf '%s\n' "$value" | sed -e 's/[\/&]/\\&/g') - sed -i.bak -E "s|^${key}=.*$|${key}=${escaped_value}|" "$file" - rm -f "${file}.bak" -} - -ensure_env_value() { - file="$1" - key="$2" - value="$3" - - if grep -q "^${key}=" "$file" 2>/dev/null; then - set_env_value "$file" "$key" "$value" - return - fi - - printf '%s=%s\n' "$key" "$value" >> "$file" -} - -get_env_value() { - file="$1" - key="$2" - - if [ ! -f "$file" ]; then - return 1 - fi - - sed -n -E "s/^${key}=(.*)$/\\1/p" "$file" | head -n 1 -} - -generate_db_password() { - openssl rand -base64 24 | tr -d '\n' | tr '/+' '_-' | cut -c1-32 -} - -generate_token() { - if command -v openssl >/dev/null 2>&1; then - openssl rand -hex 32 - return - fi - - date +%s | sha256sum | awk '{print $1}' -} - -find_available_port() { - start="${1:-3000}" - end="${2:-3020}" - - port="$start" - while [ "$port" -le "$end" ]; do - if ! is_port_in_use "$port"; then - printf '%s\n' "$port" - return 0 - fi - port=$((port + 1)) - done - - echo "❌ No available localhost port found in range ${start}-${end} for PROXY=none." >&2 - echo " Set PORT explicitly when rerunning the installer if you want a different range." >&2 - exit 1 -} - -resolve_proxyless_port() { - if [ -n "${PORT:-}" ] && [ "${PORT}" != "auto" ]; then - printf '%s\n' "${PORT}" - return - fi - - find_available_port 3000 3020 -} - -install_docker_if_needed() { - if command -v docker >/dev/null 2>&1 && docker compose version >/dev/null 2>&1; then - echo "🐳 Docker is already installed" - return - fi - - if [ "$(id -u)" -ne 0 ]; then - echo "❌ Docker is not installed and this installer is not running as root." >&2 - echo " Re-run it as root or with sudo so Synapsis can install Docker for you." >&2 - exit 1 - fi - - echo "🐳 Docker not found, installing Docker" - curl -fsSL https://get.docker.com | sh - - if command -v systemctl >/dev/null 2>&1; then - systemctl enable --now docker >/dev/null 2>&1 || true - elif command -v service >/dev/null 2>&1; then - service docker start >/dev/null 2>&1 || true - fi - - if ! command -v docker >/dev/null 2>&1; then - echo "❌ Docker installation did not finish successfully." >&2 - exit 1 - fi - - if ! docker compose version >/dev/null 2>&1; then - echo "⚠️ Docker was installed, but 'docker compose' is not available yet." >&2 - echo " Install the Docker Compose plugin before starting Synapsis." >&2 - fi -} - -install_python3_if_needed() { - if command -v python3 >/dev/null 2>&1; then - return - fi - - if command -v apt-get >/dev/null 2>&1; then - apt-get update - apt-get install -y python3 - return - fi - - if command -v apk >/dev/null 2>&1; then - apk add --no-cache python3 - return - fi - - if command -v dnf >/dev/null 2>&1; then - dnf install -y python3 - return - fi - - if command -v yum >/dev/null 2>&1; then - yum install -y python3 - return - fi - - echo "⚠️ Could not install python3 automatically. Host updater will be unavailable." >&2 -} - -install_host_updater() { - if [ "$(id -u)" -ne 0 ]; then - echo "⚠️ Host updater installation requires root. Skipping one-click updater setup." - return - fi - - download_file "docker/host-updater.py" "${INSTALL_DIR}/host-updater.py" - download_file "docker/update-local.sh" "${INSTALL_DIR}/update-local.sh" - chmod 755 "${INSTALL_DIR}/host-updater.py" "${INSTALL_DIR}/update-local.sh" - - mkdir -p "$(dirname "${HOST_UPDATER_SOCKET_PATH}")" - - updater_token="$(get_env_value "${INSTALL_DIR}/.env" "HOST_UPDATER_TOKEN" || true)" - if [ -z "${updater_token}" ]; then - updater_token="$(generate_token)" - ensure_env_value "${INSTALL_DIR}/.env" "HOST_UPDATER_TOKEN" "${updater_token}" - fi - - ensure_env_value "${INSTALL_DIR}/.env" "HOST_UPDATER_SOCKET" "${HOST_UPDATER_SOCKET_PATH}" - - if ! command -v systemctl >/dev/null 2>&1; then - echo "⚠️ systemd not found. Admin one-click updates will be unavailable on this host." - return - fi - - install_python3_if_needed - if ! command -v python3 >/dev/null 2>&1; then - echo "⚠️ python3 is unavailable. Admin one-click updates will be unavailable." - return - fi - - cat > "${INSTALL_DIR}/updater.env" < /etc/systemd/system/synapsis-updater.service </dev/null 2>&1 || true - systemctl restart synapsis-updater.service >/dev/null 2>&1 || true -} - -require_command curl -require_command chmod -require_command mkdir -require_command cp - -RAW_BASE="https://raw.githubusercontent.com/${REPO}/${REF}" -PROXY="$(normalize_proxy_mode "${PROXY}")" -PROXYLESS_PORT="$(resolve_proxyless_port)" - -echo "========================================" -echo " Synapsis Docker Installer" -echo "========================================" -echo " Repo: ${REPO}" -echo " Ref: ${REF}" -echo " Install dir: ${INSTALL_DIR}" -echo " Proxy mode: ${PROXY}" -echo "========================================" - -install_docker_if_needed -mkdir -p "${INSTALL_DIR}" - -download_file "docker/.env.example" "${INSTALL_DIR}/.env.example" -case "${PROXY}" in - caddy) - ensure_caddy_ports_available - download_file "docker-compose.yml" "${INSTALL_DIR}/docker-compose.yml" - download_file "docker/Caddyfile" "${INSTALL_DIR}/Caddyfile" - download_file "docker/caddy-entrypoint.sh" "${INSTALL_DIR}/caddy-entrypoint.sh" - chmod 755 "${INSTALL_DIR}/caddy-entrypoint.sh" - rm -f "${INSTALL_DIR}/docker-compose.proxyless.yml" - ;; - none) - download_file "docker-compose.proxyless.yml" "${INSTALL_DIR}/docker-compose.yml" - rm -f "${INSTALL_DIR}/Caddyfile" "${INSTALL_DIR}/caddy-entrypoint.sh" - ;; -esac - -if [ ! -f "${INSTALL_DIR}/.env" ]; then - cp "${INSTALL_DIR}/.env.example" "${INSTALL_DIR}/.env" - echo "πŸ“ Created ${INSTALL_DIR}/.env" - - if command -v openssl >/dev/null 2>&1; then - set_env_value "${INSTALL_DIR}/.env" "AUTH_SECRET" "$(openssl rand -hex 32)" - set_env_value "${INSTALL_DIR}/.env" "DB_PASSWORD" "$(generate_db_password)" - echo "πŸ” Generated AUTH_SECRET and DB_PASSWORD" - else - echo "⚠️ openssl not found, leaving placeholder secrets in .env" - fi - - if [ -n "${DOMAIN:-}" ]; then - set_env_value "${INSTALL_DIR}/.env" "DOMAIN" "${DOMAIN}" - echo "🌐 Set DOMAIN=${DOMAIN}" - fi - - if [ -n "${ADMIN_EMAILS:-}" ]; then - set_env_value "${INSTALL_DIR}/.env" "ADMIN_EMAILS" "${ADMIN_EMAILS}" - echo "πŸ“§ Set ADMIN_EMAILS=${ADMIN_EMAILS}" - fi - - if [ "${PROXY}" = "none" ]; then - set_env_value "${INSTALL_DIR}/.env" "PORT" "${PROXYLESS_PORT}" - echo "πŸ“‘ Set PORT=${PROXYLESS_PORT} for proxyless mode" - fi -else - echo "πŸ“ Existing ${INSTALL_DIR}/.env found, leaving it unchanged" - - if [ "${PROXY}" = "none" ]; then - current_port="$(get_env_value "${INSTALL_DIR}/.env" "PORT" || true)" - if [ -z "${current_port}" ] || [ "${current_port}" = "auto" ]; then - set_env_value "${INSTALL_DIR}/.env" "PORT" "${PROXYLESS_PORT}" - echo "πŸ“‘ Updated PORT=${PROXYLESS_PORT} for proxyless mode" - fi - fi -fi - -install_host_updater - -echo "" -echo "Next steps:" -echo " 1. Review ${INSTALL_DIR}/.env" -if [ "${PROXY}" = "caddy" ]; then - echo " 2. Start Synapsis:" - echo " cd ${INSTALL_DIR} && docker compose up -d" -else - echo " 2. Start Synapsis:" - echo " cd ${INSTALL_DIR} && docker compose up -d" - echo " 3. Configure your existing reverse proxy to forward to:" - echo " http://127.0.0.1:${PROXYLESS_PORT}" - echo " (change PORT in ${INSTALL_DIR}/.env if you want a different localhost port)" -fi diff --git a/docker/nginx/conf.d/default.conf b/docker/nginx/conf.d/default.conf deleted file mode 100644 index 85cbbd8..0000000 --- a/docker/nginx/conf.d/default.conf +++ /dev/null @@ -1,63 +0,0 @@ -# HTTP to HTTPS redirect (run this first without SSL) -# After SSL certificates are obtained, use the SSL version below - -server { - listen 80; - server_name _; # Accept any server name (change to your domain for production) - - # Health check endpoint for Docker - location /nginx-health { - access_log off; - return 200 "healthy\n"; - add_header Content-Type text/plain; - } - - # Proxy all requests to the Next.js app - location / { - proxy_pass http://app:3000; - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection 'upgrade'; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_cache_bypass $http_upgrade; - proxy_read_timeout 86400; - } - - # Static files caching - location /_next/static { - proxy_pass http://app:3000; - proxy_cache_valid 200 365d; - add_header Cache-Control "public, immutable"; - } - - # API rate limiting - location /api/ { - limit_req zone=api burst=20 nodelay; - limit_conn addr 10; - - proxy_pass http://app:3000; - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection 'upgrade'; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - } - - # Auth endpoints - stricter rate limiting - location /api/auth/ { - limit_req zone=auth burst=5 nodelay; - limit_conn addr 5; - - proxy_pass http://app:3000; - proxy_http_version 1.1; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - } -} diff --git a/docker/nginx/conf.d/default.conf.ssl b/docker/nginx/conf.d/default.conf.ssl deleted file mode 100644 index 25ebb96..0000000 --- a/docker/nginx/conf.d/default.conf.ssl +++ /dev/null @@ -1,91 +0,0 @@ -# SSL Configuration (use this after obtaining certificates) -# Rename to default.conf after SSL setup - -server { - listen 80; - server_name ${DOMAIN}; - - # Certbot challenge - location /.well-known/acme-challenge/ { - root /var/www/certbot; - } - - # Redirect all HTTP to HTTPS - location / { - return 301 https://$server_name$request_uri; - } -} - -server { - listen 443 ssl http2; - server_name ${DOMAIN}; - - # SSL certificates (mounted from certbot) - ssl_certificate /etc/letsencrypt/live/${DOMAIN}/fullchain.pem; - ssl_certificate_key /etc/letsencrypt/live/${DOMAIN}/privkey.pem; - - # SSL configuration - ssl_protocols TLSv1.2 TLSv1.3; - ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384; - ssl_prefer_server_ciphers off; - ssl_session_cache shared:SSL:10m; - ssl_session_timeout 1d; - ssl_session_tickets off; - - # HSTS (enable after confirming HTTPS works) - # add_header Strict-Transport-Security "max-age=63072000" always; - - # Health check - location /nginx-health { - access_log off; - return 200 "healthy\n"; - add_header Content-Type text/plain; - } - - # Proxy all requests to the Next.js app - location / { - proxy_pass http://app:3000; - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection 'upgrade'; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_cache_bypass $http_upgrade; - proxy_read_timeout 86400; - } - - # Static files caching - location /_next/static { - proxy_pass http://app:3000; - proxy_cache_valid 200 365d; - add_header Cache-Control "public, immutable"; - } - - # API rate limiting - location /api/ { - limit_req zone=api burst=20 nodelay; - limit_conn addr 10; - - proxy_pass http://app:3000; - proxy_http_version 1.1; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - } - - # Auth endpoints - stricter rate limiting - location /api/auth/ { - limit_req zone=auth burst=5 nodelay; - limit_conn addr 5; - - proxy_pass http://app:3000; - proxy_http_version 1.1; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - } -} diff --git a/docker/nginx/nginx.conf b/docker/nginx/nginx.conf deleted file mode 100644 index 1f7764d..0000000 --- a/docker/nginx/nginx.conf +++ /dev/null @@ -1,70 +0,0 @@ -# Nginx configuration for Synapsis -# This configuration includes: -# - Gzip compression -# - Security headers -# - Rate limiting -# - Proper handling of Next.js static files - -user nginx; -worker_processes auto; -error_log /var/log/nginx/error.log warn; -pid /var/run/nginx.pid; - -events { - worker_connections 1024; - use epoll; - multi_accept on; -} - -http { - include /etc/nginx/mime.types; - default_type application/octet-stream; - - # Logging format - log_format main '$remote_addr - $remote_user [$time_local] "$request" ' - '$status $body_bytes_sent "$http_referer" ' - '"$http_user_agent" "$http_x_forwarded_for"'; - - access_log /var/log/nginx/access.log main; - - # Performance - sendfile on; - tcp_nopush on; - tcp_nodelay on; - keepalive_timeout 65; - types_hash_max_size 2048; - client_max_body_size 50M; - - # Gzip compression - gzip on; - gzip_vary on; - gzip_proxied any; - gzip_comp_level 6; - gzip_types - text/plain - text/css - text/xml - text/javascript - application/json - application/javascript - application/xml+rss - application/rss+xml - font/truetype - font/opentype - application/vnd.ms-fontobject - image/svg+xml; - - # Rate limiting zones - limit_req_zone $binary_remote_addr zone=api:10m rate=10r/s; - limit_req_zone $binary_remote_addr zone=auth:10m rate=5r/m; - limit_conn_zone $binary_remote_addr zone=addr:10m; - - # Security headers - add_header X-Frame-Options "SAMEORIGIN" always; - add_header X-Content-Type-Options "nosniff" always; - add_header X-XSS-Protection "1; mode=block" always; - add_header Referrer-Policy "strict-origin-when-cross-origin" always; - - # Include server configurations - include /etc/nginx/conf.d/*.conf; -} diff --git a/docker/uninstall.sh b/docker/uninstall.sh deleted file mode 100644 index 950cecc..0000000 --- a/docker/uninstall.sh +++ /dev/null @@ -1,127 +0,0 @@ -#!/bin/sh - -set -eu - -INSTALL_DIR="${1:-${INSTALL_DIR:-/opt/synapsis}}" -PROJECT_NAME="${PROJECT_NAME:-synapsis}" -IMAGE_REPO="${IMAGE_REPO:-ghcr.io/gnosyslabs/synapsis}" - -require_command() { - if ! command -v "$1" >/dev/null 2>&1; then - echo "❌ Required command not found: $1" >&2 - exit 1 - fi -} - -confirm_uninstall() { - if [ "${FORCE:-0}" = "1" ] || [ "${YES:-0}" = "1" ]; then - return - fi - - echo "========================================" - echo " Synapsis Docker Uninstaller" - echo "========================================" - echo " Install dir: ${INSTALL_DIR}" - echo " Project name: ${PROJECT_NAME}" - echo "" - echo "This will permanently remove:" - echo " - Synapsis containers" - echo " - Synapsis Docker volumes and network" - echo " - Synapsis images pulled from GHCR/local cache" - echo " - ${INSTALL_DIR}" - echo "" - if [ -r /dev/tty ]; then - printf "Type DELETE to continue: " > /dev/tty - read -r confirmation < /dev/tty - else - echo "❌ Interactive confirmation requires a TTY." >&2 - echo " Re-run with FORCE=1 if you want to skip the prompt." >&2 - exit 1 - fi - - if [ "$confirmation" != "DELETE" ]; then - echo "Aborted." - exit 1 - fi -} - -cleanup_with_compose() { - if [ -f "${INSTALL_DIR}/docker-compose.yml" ]; then - echo "🧹 Stopping Synapsis compose stack" - if [ -f "${INSTALL_DIR}/.env" ]; then - docker compose --env-file "${INSTALL_DIR}/.env" -f "${INSTALL_DIR}/docker-compose.yml" down --volumes --remove-orphans || true - else - docker compose -f "${INSTALL_DIR}/docker-compose.yml" down --volumes --remove-orphans || true - fi - fi -} - -cleanup_named_resources() { - for container in synapsis-caddy synapsis-app synapsis-db; do - if docker ps -aq --filter "name=^${container}$" | grep -q .; then - echo "πŸ—‘οΈ Removing container ${container}" - docker rm -f "${container}" >/dev/null 2>&1 || true - fi - done - - for volume in \ - synapsis_postgres_data \ - synapsis_uploads_data \ - synapsis_port_data \ - synapsis_caddy_data \ - synapsis_caddy_config - do - if docker volume inspect "${volume}" >/dev/null 2>&1; then - echo "πŸ—‘οΈ Removing volume ${volume}" - docker volume rm -f "${volume}" >/dev/null 2>&1 || true - fi - done - - if docker network inspect synapsis_synapsis-network >/dev/null 2>&1; then - echo "πŸ—‘οΈ Removing network synapsis_synapsis-network" - docker network rm synapsis_synapsis-network >/dev/null 2>&1 || true - fi - - if command -v systemctl >/dev/null 2>&1; then - systemctl disable --now synapsis-updater.service >/dev/null 2>&1 || true - rm -f /etc/systemd/system/synapsis-updater.service - systemctl daemon-reload >/dev/null 2>&1 || true - fi - - rm -rf /var/run/synapsis-updater -} - -cleanup_images() { - docker images --format '{{.Repository}}:{{.Tag}}' | while IFS= read -r image; do - case "$image" in - "${IMAGE_REPO}:"*|synapsis:*) - echo "πŸ—‘οΈ Removing image ${image}" - docker rmi -f "$image" >/dev/null 2>&1 || true - ;; - esac - done -} - -remove_install_dir() { - if [ -d "${INSTALL_DIR}" ]; then - echo "πŸ—‘οΈ Removing ${INSTALL_DIR}" - rm -rf "${INSTALL_DIR}" - fi -} - -require_command docker -require_command rm - -if [ "$(id -u)" -ne 0 ]; then - echo "❌ Run this uninstaller as root or with sudo." >&2 - exit 1 -fi - -confirm_uninstall -cleanup_with_compose -cleanup_named_resources -cleanup_images -remove_install_dir - -echo "" -echo "βœ… Synapsis has been removed from this host." diff --git a/docker/update-local.sh b/docker/update-local.sh deleted file mode 100755 index bc1e404..0000000 --- a/docker/update-local.sh +++ /dev/null @@ -1,77 +0,0 @@ -#!/bin/sh - -set -eu - -REPO="${REPO:-GnosysLabs/Synapsis}" -REF="${REF:-main}" -INSTALL_DIR="${1:-${INSTALL_DIR:-/opt/synapsis}}" -RAW_BASE="https://raw.githubusercontent.com/${REPO}/${REF}" - -require_command() { - if ! command -v "$1" >/dev/null 2>&1; then - echo "❌ Required command not found: $1" >&2 - exit 1 - fi -} - -download_file() { - source_path="$1" - target_path="$2" - echo "⬇️ Downloading ${source_path}" - curl -fsSL "${RAW_BASE}/${source_path}" -o "${target_path}" -} - -detect_proxy_mode() { - if [ -f "${INSTALL_DIR}/Caddyfile" ] || [ -f "${INSTALL_DIR}/caddy-entrypoint.sh" ]; then - printf 'caddy\n' - return - fi - - printf 'none\n' -} - -compose_cmd() { - if [ -f "${INSTALL_DIR}/.env" ]; then - docker compose --env-file "${INSTALL_DIR}/.env" -f "${INSTALL_DIR}/docker-compose.yml" "$@" - else - docker compose -f "${INSTALL_DIR}/docker-compose.yml" "$@" - fi -} - -require_command curl -require_command docker -require_command chmod -require_command mkdir - -if [ ! -d "${INSTALL_DIR}" ]; then - echo "❌ ${INSTALL_DIR} does not exist." >&2 - exit 1 -fi - -ACTIVE_PROXY="$(detect_proxy_mode)" - -case "${ACTIVE_PROXY}" in - caddy) - download_file "docker-compose.yml" "${INSTALL_DIR}/docker-compose.yml" - download_file "docker/Caddyfile" "${INSTALL_DIR}/Caddyfile" - download_file "docker/caddy-entrypoint.sh" "${INSTALL_DIR}/caddy-entrypoint.sh" - chmod 755 "${INSTALL_DIR}/caddy-entrypoint.sh" - ;; - none) - download_file "docker-compose.proxyless.yml" "${INSTALL_DIR}/docker-compose.yml" - rm -f "${INSTALL_DIR}/Caddyfile" "${INSTALL_DIR}/caddy-entrypoint.sh" - ;; -esac - -download_file "docker/host-updater.py" "${INSTALL_DIR}/host-updater.py" -download_file "docker/update-local.sh" "${INSTALL_DIR}/update-local.sh" -chmod 755 "${INSTALL_DIR}/host-updater.py" "${INSTALL_DIR}/update-local.sh" - -echo "🐳 Pulling latest Synapsis image" -compose_cmd pull - -echo "πŸš€ Restarting Synapsis" -compose_cmd up -d --remove-orphans - -echo "" -echo "βœ… Synapsis has been updated to the latest published image." diff --git a/docker/update.sh b/docker/update.sh deleted file mode 100644 index f240feb..0000000 --- a/docker/update.sh +++ /dev/null @@ -1,237 +0,0 @@ -#!/bin/sh - -set -eu - -REPO="${REPO:-GnosysLabs/Synapsis}" -REF="${REF:-main}" -INSTALL_DIR="${1:-${INSTALL_DIR:-/opt/synapsis}}" -RAW_BASE="https://raw.githubusercontent.com/${REPO}/${REF}" -PROXY="${PROXY:-}" -HOST_UPDATER_SOCKET_PATH="${HOST_UPDATER_SOCKET_PATH:-/var/run/synapsis-updater/updater.sock}" - -require_command() { - if ! command -v "$1" >/dev/null 2>&1; then - echo "❌ Required command not found: $1" >&2 - exit 1 - fi -} - -download_file() { - source_path="$1" - target_path="$2" - echo "⬇️ Downloading ${source_path}" - curl -fsSL "${RAW_BASE}/${source_path}" -o "${target_path}" -} - -set_env_value() { - file="$1" - key="$2" - value="$3" - - escaped_value=$(printf '%s\n' "$value" | sed -e 's/[\/&]/\\&/g') - sed -i.bak -E "s|^${key}=.*$|${key}=${escaped_value}|" "$file" - rm -f "${file}.bak" -} - -ensure_env_value() { - file="$1" - key="$2" - value="$3" - - if grep -q "^${key}=" "$file" 2>/dev/null; then - set_env_value "$file" "$key" "$value" - return - fi - - printf '%s=%s\n' "$key" "$value" >> "$file" -} - -get_env_value() { - file="$1" - key="$2" - sed -n -E "s/^${key}=(.*)$/\\1/p" "$file" | head -n 1 -} - -generate_token() { - if command -v openssl >/dev/null 2>&1; then - openssl rand -hex 32 - return - fi - - date +%s | sha256sum | awk '{print $1}' -} - -normalize_proxy_mode() { - case "$1" in - caddy|none) - printf '%s\n' "$1" - ;; - *) - echo "❌ Unsupported PROXY mode: $1" >&2 - echo " Supported values: caddy, none" >&2 - exit 1 - ;; - esac -} - -detect_proxy_mode() { - if [ -n "${PROXY}" ]; then - normalize_proxy_mode "${PROXY}" - return - fi - - if [ -f "${INSTALL_DIR}/Caddyfile" ] || [ -f "${INSTALL_DIR}/caddy-entrypoint.sh" ]; then - printf 'caddy\n' - return - fi - - printf 'none\n' -} - -install_python3_if_needed() { - if command -v python3 >/dev/null 2>&1; then - return - fi - - if command -v apt-get >/dev/null 2>&1; then - apt-get update - apt-get install -y python3 - return - fi - - if command -v apk >/dev/null 2>&1; then - apk add --no-cache python3 - return - fi -} - -install_host_updater() { - if [ "$(id -u)" -ne 0 ]; then - return - fi - - if [ ! -f "${INSTALL_DIR}/.env" ]; then - return - fi - - download_file "docker/host-updater.py" "${INSTALL_DIR}/host-updater.py" - download_file "docker/update-local.sh" "${INSTALL_DIR}/update-local.sh" - chmod 755 "${INSTALL_DIR}/host-updater.py" "${INSTALL_DIR}/update-local.sh" - - mkdir -p "$(dirname "${HOST_UPDATER_SOCKET_PATH}")" - - updater_token="$(get_env_value "${INSTALL_DIR}/.env" "HOST_UPDATER_TOKEN" || true)" - if [ -z "${updater_token}" ]; then - updater_token="$(generate_token)" - ensure_env_value "${INSTALL_DIR}/.env" "HOST_UPDATER_TOKEN" "${updater_token}" - fi - - ensure_env_value "${INSTALL_DIR}/.env" "HOST_UPDATER_SOCKET" "${HOST_UPDATER_SOCKET_PATH}" - - if ! command -v systemctl >/dev/null 2>&1; then - return - fi - - install_python3_if_needed - if ! command -v python3 >/dev/null 2>&1; then - return - fi - - cat > "${INSTALL_DIR}/updater.env" < /etc/systemd/system/synapsis-updater.service </dev/null 2>&1 || true - systemctl restart synapsis-updater.service >/dev/null 2>&1 || true -} - -require_command curl -require_command docker -require_command chmod -require_command mkdir - -if [ ! -d "${INSTALL_DIR}" ]; then - echo "❌ ${INSTALL_DIR} does not exist." >&2 - echo " Run the installer first:" >&2 - echo " curl -fsSL https://synapsis.social/install.sh | bash" >&2 - exit 1 -fi - -if [ ! -f "${INSTALL_DIR}/docker-compose.yml" ]; then - echo "❌ ${INSTALL_DIR}/docker-compose.yml was not found." >&2 - echo " This does not look like a Synapsis install directory." >&2 - exit 1 -fi - -ACTIVE_PROXY="$(detect_proxy_mode)" - -echo "========================================" -echo " Synapsis Docker Updater" -echo "========================================" -echo " Repo: ${REPO}" -echo " Ref: ${REF}" -echo " Install dir: ${INSTALL_DIR}" -echo " Proxy mode: ${ACTIVE_PROXY}" -echo "========================================" - -mkdir -p "${INSTALL_DIR}" - -download_file "docker/.env.example" "${INSTALL_DIR}/.env.example" - -case "${ACTIVE_PROXY}" in - caddy) - download_file "docker-compose.yml" "${INSTALL_DIR}/docker-compose.yml" - download_file "docker/Caddyfile" "${INSTALL_DIR}/Caddyfile" - download_file "docker/caddy-entrypoint.sh" "${INSTALL_DIR}/caddy-entrypoint.sh" - chmod 755 "${INSTALL_DIR}/caddy-entrypoint.sh" - ;; - none) - download_file "docker-compose.proxyless.yml" "${INSTALL_DIR}/docker-compose.yml" - rm -f "${INSTALL_DIR}/Caddyfile" "${INSTALL_DIR}/caddy-entrypoint.sh" - ;; -esac - -install_host_updater - -echo "🐳 Pulling latest Synapsis image" -if [ -f "${INSTALL_DIR}/.env" ]; then - docker compose --env-file "${INSTALL_DIR}/.env" -f "${INSTALL_DIR}/docker-compose.yml" pull - echo "πŸš€ Restarting Synapsis" - docker compose --env-file "${INSTALL_DIR}/.env" -f "${INSTALL_DIR}/docker-compose.yml" up -d --remove-orphans -else - docker compose -f "${INSTALL_DIR}/docker-compose.yml" pull - echo "πŸš€ Restarting Synapsis" - docker compose -f "${INSTALL_DIR}/docker-compose.yml" up -d --remove-orphans -fi - -echo "" -echo "βœ… Synapsis has been updated to the latest published image." diff --git a/drizzle.config.ts b/drizzle.config.ts index af7d04d..d29992c 100644 --- a/drizzle.config.ts +++ b/drizzle.config.ts @@ -7,8 +7,8 @@ dotenv.config(); export default defineConfig({ schema: './src/db/schema.ts', out: './drizzle', - dialect: 'postgresql', + dialect: 'sqlite', dbCredentials: { - url: process.env.DATABASE_URL!, + url: process.env.DATABASE_PATH || './data/synapsis.db', }, }); diff --git a/drizzle/0000_clumsy_donald_blake.sql b/drizzle/0000_clumsy_donald_blake.sql deleted file mode 100644 index 50d7d0e..0000000 --- a/drizzle/0000_clumsy_donald_blake.sql +++ /dev/null @@ -1,369 +0,0 @@ -CREATE TABLE "blocks" ( - "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, - "user_id" uuid NOT NULL, - "blocked_user_id" uuid NOT NULL, - "created_at" timestamp DEFAULT now() NOT NULL -); ---> statement-breakpoint -CREATE TABLE "bot_activity_logs" ( - "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, - "bot_id" uuid NOT NULL, - "action" text NOT NULL, - "details" text NOT NULL, - "success" boolean NOT NULL, - "error_message" text, - "created_at" timestamp DEFAULT now() NOT NULL -); ---> statement-breakpoint -CREATE TABLE "bot_content_items" ( - "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, - "source_id" uuid NOT NULL, - "external_id" text NOT NULL, - "title" text NOT NULL, - "content" text, - "url" text NOT NULL, - "published_at" timestamp NOT NULL, - "fetched_at" timestamp DEFAULT now() NOT NULL, - "is_processed" boolean DEFAULT false NOT NULL, - "processed_at" timestamp, - "post_id" uuid, - "interest_score" integer, - "interest_reason" text -); ---> statement-breakpoint -CREATE TABLE "bot_content_sources" ( - "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, - "bot_id" uuid NOT NULL, - "type" text NOT NULL, - "url" text NOT NULL, - "subreddit" text, - "api_key_encrypted" text, - "fetch_interval_minutes" integer DEFAULT 30 NOT NULL, - "keywords" text, - "is_active" boolean DEFAULT true NOT NULL, - "last_fetch_at" timestamp, - "last_error" text, - "consecutive_errors" integer DEFAULT 0 NOT NULL, - "created_at" timestamp DEFAULT now() NOT NULL, - "updated_at" timestamp DEFAULT now() NOT NULL -); ---> statement-breakpoint -CREATE TABLE "bot_mentions" ( - "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, - "bot_id" uuid NOT NULL, - "post_id" uuid NOT NULL, - "author_id" uuid NOT NULL, - "content" text NOT NULL, - "is_processed" boolean DEFAULT false NOT NULL, - "processed_at" timestamp, - "response_post_id" uuid, - "is_remote" boolean DEFAULT false NOT NULL, - "remote_actor_url" text, - "created_at" timestamp DEFAULT now() NOT NULL -); ---> statement-breakpoint -CREATE TABLE "bot_rate_limits" ( - "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, - "bot_id" uuid NOT NULL, - "window_start" timestamp NOT NULL, - "window_type" text NOT NULL, - "post_count" integer DEFAULT 0 NOT NULL, - "reply_count" integer DEFAULT 0 NOT NULL, - "created_at" timestamp DEFAULT now() NOT NULL -); ---> statement-breakpoint -CREATE TABLE "bots" ( - "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, - "user_id" uuid NOT NULL, - "name" text NOT NULL, - "handle" text NOT NULL, - "bio" text, - "avatar_url" text, - "personality_config" text NOT NULL, - "llm_provider" text NOT NULL, - "llm_model" text NOT NULL, - "llm_api_key_encrypted" text NOT NULL, - "schedule_config" text, - "autonomous_mode" boolean DEFAULT false NOT NULL, - "is_active" boolean DEFAULT true NOT NULL, - "is_suspended" boolean DEFAULT false NOT NULL, - "suspension_reason" text, - "suspended_at" timestamp, - "public_key" text NOT NULL, - "private_key_encrypted" text NOT NULL, - "last_post_at" timestamp, - "created_at" timestamp DEFAULT now() NOT NULL, - "updated_at" timestamp DEFAULT now() NOT NULL, - CONSTRAINT "bots_handle_unique" UNIQUE("handle") -); ---> statement-breakpoint -CREATE TABLE "follows" ( - "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, - "follower_id" uuid NOT NULL, - "following_id" uuid NOT NULL, - "ap_id" text, - "pending" boolean DEFAULT false, - "created_at" timestamp DEFAULT now() NOT NULL, - CONSTRAINT "follows_ap_id_unique" UNIQUE("ap_id") -); ---> statement-breakpoint -CREATE TABLE "handle_registry" ( - "handle" text PRIMARY KEY NOT NULL, - "did" text NOT NULL, - "node_domain" text NOT NULL, - "registered_at" timestamp DEFAULT now() NOT NULL, - "updated_at" timestamp DEFAULT now() NOT NULL -); ---> statement-breakpoint -CREATE TABLE "likes" ( - "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, - "user_id" uuid NOT NULL, - "post_id" uuid NOT NULL, - "ap_id" text, - "created_at" timestamp DEFAULT now() NOT NULL, - CONSTRAINT "likes_ap_id_unique" UNIQUE("ap_id") -); ---> statement-breakpoint -CREATE TABLE "media" ( - "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, - "user_id" uuid NOT NULL, - "post_id" uuid, - "url" text NOT NULL, - "alt_text" text, - "mime_type" text, - "width" integer, - "height" integer, - "created_at" timestamp DEFAULT now() NOT NULL -); ---> statement-breakpoint -CREATE TABLE "mutes" ( - "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, - "user_id" uuid NOT NULL, - "muted_user_id" uuid NOT NULL, - "created_at" timestamp DEFAULT now() NOT NULL -); ---> statement-breakpoint -CREATE TABLE "nodes" ( - "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, - "domain" text NOT NULL, - "name" text NOT NULL, - "description" text, - "long_description" text, - "rules" text, - "banner_url" text, - "accent_color" text DEFAULT '#FFFFFF', - "public_key" text, - "created_at" timestamp DEFAULT now() NOT NULL, - "updated_at" timestamp DEFAULT now() NOT NULL, - CONSTRAINT "nodes_domain_unique" UNIQUE("domain") -); ---> statement-breakpoint -CREATE TABLE "notifications" ( - "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, - "user_id" uuid NOT NULL, - "actor_id" uuid NOT NULL, - "post_id" uuid, - "type" text NOT NULL, - "read_at" timestamp, - "created_at" timestamp DEFAULT now() NOT NULL -); ---> statement-breakpoint -CREATE TABLE "posts" ( - "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, - "user_id" uuid NOT NULL, - "content" text NOT NULL, - "reply_to_id" uuid, - "repost_of_id" uuid, - "likes_count" integer DEFAULT 0 NOT NULL, - "reposts_count" integer DEFAULT 0 NOT NULL, - "replies_count" integer DEFAULT 0 NOT NULL, - "is_removed" boolean DEFAULT false NOT NULL, - "removed_at" timestamp, - "removed_by" uuid, - "removed_reason" text, - "ap_id" text, - "ap_url" text, - "link_preview_url" text, - "link_preview_title" text, - "link_preview_description" text, - "link_preview_image" text, - "created_at" timestamp DEFAULT now() NOT NULL, - "updated_at" timestamp DEFAULT now() NOT NULL, - CONSTRAINT "posts_ap_id_unique" UNIQUE("ap_id") -); ---> statement-breakpoint -CREATE TABLE "remote_followers" ( - "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, - "user_id" uuid NOT NULL, - "actor_url" text NOT NULL, - "inbox_url" text NOT NULL, - "shared_inbox_url" text, - "handle" text, - "activity_id" text, - "created_at" timestamp DEFAULT now() NOT NULL, - CONSTRAINT "remote_followers_actor_url_unique" UNIQUE("actor_url") -); ---> statement-breakpoint -CREATE TABLE "remote_follows" ( - "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, - "follower_id" uuid NOT NULL, - "target_handle" text NOT NULL, - "target_actor_url" text NOT NULL, - "inbox_url" text NOT NULL, - "activity_id" text NOT NULL, - "display_name" text, - "bio" text, - "avatar_url" text, - "created_at" timestamp DEFAULT now() NOT NULL -); ---> statement-breakpoint -CREATE TABLE "remote_posts" ( - "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, - "ap_id" text NOT NULL, - "author_handle" text NOT NULL, - "author_actor_url" text NOT NULL, - "author_display_name" text, - "author_avatar_url" text, - "content" text NOT NULL, - "published_at" timestamp NOT NULL, - "link_preview_url" text, - "link_preview_title" text, - "link_preview_description" text, - "link_preview_image" text, - "media_json" text, - "fetched_at" timestamp DEFAULT now() NOT NULL, - "created_at" timestamp DEFAULT now() NOT NULL, - CONSTRAINT "remote_posts_ap_id_unique" UNIQUE("ap_id") -); ---> statement-breakpoint -CREATE TABLE "reports" ( - "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, - "reporter_id" uuid, - "target_type" text NOT NULL, - "target_id" uuid NOT NULL, - "reason" text NOT NULL, - "status" text DEFAULT 'open' NOT NULL, - "resolved_at" timestamp, - "resolved_by" uuid, - "resolution_note" text, - "created_at" timestamp DEFAULT now() NOT NULL -); ---> statement-breakpoint -CREATE TABLE "sessions" ( - "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, - "user_id" uuid NOT NULL, - "token" text NOT NULL, - "expires_at" timestamp NOT NULL, - "created_at" timestamp DEFAULT now() NOT NULL, - CONSTRAINT "sessions_token_unique" UNIQUE("token") -); ---> statement-breakpoint -CREATE TABLE "users" ( - "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, - "did" text NOT NULL, - "handle" text NOT NULL, - "email" text, - "password_hash" text, - "display_name" text, - "bio" text, - "avatar_url" text, - "header_url" text, - "private_key_encrypted" text, - "public_key" text NOT NULL, - "node_id" uuid, - "is_suspended" boolean DEFAULT false NOT NULL, - "suspension_reason" text, - "suspended_at" timestamp, - "is_silenced" boolean DEFAULT false NOT NULL, - "silence_reason" text, - "silenced_at" timestamp, - "moved_to" text, - "moved_from" text, - "migrated_at" timestamp, - "followers_count" integer DEFAULT 0 NOT NULL, - "following_count" integer DEFAULT 0 NOT NULL, - "posts_count" integer DEFAULT 0 NOT NULL, - "website" text, - "created_at" timestamp DEFAULT now() NOT NULL, - "updated_at" timestamp DEFAULT now() NOT NULL, - CONSTRAINT "users_did_unique" UNIQUE("did"), - CONSTRAINT "users_handle_unique" UNIQUE("handle"), - CONSTRAINT "users_email_unique" UNIQUE("email") -); ---> statement-breakpoint -ALTER TABLE "blocks" ADD CONSTRAINT "blocks_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "blocks" ADD CONSTRAINT "blocks_blocked_user_id_users_id_fk" FOREIGN KEY ("blocked_user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "bot_activity_logs" ADD CONSTRAINT "bot_activity_logs_bot_id_bots_id_fk" FOREIGN KEY ("bot_id") REFERENCES "public"."bots"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "bot_content_items" ADD CONSTRAINT "bot_content_items_source_id_bot_content_sources_id_fk" FOREIGN KEY ("source_id") REFERENCES "public"."bot_content_sources"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "bot_content_items" ADD CONSTRAINT "bot_content_items_post_id_posts_id_fk" FOREIGN KEY ("post_id") REFERENCES "public"."posts"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "bot_content_sources" ADD CONSTRAINT "bot_content_sources_bot_id_bots_id_fk" FOREIGN KEY ("bot_id") REFERENCES "public"."bots"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "bot_mentions" ADD CONSTRAINT "bot_mentions_bot_id_bots_id_fk" FOREIGN KEY ("bot_id") REFERENCES "public"."bots"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "bot_mentions" ADD CONSTRAINT "bot_mentions_post_id_posts_id_fk" FOREIGN KEY ("post_id") REFERENCES "public"."posts"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "bot_mentions" ADD CONSTRAINT "bot_mentions_author_id_users_id_fk" FOREIGN KEY ("author_id") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "bot_mentions" ADD CONSTRAINT "bot_mentions_response_post_id_posts_id_fk" FOREIGN KEY ("response_post_id") REFERENCES "public"."posts"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "bot_rate_limits" ADD CONSTRAINT "bot_rate_limits_bot_id_bots_id_fk" FOREIGN KEY ("bot_id") REFERENCES "public"."bots"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "bots" ADD CONSTRAINT "bots_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "follows" ADD CONSTRAINT "follows_follower_id_users_id_fk" FOREIGN KEY ("follower_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "follows" ADD CONSTRAINT "follows_following_id_users_id_fk" FOREIGN KEY ("following_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "likes" ADD CONSTRAINT "likes_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "likes" ADD CONSTRAINT "likes_post_id_posts_id_fk" FOREIGN KEY ("post_id") REFERENCES "public"."posts"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "media" ADD CONSTRAINT "media_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "media" ADD CONSTRAINT "media_post_id_posts_id_fk" FOREIGN KEY ("post_id") REFERENCES "public"."posts"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "mutes" ADD CONSTRAINT "mutes_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "mutes" ADD CONSTRAINT "mutes_muted_user_id_users_id_fk" FOREIGN KEY ("muted_user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "notifications" ADD CONSTRAINT "notifications_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "notifications" ADD CONSTRAINT "notifications_actor_id_users_id_fk" FOREIGN KEY ("actor_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "notifications" ADD CONSTRAINT "notifications_post_id_posts_id_fk" FOREIGN KEY ("post_id") REFERENCES "public"."posts"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "posts" ADD CONSTRAINT "posts_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "posts" ADD CONSTRAINT "posts_removed_by_users_id_fk" FOREIGN KEY ("removed_by") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "remote_followers" ADD CONSTRAINT "remote_followers_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "remote_follows" ADD CONSTRAINT "remote_follows_follower_id_users_id_fk" FOREIGN KEY ("follower_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "reports" ADD CONSTRAINT "reports_reporter_id_users_id_fk" FOREIGN KEY ("reporter_id") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "reports" ADD CONSTRAINT "reports_resolved_by_users_id_fk" FOREIGN KEY ("resolved_by") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "sessions" ADD CONSTRAINT "sessions_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "users" ADD CONSTRAINT "users_node_id_nodes_id_fk" FOREIGN KEY ("node_id") REFERENCES "public"."nodes"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint -CREATE INDEX "blocks_user_idx" ON "blocks" USING btree ("user_id");--> statement-breakpoint -CREATE INDEX "bot_activity_logs_bot_idx" ON "bot_activity_logs" USING btree ("bot_id");--> statement-breakpoint -CREATE INDEX "bot_activity_logs_action_idx" ON "bot_activity_logs" USING btree ("action");--> statement-breakpoint -CREATE INDEX "bot_activity_logs_created_idx" ON "bot_activity_logs" USING btree ("created_at");--> statement-breakpoint -CREATE INDEX "bot_content_items_source_idx" ON "bot_content_items" USING btree ("source_id");--> statement-breakpoint -CREATE INDEX "bot_content_items_processed_idx" ON "bot_content_items" USING btree ("is_processed");--> statement-breakpoint -CREATE INDEX "bot_content_items_external_idx" ON "bot_content_items" USING btree ("external_id");--> statement-breakpoint -CREATE INDEX "bot_content_sources_bot_idx" ON "bot_content_sources" USING btree ("bot_id");--> statement-breakpoint -CREATE INDEX "bot_content_sources_type_idx" ON "bot_content_sources" USING btree ("type");--> statement-breakpoint -CREATE INDEX "bot_mentions_bot_idx" ON "bot_mentions" USING btree ("bot_id");--> statement-breakpoint -CREATE INDEX "bot_mentions_processed_idx" ON "bot_mentions" USING btree ("is_processed");--> statement-breakpoint -CREATE INDEX "bot_mentions_created_idx" ON "bot_mentions" USING btree ("created_at");--> statement-breakpoint -CREATE INDEX "bot_rate_limits_bot_window_idx" ON "bot_rate_limits" USING btree ("bot_id","window_start");--> statement-breakpoint -CREATE INDEX "bots_user_id_idx" ON "bots" USING btree ("user_id");--> statement-breakpoint -CREATE INDEX "bots_handle_idx" ON "bots" USING btree ("handle");--> statement-breakpoint -CREATE INDEX "bots_active_idx" ON "bots" USING btree ("is_active");--> statement-breakpoint -CREATE INDEX "follows_follower_idx" ON "follows" USING btree ("follower_id");--> statement-breakpoint -CREATE INDEX "follows_following_idx" ON "follows" USING btree ("following_id");--> statement-breakpoint -CREATE INDEX "handle_registry_updated_idx" ON "handle_registry" USING btree ("updated_at");--> statement-breakpoint -CREATE INDEX "likes_user_post_idx" ON "likes" USING btree ("user_id","post_id");--> statement-breakpoint -CREATE INDEX "media_user_idx" ON "media" USING btree ("user_id");--> statement-breakpoint -CREATE INDEX "media_post_idx" ON "media" USING btree ("post_id");--> statement-breakpoint -CREATE INDEX "mutes_user_idx" ON "mutes" USING btree ("user_id");--> statement-breakpoint -CREATE INDEX "notifications_user_idx" ON "notifications" USING btree ("user_id");--> statement-breakpoint -CREATE INDEX "notifications_created_idx" ON "notifications" USING btree ("created_at");--> statement-breakpoint -CREATE INDEX "posts_user_id_idx" ON "posts" USING btree ("user_id");--> statement-breakpoint -CREATE INDEX "posts_created_at_idx" ON "posts" USING btree ("created_at");--> statement-breakpoint -CREATE INDEX "posts_reply_to_idx" ON "posts" USING btree ("reply_to_id");--> statement-breakpoint -CREATE INDEX "posts_removed_idx" ON "posts" USING btree ("is_removed");--> statement-breakpoint -CREATE INDEX "remote_followers_user_idx" ON "remote_followers" USING btree ("user_id");--> statement-breakpoint -CREATE INDEX "remote_followers_actor_idx" ON "remote_followers" USING btree ("actor_url");--> statement-breakpoint -CREATE INDEX "remote_follows_follower_idx" ON "remote_follows" USING btree ("follower_id");--> statement-breakpoint -CREATE INDEX "remote_follows_target_idx" ON "remote_follows" USING btree ("target_handle");--> statement-breakpoint -CREATE INDEX "remote_posts_author_idx" ON "remote_posts" USING btree ("author_handle");--> statement-breakpoint -CREATE INDEX "remote_posts_published_idx" ON "remote_posts" USING btree ("published_at");--> statement-breakpoint -CREATE INDEX "remote_posts_ap_id_idx" ON "remote_posts" USING btree ("ap_id");--> statement-breakpoint -CREATE INDEX "reports_status_idx" ON "reports" USING btree ("status");--> statement-breakpoint -CREATE INDEX "reports_target_idx" ON "reports" USING btree ("target_type","target_id");--> statement-breakpoint -CREATE INDEX "reports_reporter_idx" ON "reports" USING btree ("reporter_id");--> statement-breakpoint -CREATE INDEX "sessions_token_idx" ON "sessions" USING btree ("token");--> statement-breakpoint -CREATE INDEX "sessions_user_idx" ON "sessions" USING btree ("user_id");--> statement-breakpoint -CREATE INDEX "users_handle_idx" ON "users" USING btree ("handle");--> statement-breakpoint -CREATE INDEX "users_did_idx" ON "users" USING btree ("did");--> statement-breakpoint -CREATE INDEX "users_suspended_idx" ON "users" USING btree ("is_suspended");--> statement-breakpoint -CREATE INDEX "users_silenced_idx" ON "users" USING btree ("is_silenced"); \ No newline at end of file diff --git a/drizzle/0001_remove_fetch_interval.sql b/drizzle/0001_remove_fetch_interval.sql deleted file mode 100644 index 47ea9ca..0000000 --- a/drizzle/0001_remove_fetch_interval.sql +++ /dev/null @@ -1,2 +0,0 @@ --- Remove fetch_interval_minutes column from bot_content_sources -ALTER TABLE "bot_content_sources" DROP COLUMN IF EXISTS "fetch_interval_minutes"; diff --git a/drizzle/0002_add_bot_id_to_posts.sql b/drizzle/0002_add_bot_id_to_posts.sql deleted file mode 100644 index 39a3c53..0000000 --- a/drizzle/0002_add_bot_id_to_posts.sql +++ /dev/null @@ -1,5 +0,0 @@ --- Add bot_id column to posts table -ALTER TABLE "posts" ADD COLUMN "bot_id" uuid REFERENCES "bots"("id") ON DELETE SET NULL; - --- Create index for bot_id -CREATE INDEX IF NOT EXISTS "posts_bot_id_idx" ON "posts" ("bot_id"); diff --git a/drizzle/0002_add_logo_url.sql b/drizzle/0002_add_logo_url.sql deleted file mode 100644 index 1cdb2f9..0000000 --- a/drizzle/0002_add_logo_url.sql +++ /dev/null @@ -1,24 +0,0 @@ -ALTER TABLE "bots" DROP CONSTRAINT "bots_handle_unique";--> statement-breakpoint -ALTER TABLE "bot_content_items" DROP CONSTRAINT "bot_content_items_post_id_posts_id_fk"; ---> statement-breakpoint -DROP INDEX "bots_handle_idx";--> statement-breakpoint -ALTER TABLE "bot_content_sources" ADD COLUMN "source_config" text;--> statement-breakpoint -ALTER TABLE "bots" ADD COLUMN "owner_id" uuid NOT NULL;--> statement-breakpoint -ALTER TABLE "nodes" ADD COLUMN "logo_url" text;--> statement-breakpoint -ALTER TABLE "posts" ADD COLUMN "bot_id" uuid;--> statement-breakpoint -ALTER TABLE "users" ADD COLUMN "is_bot" boolean DEFAULT false NOT NULL;--> statement-breakpoint -ALTER TABLE "users" ADD COLUMN "bot_owner_id" uuid;--> statement-breakpoint -ALTER TABLE "bot_content_items" ADD CONSTRAINT "bot_content_items_post_id_posts_id_fk" FOREIGN KEY ("post_id") REFERENCES "public"."posts"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "bots" ADD CONSTRAINT "bots_owner_id_users_id_fk" FOREIGN KEY ("owner_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "posts" ADD CONSTRAINT "posts_bot_id_bots_id_fk" FOREIGN KEY ("bot_id") REFERENCES "public"."bots"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "users" ADD CONSTRAINT "users_bot_owner_id_users_id_fk" FOREIGN KEY ("bot_owner_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -CREATE INDEX "bots_owner_id_idx" ON "bots" USING btree ("owner_id");--> statement-breakpoint -CREATE INDEX "posts_bot_id_idx" ON "posts" USING btree ("bot_id");--> statement-breakpoint -CREATE INDEX "users_is_bot_idx" ON "users" USING btree ("is_bot");--> statement-breakpoint -CREATE INDEX "users_bot_owner_idx" ON "users" USING btree ("bot_owner_id");--> statement-breakpoint -ALTER TABLE "bot_content_sources" DROP COLUMN "fetch_interval_minutes";--> statement-breakpoint -ALTER TABLE "bots" DROP COLUMN "handle";--> statement-breakpoint -ALTER TABLE "bots" DROP COLUMN "bio";--> statement-breakpoint -ALTER TABLE "bots" DROP COLUMN "avatar_url";--> statement-breakpoint -ALTER TABLE "bots" DROP COLUMN "public_key";--> statement-breakpoint -ALTER TABLE "bots" DROP COLUMN "private_key_encrypted"; \ No newline at end of file diff --git a/drizzle/0003_fix_bot_content_items_fk.sql b/drizzle/0003_fix_bot_content_items_fk.sql deleted file mode 100644 index 662a314..0000000 --- a/drizzle/0003_fix_bot_content_items_fk.sql +++ /dev/null @@ -1,4 +0,0 @@ --- Fix bot_content_items post_id foreign key to allow cascade on delete -ALTER TABLE "bot_content_items" DROP CONSTRAINT IF EXISTS "bot_content_items_post_id_posts_id_fk"; -ALTER TABLE "bot_content_items" ADD CONSTRAINT "bot_content_items_post_id_posts_id_fk" - FOREIGN KEY ("post_id") REFERENCES "posts"("id") ON DELETE SET NULL; diff --git a/drizzle/0003_small_reavers.sql b/drizzle/0003_small_reavers.sql deleted file mode 100644 index 77911b9..0000000 --- a/drizzle/0003_small_reavers.sql +++ /dev/null @@ -1,56 +0,0 @@ -CREATE TABLE "swarm_nodes" ( - "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, - "domain" text NOT NULL, - "name" text, - "description" text, - "logo_url" text, - "public_key" text, - "software_version" text, - "user_count" integer, - "post_count" integer, - "discovered_via" text, - "discovered_at" timestamp DEFAULT now() NOT NULL, - "last_seen_at" timestamp DEFAULT now() NOT NULL, - "last_sync_at" timestamp, - "consecutive_failures" integer DEFAULT 0 NOT NULL, - "is_active" boolean DEFAULT true NOT NULL, - "trust_score" integer DEFAULT 50 NOT NULL, - "capabilities" text, - "created_at" timestamp DEFAULT now() NOT NULL, - "updated_at" timestamp DEFAULT now() NOT NULL, - CONSTRAINT "swarm_nodes_domain_unique" UNIQUE("domain") -); ---> statement-breakpoint -CREATE TABLE "swarm_seeds" ( - "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, - "domain" text NOT NULL, - "priority" integer DEFAULT 100 NOT NULL, - "is_enabled" boolean DEFAULT true NOT NULL, - "last_contact_at" timestamp, - "consecutive_failures" integer DEFAULT 0 NOT NULL, - "created_at" timestamp DEFAULT now() NOT NULL, - CONSTRAINT "swarm_seeds_domain_unique" UNIQUE("domain") -); ---> statement-breakpoint -CREATE TABLE "swarm_sync_log" ( - "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, - "remote_domain" text NOT NULL, - "direction" text NOT NULL, - "nodes_received" integer DEFAULT 0 NOT NULL, - "nodes_sent" integer DEFAULT 0 NOT NULL, - "handles_received" integer DEFAULT 0 NOT NULL, - "handles_sent" integer DEFAULT 0 NOT NULL, - "success" boolean NOT NULL, - "error_message" text, - "duration_ms" integer, - "created_at" timestamp DEFAULT now() NOT NULL -); ---> statement-breakpoint -CREATE INDEX "swarm_nodes_domain_idx" ON "swarm_nodes" USING btree ("domain");--> statement-breakpoint -CREATE INDEX "swarm_nodes_active_idx" ON "swarm_nodes" USING btree ("is_active");--> statement-breakpoint -CREATE INDEX "swarm_nodes_last_seen_idx" ON "swarm_nodes" USING btree ("last_seen_at");--> statement-breakpoint -CREATE INDEX "swarm_nodes_trust_idx" ON "swarm_nodes" USING btree ("trust_score");--> statement-breakpoint -CREATE INDEX "swarm_seeds_enabled_idx" ON "swarm_seeds" USING btree ("is_enabled");--> statement-breakpoint -CREATE INDEX "swarm_seeds_priority_idx" ON "swarm_seeds" USING btree ("priority");--> statement-breakpoint -CREATE INDEX "swarm_sync_log_remote_idx" ON "swarm_sync_log" USING btree ("remote_domain");--> statement-breakpoint -CREATE INDEX "swarm_sync_log_created_idx" ON "swarm_sync_log" USING btree ("created_at"); \ No newline at end of file diff --git a/drizzle/0004_add_source_config.sql b/drizzle/0004_add_source_config.sql deleted file mode 100644 index 6f60b7a..0000000 --- a/drizzle/0004_add_source_config.sql +++ /dev/null @@ -1,2 +0,0 @@ --- Add source_config column for Brave News and News API query builder configurations -ALTER TABLE "bot_content_sources" ADD COLUMN "source_config" text; diff --git a/drizzle/0004_luxuriant_lockheed.sql b/drizzle/0004_luxuriant_lockheed.sql deleted file mode 100644 index d117519..0000000 --- a/drizzle/0004_luxuriant_lockheed.sql +++ /dev/null @@ -1,21 +0,0 @@ -CREATE TABLE "muted_nodes" ( - "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, - "user_id" uuid NOT NULL, - "node_domain" text NOT NULL, - "created_at" timestamp DEFAULT now() NOT NULL -); ---> statement-breakpoint -ALTER TABLE "nodes" ADD COLUMN "is_nsfw" boolean DEFAULT false NOT NULL;--> statement-breakpoint -ALTER TABLE "posts" ADD COLUMN "is_nsfw" boolean DEFAULT false NOT NULL;--> statement-breakpoint -ALTER TABLE "swarm_nodes" ADD COLUMN "is_nsfw" boolean DEFAULT false NOT NULL;--> statement-breakpoint -ALTER TABLE "users" ADD COLUMN "is_nsfw" boolean DEFAULT false NOT NULL;--> statement-breakpoint -ALTER TABLE "users" ADD COLUMN "nsfw_enabled" boolean DEFAULT false NOT NULL;--> statement-breakpoint -ALTER TABLE "users" ADD COLUMN "age_verified_at" timestamp;--> statement-breakpoint -ALTER TABLE "muted_nodes" ADD CONSTRAINT "muted_nodes_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -CREATE INDEX "muted_nodes_user_idx" ON "muted_nodes" USING btree ("user_id");--> statement-breakpoint -CREATE INDEX "muted_nodes_domain_idx" ON "muted_nodes" USING btree ("node_domain");--> statement-breakpoint -CREATE INDEX "blocks_blocked_user_idx" ON "blocks" USING btree ("blocked_user_id");--> statement-breakpoint -CREATE INDEX "mutes_muted_user_idx" ON "mutes" USING btree ("muted_user_id");--> statement-breakpoint -CREATE INDEX "posts_nsfw_idx" ON "posts" USING btree ("is_nsfw");--> statement-breakpoint -CREATE INDEX "swarm_nodes_nsfw_idx" ON "swarm_nodes" USING btree ("is_nsfw");--> statement-breakpoint -CREATE INDEX "users_nsfw_idx" ON "users" USING btree ("is_nsfw"); \ No newline at end of file diff --git a/drizzle/0005_bots_as_users.sql b/drizzle/0005_bots_as_users.sql deleted file mode 100644 index 6c99ba0..0000000 --- a/drizzle/0005_bots_as_users.sql +++ /dev/null @@ -1,34 +0,0 @@ --- Bots as First-Class Users Migration --- This migration transforms bots to have their own user accounts - --- Add bot-related fields to users table -ALTER TABLE "users" ADD COLUMN "is_bot" boolean DEFAULT false NOT NULL; -ALTER TABLE "users" ADD COLUMN "bot_owner_id" uuid REFERENCES "users"("id") ON DELETE CASCADE; - --- Create indexes for bot fields -CREATE INDEX IF NOT EXISTS "users_is_bot_idx" ON "users" ("is_bot"); -CREATE INDEX IF NOT EXISTS "users_bot_owner_idx" ON "users" ("bot_owner_id"); - --- Add owner_id to bots table (will be populated during migration) -ALTER TABLE "bots" ADD COLUMN "owner_id" uuid REFERENCES "users"("id") ON DELETE CASCADE; - --- Copy existing userId to ownerId (existing bots were owned by the user) -UPDATE "bots" SET "owner_id" = "user_id"; - --- Make owner_id NOT NULL after populating -ALTER TABLE "bots" ALTER COLUMN "owner_id" SET NOT NULL; - --- Create index for owner_id -CREATE INDEX IF NOT EXISTS "bots_owner_id_idx" ON "bots" ("owner_id"); - --- Remove columns that are now on the user account --- Note: handle, bio, avatarUrl, publicKey, privateKeyEncrypted move to users table --- We'll keep them for now and handle migration in application code --- ALTER TABLE "bots" DROP COLUMN "handle"; --- ALTER TABLE "bots" DROP COLUMN "bio"; --- ALTER TABLE "bots" DROP COLUMN "avatar_url"; --- ALTER TABLE "bots" DROP COLUMN "public_key"; --- ALTER TABLE "bots" DROP COLUMN "private_key_encrypted"; - --- Drop the handle index since handle is now on users -DROP INDEX IF EXISTS "bots_handle_idx"; diff --git a/drizzle/0005_yummy_millenium_guard.sql b/drizzle/0005_yummy_millenium_guard.sql deleted file mode 100644 index aedcd54..0000000 --- a/drizzle/0005_yummy_millenium_guard.sql +++ /dev/null @@ -1,3 +0,0 @@ -ALTER TABLE "remote_followers" DROP CONSTRAINT "remote_followers_actor_url_unique";--> statement-breakpoint -ALTER TABLE "nodes" ADD COLUMN "favicon_url" text;--> statement-breakpoint -CREATE UNIQUE INDEX "remote_followers_user_actor_unique" ON "remote_followers" USING btree ("user_id","actor_url"); \ No newline at end of file diff --git a/drizzle/0006_add_favicon_url.sql b/drizzle/0006_add_favicon_url.sql deleted file mode 100644 index 282ff35..0000000 --- a/drizzle/0006_add_favicon_url.sql +++ /dev/null @@ -1,2 +0,0 @@ --- Add favicon_url column to nodes table -ALTER TABLE "nodes" ADD COLUMN IF NOT EXISTS "favicon_url" text; diff --git a/drizzle/0007_kind_agent_zero.sql b/drizzle/0007_kind_agent_zero.sql deleted file mode 100644 index 99ace8a..0000000 --- a/drizzle/0007_kind_agent_zero.sql +++ /dev/null @@ -1,29 +0,0 @@ -CREATE TABLE "remote_likes" ( - "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, - "post_id" uuid NOT NULL, - "actor_handle" text NOT NULL, - "actor_node_domain" text NOT NULL, - "created_at" timestamp DEFAULT now() NOT NULL -); ---> statement-breakpoint -CREATE TABLE "remote_reposts" ( - "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, - "post_id" uuid NOT NULL, - "actor_handle" text NOT NULL, - "actor_node_domain" text NOT NULL, - "created_at" timestamp DEFAULT now() NOT NULL -); ---> statement-breakpoint -ALTER TABLE "nodes" ADD COLUMN "turnstile_site_key" text;--> statement-breakpoint -ALTER TABLE "nodes" ADD COLUMN "turnstile_secret_key" text;--> statement-breakpoint -ALTER TABLE "posts" ADD COLUMN "swarm_reply_to_id" text;--> statement-breakpoint -ALTER TABLE "posts" ADD COLUMN "swarm_reply_to_content" text;--> statement-breakpoint -ALTER TABLE "posts" ADD COLUMN "swarm_reply_to_author" text;--> statement-breakpoint -ALTER TABLE "remote_likes" ADD CONSTRAINT "remote_likes_post_id_posts_id_fk" FOREIGN KEY ("post_id") REFERENCES "public"."posts"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "remote_reposts" ADD CONSTRAINT "remote_reposts_post_id_posts_id_fk" FOREIGN KEY ("post_id") REFERENCES "public"."posts"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -CREATE INDEX "remote_likes_post_idx" ON "remote_likes" USING btree ("post_id");--> statement-breakpoint -CREATE INDEX "remote_likes_actor_idx" ON "remote_likes" USING btree ("actor_handle","actor_node_domain");--> statement-breakpoint -CREATE UNIQUE INDEX "remote_likes_unique" ON "remote_likes" USING btree ("post_id","actor_handle","actor_node_domain");--> statement-breakpoint -CREATE INDEX "remote_reposts_post_idx" ON "remote_reposts" USING btree ("post_id");--> statement-breakpoint -CREATE INDEX "remote_reposts_actor_idx" ON "remote_reposts" USING btree ("actor_handle","actor_node_domain");--> statement-breakpoint -CREATE UNIQUE INDEX "remote_reposts_unique" ON "remote_reposts" USING btree ("post_id","actor_handle","actor_node_domain"); \ No newline at end of file diff --git a/drizzle/0008_illegal_carlie_cooper.sql b/drizzle/0008_illegal_carlie_cooper.sql deleted file mode 100644 index fcfb604..0000000 --- a/drizzle/0008_illegal_carlie_cooper.sql +++ /dev/null @@ -1,46 +0,0 @@ -CREATE TABLE "chat_conversations" ( - "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, - "type" text DEFAULT 'direct' NOT NULL, - "participant1_id" uuid NOT NULL, - "participant2_handle" text NOT NULL, - "last_message_at" timestamp, - "last_message_preview" text, - "created_at" timestamp DEFAULT now() NOT NULL, - "updated_at" timestamp DEFAULT now() NOT NULL -); ---> statement-breakpoint -CREATE TABLE "chat_messages" ( - "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, - "conversation_id" uuid NOT NULL, - "sender_handle" text NOT NULL, - "sender_display_name" text, - "sender_avatar_url" text, - "sender_node_domain" text, - "encrypted_content" text NOT NULL, - "swarm_message_id" text, - "delivered_at" timestamp, - "read_at" timestamp, - "created_at" timestamp DEFAULT now() NOT NULL, - CONSTRAINT "chat_messages_swarm_message_id_unique" UNIQUE("swarm_message_id") -); ---> statement-breakpoint -CREATE TABLE "chat_typing_indicators" ( - "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, - "conversation_id" uuid NOT NULL, - "user_handle" text NOT NULL, - "expires_at" timestamp NOT NULL, - "created_at" timestamp DEFAULT now() NOT NULL -); ---> statement-breakpoint -ALTER TABLE "chat_conversations" ADD CONSTRAINT "chat_conversations_participant1_id_users_id_fk" FOREIGN KEY ("participant1_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "chat_messages" ADD CONSTRAINT "chat_messages_conversation_id_chat_conversations_id_fk" FOREIGN KEY ("conversation_id") REFERENCES "public"."chat_conversations"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "chat_typing_indicators" ADD CONSTRAINT "chat_typing_indicators_conversation_id_chat_conversations_id_fk" FOREIGN KEY ("conversation_id") REFERENCES "public"."chat_conversations"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -CREATE INDEX "chat_conversations_participant1_idx" ON "chat_conversations" USING btree ("participant1_id");--> statement-breakpoint -CREATE INDEX "chat_conversations_last_message_idx" ON "chat_conversations" USING btree ("last_message_at");--> statement-breakpoint -CREATE UNIQUE INDEX "chat_conversations_unique" ON "chat_conversations" USING btree ("participant1_id","participant2_handle");--> statement-breakpoint -CREATE INDEX "chat_messages_conversation_idx" ON "chat_messages" USING btree ("conversation_id");--> statement-breakpoint -CREATE INDEX "chat_messages_created_idx" ON "chat_messages" USING btree ("created_at");--> statement-breakpoint -CREATE INDEX "chat_messages_swarm_id_idx" ON "chat_messages" USING btree ("swarm_message_id");--> statement-breakpoint -CREATE INDEX "chat_typing_conversation_idx" ON "chat_typing_indicators" USING btree ("conversation_id");--> statement-breakpoint -CREATE INDEX "chat_typing_expires_idx" ON "chat_typing_indicators" USING btree ("expires_at");--> statement-breakpoint -CREATE UNIQUE INDEX "chat_typing_unique" ON "chat_typing_indicators" USING btree ("conversation_id","user_handle"); \ No newline at end of file diff --git a/drizzle/0009_add_node_private_key.sql b/drizzle/0009_add_node_private_key.sql deleted file mode 100644 index 3bed254..0000000 --- a/drizzle/0009_add_node_private_key.sql +++ /dev/null @@ -1,2 +0,0 @@ --- Add private_key_encrypted column to nodes table for cryptographic signing -ALTER TABLE "nodes" ADD COLUMN "private_key_encrypted" text; diff --git a/drizzle/0009_sweet_chat.sql b/drizzle/0009_sweet_chat.sql deleted file mode 100644 index 89c4dba..0000000 --- a/drizzle/0009_sweet_chat.sql +++ /dev/null @@ -1,21 +0,0 @@ -CREATE TABLE "remote_identity_cache" ( - "did" text PRIMARY KEY NOT NULL, - "public_key" text NOT NULL, - "fetched_at" timestamp NOT NULL, - "expires_at" timestamp NOT NULL -); ---> statement-breakpoint -CREATE TABLE "signed_action_dedupe" ( - "action_id" text PRIMARY KEY NOT NULL, - "did" text NOT NULL, - "nonce" text NOT NULL, - "ts" bigint NOT NULL, - "created_at" timestamp DEFAULT now() NOT NULL -); ---> statement-breakpoint -ALTER TABLE "chat_messages" ADD COLUMN "sender_encrypted_content" text;--> statement-breakpoint -ALTER TABLE "chat_messages" ADD COLUMN "sender_chat_public_key" text;--> statement-breakpoint -ALTER TABLE "nodes" ADD COLUMN "private_key_encrypted" text;--> statement-breakpoint -ALTER TABLE "users" ADD COLUMN "chat_public_key" text;--> statement-breakpoint -ALTER TABLE "users" ADD COLUMN "chat_private_key_encrypted" text;--> statement-breakpoint -CREATE INDEX "signed_action_dedupe_created_idx" ON "signed_action_dedupe" USING btree ("created_at"); \ No newline at end of file diff --git a/drizzle/0010_add_sender_did_to_chat_messages.sql b/drizzle/0010_add_sender_did_to_chat_messages.sql deleted file mode 100644 index 19d98cf..0000000 --- a/drizzle/0010_add_sender_did_to_chat_messages.sql +++ /dev/null @@ -1,43 +0,0 @@ -CREATE TABLE "chat_device_bundles" ( - "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, - "user_id" uuid NOT NULL, - "did" text NOT NULL, - "device_id" text NOT NULL, - "identity_key" text NOT NULL, - "signed_pre_key" text NOT NULL, - "signature" text NOT NULL, - "last_seen_at" timestamp DEFAULT now() NOT NULL, - "created_at" timestamp DEFAULT now() NOT NULL -); ---> statement-breakpoint -CREATE TABLE "chat_inbox" ( - "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, - "recipient_did" text NOT NULL, - "recipient_device_id" text, - "sender_did" text NOT NULL, - "envelope_json" text NOT NULL, - "is_read" boolean DEFAULT false NOT NULL, - "created_at" timestamp DEFAULT now() NOT NULL, - "expires_at" timestamp NOT NULL -); ---> statement-breakpoint -CREATE TABLE "chat_one_time_keys" ( - "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, - "user_id" uuid NOT NULL, - "bundle_id" uuid NOT NULL, - "key_id" integer NOT NULL, - "public_key" text NOT NULL, - "created_at" timestamp DEFAULT now() NOT NULL -); ---> statement-breakpoint -ALTER TABLE "chat_messages" ADD COLUMN "sender_did" text;--> statement-breakpoint -ALTER TABLE "chat_device_bundles" ADD CONSTRAINT "chat_device_bundles_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "chat_one_time_keys" ADD CONSTRAINT "chat_one_time_keys_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "chat_one_time_keys" ADD CONSTRAINT "chat_one_time_keys_bundle_id_chat_device_bundles_id_fk" FOREIGN KEY ("bundle_id") REFERENCES "public"."chat_device_bundles"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -CREATE INDEX "chat_bundles_user_idx" ON "chat_device_bundles" USING btree ("user_id");--> statement-breakpoint -CREATE INDEX "chat_bundles_did_idx" ON "chat_device_bundles" USING btree ("did");--> statement-breakpoint -CREATE UNIQUE INDEX "chat_bundles_device_unique" ON "chat_device_bundles" USING btree ("user_id","device_id");--> statement-breakpoint -CREATE INDEX "chat_inbox_recipient_idx" ON "chat_inbox" USING btree ("recipient_did","recipient_device_id");--> statement-breakpoint -CREATE INDEX "chat_inbox_created_idx" ON "chat_inbox" USING btree ("created_at");--> statement-breakpoint -CREATE INDEX "chat_otk_bundle_idx" ON "chat_one_time_keys" USING btree ("bundle_id");--> statement-breakpoint -CREATE UNIQUE INDEX "chat_otk_unique" ON "chat_one_time_keys" USING btree ("bundle_id","key_id"); \ No newline at end of file diff --git a/drizzle/0011_add_user_storage.sql b/drizzle/0011_add_user_storage.sql deleted file mode 100644 index 262ca57..0000000 --- a/drizzle/0011_add_user_storage.sql +++ /dev/null @@ -1,3 +0,0 @@ --- Migration: Add user storage columns -ALTER TABLE "users" ADD COLUMN IF NOT EXISTS "storage_provider" text; -ALTER TABLE "users" ADD COLUMN IF NOT EXISTS "storage_api_key_encrypted" text; diff --git a/drizzle/0012_add_logo_favicon_data.sql b/drizzle/0012_add_logo_favicon_data.sql deleted file mode 100644 index c87cc2c..0000000 --- a/drizzle/0012_add_logo_favicon_data.sql +++ /dev/null @@ -1,3 +0,0 @@ --- Migration: Add logo_data and favicon_data columns for base64 storage -ALTER TABLE "nodes" ADD COLUMN IF NOT EXISTS "logo_data" text; -ALTER TABLE "nodes" ADD COLUMN IF NOT EXISTS "favicon_data" text; diff --git a/drizzle/0013_add_storage_public_base_url.sql b/drizzle/0013_add_storage_public_base_url.sql deleted file mode 100644 index 9c1daff..0000000 --- a/drizzle/0013_add_storage_public_base_url.sql +++ /dev/null @@ -1,2 +0,0 @@ --- Migration: Add storage_public_base_url column to users table -ALTER TABLE "users" ADD COLUMN IF NOT EXISTS "storage_public_base_url" text; diff --git a/drizzle/20260714222942_pale_cardiac/migration.sql b/drizzle/20260714222942_pale_cardiac/migration.sql new file mode 100644 index 0000000..87fe4db --- /dev/null +++ b/drizzle/20260714222942_pale_cardiac/migration.sql @@ -0,0 +1,620 @@ +CREATE TABLE `blocks` ( + `id` text PRIMARY KEY, + `user_id` text NOT NULL, + `blocked_user_id` text NOT NULL, + `created_at` integer DEFAULT (unixepoch()) NOT NULL, + CONSTRAINT `fk_blocks_user_id_users_id_fk` FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON DELETE CASCADE, + CONSTRAINT `fk_blocks_blocked_user_id_users_id_fk` FOREIGN KEY (`blocked_user_id`) REFERENCES `users`(`id`) ON DELETE CASCADE +); +--> statement-breakpoint +CREATE TABLE `bot_activity_logs` ( + `id` text PRIMARY KEY, + `bot_id` text NOT NULL, + `action` text NOT NULL, + `details` text NOT NULL, + `success` integer NOT NULL, + `error_message` text, + `created_at` integer DEFAULT (unixepoch()) NOT NULL, + CONSTRAINT `fk_bot_activity_logs_bot_id_bots_id_fk` FOREIGN KEY (`bot_id`) REFERENCES `bots`(`id`) ON DELETE CASCADE +); +--> statement-breakpoint +CREATE TABLE `bot_content_items` ( + `id` text PRIMARY KEY, + `source_id` text NOT NULL, + `external_id` text NOT NULL, + `title` text NOT NULL, + `content` text, + `url` text NOT NULL, + `published_at` integer NOT NULL, + `fetched_at` integer DEFAULT (unixepoch()) NOT NULL, + `is_processed` integer DEFAULT false NOT NULL, + `processed_at` integer, + `post_id` text, + `interest_score` integer, + `interest_reason` text, + CONSTRAINT `fk_bot_content_items_source_id_bot_content_sources_id_fk` FOREIGN KEY (`source_id`) REFERENCES `bot_content_sources`(`id`) ON DELETE CASCADE, + CONSTRAINT `fk_bot_content_items_post_id_posts_id_fk` FOREIGN KEY (`post_id`) REFERENCES `posts`(`id`) ON DELETE SET NULL +); +--> statement-breakpoint +CREATE TABLE `bot_content_sources` ( + `id` text PRIMARY KEY, + `bot_id` text NOT NULL, + `type` text NOT NULL, + `url` text NOT NULL, + `subreddit` text, + `api_key_encrypted` text, + `source_config` text, + `keywords` text, + `is_active` integer DEFAULT true NOT NULL, + `last_fetch_at` integer, + `last_error` text, + `consecutive_errors` integer DEFAULT 0 NOT NULL, + `created_at` integer DEFAULT (unixepoch()) NOT NULL, + `updated_at` integer DEFAULT (unixepoch()) NOT NULL, + CONSTRAINT `fk_bot_content_sources_bot_id_bots_id_fk` FOREIGN KEY (`bot_id`) REFERENCES `bots`(`id`) ON DELETE CASCADE +); +--> statement-breakpoint +CREATE TABLE `bot_mentions` ( + `id` text PRIMARY KEY, + `bot_id` text NOT NULL, + `post_id` text NOT NULL, + `author_id` text NOT NULL, + `content` text NOT NULL, + `is_processed` integer DEFAULT false NOT NULL, + `processed_at` integer, + `response_post_id` text, + `is_remote` integer DEFAULT false NOT NULL, + `remote_actor_url` text, + `created_at` integer DEFAULT (unixepoch()) NOT NULL, + CONSTRAINT `fk_bot_mentions_bot_id_bots_id_fk` FOREIGN KEY (`bot_id`) REFERENCES `bots`(`id`) ON DELETE CASCADE, + CONSTRAINT `fk_bot_mentions_post_id_posts_id_fk` FOREIGN KEY (`post_id`) REFERENCES `posts`(`id`) ON DELETE CASCADE, + CONSTRAINT `fk_bot_mentions_author_id_users_id_fk` FOREIGN KEY (`author_id`) REFERENCES `users`(`id`), + CONSTRAINT `fk_bot_mentions_response_post_id_posts_id_fk` FOREIGN KEY (`response_post_id`) REFERENCES `posts`(`id`) +); +--> statement-breakpoint +CREATE TABLE `bot_rate_limits` ( + `id` text PRIMARY KEY, + `bot_id` text NOT NULL, + `window_start` integer NOT NULL, + `window_type` text NOT NULL, + `post_count` integer DEFAULT 0 NOT NULL, + `reply_count` integer DEFAULT 0 NOT NULL, + `created_at` integer DEFAULT (unixepoch()) NOT NULL, + CONSTRAINT `fk_bot_rate_limits_bot_id_bots_id_fk` FOREIGN KEY (`bot_id`) REFERENCES `bots`(`id`) ON DELETE CASCADE +); +--> statement-breakpoint +CREATE TABLE `bots` ( + `id` text PRIMARY KEY, + `user_id` text NOT NULL, + `owner_id` text NOT NULL, + `name` text NOT NULL, + `personality_config` text NOT NULL, + `llm_provider` text NOT NULL, + `llm_model` text NOT NULL, + `llm_endpoint` text, + `llm_api_key_encrypted` text NOT NULL, + `schedule_config` text, + `autonomous_mode` integer DEFAULT false NOT NULL, + `is_active` integer DEFAULT true NOT NULL, + `is_suspended` integer DEFAULT false NOT NULL, + `suspension_reason` text, + `suspended_at` integer, + `last_post_at` integer, + `created_at` integer DEFAULT (unixepoch()) NOT NULL, + `updated_at` integer DEFAULT (unixepoch()) NOT NULL, + CONSTRAINT `fk_bots_user_id_users_id_fk` FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON DELETE CASCADE, + CONSTRAINT `fk_bots_owner_id_users_id_fk` FOREIGN KEY (`owner_id`) REFERENCES `users`(`id`) ON DELETE CASCADE +); +--> statement-breakpoint +CREATE TABLE `chat_conversations` ( + `id` text PRIMARY KEY, + `type` text DEFAULT 'direct' NOT NULL, + `participant1_id` text NOT NULL, + `participant2_handle` text NOT NULL, + `last_message_at` integer, + `last_message_preview` text, + `created_at` integer DEFAULT (unixepoch()) NOT NULL, + `updated_at` integer DEFAULT (unixepoch()) NOT NULL, + CONSTRAINT `fk_chat_conversations_participant1_id_users_id_fk` FOREIGN KEY (`participant1_id`) REFERENCES `users`(`id`) ON DELETE CASCADE +); +--> statement-breakpoint +CREATE TABLE `chat_messages` ( + `id` text PRIMARY KEY, + `conversation_id` text NOT NULL, + `sender_handle` text NOT NULL, + `sender_display_name` text, + `sender_avatar_url` text, + `sender_node_domain` text, + `sender_did` text, + `content` text, + `swarm_message_id` text, + `delivered_at` integer, + `read_at` integer, + `created_at` integer DEFAULT (unixepoch()) NOT NULL, + CONSTRAINT `fk_chat_messages_conversation_id_chat_conversations_id_fk` FOREIGN KEY (`conversation_id`) REFERENCES `chat_conversations`(`id`) ON DELETE CASCADE +); +--> statement-breakpoint +CREATE TABLE `chat_typing_indicators` ( + `id` text PRIMARY KEY, + `conversation_id` text NOT NULL, + `user_handle` text NOT NULL, + `expires_at` integer NOT NULL, + `created_at` integer DEFAULT (unixepoch()) NOT NULL, + CONSTRAINT `fk_chat_typing_indicators_conversation_id_chat_conversations_id_fk` FOREIGN KEY (`conversation_id`) REFERENCES `chat_conversations`(`id`) ON DELETE CASCADE +); +--> statement-breakpoint +CREATE TABLE `follows` ( + `id` text PRIMARY KEY, + `follower_id` text NOT NULL, + `following_id` text NOT NULL, + `ap_id` text UNIQUE, + `pending` integer DEFAULT false, + `created_at` integer DEFAULT (unixepoch()) NOT NULL, + CONSTRAINT `fk_follows_follower_id_users_id_fk` FOREIGN KEY (`follower_id`) REFERENCES `users`(`id`) ON DELETE CASCADE, + CONSTRAINT `fk_follows_following_id_users_id_fk` FOREIGN KEY (`following_id`) REFERENCES `users`(`id`) ON DELETE CASCADE +); +--> statement-breakpoint +CREATE TABLE `handle_registry` ( + `handle` text PRIMARY KEY, + `did` text NOT NULL, + `node_domain` text NOT NULL, + `registered_at` integer DEFAULT (unixepoch()) NOT NULL, + `updated_at` integer DEFAULT (unixepoch()) NOT NULL +); +--> statement-breakpoint +CREATE TABLE `likes` ( + `id` text PRIMARY KEY, + `user_id` text NOT NULL, + `post_id` text NOT NULL, + `ap_id` text UNIQUE, + `created_at` integer DEFAULT (unixepoch()) NOT NULL, + CONSTRAINT `fk_likes_user_id_users_id_fk` FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON DELETE CASCADE, + CONSTRAINT `fk_likes_post_id_posts_id_fk` FOREIGN KEY (`post_id`) REFERENCES `posts`(`id`) ON DELETE CASCADE +); +--> statement-breakpoint +CREATE TABLE `media` ( + `id` text PRIMARY KEY, + `user_id` text NOT NULL, + `post_id` text, + `url` text NOT NULL, + `alt_text` text, + `mime_type` text, + `width` integer, + `height` integer, + `created_at` integer DEFAULT (unixepoch()) NOT NULL, + CONSTRAINT `fk_media_user_id_users_id_fk` FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON DELETE CASCADE, + CONSTRAINT `fk_media_post_id_posts_id_fk` FOREIGN KEY (`post_id`) REFERENCES `posts`(`id`) ON DELETE CASCADE +); +--> statement-breakpoint +CREATE TABLE `muted_nodes` ( + `id` text PRIMARY KEY, + `user_id` text NOT NULL, + `node_domain` text NOT NULL, + `created_at` integer DEFAULT (unixepoch()) NOT NULL, + CONSTRAINT `fk_muted_nodes_user_id_users_id_fk` FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON DELETE CASCADE +); +--> statement-breakpoint +CREATE TABLE `mutes` ( + `id` text PRIMARY KEY, + `user_id` text NOT NULL, + `muted_user_id` text NOT NULL, + `created_at` integer DEFAULT (unixepoch()) NOT NULL, + CONSTRAINT `fk_mutes_user_id_users_id_fk` FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON DELETE CASCADE, + CONSTRAINT `fk_mutes_muted_user_id_users_id_fk` FOREIGN KEY (`muted_user_id`) REFERENCES `users`(`id`) ON DELETE CASCADE +); +--> statement-breakpoint +CREATE TABLE `nodes` ( + `id` text PRIMARY KEY, + `domain` text NOT NULL UNIQUE, + `name` text NOT NULL, + `description` text, + `long_description` text, + `rules` text, + `banner_url` text, + `logo_url` text, + `favicon_url` text, + `logo_data` text, + `favicon_data` text, + `accent_color` text DEFAULT '#FFFFFF', + `public_key` text, + `private_key_encrypted` text, + `is_nsfw` integer DEFAULT false NOT NULL, + `turnstile_site_key` text, + `turnstile_secret_key` text, + `created_at` integer DEFAULT (unixepoch()) NOT NULL, + `updated_at` integer DEFAULT (unixepoch()) NOT NULL +); +--> statement-breakpoint +CREATE TABLE `notifications` ( + `id` text PRIMARY KEY, + `user_id` text NOT NULL, + `actor_id` text, + `actor_handle` text NOT NULL, + `actor_display_name` text, + `actor_avatar_url` text, + `actor_node_domain` text, + `target_handle` text, + `target_display_name` text, + `target_avatar_url` text, + `target_node_domain` text, + `target_is_bot` integer, + `post_id` text, + `post_content` text, + `type` text NOT NULL, + `read_at` integer, + `created_at` integer DEFAULT (unixepoch()) NOT NULL, + CONSTRAINT `fk_notifications_user_id_users_id_fk` FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON DELETE CASCADE, + CONSTRAINT `fk_notifications_actor_id_users_id_fk` FOREIGN KEY (`actor_id`) REFERENCES `users`(`id`) ON DELETE CASCADE, + CONSTRAINT `fk_notifications_post_id_posts_id_fk` FOREIGN KEY (`post_id`) REFERENCES `posts`(`id`) ON DELETE CASCADE +); +--> statement-breakpoint +CREATE TABLE `posts` ( + `id` text PRIMARY KEY, + `user_id` text NOT NULL, + `bot_id` text, + `content` text NOT NULL, + `reply_to_id` text, + `repost_of_id` text, + `swarm_reply_to_id` text, + `swarm_reply_to_content` text, + `swarm_reply_to_author` text, + `likes_count` integer DEFAULT 0 NOT NULL, + `reposts_count` integer DEFAULT 0 NOT NULL, + `replies_count` integer DEFAULT 0 NOT NULL, + `is_nsfw` integer DEFAULT false NOT NULL, + `is_removed` integer DEFAULT false NOT NULL, + `removed_at` integer, + `removed_by` text, + `removed_reason` text, + `ap_id` text UNIQUE, + `ap_url` text, + `link_preview_url` text, + `link_preview_title` text, + `link_preview_description` text, + `link_preview_image` text, + `link_preview_type` text, + `link_preview_video_url` text, + `link_preview_media_json` text, + `created_at` integer DEFAULT (unixepoch()) NOT NULL, + `updated_at` integer DEFAULT (unixepoch()) NOT NULL, + CONSTRAINT `fk_posts_user_id_users_id_fk` FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON DELETE CASCADE, + CONSTRAINT `fk_posts_bot_id_bots_id_fk` FOREIGN KEY (`bot_id`) REFERENCES `bots`(`id`) ON DELETE SET NULL, + CONSTRAINT `fk_posts_removed_by_users_id_fk` FOREIGN KEY (`removed_by`) REFERENCES `users`(`id`) +); +--> statement-breakpoint +CREATE TABLE `remote_followers` ( + `id` text PRIMARY KEY, + `user_id` text NOT NULL, + `actor_url` text NOT NULL, + `inbox_url` text NOT NULL, + `shared_inbox_url` text, + `handle` text, + `activity_id` text, + `created_at` integer DEFAULT (unixepoch()) NOT NULL, + CONSTRAINT `fk_remote_followers_user_id_users_id_fk` FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON DELETE CASCADE +); +--> statement-breakpoint +CREATE TABLE `remote_follows` ( + `id` text PRIMARY KEY, + `follower_id` text NOT NULL, + `target_handle` text NOT NULL, + `target_actor_url` text NOT NULL, + `inbox_url` text NOT NULL, + `activity_id` text NOT NULL, + `display_name` text, + `bio` text, + `avatar_url` text, + `created_at` integer DEFAULT (unixepoch()) NOT NULL, + CONSTRAINT `fk_remote_follows_follower_id_users_id_fk` FOREIGN KEY (`follower_id`) REFERENCES `users`(`id`) ON DELETE CASCADE +); +--> statement-breakpoint +CREATE TABLE `remote_identity_cache` ( + `did` text PRIMARY KEY, + `public_key` text NOT NULL, + `fetched_at` integer NOT NULL, + `expires_at` integer NOT NULL +); +--> statement-breakpoint +CREATE TABLE `remote_likes` ( + `id` text PRIMARY KEY, + `post_id` text NOT NULL, + `actor_handle` text NOT NULL, + `actor_node_domain` text NOT NULL, + `created_at` integer DEFAULT (unixepoch()) NOT NULL, + CONSTRAINT `fk_remote_likes_post_id_posts_id_fk` FOREIGN KEY (`post_id`) REFERENCES `posts`(`id`) ON DELETE CASCADE +); +--> statement-breakpoint +CREATE TABLE `remote_posts` ( + `id` text PRIMARY KEY, + `ap_id` text NOT NULL, + `author_handle` text NOT NULL, + `author_actor_url` text NOT NULL, + `author_display_name` text, + `author_avatar_url` text, + `content` text NOT NULL, + `published_at` integer NOT NULL, + `link_preview_url` text, + `link_preview_title` text, + `link_preview_description` text, + `link_preview_image` text, + `link_preview_type` text, + `link_preview_video_url` text, + `link_preview_media_json` text, + `media_json` text, + `fetched_at` integer DEFAULT (unixepoch()) NOT NULL, + `created_at` integer DEFAULT (unixepoch()) NOT NULL +); +--> statement-breakpoint +CREATE TABLE `remote_reposts` ( + `id` text PRIMARY KEY, + `post_id` text NOT NULL, + `actor_handle` text NOT NULL, + `actor_node_domain` text NOT NULL, + `created_at` integer DEFAULT (unixepoch()) NOT NULL, + CONSTRAINT `fk_remote_reposts_post_id_posts_id_fk` FOREIGN KEY (`post_id`) REFERENCES `posts`(`id`) ON DELETE CASCADE +); +--> statement-breakpoint +CREATE TABLE `reports` ( + `id` text PRIMARY KEY, + `reporter_id` text, + `target_type` text NOT NULL, + `target_id` text NOT NULL, + `reason` text NOT NULL, + `status` text DEFAULT 'open' NOT NULL, + `resolved_at` integer, + `resolved_by` text, + `resolution_note` text, + `created_at` integer DEFAULT (unixepoch()) NOT NULL, + CONSTRAINT `fk_reports_reporter_id_users_id_fk` FOREIGN KEY (`reporter_id`) REFERENCES `users`(`id`) ON DELETE SET NULL, + CONSTRAINT `fk_reports_resolved_by_users_id_fk` FOREIGN KEY (`resolved_by`) REFERENCES `users`(`id`) +); +--> statement-breakpoint +CREATE TABLE `sessions` ( + `id` text PRIMARY KEY, + `user_id` text NOT NULL, + `token` text NOT NULL, + `expires_at` integer NOT NULL, + `created_at` integer DEFAULT (unixepoch()) NOT NULL, + CONSTRAINT `fk_sessions_user_id_users_id_fk` FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON DELETE CASCADE +); +--> statement-breakpoint +CREATE TABLE `signed_action_dedupe` ( + `action_id` text PRIMARY KEY, + `did` text NOT NULL, + `nonce` text NOT NULL, + `ts` integer NOT NULL, + `created_at` integer DEFAULT (unixepoch()) NOT NULL +); +--> statement-breakpoint +CREATE TABLE `swarm_nodes` ( + `id` text PRIMARY KEY, + `domain` text NOT NULL, + `name` text, + `description` text, + `logo_url` text, + `public_key` text, + `software_version` text, + `user_count` integer, + `post_count` integer, + `is_nsfw` integer DEFAULT false NOT NULL, + `discovered_via` text, + `discovered_at` integer DEFAULT (unixepoch()) NOT NULL, + `last_seen_at` integer DEFAULT (unixepoch()) NOT NULL, + `last_sync_at` integer, + `consecutive_failures` integer DEFAULT 0 NOT NULL, + `is_active` integer DEFAULT true NOT NULL, + `trust_score` integer DEFAULT 50 NOT NULL, + `is_blocked` integer DEFAULT false NOT NULL, + `block_reason` text, + `blocked_at` integer, + `capabilities` text, + `created_at` integer DEFAULT (unixepoch()) NOT NULL, + `updated_at` integer DEFAULT (unixepoch()) NOT NULL +); +--> statement-breakpoint +CREATE TABLE `swarm_seeds` ( + `id` text PRIMARY KEY, + `domain` text NOT NULL UNIQUE, + `priority` integer DEFAULT 100 NOT NULL, + `is_enabled` integer DEFAULT true NOT NULL, + `last_contact_at` integer, + `consecutive_failures` integer DEFAULT 0 NOT NULL, + `created_at` integer DEFAULT (unixepoch()) NOT NULL +); +--> statement-breakpoint +CREATE TABLE `swarm_sync_log` ( + `id` text PRIMARY KEY, + `remote_domain` text NOT NULL, + `direction` text NOT NULL, + `nodes_received` integer DEFAULT 0 NOT NULL, + `nodes_sent` integer DEFAULT 0 NOT NULL, + `handles_received` integer DEFAULT 0 NOT NULL, + `handles_sent` integer DEFAULT 0 NOT NULL, + `success` integer NOT NULL, + `error_message` text, + `duration_ms` integer, + `created_at` integer DEFAULT (unixepoch()) NOT NULL +); +--> statement-breakpoint +CREATE TABLE `user_swarm_likes` ( + `id` text PRIMARY KEY, + `user_id` text NOT NULL, + `node_domain` text NOT NULL, + `original_post_id` text NOT NULL, + `author_handle` text NOT NULL, + `author_display_name` text, + `author_avatar_url` text, + `content` text NOT NULL, + `post_created_at` integer NOT NULL, + `likes_count` integer DEFAULT 0 NOT NULL, + `reposts_count` integer DEFAULT 0 NOT NULL, + `replies_count` integer DEFAULT 0 NOT NULL, + `link_preview_url` text, + `link_preview_title` text, + `link_preview_description` text, + `link_preview_image` text, + `link_preview_type` text, + `link_preview_video_url` text, + `link_preview_media_json` text, + `media_json` text, + `liked_at` integer DEFAULT (unixepoch()) NOT NULL, + CONSTRAINT `fk_user_swarm_likes_user_id_users_id_fk` FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON DELETE CASCADE +); +--> statement-breakpoint +CREATE TABLE `user_swarm_reposts` ( + `id` text PRIMARY KEY, + `user_id` text NOT NULL, + `node_domain` text NOT NULL, + `original_post_id` text NOT NULL, + `author_handle` text NOT NULL, + `author_display_name` text, + `author_avatar_url` text, + `content` text NOT NULL, + `post_created_at` integer NOT NULL, + `likes_count` integer DEFAULT 0 NOT NULL, + `reposts_count` integer DEFAULT 0 NOT NULL, + `replies_count` integer DEFAULT 0 NOT NULL, + `link_preview_url` text, + `link_preview_title` text, + `link_preview_description` text, + `link_preview_image` text, + `link_preview_type` text, + `link_preview_video_url` text, + `link_preview_media_json` text, + `media_json` text, + `reposted_at` integer DEFAULT (unixepoch()) NOT NULL, + CONSTRAINT `fk_user_swarm_reposts_user_id_users_id_fk` FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON DELETE CASCADE +); +--> statement-breakpoint +CREATE TABLE `users` ( + `id` text PRIMARY KEY, + `did` text NOT NULL, + `handle` text NOT NULL, + `email` text UNIQUE, + `password_hash` text, + `display_name` text, + `bio` text, + `avatar_url` text, + `header_url` text, + `private_key_encrypted` text, + `public_key` text NOT NULL, + `node_id` text, + `is_bot` integer DEFAULT false NOT NULL, + `bot_owner_id` text, + `is_nsfw` integer DEFAULT false NOT NULL, + `nsfw_enabled` integer DEFAULT false NOT NULL, + `age_verified_at` integer, + `is_suspended` integer DEFAULT false NOT NULL, + `suspension_reason` text, + `suspended_at` integer, + `is_silenced` integer DEFAULT false NOT NULL, + `silence_reason` text, + `silenced_at` integer, + `moved_to` text, + `moved_from` text, + `migrated_at` integer, + `storage_provider` text, + `storage_endpoint` text, + `storage_public_base_url` text, + `storage_region` text, + `storage_bucket` text, + `storage_access_key_encrypted` text, + `storage_secret_key_encrypted` text, + `followers_count` integer DEFAULT 0 NOT NULL, + `following_count` integer DEFAULT 0 NOT NULL, + `posts_count` integer DEFAULT 0 NOT NULL, + `website` text, + `dm_privacy` text DEFAULT 'everyone' NOT NULL, + `created_at` integer DEFAULT (unixepoch()) NOT NULL, + `updated_at` integer DEFAULT (unixepoch()) NOT NULL, + CONSTRAINT `fk_users_node_id_nodes_id_fk` FOREIGN KEY (`node_id`) REFERENCES `nodes`(`id`), + CONSTRAINT `users_bot_owner_id_users_id_fk` FOREIGN KEY (`bot_owner_id`) REFERENCES `users`(`id`) ON DELETE CASCADE +); +--> statement-breakpoint +CREATE INDEX `blocks_user_idx` ON `blocks` (`user_id`);--> statement-breakpoint +CREATE INDEX `blocks_blocked_user_idx` ON `blocks` (`blocked_user_id`);--> statement-breakpoint +CREATE INDEX `bot_activity_logs_bot_idx` ON `bot_activity_logs` (`bot_id`);--> statement-breakpoint +CREATE INDEX `bot_activity_logs_action_idx` ON `bot_activity_logs` (`action`);--> statement-breakpoint +CREATE INDEX `bot_activity_logs_created_idx` ON `bot_activity_logs` (`created_at`);--> statement-breakpoint +CREATE INDEX `bot_content_items_source_idx` ON `bot_content_items` (`source_id`);--> statement-breakpoint +CREATE INDEX `bot_content_items_processed_idx` ON `bot_content_items` (`is_processed`);--> statement-breakpoint +CREATE INDEX `bot_content_items_external_idx` ON `bot_content_items` (`external_id`);--> statement-breakpoint +CREATE INDEX `bot_content_sources_bot_idx` ON `bot_content_sources` (`bot_id`);--> statement-breakpoint +CREATE INDEX `bot_content_sources_type_idx` ON `bot_content_sources` (`type`);--> statement-breakpoint +CREATE INDEX `bot_mentions_bot_idx` ON `bot_mentions` (`bot_id`);--> statement-breakpoint +CREATE INDEX `bot_mentions_processed_idx` ON `bot_mentions` (`is_processed`);--> statement-breakpoint +CREATE INDEX `bot_mentions_created_idx` ON `bot_mentions` (`created_at`);--> statement-breakpoint +CREATE INDEX `bot_rate_limits_bot_window_idx` ON `bot_rate_limits` (`bot_id`,`window_start`);--> statement-breakpoint +CREATE INDEX `bots_user_id_idx` ON `bots` (`user_id`);--> statement-breakpoint +CREATE INDEX `bots_owner_id_idx` ON `bots` (`owner_id`);--> statement-breakpoint +CREATE INDEX `bots_active_idx` ON `bots` (`is_active`);--> statement-breakpoint +CREATE INDEX `chat_conversations_participant1_idx` ON `chat_conversations` (`participant1_id`);--> statement-breakpoint +CREATE INDEX `chat_conversations_last_message_idx` ON `chat_conversations` (`last_message_at`);--> statement-breakpoint +CREATE UNIQUE INDEX `chat_conversations_unique` ON `chat_conversations` (`participant1_id`,`participant2_handle`);--> statement-breakpoint +CREATE INDEX `chat_messages_conversation_idx` ON `chat_messages` (`conversation_id`);--> statement-breakpoint +CREATE INDEX `chat_messages_created_idx` ON `chat_messages` (`created_at`);--> statement-breakpoint +CREATE INDEX `chat_messages_swarm_id_idx` ON `chat_messages` (`swarm_message_id`);--> statement-breakpoint +CREATE INDEX `chat_typing_conversation_idx` ON `chat_typing_indicators` (`conversation_id`);--> statement-breakpoint +CREATE INDEX `chat_typing_expires_idx` ON `chat_typing_indicators` (`expires_at`);--> statement-breakpoint +CREATE UNIQUE INDEX `chat_typing_unique` ON `chat_typing_indicators` (`conversation_id`,`user_handle`);--> statement-breakpoint +CREATE INDEX `follows_follower_idx` ON `follows` (`follower_id`);--> statement-breakpoint +CREATE INDEX `follows_following_idx` ON `follows` (`following_id`);--> statement-breakpoint +CREATE INDEX `handle_registry_updated_idx` ON `handle_registry` (`updated_at`);--> statement-breakpoint +CREATE INDEX `likes_user_post_idx` ON `likes` (`user_id`,`post_id`);--> statement-breakpoint +CREATE INDEX `media_user_idx` ON `media` (`user_id`);--> statement-breakpoint +CREATE INDEX `media_post_idx` ON `media` (`post_id`);--> statement-breakpoint +CREATE INDEX `muted_nodes_user_idx` ON `muted_nodes` (`user_id`);--> statement-breakpoint +CREATE INDEX `muted_nodes_domain_idx` ON `muted_nodes` (`node_domain`);--> statement-breakpoint +CREATE INDEX `mutes_user_idx` ON `mutes` (`user_id`);--> statement-breakpoint +CREATE INDEX `mutes_muted_user_idx` ON `mutes` (`muted_user_id`);--> statement-breakpoint +CREATE INDEX `notifications_user_idx` ON `notifications` (`user_id`);--> statement-breakpoint +CREATE INDEX `notifications_created_idx` ON `notifications` (`created_at`);--> statement-breakpoint +CREATE INDEX `posts_user_id_idx` ON `posts` (`user_id`);--> statement-breakpoint +CREATE INDEX `posts_bot_id_idx` ON `posts` (`bot_id`);--> statement-breakpoint +CREATE INDEX `posts_created_at_idx` ON `posts` (`created_at`);--> statement-breakpoint +CREATE INDEX `posts_reply_to_idx` ON `posts` (`reply_to_id`);--> statement-breakpoint +CREATE INDEX `posts_removed_idx` ON `posts` (`is_removed`);--> statement-breakpoint +CREATE INDEX `posts_nsfw_idx` ON `posts` (`is_nsfw`);--> statement-breakpoint +CREATE INDEX `remote_followers_user_idx` ON `remote_followers` (`user_id`);--> statement-breakpoint +CREATE INDEX `remote_followers_actor_idx` ON `remote_followers` (`actor_url`);--> statement-breakpoint +CREATE UNIQUE INDEX `remote_followers_user_actor_unique` ON `remote_followers` (`user_id`,`actor_url`);--> statement-breakpoint +CREATE INDEX `remote_follows_follower_idx` ON `remote_follows` (`follower_id`);--> statement-breakpoint +CREATE INDEX `remote_follows_target_idx` ON `remote_follows` (`target_handle`);--> statement-breakpoint +CREATE INDEX `remote_likes_post_idx` ON `remote_likes` (`post_id`);--> statement-breakpoint +CREATE INDEX `remote_likes_actor_idx` ON `remote_likes` (`actor_handle`,`actor_node_domain`);--> statement-breakpoint +CREATE UNIQUE INDEX `remote_likes_unique` ON `remote_likes` (`post_id`,`actor_handle`,`actor_node_domain`);--> statement-breakpoint +CREATE INDEX `remote_posts_author_idx` ON `remote_posts` (`author_handle`);--> statement-breakpoint +CREATE INDEX `remote_posts_published_idx` ON `remote_posts` (`published_at`);--> statement-breakpoint +CREATE INDEX `remote_posts_ap_id_idx` ON `remote_posts` (`ap_id`);--> statement-breakpoint +CREATE INDEX `remote_reposts_post_idx` ON `remote_reposts` (`post_id`);--> statement-breakpoint +CREATE INDEX `remote_reposts_actor_idx` ON `remote_reposts` (`actor_handle`,`actor_node_domain`);--> statement-breakpoint +CREATE UNIQUE INDEX `remote_reposts_unique` ON `remote_reposts` (`post_id`,`actor_handle`,`actor_node_domain`);--> statement-breakpoint +CREATE INDEX `reports_status_idx` ON `reports` (`status`);--> statement-breakpoint +CREATE INDEX `reports_target_idx` ON `reports` (`target_type`,`target_id`);--> statement-breakpoint +CREATE INDEX `reports_reporter_idx` ON `reports` (`reporter_id`);--> statement-breakpoint +CREATE INDEX `sessions_token_idx` ON `sessions` (`token`);--> statement-breakpoint +CREATE INDEX `sessions_user_idx` ON `sessions` (`user_id`);--> statement-breakpoint +CREATE INDEX `signed_action_dedupe_created_idx` ON `signed_action_dedupe` (`created_at`);--> statement-breakpoint +CREATE INDEX `swarm_nodes_domain_idx` ON `swarm_nodes` (`domain`);--> statement-breakpoint +CREATE INDEX `swarm_nodes_active_idx` ON `swarm_nodes` (`is_active`);--> statement-breakpoint +CREATE INDEX `swarm_nodes_last_seen_idx` ON `swarm_nodes` (`last_seen_at`);--> statement-breakpoint +CREATE INDEX `swarm_nodes_trust_idx` ON `swarm_nodes` (`trust_score`);--> statement-breakpoint +CREATE INDEX `swarm_nodes_nsfw_idx` ON `swarm_nodes` (`is_nsfw`);--> statement-breakpoint +CREATE INDEX `swarm_nodes_blocked_idx` ON `swarm_nodes` (`is_blocked`);--> statement-breakpoint +CREATE INDEX `swarm_seeds_enabled_idx` ON `swarm_seeds` (`is_enabled`);--> statement-breakpoint +CREATE INDEX `swarm_seeds_priority_idx` ON `swarm_seeds` (`priority`);--> statement-breakpoint +CREATE INDEX `swarm_sync_log_remote_idx` ON `swarm_sync_log` (`remote_domain`);--> statement-breakpoint +CREATE INDEX `swarm_sync_log_created_idx` ON `swarm_sync_log` (`created_at`);--> statement-breakpoint +CREATE INDEX `user_swarm_likes_user_idx` ON `user_swarm_likes` (`user_id`,`liked_at`);--> statement-breakpoint +CREATE INDEX `user_swarm_likes_post_idx` ON `user_swarm_likes` (`node_domain`,`original_post_id`);--> statement-breakpoint +CREATE UNIQUE INDEX `user_swarm_likes_unique` ON `user_swarm_likes` (`user_id`,`node_domain`,`original_post_id`);--> statement-breakpoint +CREATE INDEX `user_swarm_reposts_user_idx` ON `user_swarm_reposts` (`user_id`,`reposted_at`);--> statement-breakpoint +CREATE INDEX `user_swarm_reposts_post_idx` ON `user_swarm_reposts` (`node_domain`,`original_post_id`);--> statement-breakpoint +CREATE UNIQUE INDEX `user_swarm_reposts_unique` ON `user_swarm_reposts` (`user_id`,`node_domain`,`original_post_id`);--> statement-breakpoint +CREATE INDEX `users_handle_idx` ON `users` (`handle`);--> statement-breakpoint +CREATE INDEX `users_did_idx` ON `users` (`did`);--> statement-breakpoint +CREATE INDEX `users_suspended_idx` ON `users` (`is_suspended`);--> statement-breakpoint +CREATE INDEX `users_silenced_idx` ON `users` (`is_silenced`);--> statement-breakpoint +CREATE INDEX `users_is_bot_idx` ON `users` (`is_bot`);--> statement-breakpoint +CREATE INDEX `users_bot_owner_idx` ON `users` (`bot_owner_id`);--> statement-breakpoint +CREATE INDEX `users_nsfw_idx` ON `users` (`is_nsfw`); \ No newline at end of file diff --git a/drizzle/20260714222942_pale_cardiac/snapshot.json b/drizzle/20260714222942_pale_cardiac/snapshot.json new file mode 100644 index 0000000..26086e0 --- /dev/null +++ b/drizzle/20260714222942_pale_cardiac/snapshot.json @@ -0,0 +1,6325 @@ +{ + "version": "7", + "dialect": "sqlite", + "id": "f7179b64-ec71-42e4-9b56-8c19657cea92", + "prevIds": [ + "00000000-0000-0000-0000-000000000000" + ], + "ddl": [ + { + "name": "blocks", + "entityType": "tables" + }, + { + "name": "bot_activity_logs", + "entityType": "tables" + }, + { + "name": "bot_content_items", + "entityType": "tables" + }, + { + "name": "bot_content_sources", + "entityType": "tables" + }, + { + "name": "bot_mentions", + "entityType": "tables" + }, + { + "name": "bot_rate_limits", + "entityType": "tables" + }, + { + "name": "bots", + "entityType": "tables" + }, + { + "name": "chat_conversations", + "entityType": "tables" + }, + { + "name": "chat_messages", + "entityType": "tables" + }, + { + "name": "chat_typing_indicators", + "entityType": "tables" + }, + { + "name": "follows", + "entityType": "tables" + }, + { + "name": "handle_registry", + "entityType": "tables" + }, + { + "name": "likes", + "entityType": "tables" + }, + { + "name": "media", + "entityType": "tables" + }, + { + "name": "muted_nodes", + "entityType": "tables" + }, + { + "name": "mutes", + "entityType": "tables" + }, + { + "name": "nodes", + "entityType": "tables" + }, + { + "name": "notifications", + "entityType": "tables" + }, + { + "name": "posts", + "entityType": "tables" + }, + { + "name": "remote_followers", + "entityType": "tables" + }, + { + "name": "remote_follows", + "entityType": "tables" + }, + { + "name": "remote_identity_cache", + "entityType": "tables" + }, + { + "name": "remote_likes", + "entityType": "tables" + }, + { + "name": "remote_posts", + "entityType": "tables" + }, + { + "name": "remote_reposts", + "entityType": "tables" + }, + { + "name": "reports", + "entityType": "tables" + }, + { + "name": "sessions", + "entityType": "tables" + }, + { + "name": "signed_action_dedupe", + "entityType": "tables" + }, + { + "name": "swarm_nodes", + "entityType": "tables" + }, + { + "name": "swarm_seeds", + "entityType": "tables" + }, + { + "name": "swarm_sync_log", + "entityType": "tables" + }, + { + "name": "user_swarm_likes", + "entityType": "tables" + }, + { + "name": "user_swarm_reposts", + "entityType": "tables" + }, + { + "name": "users", + "entityType": "tables" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "id", + "entityType": "columns", + "table": "blocks" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "user_id", + "entityType": "columns", + "table": "blocks" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "blocked_user_id", + "entityType": "columns", + "table": "blocks" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())", + "generated": null, + "name": "created_at", + "entityType": "columns", + "table": "blocks" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "id", + "entityType": "columns", + "table": "bot_activity_logs" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "bot_id", + "entityType": "columns", + "table": "bot_activity_logs" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "action", + "entityType": "columns", + "table": "bot_activity_logs" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "details", + "entityType": "columns", + "table": "bot_activity_logs" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "success", + "entityType": "columns", + "table": "bot_activity_logs" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "error_message", + "entityType": "columns", + "table": "bot_activity_logs" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())", + "generated": null, + "name": "created_at", + "entityType": "columns", + "table": "bot_activity_logs" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "id", + "entityType": "columns", + "table": "bot_content_items" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "source_id", + "entityType": "columns", + "table": "bot_content_items" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "external_id", + "entityType": "columns", + "table": "bot_content_items" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "title", + "entityType": "columns", + "table": "bot_content_items" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "content", + "entityType": "columns", + "table": "bot_content_items" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "url", + "entityType": "columns", + "table": "bot_content_items" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "published_at", + "entityType": "columns", + "table": "bot_content_items" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())", + "generated": null, + "name": "fetched_at", + "entityType": "columns", + "table": "bot_content_items" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "false", + "generated": null, + "name": "is_processed", + "entityType": "columns", + "table": "bot_content_items" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "processed_at", + "entityType": "columns", + "table": "bot_content_items" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "post_id", + "entityType": "columns", + "table": "bot_content_items" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "interest_score", + "entityType": "columns", + "table": "bot_content_items" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "interest_reason", + "entityType": "columns", + "table": "bot_content_items" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "id", + "entityType": "columns", + "table": "bot_content_sources" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "bot_id", + "entityType": "columns", + "table": "bot_content_sources" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "type", + "entityType": "columns", + "table": "bot_content_sources" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "url", + "entityType": "columns", + "table": "bot_content_sources" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "subreddit", + "entityType": "columns", + "table": "bot_content_sources" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "api_key_encrypted", + "entityType": "columns", + "table": "bot_content_sources" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "source_config", + "entityType": "columns", + "table": "bot_content_sources" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "keywords", + "entityType": "columns", + "table": "bot_content_sources" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "true", + "generated": null, + "name": "is_active", + "entityType": "columns", + "table": "bot_content_sources" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "last_fetch_at", + "entityType": "columns", + "table": "bot_content_sources" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "last_error", + "entityType": "columns", + "table": "bot_content_sources" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "0", + "generated": null, + "name": "consecutive_errors", + "entityType": "columns", + "table": "bot_content_sources" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())", + "generated": null, + "name": "created_at", + "entityType": "columns", + "table": "bot_content_sources" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())", + "generated": null, + "name": "updated_at", + "entityType": "columns", + "table": "bot_content_sources" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "id", + "entityType": "columns", + "table": "bot_mentions" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "bot_id", + "entityType": "columns", + "table": "bot_mentions" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "post_id", + "entityType": "columns", + "table": "bot_mentions" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "author_id", + "entityType": "columns", + "table": "bot_mentions" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "content", + "entityType": "columns", + "table": "bot_mentions" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "false", + "generated": null, + "name": "is_processed", + "entityType": "columns", + "table": "bot_mentions" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "processed_at", + "entityType": "columns", + "table": "bot_mentions" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "response_post_id", + "entityType": "columns", + "table": "bot_mentions" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "false", + "generated": null, + "name": "is_remote", + "entityType": "columns", + "table": "bot_mentions" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "remote_actor_url", + "entityType": "columns", + "table": "bot_mentions" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())", + "generated": null, + "name": "created_at", + "entityType": "columns", + "table": "bot_mentions" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "id", + "entityType": "columns", + "table": "bot_rate_limits" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "bot_id", + "entityType": "columns", + "table": "bot_rate_limits" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "window_start", + "entityType": "columns", + "table": "bot_rate_limits" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "window_type", + "entityType": "columns", + "table": "bot_rate_limits" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "0", + "generated": null, + "name": "post_count", + "entityType": "columns", + "table": "bot_rate_limits" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "0", + "generated": null, + "name": "reply_count", + "entityType": "columns", + "table": "bot_rate_limits" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())", + "generated": null, + "name": "created_at", + "entityType": "columns", + "table": "bot_rate_limits" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "id", + "entityType": "columns", + "table": "bots" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "user_id", + "entityType": "columns", + "table": "bots" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "owner_id", + "entityType": "columns", + "table": "bots" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "name", + "entityType": "columns", + "table": "bots" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "personality_config", + "entityType": "columns", + "table": "bots" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "llm_provider", + "entityType": "columns", + "table": "bots" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "llm_model", + "entityType": "columns", + "table": "bots" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "llm_endpoint", + "entityType": "columns", + "table": "bots" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "llm_api_key_encrypted", + "entityType": "columns", + "table": "bots" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "schedule_config", + "entityType": "columns", + "table": "bots" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "false", + "generated": null, + "name": "autonomous_mode", + "entityType": "columns", + "table": "bots" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "true", + "generated": null, + "name": "is_active", + "entityType": "columns", + "table": "bots" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "false", + "generated": null, + "name": "is_suspended", + "entityType": "columns", + "table": "bots" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "suspension_reason", + "entityType": "columns", + "table": "bots" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "suspended_at", + "entityType": "columns", + "table": "bots" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "last_post_at", + "entityType": "columns", + "table": "bots" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())", + "generated": null, + "name": "created_at", + "entityType": "columns", + "table": "bots" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())", + "generated": null, + "name": "updated_at", + "entityType": "columns", + "table": "bots" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "id", + "entityType": "columns", + "table": "chat_conversations" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": "'direct'", + "generated": null, + "name": "type", + "entityType": "columns", + "table": "chat_conversations" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "participant1_id", + "entityType": "columns", + "table": "chat_conversations" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "participant2_handle", + "entityType": "columns", + "table": "chat_conversations" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "last_message_at", + "entityType": "columns", + "table": "chat_conversations" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "last_message_preview", + "entityType": "columns", + "table": "chat_conversations" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())", + "generated": null, + "name": "created_at", + "entityType": "columns", + "table": "chat_conversations" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())", + "generated": null, + "name": "updated_at", + "entityType": "columns", + "table": "chat_conversations" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "id", + "entityType": "columns", + "table": "chat_messages" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "conversation_id", + "entityType": "columns", + "table": "chat_messages" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "sender_handle", + "entityType": "columns", + "table": "chat_messages" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "sender_display_name", + "entityType": "columns", + "table": "chat_messages" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "sender_avatar_url", + "entityType": "columns", + "table": "chat_messages" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "sender_node_domain", + "entityType": "columns", + "table": "chat_messages" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "sender_did", + "entityType": "columns", + "table": "chat_messages" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "content", + "entityType": "columns", + "table": "chat_messages" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "swarm_message_id", + "entityType": "columns", + "table": "chat_messages" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "delivered_at", + "entityType": "columns", + "table": "chat_messages" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "read_at", + "entityType": "columns", + "table": "chat_messages" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())", + "generated": null, + "name": "created_at", + "entityType": "columns", + "table": "chat_messages" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "id", + "entityType": "columns", + "table": "chat_typing_indicators" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "conversation_id", + "entityType": "columns", + "table": "chat_typing_indicators" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "user_handle", + "entityType": "columns", + "table": "chat_typing_indicators" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "expires_at", + "entityType": "columns", + "table": "chat_typing_indicators" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())", + "generated": null, + "name": "created_at", + "entityType": "columns", + "table": "chat_typing_indicators" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "id", + "entityType": "columns", + "table": "follows" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "follower_id", + "entityType": "columns", + "table": "follows" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "following_id", + "entityType": "columns", + "table": "follows" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "ap_id", + "entityType": "columns", + "table": "follows" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": "false", + "generated": null, + "name": "pending", + "entityType": "columns", + "table": "follows" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())", + "generated": null, + "name": "created_at", + "entityType": "columns", + "table": "follows" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "handle", + "entityType": "columns", + "table": "handle_registry" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "did", + "entityType": "columns", + "table": "handle_registry" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "node_domain", + "entityType": "columns", + "table": "handle_registry" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())", + "generated": null, + "name": "registered_at", + "entityType": "columns", + "table": "handle_registry" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())", + "generated": null, + "name": "updated_at", + "entityType": "columns", + "table": "handle_registry" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "id", + "entityType": "columns", + "table": "likes" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "user_id", + "entityType": "columns", + "table": "likes" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "post_id", + "entityType": "columns", + "table": "likes" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "ap_id", + "entityType": "columns", + "table": "likes" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())", + "generated": null, + "name": "created_at", + "entityType": "columns", + "table": "likes" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "id", + "entityType": "columns", + "table": "media" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "user_id", + "entityType": "columns", + "table": "media" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "post_id", + "entityType": "columns", + "table": "media" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "url", + "entityType": "columns", + "table": "media" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "alt_text", + "entityType": "columns", + "table": "media" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "mime_type", + "entityType": "columns", + "table": "media" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "width", + "entityType": "columns", + "table": "media" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "height", + "entityType": "columns", + "table": "media" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())", + "generated": null, + "name": "created_at", + "entityType": "columns", + "table": "media" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "id", + "entityType": "columns", + "table": "muted_nodes" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "user_id", + "entityType": "columns", + "table": "muted_nodes" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "node_domain", + "entityType": "columns", + "table": "muted_nodes" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())", + "generated": null, + "name": "created_at", + "entityType": "columns", + "table": "muted_nodes" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "id", + "entityType": "columns", + "table": "mutes" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "user_id", + "entityType": "columns", + "table": "mutes" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "muted_user_id", + "entityType": "columns", + "table": "mutes" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())", + "generated": null, + "name": "created_at", + "entityType": "columns", + "table": "mutes" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "id", + "entityType": "columns", + "table": "nodes" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "domain", + "entityType": "columns", + "table": "nodes" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "name", + "entityType": "columns", + "table": "nodes" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "description", + "entityType": "columns", + "table": "nodes" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "long_description", + "entityType": "columns", + "table": "nodes" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "rules", + "entityType": "columns", + "table": "nodes" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "banner_url", + "entityType": "columns", + "table": "nodes" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "logo_url", + "entityType": "columns", + "table": "nodes" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "favicon_url", + "entityType": "columns", + "table": "nodes" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "logo_data", + "entityType": "columns", + "table": "nodes" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "favicon_data", + "entityType": "columns", + "table": "nodes" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": "'#FFFFFF'", + "generated": null, + "name": "accent_color", + "entityType": "columns", + "table": "nodes" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "public_key", + "entityType": "columns", + "table": "nodes" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "private_key_encrypted", + "entityType": "columns", + "table": "nodes" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "false", + "generated": null, + "name": "is_nsfw", + "entityType": "columns", + "table": "nodes" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "turnstile_site_key", + "entityType": "columns", + "table": "nodes" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "turnstile_secret_key", + "entityType": "columns", + "table": "nodes" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())", + "generated": null, + "name": "created_at", + "entityType": "columns", + "table": "nodes" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())", + "generated": null, + "name": "updated_at", + "entityType": "columns", + "table": "nodes" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "id", + "entityType": "columns", + "table": "notifications" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "user_id", + "entityType": "columns", + "table": "notifications" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "actor_id", + "entityType": "columns", + "table": "notifications" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "actor_handle", + "entityType": "columns", + "table": "notifications" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "actor_display_name", + "entityType": "columns", + "table": "notifications" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "actor_avatar_url", + "entityType": "columns", + "table": "notifications" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "actor_node_domain", + "entityType": "columns", + "table": "notifications" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "target_handle", + "entityType": "columns", + "table": "notifications" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "target_display_name", + "entityType": "columns", + "table": "notifications" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "target_avatar_url", + "entityType": "columns", + "table": "notifications" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "target_node_domain", + "entityType": "columns", + "table": "notifications" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "target_is_bot", + "entityType": "columns", + "table": "notifications" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "post_id", + "entityType": "columns", + "table": "notifications" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "post_content", + "entityType": "columns", + "table": "notifications" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "type", + "entityType": "columns", + "table": "notifications" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "read_at", + "entityType": "columns", + "table": "notifications" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())", + "generated": null, + "name": "created_at", + "entityType": "columns", + "table": "notifications" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "id", + "entityType": "columns", + "table": "posts" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "user_id", + "entityType": "columns", + "table": "posts" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "bot_id", + "entityType": "columns", + "table": "posts" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "content", + "entityType": "columns", + "table": "posts" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "reply_to_id", + "entityType": "columns", + "table": "posts" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "repost_of_id", + "entityType": "columns", + "table": "posts" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "swarm_reply_to_id", + "entityType": "columns", + "table": "posts" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "swarm_reply_to_content", + "entityType": "columns", + "table": "posts" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "swarm_reply_to_author", + "entityType": "columns", + "table": "posts" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "0", + "generated": null, + "name": "likes_count", + "entityType": "columns", + "table": "posts" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "0", + "generated": null, + "name": "reposts_count", + "entityType": "columns", + "table": "posts" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "0", + "generated": null, + "name": "replies_count", + "entityType": "columns", + "table": "posts" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "false", + "generated": null, + "name": "is_nsfw", + "entityType": "columns", + "table": "posts" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "false", + "generated": null, + "name": "is_removed", + "entityType": "columns", + "table": "posts" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "removed_at", + "entityType": "columns", + "table": "posts" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "removed_by", + "entityType": "columns", + "table": "posts" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "removed_reason", + "entityType": "columns", + "table": "posts" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "ap_id", + "entityType": "columns", + "table": "posts" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "ap_url", + "entityType": "columns", + "table": "posts" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "link_preview_url", + "entityType": "columns", + "table": "posts" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "link_preview_title", + "entityType": "columns", + "table": "posts" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "link_preview_description", + "entityType": "columns", + "table": "posts" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "link_preview_image", + "entityType": "columns", + "table": "posts" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "link_preview_type", + "entityType": "columns", + "table": "posts" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "link_preview_video_url", + "entityType": "columns", + "table": "posts" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "link_preview_media_json", + "entityType": "columns", + "table": "posts" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())", + "generated": null, + "name": "created_at", + "entityType": "columns", + "table": "posts" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())", + "generated": null, + "name": "updated_at", + "entityType": "columns", + "table": "posts" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "id", + "entityType": "columns", + "table": "remote_followers" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "user_id", + "entityType": "columns", + "table": "remote_followers" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "actor_url", + "entityType": "columns", + "table": "remote_followers" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "inbox_url", + "entityType": "columns", + "table": "remote_followers" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "shared_inbox_url", + "entityType": "columns", + "table": "remote_followers" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "handle", + "entityType": "columns", + "table": "remote_followers" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "activity_id", + "entityType": "columns", + "table": "remote_followers" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())", + "generated": null, + "name": "created_at", + "entityType": "columns", + "table": "remote_followers" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "id", + "entityType": "columns", + "table": "remote_follows" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "follower_id", + "entityType": "columns", + "table": "remote_follows" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "target_handle", + "entityType": "columns", + "table": "remote_follows" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "target_actor_url", + "entityType": "columns", + "table": "remote_follows" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "inbox_url", + "entityType": "columns", + "table": "remote_follows" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "activity_id", + "entityType": "columns", + "table": "remote_follows" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "display_name", + "entityType": "columns", + "table": "remote_follows" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "bio", + "entityType": "columns", + "table": "remote_follows" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "avatar_url", + "entityType": "columns", + "table": "remote_follows" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())", + "generated": null, + "name": "created_at", + "entityType": "columns", + "table": "remote_follows" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "did", + "entityType": "columns", + "table": "remote_identity_cache" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "public_key", + "entityType": "columns", + "table": "remote_identity_cache" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "fetched_at", + "entityType": "columns", + "table": "remote_identity_cache" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "expires_at", + "entityType": "columns", + "table": "remote_identity_cache" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "id", + "entityType": "columns", + "table": "remote_likes" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "post_id", + "entityType": "columns", + "table": "remote_likes" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "actor_handle", + "entityType": "columns", + "table": "remote_likes" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "actor_node_domain", + "entityType": "columns", + "table": "remote_likes" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())", + "generated": null, + "name": "created_at", + "entityType": "columns", + "table": "remote_likes" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "id", + "entityType": "columns", + "table": "remote_posts" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "ap_id", + "entityType": "columns", + "table": "remote_posts" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "author_handle", + "entityType": "columns", + "table": "remote_posts" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "author_actor_url", + "entityType": "columns", + "table": "remote_posts" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "author_display_name", + "entityType": "columns", + "table": "remote_posts" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "author_avatar_url", + "entityType": "columns", + "table": "remote_posts" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "content", + "entityType": "columns", + "table": "remote_posts" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "published_at", + "entityType": "columns", + "table": "remote_posts" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "link_preview_url", + "entityType": "columns", + "table": "remote_posts" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "link_preview_title", + "entityType": "columns", + "table": "remote_posts" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "link_preview_description", + "entityType": "columns", + "table": "remote_posts" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "link_preview_image", + "entityType": "columns", + "table": "remote_posts" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "link_preview_type", + "entityType": "columns", + "table": "remote_posts" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "link_preview_video_url", + "entityType": "columns", + "table": "remote_posts" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "link_preview_media_json", + "entityType": "columns", + "table": "remote_posts" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "media_json", + "entityType": "columns", + "table": "remote_posts" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())", + "generated": null, + "name": "fetched_at", + "entityType": "columns", + "table": "remote_posts" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())", + "generated": null, + "name": "created_at", + "entityType": "columns", + "table": "remote_posts" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "id", + "entityType": "columns", + "table": "remote_reposts" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "post_id", + "entityType": "columns", + "table": "remote_reposts" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "actor_handle", + "entityType": "columns", + "table": "remote_reposts" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "actor_node_domain", + "entityType": "columns", + "table": "remote_reposts" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())", + "generated": null, + "name": "created_at", + "entityType": "columns", + "table": "remote_reposts" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "id", + "entityType": "columns", + "table": "reports" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "reporter_id", + "entityType": "columns", + "table": "reports" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "target_type", + "entityType": "columns", + "table": "reports" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "target_id", + "entityType": "columns", + "table": "reports" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "reason", + "entityType": "columns", + "table": "reports" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": "'open'", + "generated": null, + "name": "status", + "entityType": "columns", + "table": "reports" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "resolved_at", + "entityType": "columns", + "table": "reports" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "resolved_by", + "entityType": "columns", + "table": "reports" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "resolution_note", + "entityType": "columns", + "table": "reports" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())", + "generated": null, + "name": "created_at", + "entityType": "columns", + "table": "reports" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "id", + "entityType": "columns", + "table": "sessions" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "user_id", + "entityType": "columns", + "table": "sessions" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "token", + "entityType": "columns", + "table": "sessions" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "expires_at", + "entityType": "columns", + "table": "sessions" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())", + "generated": null, + "name": "created_at", + "entityType": "columns", + "table": "sessions" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "action_id", + "entityType": "columns", + "table": "signed_action_dedupe" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "did", + "entityType": "columns", + "table": "signed_action_dedupe" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "nonce", + "entityType": "columns", + "table": "signed_action_dedupe" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "ts", + "entityType": "columns", + "table": "signed_action_dedupe" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())", + "generated": null, + "name": "created_at", + "entityType": "columns", + "table": "signed_action_dedupe" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "id", + "entityType": "columns", + "table": "swarm_nodes" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "domain", + "entityType": "columns", + "table": "swarm_nodes" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "name", + "entityType": "columns", + "table": "swarm_nodes" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "description", + "entityType": "columns", + "table": "swarm_nodes" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "logo_url", + "entityType": "columns", + "table": "swarm_nodes" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "public_key", + "entityType": "columns", + "table": "swarm_nodes" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "software_version", + "entityType": "columns", + "table": "swarm_nodes" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "user_count", + "entityType": "columns", + "table": "swarm_nodes" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "post_count", + "entityType": "columns", + "table": "swarm_nodes" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "false", + "generated": null, + "name": "is_nsfw", + "entityType": "columns", + "table": "swarm_nodes" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "discovered_via", + "entityType": "columns", + "table": "swarm_nodes" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())", + "generated": null, + "name": "discovered_at", + "entityType": "columns", + "table": "swarm_nodes" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())", + "generated": null, + "name": "last_seen_at", + "entityType": "columns", + "table": "swarm_nodes" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "last_sync_at", + "entityType": "columns", + "table": "swarm_nodes" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "0", + "generated": null, + "name": "consecutive_failures", + "entityType": "columns", + "table": "swarm_nodes" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "true", + "generated": null, + "name": "is_active", + "entityType": "columns", + "table": "swarm_nodes" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "50", + "generated": null, + "name": "trust_score", + "entityType": "columns", + "table": "swarm_nodes" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "false", + "generated": null, + "name": "is_blocked", + "entityType": "columns", + "table": "swarm_nodes" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "block_reason", + "entityType": "columns", + "table": "swarm_nodes" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "blocked_at", + "entityType": "columns", + "table": "swarm_nodes" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "capabilities", + "entityType": "columns", + "table": "swarm_nodes" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())", + "generated": null, + "name": "created_at", + "entityType": "columns", + "table": "swarm_nodes" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())", + "generated": null, + "name": "updated_at", + "entityType": "columns", + "table": "swarm_nodes" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "id", + "entityType": "columns", + "table": "swarm_seeds" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "domain", + "entityType": "columns", + "table": "swarm_seeds" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "100", + "generated": null, + "name": "priority", + "entityType": "columns", + "table": "swarm_seeds" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "true", + "generated": null, + "name": "is_enabled", + "entityType": "columns", + "table": "swarm_seeds" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "last_contact_at", + "entityType": "columns", + "table": "swarm_seeds" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "0", + "generated": null, + "name": "consecutive_failures", + "entityType": "columns", + "table": "swarm_seeds" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())", + "generated": null, + "name": "created_at", + "entityType": "columns", + "table": "swarm_seeds" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "id", + "entityType": "columns", + "table": "swarm_sync_log" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "remote_domain", + "entityType": "columns", + "table": "swarm_sync_log" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "direction", + "entityType": "columns", + "table": "swarm_sync_log" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "0", + "generated": null, + "name": "nodes_received", + "entityType": "columns", + "table": "swarm_sync_log" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "0", + "generated": null, + "name": "nodes_sent", + "entityType": "columns", + "table": "swarm_sync_log" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "0", + "generated": null, + "name": "handles_received", + "entityType": "columns", + "table": "swarm_sync_log" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "0", + "generated": null, + "name": "handles_sent", + "entityType": "columns", + "table": "swarm_sync_log" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "success", + "entityType": "columns", + "table": "swarm_sync_log" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "error_message", + "entityType": "columns", + "table": "swarm_sync_log" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "duration_ms", + "entityType": "columns", + "table": "swarm_sync_log" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())", + "generated": null, + "name": "created_at", + "entityType": "columns", + "table": "swarm_sync_log" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "id", + "entityType": "columns", + "table": "user_swarm_likes" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "user_id", + "entityType": "columns", + "table": "user_swarm_likes" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "node_domain", + "entityType": "columns", + "table": "user_swarm_likes" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "original_post_id", + "entityType": "columns", + "table": "user_swarm_likes" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "author_handle", + "entityType": "columns", + "table": "user_swarm_likes" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "author_display_name", + "entityType": "columns", + "table": "user_swarm_likes" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "author_avatar_url", + "entityType": "columns", + "table": "user_swarm_likes" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "content", + "entityType": "columns", + "table": "user_swarm_likes" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "post_created_at", + "entityType": "columns", + "table": "user_swarm_likes" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "0", + "generated": null, + "name": "likes_count", + "entityType": "columns", + "table": "user_swarm_likes" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "0", + "generated": null, + "name": "reposts_count", + "entityType": "columns", + "table": "user_swarm_likes" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "0", + "generated": null, + "name": "replies_count", + "entityType": "columns", + "table": "user_swarm_likes" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "link_preview_url", + "entityType": "columns", + "table": "user_swarm_likes" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "link_preview_title", + "entityType": "columns", + "table": "user_swarm_likes" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "link_preview_description", + "entityType": "columns", + "table": "user_swarm_likes" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "link_preview_image", + "entityType": "columns", + "table": "user_swarm_likes" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "link_preview_type", + "entityType": "columns", + "table": "user_swarm_likes" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "link_preview_video_url", + "entityType": "columns", + "table": "user_swarm_likes" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "link_preview_media_json", + "entityType": "columns", + "table": "user_swarm_likes" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "media_json", + "entityType": "columns", + "table": "user_swarm_likes" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())", + "generated": null, + "name": "liked_at", + "entityType": "columns", + "table": "user_swarm_likes" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "id", + "entityType": "columns", + "table": "user_swarm_reposts" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "user_id", + "entityType": "columns", + "table": "user_swarm_reposts" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "node_domain", + "entityType": "columns", + "table": "user_swarm_reposts" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "original_post_id", + "entityType": "columns", + "table": "user_swarm_reposts" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "author_handle", + "entityType": "columns", + "table": "user_swarm_reposts" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "author_display_name", + "entityType": "columns", + "table": "user_swarm_reposts" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "author_avatar_url", + "entityType": "columns", + "table": "user_swarm_reposts" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "content", + "entityType": "columns", + "table": "user_swarm_reposts" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "post_created_at", + "entityType": "columns", + "table": "user_swarm_reposts" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "0", + "generated": null, + "name": "likes_count", + "entityType": "columns", + "table": "user_swarm_reposts" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "0", + "generated": null, + "name": "reposts_count", + "entityType": "columns", + "table": "user_swarm_reposts" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "0", + "generated": null, + "name": "replies_count", + "entityType": "columns", + "table": "user_swarm_reposts" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "link_preview_url", + "entityType": "columns", + "table": "user_swarm_reposts" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "link_preview_title", + "entityType": "columns", + "table": "user_swarm_reposts" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "link_preview_description", + "entityType": "columns", + "table": "user_swarm_reposts" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "link_preview_image", + "entityType": "columns", + "table": "user_swarm_reposts" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "link_preview_type", + "entityType": "columns", + "table": "user_swarm_reposts" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "link_preview_video_url", + "entityType": "columns", + "table": "user_swarm_reposts" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "link_preview_media_json", + "entityType": "columns", + "table": "user_swarm_reposts" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "media_json", + "entityType": "columns", + "table": "user_swarm_reposts" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())", + "generated": null, + "name": "reposted_at", + "entityType": "columns", + "table": "user_swarm_reposts" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "id", + "entityType": "columns", + "table": "users" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "did", + "entityType": "columns", + "table": "users" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "handle", + "entityType": "columns", + "table": "users" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "email", + "entityType": "columns", + "table": "users" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "password_hash", + "entityType": "columns", + "table": "users" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "display_name", + "entityType": "columns", + "table": "users" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "bio", + "entityType": "columns", + "table": "users" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "avatar_url", + "entityType": "columns", + "table": "users" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "header_url", + "entityType": "columns", + "table": "users" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "private_key_encrypted", + "entityType": "columns", + "table": "users" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "public_key", + "entityType": "columns", + "table": "users" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "node_id", + "entityType": "columns", + "table": "users" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "false", + "generated": null, + "name": "is_bot", + "entityType": "columns", + "table": "users" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "bot_owner_id", + "entityType": "columns", + "table": "users" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "false", + "generated": null, + "name": "is_nsfw", + "entityType": "columns", + "table": "users" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "false", + "generated": null, + "name": "nsfw_enabled", + "entityType": "columns", + "table": "users" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "age_verified_at", + "entityType": "columns", + "table": "users" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "false", + "generated": null, + "name": "is_suspended", + "entityType": "columns", + "table": "users" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "suspension_reason", + "entityType": "columns", + "table": "users" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "suspended_at", + "entityType": "columns", + "table": "users" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "false", + "generated": null, + "name": "is_silenced", + "entityType": "columns", + "table": "users" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "silence_reason", + "entityType": "columns", + "table": "users" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "silenced_at", + "entityType": "columns", + "table": "users" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "moved_to", + "entityType": "columns", + "table": "users" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "moved_from", + "entityType": "columns", + "table": "users" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "migrated_at", + "entityType": "columns", + "table": "users" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "storage_provider", + "entityType": "columns", + "table": "users" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "storage_endpoint", + "entityType": "columns", + "table": "users" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "storage_public_base_url", + "entityType": "columns", + "table": "users" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "storage_region", + "entityType": "columns", + "table": "users" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "storage_bucket", + "entityType": "columns", + "table": "users" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "storage_access_key_encrypted", + "entityType": "columns", + "table": "users" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "storage_secret_key_encrypted", + "entityType": "columns", + "table": "users" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "0", + "generated": null, + "name": "followers_count", + "entityType": "columns", + "table": "users" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "0", + "generated": null, + "name": "following_count", + "entityType": "columns", + "table": "users" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "0", + "generated": null, + "name": "posts_count", + "entityType": "columns", + "table": "users" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "website", + "entityType": "columns", + "table": "users" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": "'everyone'", + "generated": null, + "name": "dm_privacy", + "entityType": "columns", + "table": "users" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())", + "generated": null, + "name": "created_at", + "entityType": "columns", + "table": "users" + }, + { + "type": "integer", + "notNull": true, + "autoincrement": false, + "default": "(unixepoch())", + "generated": null, + "name": "updated_at", + "entityType": "columns", + "table": "users" + }, + { + "columns": [ + "user_id" + ], + "tableTo": "users", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "nameExplicit": false, + "name": "fk_blocks_user_id_users_id_fk", + "entityType": "fks", + "table": "blocks" + }, + { + "columns": [ + "blocked_user_id" + ], + "tableTo": "users", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "nameExplicit": false, + "name": "fk_blocks_blocked_user_id_users_id_fk", + "entityType": "fks", + "table": "blocks" + }, + { + "columns": [ + "bot_id" + ], + "tableTo": "bots", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "nameExplicit": false, + "name": "fk_bot_activity_logs_bot_id_bots_id_fk", + "entityType": "fks", + "table": "bot_activity_logs" + }, + { + "columns": [ + "source_id" + ], + "tableTo": "bot_content_sources", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "nameExplicit": false, + "name": "fk_bot_content_items_source_id_bot_content_sources_id_fk", + "entityType": "fks", + "table": "bot_content_items" + }, + { + "columns": [ + "post_id" + ], + "tableTo": "posts", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "SET NULL", + "nameExplicit": false, + "name": "fk_bot_content_items_post_id_posts_id_fk", + "entityType": "fks", + "table": "bot_content_items" + }, + { + "columns": [ + "bot_id" + ], + "tableTo": "bots", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "nameExplicit": false, + "name": "fk_bot_content_sources_bot_id_bots_id_fk", + "entityType": "fks", + "table": "bot_content_sources" + }, + { + "columns": [ + "bot_id" + ], + "tableTo": "bots", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "nameExplicit": false, + "name": "fk_bot_mentions_bot_id_bots_id_fk", + "entityType": "fks", + "table": "bot_mentions" + }, + { + "columns": [ + "post_id" + ], + "tableTo": "posts", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "nameExplicit": false, + "name": "fk_bot_mentions_post_id_posts_id_fk", + "entityType": "fks", + "table": "bot_mentions" + }, + { + "columns": [ + "author_id" + ], + "tableTo": "users", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "NO ACTION", + "nameExplicit": false, + "name": "fk_bot_mentions_author_id_users_id_fk", + "entityType": "fks", + "table": "bot_mentions" + }, + { + "columns": [ + "response_post_id" + ], + "tableTo": "posts", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "NO ACTION", + "nameExplicit": false, + "name": "fk_bot_mentions_response_post_id_posts_id_fk", + "entityType": "fks", + "table": "bot_mentions" + }, + { + "columns": [ + "bot_id" + ], + "tableTo": "bots", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "nameExplicit": false, + "name": "fk_bot_rate_limits_bot_id_bots_id_fk", + "entityType": "fks", + "table": "bot_rate_limits" + }, + { + "columns": [ + "user_id" + ], + "tableTo": "users", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "nameExplicit": false, + "name": "fk_bots_user_id_users_id_fk", + "entityType": "fks", + "table": "bots" + }, + { + "columns": [ + "owner_id" + ], + "tableTo": "users", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "nameExplicit": false, + "name": "fk_bots_owner_id_users_id_fk", + "entityType": "fks", + "table": "bots" + }, + { + "columns": [ + "participant1_id" + ], + "tableTo": "users", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "nameExplicit": false, + "name": "fk_chat_conversations_participant1_id_users_id_fk", + "entityType": "fks", + "table": "chat_conversations" + }, + { + "columns": [ + "conversation_id" + ], + "tableTo": "chat_conversations", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "nameExplicit": false, + "name": "fk_chat_messages_conversation_id_chat_conversations_id_fk", + "entityType": "fks", + "table": "chat_messages" + }, + { + "columns": [ + "conversation_id" + ], + "tableTo": "chat_conversations", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "nameExplicit": false, + "name": "fk_chat_typing_indicators_conversation_id_chat_conversations_id_fk", + "entityType": "fks", + "table": "chat_typing_indicators" + }, + { + "columns": [ + "follower_id" + ], + "tableTo": "users", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "nameExplicit": false, + "name": "fk_follows_follower_id_users_id_fk", + "entityType": "fks", + "table": "follows" + }, + { + "columns": [ + "following_id" + ], + "tableTo": "users", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "nameExplicit": false, + "name": "fk_follows_following_id_users_id_fk", + "entityType": "fks", + "table": "follows" + }, + { + "columns": [ + "user_id" + ], + "tableTo": "users", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "nameExplicit": false, + "name": "fk_likes_user_id_users_id_fk", + "entityType": "fks", + "table": "likes" + }, + { + "columns": [ + "post_id" + ], + "tableTo": "posts", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "nameExplicit": false, + "name": "fk_likes_post_id_posts_id_fk", + "entityType": "fks", + "table": "likes" + }, + { + "columns": [ + "user_id" + ], + "tableTo": "users", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "nameExplicit": false, + "name": "fk_media_user_id_users_id_fk", + "entityType": "fks", + "table": "media" + }, + { + "columns": [ + "post_id" + ], + "tableTo": "posts", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "nameExplicit": false, + "name": "fk_media_post_id_posts_id_fk", + "entityType": "fks", + "table": "media" + }, + { + "columns": [ + "user_id" + ], + "tableTo": "users", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "nameExplicit": false, + "name": "fk_muted_nodes_user_id_users_id_fk", + "entityType": "fks", + "table": "muted_nodes" + }, + { + "columns": [ + "user_id" + ], + "tableTo": "users", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "nameExplicit": false, + "name": "fk_mutes_user_id_users_id_fk", + "entityType": "fks", + "table": "mutes" + }, + { + "columns": [ + "muted_user_id" + ], + "tableTo": "users", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "nameExplicit": false, + "name": "fk_mutes_muted_user_id_users_id_fk", + "entityType": "fks", + "table": "mutes" + }, + { + "columns": [ + "user_id" + ], + "tableTo": "users", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "nameExplicit": false, + "name": "fk_notifications_user_id_users_id_fk", + "entityType": "fks", + "table": "notifications" + }, + { + "columns": [ + "actor_id" + ], + "tableTo": "users", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "nameExplicit": false, + "name": "fk_notifications_actor_id_users_id_fk", + "entityType": "fks", + "table": "notifications" + }, + { + "columns": [ + "post_id" + ], + "tableTo": "posts", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "nameExplicit": false, + "name": "fk_notifications_post_id_posts_id_fk", + "entityType": "fks", + "table": "notifications" + }, + { + "columns": [ + "user_id" + ], + "tableTo": "users", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "nameExplicit": false, + "name": "fk_posts_user_id_users_id_fk", + "entityType": "fks", + "table": "posts" + }, + { + "columns": [ + "bot_id" + ], + "tableTo": "bots", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "SET NULL", + "nameExplicit": false, + "name": "fk_posts_bot_id_bots_id_fk", + "entityType": "fks", + "table": "posts" + }, + { + "columns": [ + "removed_by" + ], + "tableTo": "users", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "NO ACTION", + "nameExplicit": false, + "name": "fk_posts_removed_by_users_id_fk", + "entityType": "fks", + "table": "posts" + }, + { + "columns": [ + "user_id" + ], + "tableTo": "users", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "nameExplicit": false, + "name": "fk_remote_followers_user_id_users_id_fk", + "entityType": "fks", + "table": "remote_followers" + }, + { + "columns": [ + "follower_id" + ], + "tableTo": "users", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "nameExplicit": false, + "name": "fk_remote_follows_follower_id_users_id_fk", + "entityType": "fks", + "table": "remote_follows" + }, + { + "columns": [ + "post_id" + ], + "tableTo": "posts", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "nameExplicit": false, + "name": "fk_remote_likes_post_id_posts_id_fk", + "entityType": "fks", + "table": "remote_likes" + }, + { + "columns": [ + "post_id" + ], + "tableTo": "posts", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "nameExplicit": false, + "name": "fk_remote_reposts_post_id_posts_id_fk", + "entityType": "fks", + "table": "remote_reposts" + }, + { + "columns": [ + "reporter_id" + ], + "tableTo": "users", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "SET NULL", + "nameExplicit": false, + "name": "fk_reports_reporter_id_users_id_fk", + "entityType": "fks", + "table": "reports" + }, + { + "columns": [ + "resolved_by" + ], + "tableTo": "users", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "NO ACTION", + "nameExplicit": false, + "name": "fk_reports_resolved_by_users_id_fk", + "entityType": "fks", + "table": "reports" + }, + { + "columns": [ + "user_id" + ], + "tableTo": "users", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "nameExplicit": false, + "name": "fk_sessions_user_id_users_id_fk", + "entityType": "fks", + "table": "sessions" + }, + { + "columns": [ + "user_id" + ], + "tableTo": "users", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "nameExplicit": false, + "name": "fk_user_swarm_likes_user_id_users_id_fk", + "entityType": "fks", + "table": "user_swarm_likes" + }, + { + "columns": [ + "user_id" + ], + "tableTo": "users", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "nameExplicit": false, + "name": "fk_user_swarm_reposts_user_id_users_id_fk", + "entityType": "fks", + "table": "user_swarm_reposts" + }, + { + "columns": [ + "node_id" + ], + "tableTo": "nodes", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "NO ACTION", + "nameExplicit": false, + "name": "fk_users_node_id_nodes_id_fk", + "entityType": "fks", + "table": "users" + }, + { + "columns": [ + "bot_owner_id" + ], + "tableTo": "users", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "nameExplicit": true, + "name": "users_bot_owner_id_users_id_fk", + "entityType": "fks", + "table": "users" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "blocks_pk", + "table": "blocks", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "bot_activity_logs_pk", + "table": "bot_activity_logs", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "bot_content_items_pk", + "table": "bot_content_items", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "bot_content_sources_pk", + "table": "bot_content_sources", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "bot_mentions_pk", + "table": "bot_mentions", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "bot_rate_limits_pk", + "table": "bot_rate_limits", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "bots_pk", + "table": "bots", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "chat_conversations_pk", + "table": "chat_conversations", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "chat_messages_pk", + "table": "chat_messages", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "chat_typing_indicators_pk", + "table": "chat_typing_indicators", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "follows_pk", + "table": "follows", + "entityType": "pks" + }, + { + "columns": [ + "handle" + ], + "nameExplicit": false, + "name": "handle_registry_pk", + "table": "handle_registry", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "likes_pk", + "table": "likes", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "media_pk", + "table": "media", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "muted_nodes_pk", + "table": "muted_nodes", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "mutes_pk", + "table": "mutes", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "nodes_pk", + "table": "nodes", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "notifications_pk", + "table": "notifications", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "posts_pk", + "table": "posts", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "remote_followers_pk", + "table": "remote_followers", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "remote_follows_pk", + "table": "remote_follows", + "entityType": "pks" + }, + { + "columns": [ + "did" + ], + "nameExplicit": false, + "name": "remote_identity_cache_pk", + "table": "remote_identity_cache", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "remote_likes_pk", + "table": "remote_likes", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "remote_posts_pk", + "table": "remote_posts", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "remote_reposts_pk", + "table": "remote_reposts", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "reports_pk", + "table": "reports", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "sessions_pk", + "table": "sessions", + "entityType": "pks" + }, + { + "columns": [ + "action_id" + ], + "nameExplicit": false, + "name": "signed_action_dedupe_pk", + "table": "signed_action_dedupe", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "swarm_nodes_pk", + "table": "swarm_nodes", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "swarm_seeds_pk", + "table": "swarm_seeds", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "swarm_sync_log_pk", + "table": "swarm_sync_log", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "user_swarm_likes_pk", + "table": "user_swarm_likes", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "user_swarm_reposts_pk", + "table": "user_swarm_reposts", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "users_pk", + "table": "users", + "entityType": "pks" + }, + { + "columns": [ + { + "value": "user_id", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "blocks_user_idx", + "entityType": "indexes", + "table": "blocks" + }, + { + "columns": [ + { + "value": "blocked_user_id", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "blocks_blocked_user_idx", + "entityType": "indexes", + "table": "blocks" + }, + { + "columns": [ + { + "value": "bot_id", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "bot_activity_logs_bot_idx", + "entityType": "indexes", + "table": "bot_activity_logs" + }, + { + "columns": [ + { + "value": "action", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "bot_activity_logs_action_idx", + "entityType": "indexes", + "table": "bot_activity_logs" + }, + { + "columns": [ + { + "value": "created_at", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "bot_activity_logs_created_idx", + "entityType": "indexes", + "table": "bot_activity_logs" + }, + { + "columns": [ + { + "value": "source_id", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "bot_content_items_source_idx", + "entityType": "indexes", + "table": "bot_content_items" + }, + { + "columns": [ + { + "value": "is_processed", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "bot_content_items_processed_idx", + "entityType": "indexes", + "table": "bot_content_items" + }, + { + "columns": [ + { + "value": "external_id", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "bot_content_items_external_idx", + "entityType": "indexes", + "table": "bot_content_items" + }, + { + "columns": [ + { + "value": "bot_id", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "bot_content_sources_bot_idx", + "entityType": "indexes", + "table": "bot_content_sources" + }, + { + "columns": [ + { + "value": "type", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "bot_content_sources_type_idx", + "entityType": "indexes", + "table": "bot_content_sources" + }, + { + "columns": [ + { + "value": "bot_id", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "bot_mentions_bot_idx", + "entityType": "indexes", + "table": "bot_mentions" + }, + { + "columns": [ + { + "value": "is_processed", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "bot_mentions_processed_idx", + "entityType": "indexes", + "table": "bot_mentions" + }, + { + "columns": [ + { + "value": "created_at", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "bot_mentions_created_idx", + "entityType": "indexes", + "table": "bot_mentions" + }, + { + "columns": [ + { + "value": "bot_id", + "isExpression": false + }, + { + "value": "window_start", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "bot_rate_limits_bot_window_idx", + "entityType": "indexes", + "table": "bot_rate_limits" + }, + { + "columns": [ + { + "value": "user_id", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "bots_user_id_idx", + "entityType": "indexes", + "table": "bots" + }, + { + "columns": [ + { + "value": "owner_id", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "bots_owner_id_idx", + "entityType": "indexes", + "table": "bots" + }, + { + "columns": [ + { + "value": "is_active", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "bots_active_idx", + "entityType": "indexes", + "table": "bots" + }, + { + "columns": [ + { + "value": "participant1_id", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "chat_conversations_participant1_idx", + "entityType": "indexes", + "table": "chat_conversations" + }, + { + "columns": [ + { + "value": "last_message_at", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "chat_conversations_last_message_idx", + "entityType": "indexes", + "table": "chat_conversations" + }, + { + "columns": [ + { + "value": "participant1_id", + "isExpression": false + }, + { + "value": "participant2_handle", + "isExpression": false + } + ], + "isUnique": true, + "where": null, + "origin": "manual", + "name": "chat_conversations_unique", + "entityType": "indexes", + "table": "chat_conversations" + }, + { + "columns": [ + { + "value": "conversation_id", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "chat_messages_conversation_idx", + "entityType": "indexes", + "table": "chat_messages" + }, + { + "columns": [ + { + "value": "created_at", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "chat_messages_created_idx", + "entityType": "indexes", + "table": "chat_messages" + }, + { + "columns": [ + { + "value": "swarm_message_id", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "chat_messages_swarm_id_idx", + "entityType": "indexes", + "table": "chat_messages" + }, + { + "columns": [ + { + "value": "conversation_id", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "chat_typing_conversation_idx", + "entityType": "indexes", + "table": "chat_typing_indicators" + }, + { + "columns": [ + { + "value": "expires_at", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "chat_typing_expires_idx", + "entityType": "indexes", + "table": "chat_typing_indicators" + }, + { + "columns": [ + { + "value": "conversation_id", + "isExpression": false + }, + { + "value": "user_handle", + "isExpression": false + } + ], + "isUnique": true, + "where": null, + "origin": "manual", + "name": "chat_typing_unique", + "entityType": "indexes", + "table": "chat_typing_indicators" + }, + { + "columns": [ + { + "value": "follower_id", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "follows_follower_idx", + "entityType": "indexes", + "table": "follows" + }, + { + "columns": [ + { + "value": "following_id", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "follows_following_idx", + "entityType": "indexes", + "table": "follows" + }, + { + "columns": [ + { + "value": "updated_at", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "handle_registry_updated_idx", + "entityType": "indexes", + "table": "handle_registry" + }, + { + "columns": [ + { + "value": "user_id", + "isExpression": false + }, + { + "value": "post_id", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "likes_user_post_idx", + "entityType": "indexes", + "table": "likes" + }, + { + "columns": [ + { + "value": "user_id", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "media_user_idx", + "entityType": "indexes", + "table": "media" + }, + { + "columns": [ + { + "value": "post_id", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "media_post_idx", + "entityType": "indexes", + "table": "media" + }, + { + "columns": [ + { + "value": "user_id", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "muted_nodes_user_idx", + "entityType": "indexes", + "table": "muted_nodes" + }, + { + "columns": [ + { + "value": "node_domain", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "muted_nodes_domain_idx", + "entityType": "indexes", + "table": "muted_nodes" + }, + { + "columns": [ + { + "value": "user_id", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "mutes_user_idx", + "entityType": "indexes", + "table": "mutes" + }, + { + "columns": [ + { + "value": "muted_user_id", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "mutes_muted_user_idx", + "entityType": "indexes", + "table": "mutes" + }, + { + "columns": [ + { + "value": "user_id", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "notifications_user_idx", + "entityType": "indexes", + "table": "notifications" + }, + { + "columns": [ + { + "value": "created_at", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "notifications_created_idx", + "entityType": "indexes", + "table": "notifications" + }, + { + "columns": [ + { + "value": "user_id", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "posts_user_id_idx", + "entityType": "indexes", + "table": "posts" + }, + { + "columns": [ + { + "value": "bot_id", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "posts_bot_id_idx", + "entityType": "indexes", + "table": "posts" + }, + { + "columns": [ + { + "value": "created_at", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "posts_created_at_idx", + "entityType": "indexes", + "table": "posts" + }, + { + "columns": [ + { + "value": "reply_to_id", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "posts_reply_to_idx", + "entityType": "indexes", + "table": "posts" + }, + { + "columns": [ + { + "value": "is_removed", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "posts_removed_idx", + "entityType": "indexes", + "table": "posts" + }, + { + "columns": [ + { + "value": "is_nsfw", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "posts_nsfw_idx", + "entityType": "indexes", + "table": "posts" + }, + { + "columns": [ + { + "value": "user_id", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "remote_followers_user_idx", + "entityType": "indexes", + "table": "remote_followers" + }, + { + "columns": [ + { + "value": "actor_url", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "remote_followers_actor_idx", + "entityType": "indexes", + "table": "remote_followers" + }, + { + "columns": [ + { + "value": "user_id", + "isExpression": false + }, + { + "value": "actor_url", + "isExpression": false + } + ], + "isUnique": true, + "where": null, + "origin": "manual", + "name": "remote_followers_user_actor_unique", + "entityType": "indexes", + "table": "remote_followers" + }, + { + "columns": [ + { + "value": "follower_id", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "remote_follows_follower_idx", + "entityType": "indexes", + "table": "remote_follows" + }, + { + "columns": [ + { + "value": "target_handle", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "remote_follows_target_idx", + "entityType": "indexes", + "table": "remote_follows" + }, + { + "columns": [ + { + "value": "post_id", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "remote_likes_post_idx", + "entityType": "indexes", + "table": "remote_likes" + }, + { + "columns": [ + { + "value": "actor_handle", + "isExpression": false + }, + { + "value": "actor_node_domain", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "remote_likes_actor_idx", + "entityType": "indexes", + "table": "remote_likes" + }, + { + "columns": [ + { + "value": "post_id", + "isExpression": false + }, + { + "value": "actor_handle", + "isExpression": false + }, + { + "value": "actor_node_domain", + "isExpression": false + } + ], + "isUnique": true, + "where": null, + "origin": "manual", + "name": "remote_likes_unique", + "entityType": "indexes", + "table": "remote_likes" + }, + { + "columns": [ + { + "value": "author_handle", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "remote_posts_author_idx", + "entityType": "indexes", + "table": "remote_posts" + }, + { + "columns": [ + { + "value": "published_at", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "remote_posts_published_idx", + "entityType": "indexes", + "table": "remote_posts" + }, + { + "columns": [ + { + "value": "ap_id", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "remote_posts_ap_id_idx", + "entityType": "indexes", + "table": "remote_posts" + }, + { + "columns": [ + { + "value": "post_id", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "remote_reposts_post_idx", + "entityType": "indexes", + "table": "remote_reposts" + }, + { + "columns": [ + { + "value": "actor_handle", + "isExpression": false + }, + { + "value": "actor_node_domain", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "remote_reposts_actor_idx", + "entityType": "indexes", + "table": "remote_reposts" + }, + { + "columns": [ + { + "value": "post_id", + "isExpression": false + }, + { + "value": "actor_handle", + "isExpression": false + }, + { + "value": "actor_node_domain", + "isExpression": false + } + ], + "isUnique": true, + "where": null, + "origin": "manual", + "name": "remote_reposts_unique", + "entityType": "indexes", + "table": "remote_reposts" + }, + { + "columns": [ + { + "value": "status", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "reports_status_idx", + "entityType": "indexes", + "table": "reports" + }, + { + "columns": [ + { + "value": "target_type", + "isExpression": false + }, + { + "value": "target_id", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "reports_target_idx", + "entityType": "indexes", + "table": "reports" + }, + { + "columns": [ + { + "value": "reporter_id", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "reports_reporter_idx", + "entityType": "indexes", + "table": "reports" + }, + { + "columns": [ + { + "value": "token", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "sessions_token_idx", + "entityType": "indexes", + "table": "sessions" + }, + { + "columns": [ + { + "value": "user_id", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "sessions_user_idx", + "entityType": "indexes", + "table": "sessions" + }, + { + "columns": [ + { + "value": "created_at", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "signed_action_dedupe_created_idx", + "entityType": "indexes", + "table": "signed_action_dedupe" + }, + { + "columns": [ + { + "value": "domain", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "swarm_nodes_domain_idx", + "entityType": "indexes", + "table": "swarm_nodes" + }, + { + "columns": [ + { + "value": "is_active", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "swarm_nodes_active_idx", + "entityType": "indexes", + "table": "swarm_nodes" + }, + { + "columns": [ + { + "value": "last_seen_at", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "swarm_nodes_last_seen_idx", + "entityType": "indexes", + "table": "swarm_nodes" + }, + { + "columns": [ + { + "value": "trust_score", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "swarm_nodes_trust_idx", + "entityType": "indexes", + "table": "swarm_nodes" + }, + { + "columns": [ + { + "value": "is_nsfw", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "swarm_nodes_nsfw_idx", + "entityType": "indexes", + "table": "swarm_nodes" + }, + { + "columns": [ + { + "value": "is_blocked", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "swarm_nodes_blocked_idx", + "entityType": "indexes", + "table": "swarm_nodes" + }, + { + "columns": [ + { + "value": "is_enabled", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "swarm_seeds_enabled_idx", + "entityType": "indexes", + "table": "swarm_seeds" + }, + { + "columns": [ + { + "value": "priority", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "swarm_seeds_priority_idx", + "entityType": "indexes", + "table": "swarm_seeds" + }, + { + "columns": [ + { + "value": "remote_domain", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "swarm_sync_log_remote_idx", + "entityType": "indexes", + "table": "swarm_sync_log" + }, + { + "columns": [ + { + "value": "created_at", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "swarm_sync_log_created_idx", + "entityType": "indexes", + "table": "swarm_sync_log" + }, + { + "columns": [ + { + "value": "user_id", + "isExpression": false + }, + { + "value": "liked_at", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "user_swarm_likes_user_idx", + "entityType": "indexes", + "table": "user_swarm_likes" + }, + { + "columns": [ + { + "value": "node_domain", + "isExpression": false + }, + { + "value": "original_post_id", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "user_swarm_likes_post_idx", + "entityType": "indexes", + "table": "user_swarm_likes" + }, + { + "columns": [ + { + "value": "user_id", + "isExpression": false + }, + { + "value": "node_domain", + "isExpression": false + }, + { + "value": "original_post_id", + "isExpression": false + } + ], + "isUnique": true, + "where": null, + "origin": "manual", + "name": "user_swarm_likes_unique", + "entityType": "indexes", + "table": "user_swarm_likes" + }, + { + "columns": [ + { + "value": "user_id", + "isExpression": false + }, + { + "value": "reposted_at", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "user_swarm_reposts_user_idx", + "entityType": "indexes", + "table": "user_swarm_reposts" + }, + { + "columns": [ + { + "value": "node_domain", + "isExpression": false + }, + { + "value": "original_post_id", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "user_swarm_reposts_post_idx", + "entityType": "indexes", + "table": "user_swarm_reposts" + }, + { + "columns": [ + { + "value": "user_id", + "isExpression": false + }, + { + "value": "node_domain", + "isExpression": false + }, + { + "value": "original_post_id", + "isExpression": false + } + ], + "isUnique": true, + "where": null, + "origin": "manual", + "name": "user_swarm_reposts_unique", + "entityType": "indexes", + "table": "user_swarm_reposts" + }, + { + "columns": [ + { + "value": "handle", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "users_handle_idx", + "entityType": "indexes", + "table": "users" + }, + { + "columns": [ + { + "value": "did", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "users_did_idx", + "entityType": "indexes", + "table": "users" + }, + { + "columns": [ + { + "value": "is_suspended", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "users_suspended_idx", + "entityType": "indexes", + "table": "users" + }, + { + "columns": [ + { + "value": "is_silenced", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "users_silenced_idx", + "entityType": "indexes", + "table": "users" + }, + { + "columns": [ + { + "value": "is_bot", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "users_is_bot_idx", + "entityType": "indexes", + "table": "users" + }, + { + "columns": [ + { + "value": "bot_owner_id", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "users_bot_owner_idx", + "entityType": "indexes", + "table": "users" + }, + { + "columns": [ + { + "value": "is_nsfw", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "users_nsfw_idx", + "entityType": "indexes", + "table": "users" + }, + { + "columns": [ + "ap_id" + ], + "nameExplicit": false, + "name": "follows_ap_id_unique", + "entityType": "uniques", + "table": "follows" + }, + { + "columns": [ + "ap_id" + ], + "nameExplicit": false, + "name": "likes_ap_id_unique", + "entityType": "uniques", + "table": "likes" + }, + { + "columns": [ + "domain" + ], + "nameExplicit": false, + "name": "nodes_domain_unique", + "entityType": "uniques", + "table": "nodes" + }, + { + "columns": [ + "ap_id" + ], + "nameExplicit": false, + "name": "posts_ap_id_unique", + "entityType": "uniques", + "table": "posts" + }, + { + "columns": [ + "domain" + ], + "nameExplicit": false, + "name": "swarm_seeds_domain_unique", + "entityType": "uniques", + "table": "swarm_seeds" + }, + { + "columns": [ + "email" + ], + "nameExplicit": false, + "name": "users_email_unique", + "entityType": "uniques", + "table": "users" + } + ], + "renames": [] +} \ No newline at end of file diff --git a/drizzle/meta/0000_snapshot.json b/drizzle/meta/0000_snapshot.json deleted file mode 100644 index 8e51ad3..0000000 --- a/drizzle/meta/0000_snapshot.json +++ /dev/null @@ -1,2897 +0,0 @@ -{ - "id": "7025aca1-5d31-4612-98a9-9a5db99565f6", - "prevId": "00000000-0000-0000-0000-000000000000", - "version": "7", - "dialect": "postgresql", - "tables": { - "public.blocks": { - "name": "blocks", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "blocked_user_id": { - "name": "blocked_user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "blocks_user_idx": { - "name": "blocks_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "blocks_user_id_users_id_fk": { - "name": "blocks_user_id_users_id_fk", - "tableFrom": "blocks", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "blocks_blocked_user_id_users_id_fk": { - "name": "blocks_blocked_user_id_users_id_fk", - "tableFrom": "blocks", - "tableTo": "users", - "columnsFrom": [ - "blocked_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.bot_activity_logs": { - "name": "bot_activity_logs", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "bot_id": { - "name": "bot_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "details": { - "name": "details", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "success": { - "name": "success", - "type": "boolean", - "primaryKey": false, - "notNull": true - }, - "error_message": { - "name": "error_message", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "bot_activity_logs_bot_idx": { - "name": "bot_activity_logs_bot_idx", - "columns": [ - { - "expression": "bot_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_activity_logs_action_idx": { - "name": "bot_activity_logs_action_idx", - "columns": [ - { - "expression": "action", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_activity_logs_created_idx": { - "name": "bot_activity_logs_created_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "bot_activity_logs_bot_id_bots_id_fk": { - "name": "bot_activity_logs_bot_id_bots_id_fk", - "tableFrom": "bot_activity_logs", - "tableTo": "bots", - "columnsFrom": [ - "bot_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.bot_content_items": { - "name": "bot_content_items", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "source_id": { - "name": "source_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "external_id": { - "name": "external_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "title": { - "name": "title", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "url": { - "name": "url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "published_at": { - "name": "published_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "fetched_at": { - "name": "fetched_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "is_processed": { - "name": "is_processed", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "processed_at": { - "name": "processed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "post_id": { - "name": "post_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "interest_score": { - "name": "interest_score", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "interest_reason": { - "name": "interest_reason", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "bot_content_items_source_idx": { - "name": "bot_content_items_source_idx", - "columns": [ - { - "expression": "source_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_content_items_processed_idx": { - "name": "bot_content_items_processed_idx", - "columns": [ - { - "expression": "is_processed", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_content_items_external_idx": { - "name": "bot_content_items_external_idx", - "columns": [ - { - "expression": "external_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "bot_content_items_source_id_bot_content_sources_id_fk": { - "name": "bot_content_items_source_id_bot_content_sources_id_fk", - "tableFrom": "bot_content_items", - "tableTo": "bot_content_sources", - "columnsFrom": [ - "source_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "bot_content_items_post_id_posts_id_fk": { - "name": "bot_content_items_post_id_posts_id_fk", - "tableFrom": "bot_content_items", - "tableTo": "posts", - "columnsFrom": [ - "post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.bot_content_sources": { - "name": "bot_content_sources", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "bot_id": { - "name": "bot_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "url": { - "name": "url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "subreddit": { - "name": "subreddit", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "api_key_encrypted": { - "name": "api_key_encrypted", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "fetch_interval_minutes": { - "name": "fetch_interval_minutes", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 30 - }, - "keywords": { - "name": "keywords", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "is_active": { - "name": "is_active", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "last_fetch_at": { - "name": "last_fetch_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "last_error": { - "name": "last_error", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "consecutive_errors": { - "name": "consecutive_errors", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "bot_content_sources_bot_idx": { - "name": "bot_content_sources_bot_idx", - "columns": [ - { - "expression": "bot_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_content_sources_type_idx": { - "name": "bot_content_sources_type_idx", - "columns": [ - { - "expression": "type", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "bot_content_sources_bot_id_bots_id_fk": { - "name": "bot_content_sources_bot_id_bots_id_fk", - "tableFrom": "bot_content_sources", - "tableTo": "bots", - "columnsFrom": [ - "bot_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.bot_mentions": { - "name": "bot_mentions", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "bot_id": { - "name": "bot_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "post_id": { - "name": "post_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "author_id": { - "name": "author_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "is_processed": { - "name": "is_processed", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "processed_at": { - "name": "processed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "response_post_id": { - "name": "response_post_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "is_remote": { - "name": "is_remote", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "remote_actor_url": { - "name": "remote_actor_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "bot_mentions_bot_idx": { - "name": "bot_mentions_bot_idx", - "columns": [ - { - "expression": "bot_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_mentions_processed_idx": { - "name": "bot_mentions_processed_idx", - "columns": [ - { - "expression": "is_processed", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_mentions_created_idx": { - "name": "bot_mentions_created_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "bot_mentions_bot_id_bots_id_fk": { - "name": "bot_mentions_bot_id_bots_id_fk", - "tableFrom": "bot_mentions", - "tableTo": "bots", - "columnsFrom": [ - "bot_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "bot_mentions_post_id_posts_id_fk": { - "name": "bot_mentions_post_id_posts_id_fk", - "tableFrom": "bot_mentions", - "tableTo": "posts", - "columnsFrom": [ - "post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "bot_mentions_author_id_users_id_fk": { - "name": "bot_mentions_author_id_users_id_fk", - "tableFrom": "bot_mentions", - "tableTo": "users", - "columnsFrom": [ - "author_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "bot_mentions_response_post_id_posts_id_fk": { - "name": "bot_mentions_response_post_id_posts_id_fk", - "tableFrom": "bot_mentions", - "tableTo": "posts", - "columnsFrom": [ - "response_post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.bot_rate_limits": { - "name": "bot_rate_limits", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "bot_id": { - "name": "bot_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "window_start": { - "name": "window_start", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "window_type": { - "name": "window_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "post_count": { - "name": "post_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "reply_count": { - "name": "reply_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "bot_rate_limits_bot_window_idx": { - "name": "bot_rate_limits_bot_window_idx", - "columns": [ - { - "expression": "bot_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "window_start", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "bot_rate_limits_bot_id_bots_id_fk": { - "name": "bot_rate_limits_bot_id_bots_id_fk", - "tableFrom": "bot_rate_limits", - "tableTo": "bots", - "columnsFrom": [ - "bot_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.bots": { - "name": "bots", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "handle": { - "name": "handle", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "bio": { - "name": "bio", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "avatar_url": { - "name": "avatar_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "personality_config": { - "name": "personality_config", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "llm_provider": { - "name": "llm_provider", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "llm_model": { - "name": "llm_model", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "llm_api_key_encrypted": { - "name": "llm_api_key_encrypted", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "schedule_config": { - "name": "schedule_config", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "autonomous_mode": { - "name": "autonomous_mode", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "is_active": { - "name": "is_active", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "is_suspended": { - "name": "is_suspended", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "suspension_reason": { - "name": "suspension_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "suspended_at": { - "name": "suspended_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "private_key_encrypted": { - "name": "private_key_encrypted", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "last_post_at": { - "name": "last_post_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "bots_user_id_idx": { - "name": "bots_user_id_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bots_handle_idx": { - "name": "bots_handle_idx", - "columns": [ - { - "expression": "handle", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bots_active_idx": { - "name": "bots_active_idx", - "columns": [ - { - "expression": "is_active", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "bots_user_id_users_id_fk": { - "name": "bots_user_id_users_id_fk", - "tableFrom": "bots", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "bots_handle_unique": { - "name": "bots_handle_unique", - "nullsNotDistinct": false, - "columns": [ - "handle" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.follows": { - "name": "follows", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "follower_id": { - "name": "follower_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "following_id": { - "name": "following_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "ap_id": { - "name": "ap_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "pending": { - "name": "pending", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "follows_follower_idx": { - "name": "follows_follower_idx", - "columns": [ - { - "expression": "follower_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "follows_following_idx": { - "name": "follows_following_idx", - "columns": [ - { - "expression": "following_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "follows_follower_id_users_id_fk": { - "name": "follows_follower_id_users_id_fk", - "tableFrom": "follows", - "tableTo": "users", - "columnsFrom": [ - "follower_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "follows_following_id_users_id_fk": { - "name": "follows_following_id_users_id_fk", - "tableFrom": "follows", - "tableTo": "users", - "columnsFrom": [ - "following_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "follows_ap_id_unique": { - "name": "follows_ap_id_unique", - "nullsNotDistinct": false, - "columns": [ - "ap_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.handle_registry": { - "name": "handle_registry", - "schema": "", - "columns": { - "handle": { - "name": "handle", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "did": { - "name": "did", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "node_domain": { - "name": "node_domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "registered_at": { - "name": "registered_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "handle_registry_updated_idx": { - "name": "handle_registry_updated_idx", - "columns": [ - { - "expression": "updated_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.likes": { - "name": "likes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "post_id": { - "name": "post_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "ap_id": { - "name": "ap_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "likes_user_post_idx": { - "name": "likes_user_post_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "post_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "likes_user_id_users_id_fk": { - "name": "likes_user_id_users_id_fk", - "tableFrom": "likes", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "likes_post_id_posts_id_fk": { - "name": "likes_post_id_posts_id_fk", - "tableFrom": "likes", - "tableTo": "posts", - "columnsFrom": [ - "post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "likes_ap_id_unique": { - "name": "likes_ap_id_unique", - "nullsNotDistinct": false, - "columns": [ - "ap_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.media": { - "name": "media", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "post_id": { - "name": "post_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "url": { - "name": "url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "alt_text": { - "name": "alt_text", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "mime_type": { - "name": "mime_type", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "width": { - "name": "width", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "height": { - "name": "height", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "media_user_idx": { - "name": "media_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "media_post_idx": { - "name": "media_post_idx", - "columns": [ - { - "expression": "post_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "media_user_id_users_id_fk": { - "name": "media_user_id_users_id_fk", - "tableFrom": "media", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "media_post_id_posts_id_fk": { - "name": "media_post_id_posts_id_fk", - "tableFrom": "media", - "tableTo": "posts", - "columnsFrom": [ - "post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.mutes": { - "name": "mutes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "muted_user_id": { - "name": "muted_user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "mutes_user_idx": { - "name": "mutes_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "mutes_user_id_users_id_fk": { - "name": "mutes_user_id_users_id_fk", - "tableFrom": "mutes", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "mutes_muted_user_id_users_id_fk": { - "name": "mutes_muted_user_id_users_id_fk", - "tableFrom": "mutes", - "tableTo": "users", - "columnsFrom": [ - "muted_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.nodes": { - "name": "nodes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "domain": { - "name": "domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "long_description": { - "name": "long_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "rules": { - "name": "rules", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "banner_url": { - "name": "banner_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "accent_color": { - "name": "accent_color", - "type": "text", - "primaryKey": false, - "notNull": false, - "default": "'#FFFFFF'" - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "nodes_domain_unique": { - "name": "nodes_domain_unique", - "nullsNotDistinct": false, - "columns": [ - "domain" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.notifications": { - "name": "notifications", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "actor_id": { - "name": "actor_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "post_id": { - "name": "post_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "read_at": { - "name": "read_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "notifications_user_idx": { - "name": "notifications_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "notifications_created_idx": { - "name": "notifications_created_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "notifications_user_id_users_id_fk": { - "name": "notifications_user_id_users_id_fk", - "tableFrom": "notifications", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "notifications_actor_id_users_id_fk": { - "name": "notifications_actor_id_users_id_fk", - "tableFrom": "notifications", - "tableTo": "users", - "columnsFrom": [ - "actor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "notifications_post_id_posts_id_fk": { - "name": "notifications_post_id_posts_id_fk", - "tableFrom": "notifications", - "tableTo": "posts", - "columnsFrom": [ - "post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.posts": { - "name": "posts", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "reply_to_id": { - "name": "reply_to_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "repost_of_id": { - "name": "repost_of_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "likes_count": { - "name": "likes_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "reposts_count": { - "name": "reposts_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "replies_count": { - "name": "replies_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "is_removed": { - "name": "is_removed", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "removed_at": { - "name": "removed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "removed_by": { - "name": "removed_by", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "removed_reason": { - "name": "removed_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "ap_id": { - "name": "ap_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "ap_url": { - "name": "ap_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_url": { - "name": "link_preview_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_title": { - "name": "link_preview_title", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_description": { - "name": "link_preview_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_image": { - "name": "link_preview_image", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "posts_user_id_idx": { - "name": "posts_user_id_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "posts_created_at_idx": { - "name": "posts_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "posts_reply_to_idx": { - "name": "posts_reply_to_idx", - "columns": [ - { - "expression": "reply_to_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "posts_removed_idx": { - "name": "posts_removed_idx", - "columns": [ - { - "expression": "is_removed", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "posts_user_id_users_id_fk": { - "name": "posts_user_id_users_id_fk", - "tableFrom": "posts", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "posts_removed_by_users_id_fk": { - "name": "posts_removed_by_users_id_fk", - "tableFrom": "posts", - "tableTo": "users", - "columnsFrom": [ - "removed_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "posts_ap_id_unique": { - "name": "posts_ap_id_unique", - "nullsNotDistinct": false, - "columns": [ - "ap_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.remote_followers": { - "name": "remote_followers", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "actor_url": { - "name": "actor_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "inbox_url": { - "name": "inbox_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "shared_inbox_url": { - "name": "shared_inbox_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "handle": { - "name": "handle", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "activity_id": { - "name": "activity_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "remote_followers_user_idx": { - "name": "remote_followers_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_followers_actor_idx": { - "name": "remote_followers_actor_idx", - "columns": [ - { - "expression": "actor_url", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "remote_followers_user_id_users_id_fk": { - "name": "remote_followers_user_id_users_id_fk", - "tableFrom": "remote_followers", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "remote_followers_actor_url_unique": { - "name": "remote_followers_actor_url_unique", - "nullsNotDistinct": false, - "columns": [ - "actor_url" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.remote_follows": { - "name": "remote_follows", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "follower_id": { - "name": "follower_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "target_handle": { - "name": "target_handle", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "target_actor_url": { - "name": "target_actor_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "inbox_url": { - "name": "inbox_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "activity_id": { - "name": "activity_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "display_name": { - "name": "display_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "bio": { - "name": "bio", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "avatar_url": { - "name": "avatar_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "remote_follows_follower_idx": { - "name": "remote_follows_follower_idx", - "columns": [ - { - "expression": "follower_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_follows_target_idx": { - "name": "remote_follows_target_idx", - "columns": [ - { - "expression": "target_handle", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "remote_follows_follower_id_users_id_fk": { - "name": "remote_follows_follower_id_users_id_fk", - "tableFrom": "remote_follows", - "tableTo": "users", - "columnsFrom": [ - "follower_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.remote_posts": { - "name": "remote_posts", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "ap_id": { - "name": "ap_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "author_handle": { - "name": "author_handle", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "author_actor_url": { - "name": "author_actor_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "author_display_name": { - "name": "author_display_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "author_avatar_url": { - "name": "author_avatar_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "published_at": { - "name": "published_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "link_preview_url": { - "name": "link_preview_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_title": { - "name": "link_preview_title", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_description": { - "name": "link_preview_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_image": { - "name": "link_preview_image", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "media_json": { - "name": "media_json", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "fetched_at": { - "name": "fetched_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "remote_posts_author_idx": { - "name": "remote_posts_author_idx", - "columns": [ - { - "expression": "author_handle", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_posts_published_idx": { - "name": "remote_posts_published_idx", - "columns": [ - { - "expression": "published_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_posts_ap_id_idx": { - "name": "remote_posts_ap_id_idx", - "columns": [ - { - "expression": "ap_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "remote_posts_ap_id_unique": { - "name": "remote_posts_ap_id_unique", - "nullsNotDistinct": false, - "columns": [ - "ap_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.reports": { - "name": "reports", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "reporter_id": { - "name": "reporter_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "target_type": { - "name": "target_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "target_id": { - "name": "target_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'open'" - }, - "resolved_at": { - "name": "resolved_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "resolved_by": { - "name": "resolved_by", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "resolution_note": { - "name": "resolution_note", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "reports_status_idx": { - "name": "reports_status_idx", - "columns": [ - { - "expression": "status", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "reports_target_idx": { - "name": "reports_target_idx", - "columns": [ - { - "expression": "target_type", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "target_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "reports_reporter_idx": { - "name": "reports_reporter_idx", - "columns": [ - { - "expression": "reporter_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "reports_reporter_id_users_id_fk": { - "name": "reports_reporter_id_users_id_fk", - "tableFrom": "reports", - "tableTo": "users", - "columnsFrom": [ - "reporter_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "reports_resolved_by_users_id_fk": { - "name": "reports_resolved_by_users_id_fk", - "tableFrom": "reports", - "tableTo": "users", - "columnsFrom": [ - "resolved_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.sessions": { - "name": "sessions", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "sessions_token_idx": { - "name": "sessions_token_idx", - "columns": [ - { - "expression": "token", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "sessions_user_idx": { - "name": "sessions_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "sessions_user_id_users_id_fk": { - "name": "sessions_user_id_users_id_fk", - "tableFrom": "sessions", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "sessions_token_unique": { - "name": "sessions_token_unique", - "nullsNotDistinct": false, - "columns": [ - "token" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.users": { - "name": "users", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "did": { - "name": "did", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "handle": { - "name": "handle", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "password_hash": { - "name": "password_hash", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "display_name": { - "name": "display_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "bio": { - "name": "bio", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "avatar_url": { - "name": "avatar_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "header_url": { - "name": "header_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "private_key_encrypted": { - "name": "private_key_encrypted", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "node_id": { - "name": "node_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "is_suspended": { - "name": "is_suspended", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "suspension_reason": { - "name": "suspension_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "suspended_at": { - "name": "suspended_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "is_silenced": { - "name": "is_silenced", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "silence_reason": { - "name": "silence_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "silenced_at": { - "name": "silenced_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "moved_to": { - "name": "moved_to", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "moved_from": { - "name": "moved_from", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "migrated_at": { - "name": "migrated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "followers_count": { - "name": "followers_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "following_count": { - "name": "following_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "posts_count": { - "name": "posts_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "website": { - "name": "website", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "users_handle_idx": { - "name": "users_handle_idx", - "columns": [ - { - "expression": "handle", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_did_idx": { - "name": "users_did_idx", - "columns": [ - { - "expression": "did", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_suspended_idx": { - "name": "users_suspended_idx", - "columns": [ - { - "expression": "is_suspended", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_silenced_idx": { - "name": "users_silenced_idx", - "columns": [ - { - "expression": "is_silenced", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "users_node_id_nodes_id_fk": { - "name": "users_node_id_nodes_id_fk", - "tableFrom": "users", - "tableTo": "nodes", - "columnsFrom": [ - "node_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "users_did_unique": { - "name": "users_did_unique", - "nullsNotDistinct": false, - "columns": [ - "did" - ] - }, - "users_handle_unique": { - "name": "users_handle_unique", - "nullsNotDistinct": false, - "columns": [ - "handle" - ] - }, - "users_email_unique": { - "name": "users_email_unique", - "nullsNotDistinct": false, - "columns": [ - "email" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": {}, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/drizzle/meta/0002_snapshot.json b/drizzle/meta/0002_snapshot.json deleted file mode 100644 index 3c41552..0000000 --- a/drizzle/meta/0002_snapshot.json +++ /dev/null @@ -1,2973 +0,0 @@ -{ - "id": "9320c2d1-0596-438b-b795-6ce615488949", - "prevId": "7025aca1-5d31-4612-98a9-9a5db99565f6", - "version": "7", - "dialect": "postgresql", - "tables": { - "public.blocks": { - "name": "blocks", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "blocked_user_id": { - "name": "blocked_user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "blocks_user_idx": { - "name": "blocks_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "blocks_user_id_users_id_fk": { - "name": "blocks_user_id_users_id_fk", - "tableFrom": "blocks", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "blocks_blocked_user_id_users_id_fk": { - "name": "blocks_blocked_user_id_users_id_fk", - "tableFrom": "blocks", - "tableTo": "users", - "columnsFrom": [ - "blocked_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.bot_activity_logs": { - "name": "bot_activity_logs", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "bot_id": { - "name": "bot_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "details": { - "name": "details", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "success": { - "name": "success", - "type": "boolean", - "primaryKey": false, - "notNull": true - }, - "error_message": { - "name": "error_message", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "bot_activity_logs_bot_idx": { - "name": "bot_activity_logs_bot_idx", - "columns": [ - { - "expression": "bot_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_activity_logs_action_idx": { - "name": "bot_activity_logs_action_idx", - "columns": [ - { - "expression": "action", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_activity_logs_created_idx": { - "name": "bot_activity_logs_created_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "bot_activity_logs_bot_id_bots_id_fk": { - "name": "bot_activity_logs_bot_id_bots_id_fk", - "tableFrom": "bot_activity_logs", - "tableTo": "bots", - "columnsFrom": [ - "bot_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.bot_content_items": { - "name": "bot_content_items", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "source_id": { - "name": "source_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "external_id": { - "name": "external_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "title": { - "name": "title", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "url": { - "name": "url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "published_at": { - "name": "published_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "fetched_at": { - "name": "fetched_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "is_processed": { - "name": "is_processed", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "processed_at": { - "name": "processed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "post_id": { - "name": "post_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "interest_score": { - "name": "interest_score", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "interest_reason": { - "name": "interest_reason", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "bot_content_items_source_idx": { - "name": "bot_content_items_source_idx", - "columns": [ - { - "expression": "source_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_content_items_processed_idx": { - "name": "bot_content_items_processed_idx", - "columns": [ - { - "expression": "is_processed", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_content_items_external_idx": { - "name": "bot_content_items_external_idx", - "columns": [ - { - "expression": "external_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "bot_content_items_source_id_bot_content_sources_id_fk": { - "name": "bot_content_items_source_id_bot_content_sources_id_fk", - "tableFrom": "bot_content_items", - "tableTo": "bot_content_sources", - "columnsFrom": [ - "source_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "bot_content_items_post_id_posts_id_fk": { - "name": "bot_content_items_post_id_posts_id_fk", - "tableFrom": "bot_content_items", - "tableTo": "posts", - "columnsFrom": [ - "post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.bot_content_sources": { - "name": "bot_content_sources", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "bot_id": { - "name": "bot_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "url": { - "name": "url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "subreddit": { - "name": "subreddit", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "api_key_encrypted": { - "name": "api_key_encrypted", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "source_config": { - "name": "source_config", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "keywords": { - "name": "keywords", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "is_active": { - "name": "is_active", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "last_fetch_at": { - "name": "last_fetch_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "last_error": { - "name": "last_error", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "consecutive_errors": { - "name": "consecutive_errors", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "bot_content_sources_bot_idx": { - "name": "bot_content_sources_bot_idx", - "columns": [ - { - "expression": "bot_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_content_sources_type_idx": { - "name": "bot_content_sources_type_idx", - "columns": [ - { - "expression": "type", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "bot_content_sources_bot_id_bots_id_fk": { - "name": "bot_content_sources_bot_id_bots_id_fk", - "tableFrom": "bot_content_sources", - "tableTo": "bots", - "columnsFrom": [ - "bot_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.bot_mentions": { - "name": "bot_mentions", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "bot_id": { - "name": "bot_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "post_id": { - "name": "post_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "author_id": { - "name": "author_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "is_processed": { - "name": "is_processed", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "processed_at": { - "name": "processed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "response_post_id": { - "name": "response_post_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "is_remote": { - "name": "is_remote", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "remote_actor_url": { - "name": "remote_actor_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "bot_mentions_bot_idx": { - "name": "bot_mentions_bot_idx", - "columns": [ - { - "expression": "bot_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_mentions_processed_idx": { - "name": "bot_mentions_processed_idx", - "columns": [ - { - "expression": "is_processed", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_mentions_created_idx": { - "name": "bot_mentions_created_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "bot_mentions_bot_id_bots_id_fk": { - "name": "bot_mentions_bot_id_bots_id_fk", - "tableFrom": "bot_mentions", - "tableTo": "bots", - "columnsFrom": [ - "bot_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "bot_mentions_post_id_posts_id_fk": { - "name": "bot_mentions_post_id_posts_id_fk", - "tableFrom": "bot_mentions", - "tableTo": "posts", - "columnsFrom": [ - "post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "bot_mentions_author_id_users_id_fk": { - "name": "bot_mentions_author_id_users_id_fk", - "tableFrom": "bot_mentions", - "tableTo": "users", - "columnsFrom": [ - "author_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "bot_mentions_response_post_id_posts_id_fk": { - "name": "bot_mentions_response_post_id_posts_id_fk", - "tableFrom": "bot_mentions", - "tableTo": "posts", - "columnsFrom": [ - "response_post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.bot_rate_limits": { - "name": "bot_rate_limits", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "bot_id": { - "name": "bot_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "window_start": { - "name": "window_start", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "window_type": { - "name": "window_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "post_count": { - "name": "post_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "reply_count": { - "name": "reply_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "bot_rate_limits_bot_window_idx": { - "name": "bot_rate_limits_bot_window_idx", - "columns": [ - { - "expression": "bot_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "window_start", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "bot_rate_limits_bot_id_bots_id_fk": { - "name": "bot_rate_limits_bot_id_bots_id_fk", - "tableFrom": "bot_rate_limits", - "tableTo": "bots", - "columnsFrom": [ - "bot_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.bots": { - "name": "bots", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "owner_id": { - "name": "owner_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "personality_config": { - "name": "personality_config", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "llm_provider": { - "name": "llm_provider", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "llm_model": { - "name": "llm_model", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "llm_api_key_encrypted": { - "name": "llm_api_key_encrypted", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "schedule_config": { - "name": "schedule_config", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "autonomous_mode": { - "name": "autonomous_mode", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "is_active": { - "name": "is_active", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "is_suspended": { - "name": "is_suspended", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "suspension_reason": { - "name": "suspension_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "suspended_at": { - "name": "suspended_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "last_post_at": { - "name": "last_post_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "bots_user_id_idx": { - "name": "bots_user_id_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bots_owner_id_idx": { - "name": "bots_owner_id_idx", - "columns": [ - { - "expression": "owner_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bots_active_idx": { - "name": "bots_active_idx", - "columns": [ - { - "expression": "is_active", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "bots_user_id_users_id_fk": { - "name": "bots_user_id_users_id_fk", - "tableFrom": "bots", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "bots_owner_id_users_id_fk": { - "name": "bots_owner_id_users_id_fk", - "tableFrom": "bots", - "tableTo": "users", - "columnsFrom": [ - "owner_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.follows": { - "name": "follows", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "follower_id": { - "name": "follower_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "following_id": { - "name": "following_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "ap_id": { - "name": "ap_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "pending": { - "name": "pending", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "follows_follower_idx": { - "name": "follows_follower_idx", - "columns": [ - { - "expression": "follower_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "follows_following_idx": { - "name": "follows_following_idx", - "columns": [ - { - "expression": "following_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "follows_follower_id_users_id_fk": { - "name": "follows_follower_id_users_id_fk", - "tableFrom": "follows", - "tableTo": "users", - "columnsFrom": [ - "follower_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "follows_following_id_users_id_fk": { - "name": "follows_following_id_users_id_fk", - "tableFrom": "follows", - "tableTo": "users", - "columnsFrom": [ - "following_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "follows_ap_id_unique": { - "name": "follows_ap_id_unique", - "nullsNotDistinct": false, - "columns": [ - "ap_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.handle_registry": { - "name": "handle_registry", - "schema": "", - "columns": { - "handle": { - "name": "handle", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "did": { - "name": "did", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "node_domain": { - "name": "node_domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "registered_at": { - "name": "registered_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "handle_registry_updated_idx": { - "name": "handle_registry_updated_idx", - "columns": [ - { - "expression": "updated_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.likes": { - "name": "likes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "post_id": { - "name": "post_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "ap_id": { - "name": "ap_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "likes_user_post_idx": { - "name": "likes_user_post_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "post_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "likes_user_id_users_id_fk": { - "name": "likes_user_id_users_id_fk", - "tableFrom": "likes", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "likes_post_id_posts_id_fk": { - "name": "likes_post_id_posts_id_fk", - "tableFrom": "likes", - "tableTo": "posts", - "columnsFrom": [ - "post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "likes_ap_id_unique": { - "name": "likes_ap_id_unique", - "nullsNotDistinct": false, - "columns": [ - "ap_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.media": { - "name": "media", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "post_id": { - "name": "post_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "url": { - "name": "url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "alt_text": { - "name": "alt_text", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "mime_type": { - "name": "mime_type", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "width": { - "name": "width", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "height": { - "name": "height", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "media_user_idx": { - "name": "media_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "media_post_idx": { - "name": "media_post_idx", - "columns": [ - { - "expression": "post_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "media_user_id_users_id_fk": { - "name": "media_user_id_users_id_fk", - "tableFrom": "media", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "media_post_id_posts_id_fk": { - "name": "media_post_id_posts_id_fk", - "tableFrom": "media", - "tableTo": "posts", - "columnsFrom": [ - "post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.mutes": { - "name": "mutes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "muted_user_id": { - "name": "muted_user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "mutes_user_idx": { - "name": "mutes_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "mutes_user_id_users_id_fk": { - "name": "mutes_user_id_users_id_fk", - "tableFrom": "mutes", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "mutes_muted_user_id_users_id_fk": { - "name": "mutes_muted_user_id_users_id_fk", - "tableFrom": "mutes", - "tableTo": "users", - "columnsFrom": [ - "muted_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.nodes": { - "name": "nodes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "domain": { - "name": "domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "long_description": { - "name": "long_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "rules": { - "name": "rules", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "banner_url": { - "name": "banner_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "logo_url": { - "name": "logo_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "accent_color": { - "name": "accent_color", - "type": "text", - "primaryKey": false, - "notNull": false, - "default": "'#FFFFFF'" - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "nodes_domain_unique": { - "name": "nodes_domain_unique", - "nullsNotDistinct": false, - "columns": [ - "domain" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.notifications": { - "name": "notifications", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "actor_id": { - "name": "actor_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "post_id": { - "name": "post_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "read_at": { - "name": "read_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "notifications_user_idx": { - "name": "notifications_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "notifications_created_idx": { - "name": "notifications_created_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "notifications_user_id_users_id_fk": { - "name": "notifications_user_id_users_id_fk", - "tableFrom": "notifications", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "notifications_actor_id_users_id_fk": { - "name": "notifications_actor_id_users_id_fk", - "tableFrom": "notifications", - "tableTo": "users", - "columnsFrom": [ - "actor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "notifications_post_id_posts_id_fk": { - "name": "notifications_post_id_posts_id_fk", - "tableFrom": "notifications", - "tableTo": "posts", - "columnsFrom": [ - "post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.posts": { - "name": "posts", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "bot_id": { - "name": "bot_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "reply_to_id": { - "name": "reply_to_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "repost_of_id": { - "name": "repost_of_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "likes_count": { - "name": "likes_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "reposts_count": { - "name": "reposts_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "replies_count": { - "name": "replies_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "is_removed": { - "name": "is_removed", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "removed_at": { - "name": "removed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "removed_by": { - "name": "removed_by", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "removed_reason": { - "name": "removed_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "ap_id": { - "name": "ap_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "ap_url": { - "name": "ap_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_url": { - "name": "link_preview_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_title": { - "name": "link_preview_title", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_description": { - "name": "link_preview_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_image": { - "name": "link_preview_image", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "posts_user_id_idx": { - "name": "posts_user_id_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "posts_bot_id_idx": { - "name": "posts_bot_id_idx", - "columns": [ - { - "expression": "bot_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "posts_created_at_idx": { - "name": "posts_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "posts_reply_to_idx": { - "name": "posts_reply_to_idx", - "columns": [ - { - "expression": "reply_to_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "posts_removed_idx": { - "name": "posts_removed_idx", - "columns": [ - { - "expression": "is_removed", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "posts_user_id_users_id_fk": { - "name": "posts_user_id_users_id_fk", - "tableFrom": "posts", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "posts_bot_id_bots_id_fk": { - "name": "posts_bot_id_bots_id_fk", - "tableFrom": "posts", - "tableTo": "bots", - "columnsFrom": [ - "bot_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "posts_removed_by_users_id_fk": { - "name": "posts_removed_by_users_id_fk", - "tableFrom": "posts", - "tableTo": "users", - "columnsFrom": [ - "removed_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "posts_ap_id_unique": { - "name": "posts_ap_id_unique", - "nullsNotDistinct": false, - "columns": [ - "ap_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.remote_followers": { - "name": "remote_followers", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "actor_url": { - "name": "actor_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "inbox_url": { - "name": "inbox_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "shared_inbox_url": { - "name": "shared_inbox_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "handle": { - "name": "handle", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "activity_id": { - "name": "activity_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "remote_followers_user_idx": { - "name": "remote_followers_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_followers_actor_idx": { - "name": "remote_followers_actor_idx", - "columns": [ - { - "expression": "actor_url", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "remote_followers_user_id_users_id_fk": { - "name": "remote_followers_user_id_users_id_fk", - "tableFrom": "remote_followers", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "remote_followers_actor_url_unique": { - "name": "remote_followers_actor_url_unique", - "nullsNotDistinct": false, - "columns": [ - "actor_url" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.remote_follows": { - "name": "remote_follows", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "follower_id": { - "name": "follower_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "target_handle": { - "name": "target_handle", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "target_actor_url": { - "name": "target_actor_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "inbox_url": { - "name": "inbox_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "activity_id": { - "name": "activity_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "display_name": { - "name": "display_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "bio": { - "name": "bio", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "avatar_url": { - "name": "avatar_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "remote_follows_follower_idx": { - "name": "remote_follows_follower_idx", - "columns": [ - { - "expression": "follower_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_follows_target_idx": { - "name": "remote_follows_target_idx", - "columns": [ - { - "expression": "target_handle", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "remote_follows_follower_id_users_id_fk": { - "name": "remote_follows_follower_id_users_id_fk", - "tableFrom": "remote_follows", - "tableTo": "users", - "columnsFrom": [ - "follower_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.remote_posts": { - "name": "remote_posts", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "ap_id": { - "name": "ap_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "author_handle": { - "name": "author_handle", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "author_actor_url": { - "name": "author_actor_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "author_display_name": { - "name": "author_display_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "author_avatar_url": { - "name": "author_avatar_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "published_at": { - "name": "published_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "link_preview_url": { - "name": "link_preview_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_title": { - "name": "link_preview_title", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_description": { - "name": "link_preview_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_image": { - "name": "link_preview_image", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "media_json": { - "name": "media_json", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "fetched_at": { - "name": "fetched_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "remote_posts_author_idx": { - "name": "remote_posts_author_idx", - "columns": [ - { - "expression": "author_handle", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_posts_published_idx": { - "name": "remote_posts_published_idx", - "columns": [ - { - "expression": "published_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_posts_ap_id_idx": { - "name": "remote_posts_ap_id_idx", - "columns": [ - { - "expression": "ap_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "remote_posts_ap_id_unique": { - "name": "remote_posts_ap_id_unique", - "nullsNotDistinct": false, - "columns": [ - "ap_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.reports": { - "name": "reports", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "reporter_id": { - "name": "reporter_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "target_type": { - "name": "target_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "target_id": { - "name": "target_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'open'" - }, - "resolved_at": { - "name": "resolved_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "resolved_by": { - "name": "resolved_by", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "resolution_note": { - "name": "resolution_note", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "reports_status_idx": { - "name": "reports_status_idx", - "columns": [ - { - "expression": "status", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "reports_target_idx": { - "name": "reports_target_idx", - "columns": [ - { - "expression": "target_type", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "target_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "reports_reporter_idx": { - "name": "reports_reporter_idx", - "columns": [ - { - "expression": "reporter_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "reports_reporter_id_users_id_fk": { - "name": "reports_reporter_id_users_id_fk", - "tableFrom": "reports", - "tableTo": "users", - "columnsFrom": [ - "reporter_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "reports_resolved_by_users_id_fk": { - "name": "reports_resolved_by_users_id_fk", - "tableFrom": "reports", - "tableTo": "users", - "columnsFrom": [ - "resolved_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.sessions": { - "name": "sessions", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "sessions_token_idx": { - "name": "sessions_token_idx", - "columns": [ - { - "expression": "token", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "sessions_user_idx": { - "name": "sessions_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "sessions_user_id_users_id_fk": { - "name": "sessions_user_id_users_id_fk", - "tableFrom": "sessions", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "sessions_token_unique": { - "name": "sessions_token_unique", - "nullsNotDistinct": false, - "columns": [ - "token" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.users": { - "name": "users", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "did": { - "name": "did", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "handle": { - "name": "handle", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "password_hash": { - "name": "password_hash", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "display_name": { - "name": "display_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "bio": { - "name": "bio", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "avatar_url": { - "name": "avatar_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "header_url": { - "name": "header_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "private_key_encrypted": { - "name": "private_key_encrypted", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "node_id": { - "name": "node_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "is_bot": { - "name": "is_bot", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "bot_owner_id": { - "name": "bot_owner_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "is_suspended": { - "name": "is_suspended", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "suspension_reason": { - "name": "suspension_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "suspended_at": { - "name": "suspended_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "is_silenced": { - "name": "is_silenced", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "silence_reason": { - "name": "silence_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "silenced_at": { - "name": "silenced_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "moved_to": { - "name": "moved_to", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "moved_from": { - "name": "moved_from", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "migrated_at": { - "name": "migrated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "followers_count": { - "name": "followers_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "following_count": { - "name": "following_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "posts_count": { - "name": "posts_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "website": { - "name": "website", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "users_handle_idx": { - "name": "users_handle_idx", - "columns": [ - { - "expression": "handle", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_did_idx": { - "name": "users_did_idx", - "columns": [ - { - "expression": "did", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_suspended_idx": { - "name": "users_suspended_idx", - "columns": [ - { - "expression": "is_suspended", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_silenced_idx": { - "name": "users_silenced_idx", - "columns": [ - { - "expression": "is_silenced", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_is_bot_idx": { - "name": "users_is_bot_idx", - "columns": [ - { - "expression": "is_bot", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_bot_owner_idx": { - "name": "users_bot_owner_idx", - "columns": [ - { - "expression": "bot_owner_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "users_node_id_nodes_id_fk": { - "name": "users_node_id_nodes_id_fk", - "tableFrom": "users", - "tableTo": "nodes", - "columnsFrom": [ - "node_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "users_bot_owner_id_users_id_fk": { - "name": "users_bot_owner_id_users_id_fk", - "tableFrom": "users", - "tableTo": "users", - "columnsFrom": [ - "bot_owner_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "users_did_unique": { - "name": "users_did_unique", - "nullsNotDistinct": false, - "columns": [ - "did" - ] - }, - "users_handle_unique": { - "name": "users_handle_unique", - "nullsNotDistinct": false, - "columns": [ - "handle" - ] - }, - "users_email_unique": { - "name": "users_email_unique", - "nullsNotDistinct": false, - "columns": [ - "email" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": {}, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/drizzle/meta/0003_snapshot.json b/drizzle/meta/0003_snapshot.json deleted file mode 100644 index 77f6289..0000000 --- a/drizzle/meta/0003_snapshot.json +++ /dev/null @@ -1,3392 +0,0 @@ -{ - "id": "44238f9d-2c06-4033-bfba-0e51117d8048", - "prevId": "9320c2d1-0596-438b-b795-6ce615488949", - "version": "7", - "dialect": "postgresql", - "tables": { - "public.blocks": { - "name": "blocks", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "blocked_user_id": { - "name": "blocked_user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "blocks_user_idx": { - "name": "blocks_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "blocks_user_id_users_id_fk": { - "name": "blocks_user_id_users_id_fk", - "tableFrom": "blocks", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "blocks_blocked_user_id_users_id_fk": { - "name": "blocks_blocked_user_id_users_id_fk", - "tableFrom": "blocks", - "tableTo": "users", - "columnsFrom": [ - "blocked_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.bot_activity_logs": { - "name": "bot_activity_logs", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "bot_id": { - "name": "bot_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "details": { - "name": "details", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "success": { - "name": "success", - "type": "boolean", - "primaryKey": false, - "notNull": true - }, - "error_message": { - "name": "error_message", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "bot_activity_logs_bot_idx": { - "name": "bot_activity_logs_bot_idx", - "columns": [ - { - "expression": "bot_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_activity_logs_action_idx": { - "name": "bot_activity_logs_action_idx", - "columns": [ - { - "expression": "action", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_activity_logs_created_idx": { - "name": "bot_activity_logs_created_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "bot_activity_logs_bot_id_bots_id_fk": { - "name": "bot_activity_logs_bot_id_bots_id_fk", - "tableFrom": "bot_activity_logs", - "tableTo": "bots", - "columnsFrom": [ - "bot_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.bot_content_items": { - "name": "bot_content_items", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "source_id": { - "name": "source_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "external_id": { - "name": "external_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "title": { - "name": "title", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "url": { - "name": "url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "published_at": { - "name": "published_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "fetched_at": { - "name": "fetched_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "is_processed": { - "name": "is_processed", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "processed_at": { - "name": "processed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "post_id": { - "name": "post_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "interest_score": { - "name": "interest_score", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "interest_reason": { - "name": "interest_reason", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "bot_content_items_source_idx": { - "name": "bot_content_items_source_idx", - "columns": [ - { - "expression": "source_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_content_items_processed_idx": { - "name": "bot_content_items_processed_idx", - "columns": [ - { - "expression": "is_processed", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_content_items_external_idx": { - "name": "bot_content_items_external_idx", - "columns": [ - { - "expression": "external_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "bot_content_items_source_id_bot_content_sources_id_fk": { - "name": "bot_content_items_source_id_bot_content_sources_id_fk", - "tableFrom": "bot_content_items", - "tableTo": "bot_content_sources", - "columnsFrom": [ - "source_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "bot_content_items_post_id_posts_id_fk": { - "name": "bot_content_items_post_id_posts_id_fk", - "tableFrom": "bot_content_items", - "tableTo": "posts", - "columnsFrom": [ - "post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.bot_content_sources": { - "name": "bot_content_sources", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "bot_id": { - "name": "bot_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "url": { - "name": "url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "subreddit": { - "name": "subreddit", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "api_key_encrypted": { - "name": "api_key_encrypted", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "source_config": { - "name": "source_config", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "keywords": { - "name": "keywords", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "is_active": { - "name": "is_active", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "last_fetch_at": { - "name": "last_fetch_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "last_error": { - "name": "last_error", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "consecutive_errors": { - "name": "consecutive_errors", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "bot_content_sources_bot_idx": { - "name": "bot_content_sources_bot_idx", - "columns": [ - { - "expression": "bot_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_content_sources_type_idx": { - "name": "bot_content_sources_type_idx", - "columns": [ - { - "expression": "type", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "bot_content_sources_bot_id_bots_id_fk": { - "name": "bot_content_sources_bot_id_bots_id_fk", - "tableFrom": "bot_content_sources", - "tableTo": "bots", - "columnsFrom": [ - "bot_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.bot_mentions": { - "name": "bot_mentions", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "bot_id": { - "name": "bot_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "post_id": { - "name": "post_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "author_id": { - "name": "author_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "is_processed": { - "name": "is_processed", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "processed_at": { - "name": "processed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "response_post_id": { - "name": "response_post_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "is_remote": { - "name": "is_remote", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "remote_actor_url": { - "name": "remote_actor_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "bot_mentions_bot_idx": { - "name": "bot_mentions_bot_idx", - "columns": [ - { - "expression": "bot_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_mentions_processed_idx": { - "name": "bot_mentions_processed_idx", - "columns": [ - { - "expression": "is_processed", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_mentions_created_idx": { - "name": "bot_mentions_created_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "bot_mentions_bot_id_bots_id_fk": { - "name": "bot_mentions_bot_id_bots_id_fk", - "tableFrom": "bot_mentions", - "tableTo": "bots", - "columnsFrom": [ - "bot_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "bot_mentions_post_id_posts_id_fk": { - "name": "bot_mentions_post_id_posts_id_fk", - "tableFrom": "bot_mentions", - "tableTo": "posts", - "columnsFrom": [ - "post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "bot_mentions_author_id_users_id_fk": { - "name": "bot_mentions_author_id_users_id_fk", - "tableFrom": "bot_mentions", - "tableTo": "users", - "columnsFrom": [ - "author_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "bot_mentions_response_post_id_posts_id_fk": { - "name": "bot_mentions_response_post_id_posts_id_fk", - "tableFrom": "bot_mentions", - "tableTo": "posts", - "columnsFrom": [ - "response_post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.bot_rate_limits": { - "name": "bot_rate_limits", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "bot_id": { - "name": "bot_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "window_start": { - "name": "window_start", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "window_type": { - "name": "window_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "post_count": { - "name": "post_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "reply_count": { - "name": "reply_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "bot_rate_limits_bot_window_idx": { - "name": "bot_rate_limits_bot_window_idx", - "columns": [ - { - "expression": "bot_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "window_start", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "bot_rate_limits_bot_id_bots_id_fk": { - "name": "bot_rate_limits_bot_id_bots_id_fk", - "tableFrom": "bot_rate_limits", - "tableTo": "bots", - "columnsFrom": [ - "bot_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.bots": { - "name": "bots", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "owner_id": { - "name": "owner_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "personality_config": { - "name": "personality_config", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "llm_provider": { - "name": "llm_provider", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "llm_model": { - "name": "llm_model", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "llm_api_key_encrypted": { - "name": "llm_api_key_encrypted", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "schedule_config": { - "name": "schedule_config", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "autonomous_mode": { - "name": "autonomous_mode", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "is_active": { - "name": "is_active", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "is_suspended": { - "name": "is_suspended", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "suspension_reason": { - "name": "suspension_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "suspended_at": { - "name": "suspended_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "last_post_at": { - "name": "last_post_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "bots_user_id_idx": { - "name": "bots_user_id_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bots_owner_id_idx": { - "name": "bots_owner_id_idx", - "columns": [ - { - "expression": "owner_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bots_active_idx": { - "name": "bots_active_idx", - "columns": [ - { - "expression": "is_active", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "bots_user_id_users_id_fk": { - "name": "bots_user_id_users_id_fk", - "tableFrom": "bots", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "bots_owner_id_users_id_fk": { - "name": "bots_owner_id_users_id_fk", - "tableFrom": "bots", - "tableTo": "users", - "columnsFrom": [ - "owner_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.follows": { - "name": "follows", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "follower_id": { - "name": "follower_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "following_id": { - "name": "following_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "ap_id": { - "name": "ap_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "pending": { - "name": "pending", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "follows_follower_idx": { - "name": "follows_follower_idx", - "columns": [ - { - "expression": "follower_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "follows_following_idx": { - "name": "follows_following_idx", - "columns": [ - { - "expression": "following_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "follows_follower_id_users_id_fk": { - "name": "follows_follower_id_users_id_fk", - "tableFrom": "follows", - "tableTo": "users", - "columnsFrom": [ - "follower_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "follows_following_id_users_id_fk": { - "name": "follows_following_id_users_id_fk", - "tableFrom": "follows", - "tableTo": "users", - "columnsFrom": [ - "following_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "follows_ap_id_unique": { - "name": "follows_ap_id_unique", - "nullsNotDistinct": false, - "columns": [ - "ap_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.handle_registry": { - "name": "handle_registry", - "schema": "", - "columns": { - "handle": { - "name": "handle", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "did": { - "name": "did", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "node_domain": { - "name": "node_domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "registered_at": { - "name": "registered_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "handle_registry_updated_idx": { - "name": "handle_registry_updated_idx", - "columns": [ - { - "expression": "updated_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.likes": { - "name": "likes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "post_id": { - "name": "post_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "ap_id": { - "name": "ap_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "likes_user_post_idx": { - "name": "likes_user_post_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "post_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "likes_user_id_users_id_fk": { - "name": "likes_user_id_users_id_fk", - "tableFrom": "likes", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "likes_post_id_posts_id_fk": { - "name": "likes_post_id_posts_id_fk", - "tableFrom": "likes", - "tableTo": "posts", - "columnsFrom": [ - "post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "likes_ap_id_unique": { - "name": "likes_ap_id_unique", - "nullsNotDistinct": false, - "columns": [ - "ap_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.media": { - "name": "media", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "post_id": { - "name": "post_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "url": { - "name": "url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "alt_text": { - "name": "alt_text", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "mime_type": { - "name": "mime_type", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "width": { - "name": "width", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "height": { - "name": "height", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "media_user_idx": { - "name": "media_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "media_post_idx": { - "name": "media_post_idx", - "columns": [ - { - "expression": "post_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "media_user_id_users_id_fk": { - "name": "media_user_id_users_id_fk", - "tableFrom": "media", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "media_post_id_posts_id_fk": { - "name": "media_post_id_posts_id_fk", - "tableFrom": "media", - "tableTo": "posts", - "columnsFrom": [ - "post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.mutes": { - "name": "mutes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "muted_user_id": { - "name": "muted_user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "mutes_user_idx": { - "name": "mutes_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "mutes_user_id_users_id_fk": { - "name": "mutes_user_id_users_id_fk", - "tableFrom": "mutes", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "mutes_muted_user_id_users_id_fk": { - "name": "mutes_muted_user_id_users_id_fk", - "tableFrom": "mutes", - "tableTo": "users", - "columnsFrom": [ - "muted_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.nodes": { - "name": "nodes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "domain": { - "name": "domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "long_description": { - "name": "long_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "rules": { - "name": "rules", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "banner_url": { - "name": "banner_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "logo_url": { - "name": "logo_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "accent_color": { - "name": "accent_color", - "type": "text", - "primaryKey": false, - "notNull": false, - "default": "'#FFFFFF'" - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "nodes_domain_unique": { - "name": "nodes_domain_unique", - "nullsNotDistinct": false, - "columns": [ - "domain" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.notifications": { - "name": "notifications", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "actor_id": { - "name": "actor_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "post_id": { - "name": "post_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "read_at": { - "name": "read_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "notifications_user_idx": { - "name": "notifications_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "notifications_created_idx": { - "name": "notifications_created_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "notifications_user_id_users_id_fk": { - "name": "notifications_user_id_users_id_fk", - "tableFrom": "notifications", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "notifications_actor_id_users_id_fk": { - "name": "notifications_actor_id_users_id_fk", - "tableFrom": "notifications", - "tableTo": "users", - "columnsFrom": [ - "actor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "notifications_post_id_posts_id_fk": { - "name": "notifications_post_id_posts_id_fk", - "tableFrom": "notifications", - "tableTo": "posts", - "columnsFrom": [ - "post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.posts": { - "name": "posts", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "bot_id": { - "name": "bot_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "reply_to_id": { - "name": "reply_to_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "repost_of_id": { - "name": "repost_of_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "likes_count": { - "name": "likes_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "reposts_count": { - "name": "reposts_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "replies_count": { - "name": "replies_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "is_removed": { - "name": "is_removed", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "removed_at": { - "name": "removed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "removed_by": { - "name": "removed_by", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "removed_reason": { - "name": "removed_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "ap_id": { - "name": "ap_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "ap_url": { - "name": "ap_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_url": { - "name": "link_preview_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_title": { - "name": "link_preview_title", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_description": { - "name": "link_preview_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_image": { - "name": "link_preview_image", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "posts_user_id_idx": { - "name": "posts_user_id_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "posts_bot_id_idx": { - "name": "posts_bot_id_idx", - "columns": [ - { - "expression": "bot_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "posts_created_at_idx": { - "name": "posts_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "posts_reply_to_idx": { - "name": "posts_reply_to_idx", - "columns": [ - { - "expression": "reply_to_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "posts_removed_idx": { - "name": "posts_removed_idx", - "columns": [ - { - "expression": "is_removed", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "posts_user_id_users_id_fk": { - "name": "posts_user_id_users_id_fk", - "tableFrom": "posts", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "posts_bot_id_bots_id_fk": { - "name": "posts_bot_id_bots_id_fk", - "tableFrom": "posts", - "tableTo": "bots", - "columnsFrom": [ - "bot_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "posts_removed_by_users_id_fk": { - "name": "posts_removed_by_users_id_fk", - "tableFrom": "posts", - "tableTo": "users", - "columnsFrom": [ - "removed_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "posts_ap_id_unique": { - "name": "posts_ap_id_unique", - "nullsNotDistinct": false, - "columns": [ - "ap_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.remote_followers": { - "name": "remote_followers", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "actor_url": { - "name": "actor_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "inbox_url": { - "name": "inbox_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "shared_inbox_url": { - "name": "shared_inbox_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "handle": { - "name": "handle", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "activity_id": { - "name": "activity_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "remote_followers_user_idx": { - "name": "remote_followers_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_followers_actor_idx": { - "name": "remote_followers_actor_idx", - "columns": [ - { - "expression": "actor_url", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "remote_followers_user_id_users_id_fk": { - "name": "remote_followers_user_id_users_id_fk", - "tableFrom": "remote_followers", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "remote_followers_actor_url_unique": { - "name": "remote_followers_actor_url_unique", - "nullsNotDistinct": false, - "columns": [ - "actor_url" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.remote_follows": { - "name": "remote_follows", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "follower_id": { - "name": "follower_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "target_handle": { - "name": "target_handle", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "target_actor_url": { - "name": "target_actor_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "inbox_url": { - "name": "inbox_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "activity_id": { - "name": "activity_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "display_name": { - "name": "display_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "bio": { - "name": "bio", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "avatar_url": { - "name": "avatar_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "remote_follows_follower_idx": { - "name": "remote_follows_follower_idx", - "columns": [ - { - "expression": "follower_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_follows_target_idx": { - "name": "remote_follows_target_idx", - "columns": [ - { - "expression": "target_handle", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "remote_follows_follower_id_users_id_fk": { - "name": "remote_follows_follower_id_users_id_fk", - "tableFrom": "remote_follows", - "tableTo": "users", - "columnsFrom": [ - "follower_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.remote_posts": { - "name": "remote_posts", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "ap_id": { - "name": "ap_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "author_handle": { - "name": "author_handle", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "author_actor_url": { - "name": "author_actor_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "author_display_name": { - "name": "author_display_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "author_avatar_url": { - "name": "author_avatar_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "published_at": { - "name": "published_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "link_preview_url": { - "name": "link_preview_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_title": { - "name": "link_preview_title", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_description": { - "name": "link_preview_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_image": { - "name": "link_preview_image", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "media_json": { - "name": "media_json", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "fetched_at": { - "name": "fetched_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "remote_posts_author_idx": { - "name": "remote_posts_author_idx", - "columns": [ - { - "expression": "author_handle", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_posts_published_idx": { - "name": "remote_posts_published_idx", - "columns": [ - { - "expression": "published_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_posts_ap_id_idx": { - "name": "remote_posts_ap_id_idx", - "columns": [ - { - "expression": "ap_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "remote_posts_ap_id_unique": { - "name": "remote_posts_ap_id_unique", - "nullsNotDistinct": false, - "columns": [ - "ap_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.reports": { - "name": "reports", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "reporter_id": { - "name": "reporter_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "target_type": { - "name": "target_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "target_id": { - "name": "target_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'open'" - }, - "resolved_at": { - "name": "resolved_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "resolved_by": { - "name": "resolved_by", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "resolution_note": { - "name": "resolution_note", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "reports_status_idx": { - "name": "reports_status_idx", - "columns": [ - { - "expression": "status", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "reports_target_idx": { - "name": "reports_target_idx", - "columns": [ - { - "expression": "target_type", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "target_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "reports_reporter_idx": { - "name": "reports_reporter_idx", - "columns": [ - { - "expression": "reporter_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "reports_reporter_id_users_id_fk": { - "name": "reports_reporter_id_users_id_fk", - "tableFrom": "reports", - "tableTo": "users", - "columnsFrom": [ - "reporter_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "reports_resolved_by_users_id_fk": { - "name": "reports_resolved_by_users_id_fk", - "tableFrom": "reports", - "tableTo": "users", - "columnsFrom": [ - "resolved_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.sessions": { - "name": "sessions", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "sessions_token_idx": { - "name": "sessions_token_idx", - "columns": [ - { - "expression": "token", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "sessions_user_idx": { - "name": "sessions_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "sessions_user_id_users_id_fk": { - "name": "sessions_user_id_users_id_fk", - "tableFrom": "sessions", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "sessions_token_unique": { - "name": "sessions_token_unique", - "nullsNotDistinct": false, - "columns": [ - "token" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.swarm_nodes": { - "name": "swarm_nodes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "domain": { - "name": "domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "logo_url": { - "name": "logo_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "software_version": { - "name": "software_version", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "user_count": { - "name": "user_count", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "post_count": { - "name": "post_count", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "discovered_via": { - "name": "discovered_via", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "discovered_at": { - "name": "discovered_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "last_seen_at": { - "name": "last_seen_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "last_sync_at": { - "name": "last_sync_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "consecutive_failures": { - "name": "consecutive_failures", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "is_active": { - "name": "is_active", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "trust_score": { - "name": "trust_score", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 50 - }, - "capabilities": { - "name": "capabilities", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "swarm_nodes_domain_idx": { - "name": "swarm_nodes_domain_idx", - "columns": [ - { - "expression": "domain", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "swarm_nodes_active_idx": { - "name": "swarm_nodes_active_idx", - "columns": [ - { - "expression": "is_active", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "swarm_nodes_last_seen_idx": { - "name": "swarm_nodes_last_seen_idx", - "columns": [ - { - "expression": "last_seen_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "swarm_nodes_trust_idx": { - "name": "swarm_nodes_trust_idx", - "columns": [ - { - "expression": "trust_score", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "swarm_nodes_domain_unique": { - "name": "swarm_nodes_domain_unique", - "nullsNotDistinct": false, - "columns": [ - "domain" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.swarm_seeds": { - "name": "swarm_seeds", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "domain": { - "name": "domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "priority": { - "name": "priority", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 100 - }, - "is_enabled": { - "name": "is_enabled", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "last_contact_at": { - "name": "last_contact_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "consecutive_failures": { - "name": "consecutive_failures", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "swarm_seeds_enabled_idx": { - "name": "swarm_seeds_enabled_idx", - "columns": [ - { - "expression": "is_enabled", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "swarm_seeds_priority_idx": { - "name": "swarm_seeds_priority_idx", - "columns": [ - { - "expression": "priority", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "swarm_seeds_domain_unique": { - "name": "swarm_seeds_domain_unique", - "nullsNotDistinct": false, - "columns": [ - "domain" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.swarm_sync_log": { - "name": "swarm_sync_log", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "remote_domain": { - "name": "remote_domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "direction": { - "name": "direction", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "nodes_received": { - "name": "nodes_received", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "nodes_sent": { - "name": "nodes_sent", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "handles_received": { - "name": "handles_received", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "handles_sent": { - "name": "handles_sent", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "success": { - "name": "success", - "type": "boolean", - "primaryKey": false, - "notNull": true - }, - "error_message": { - "name": "error_message", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "duration_ms": { - "name": "duration_ms", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "swarm_sync_log_remote_idx": { - "name": "swarm_sync_log_remote_idx", - "columns": [ - { - "expression": "remote_domain", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "swarm_sync_log_created_idx": { - "name": "swarm_sync_log_created_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.users": { - "name": "users", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "did": { - "name": "did", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "handle": { - "name": "handle", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "password_hash": { - "name": "password_hash", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "display_name": { - "name": "display_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "bio": { - "name": "bio", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "avatar_url": { - "name": "avatar_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "header_url": { - "name": "header_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "private_key_encrypted": { - "name": "private_key_encrypted", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "node_id": { - "name": "node_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "is_bot": { - "name": "is_bot", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "bot_owner_id": { - "name": "bot_owner_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "is_suspended": { - "name": "is_suspended", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "suspension_reason": { - "name": "suspension_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "suspended_at": { - "name": "suspended_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "is_silenced": { - "name": "is_silenced", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "silence_reason": { - "name": "silence_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "silenced_at": { - "name": "silenced_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "moved_to": { - "name": "moved_to", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "moved_from": { - "name": "moved_from", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "migrated_at": { - "name": "migrated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "followers_count": { - "name": "followers_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "following_count": { - "name": "following_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "posts_count": { - "name": "posts_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "website": { - "name": "website", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "users_handle_idx": { - "name": "users_handle_idx", - "columns": [ - { - "expression": "handle", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_did_idx": { - "name": "users_did_idx", - "columns": [ - { - "expression": "did", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_suspended_idx": { - "name": "users_suspended_idx", - "columns": [ - { - "expression": "is_suspended", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_silenced_idx": { - "name": "users_silenced_idx", - "columns": [ - { - "expression": "is_silenced", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_is_bot_idx": { - "name": "users_is_bot_idx", - "columns": [ - { - "expression": "is_bot", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_bot_owner_idx": { - "name": "users_bot_owner_idx", - "columns": [ - { - "expression": "bot_owner_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "users_node_id_nodes_id_fk": { - "name": "users_node_id_nodes_id_fk", - "tableFrom": "users", - "tableTo": "nodes", - "columnsFrom": [ - "node_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "users_bot_owner_id_users_id_fk": { - "name": "users_bot_owner_id_users_id_fk", - "tableFrom": "users", - "tableTo": "users", - "columnsFrom": [ - "bot_owner_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "users_did_unique": { - "name": "users_did_unique", - "nullsNotDistinct": false, - "columns": [ - "did" - ] - }, - "users_handle_unique": { - "name": "users_handle_unique", - "nullsNotDistinct": false, - "columns": [ - "handle" - ] - }, - "users_email_unique": { - "name": "users_email_unique", - "nullsNotDistinct": false, - "columns": [ - "email" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": {}, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/drizzle/meta/0004_snapshot.json b/drizzle/meta/0004_snapshot.json deleted file mode 100644 index aefaa5c..0000000 --- a/drizzle/meta/0004_snapshot.json +++ /dev/null @@ -1,3592 +0,0 @@ -{ - "id": "3e8b2279-a62d-4851-9c43-81c2ed361d67", - "prevId": "44238f9d-2c06-4033-bfba-0e51117d8048", - "version": "7", - "dialect": "postgresql", - "tables": { - "public.blocks": { - "name": "blocks", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "blocked_user_id": { - "name": "blocked_user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "blocks_user_idx": { - "name": "blocks_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "blocks_blocked_user_idx": { - "name": "blocks_blocked_user_idx", - "columns": [ - { - "expression": "blocked_user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "blocks_user_id_users_id_fk": { - "name": "blocks_user_id_users_id_fk", - "tableFrom": "blocks", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "blocks_blocked_user_id_users_id_fk": { - "name": "blocks_blocked_user_id_users_id_fk", - "tableFrom": "blocks", - "tableTo": "users", - "columnsFrom": [ - "blocked_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.bot_activity_logs": { - "name": "bot_activity_logs", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "bot_id": { - "name": "bot_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "details": { - "name": "details", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "success": { - "name": "success", - "type": "boolean", - "primaryKey": false, - "notNull": true - }, - "error_message": { - "name": "error_message", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "bot_activity_logs_bot_idx": { - "name": "bot_activity_logs_bot_idx", - "columns": [ - { - "expression": "bot_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_activity_logs_action_idx": { - "name": "bot_activity_logs_action_idx", - "columns": [ - { - "expression": "action", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_activity_logs_created_idx": { - "name": "bot_activity_logs_created_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "bot_activity_logs_bot_id_bots_id_fk": { - "name": "bot_activity_logs_bot_id_bots_id_fk", - "tableFrom": "bot_activity_logs", - "tableTo": "bots", - "columnsFrom": [ - "bot_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.bot_content_items": { - "name": "bot_content_items", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "source_id": { - "name": "source_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "external_id": { - "name": "external_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "title": { - "name": "title", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "url": { - "name": "url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "published_at": { - "name": "published_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "fetched_at": { - "name": "fetched_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "is_processed": { - "name": "is_processed", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "processed_at": { - "name": "processed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "post_id": { - "name": "post_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "interest_score": { - "name": "interest_score", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "interest_reason": { - "name": "interest_reason", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "bot_content_items_source_idx": { - "name": "bot_content_items_source_idx", - "columns": [ - { - "expression": "source_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_content_items_processed_idx": { - "name": "bot_content_items_processed_idx", - "columns": [ - { - "expression": "is_processed", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_content_items_external_idx": { - "name": "bot_content_items_external_idx", - "columns": [ - { - "expression": "external_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "bot_content_items_source_id_bot_content_sources_id_fk": { - "name": "bot_content_items_source_id_bot_content_sources_id_fk", - "tableFrom": "bot_content_items", - "tableTo": "bot_content_sources", - "columnsFrom": [ - "source_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "bot_content_items_post_id_posts_id_fk": { - "name": "bot_content_items_post_id_posts_id_fk", - "tableFrom": "bot_content_items", - "tableTo": "posts", - "columnsFrom": [ - "post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.bot_content_sources": { - "name": "bot_content_sources", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "bot_id": { - "name": "bot_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "url": { - "name": "url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "subreddit": { - "name": "subreddit", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "api_key_encrypted": { - "name": "api_key_encrypted", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "source_config": { - "name": "source_config", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "keywords": { - "name": "keywords", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "is_active": { - "name": "is_active", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "last_fetch_at": { - "name": "last_fetch_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "last_error": { - "name": "last_error", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "consecutive_errors": { - "name": "consecutive_errors", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "bot_content_sources_bot_idx": { - "name": "bot_content_sources_bot_idx", - "columns": [ - { - "expression": "bot_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_content_sources_type_idx": { - "name": "bot_content_sources_type_idx", - "columns": [ - { - "expression": "type", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "bot_content_sources_bot_id_bots_id_fk": { - "name": "bot_content_sources_bot_id_bots_id_fk", - "tableFrom": "bot_content_sources", - "tableTo": "bots", - "columnsFrom": [ - "bot_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.bot_mentions": { - "name": "bot_mentions", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "bot_id": { - "name": "bot_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "post_id": { - "name": "post_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "author_id": { - "name": "author_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "is_processed": { - "name": "is_processed", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "processed_at": { - "name": "processed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "response_post_id": { - "name": "response_post_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "is_remote": { - "name": "is_remote", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "remote_actor_url": { - "name": "remote_actor_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "bot_mentions_bot_idx": { - "name": "bot_mentions_bot_idx", - "columns": [ - { - "expression": "bot_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_mentions_processed_idx": { - "name": "bot_mentions_processed_idx", - "columns": [ - { - "expression": "is_processed", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_mentions_created_idx": { - "name": "bot_mentions_created_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "bot_mentions_bot_id_bots_id_fk": { - "name": "bot_mentions_bot_id_bots_id_fk", - "tableFrom": "bot_mentions", - "tableTo": "bots", - "columnsFrom": [ - "bot_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "bot_mentions_post_id_posts_id_fk": { - "name": "bot_mentions_post_id_posts_id_fk", - "tableFrom": "bot_mentions", - "tableTo": "posts", - "columnsFrom": [ - "post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "bot_mentions_author_id_users_id_fk": { - "name": "bot_mentions_author_id_users_id_fk", - "tableFrom": "bot_mentions", - "tableTo": "users", - "columnsFrom": [ - "author_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "bot_mentions_response_post_id_posts_id_fk": { - "name": "bot_mentions_response_post_id_posts_id_fk", - "tableFrom": "bot_mentions", - "tableTo": "posts", - "columnsFrom": [ - "response_post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.bot_rate_limits": { - "name": "bot_rate_limits", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "bot_id": { - "name": "bot_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "window_start": { - "name": "window_start", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "window_type": { - "name": "window_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "post_count": { - "name": "post_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "reply_count": { - "name": "reply_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "bot_rate_limits_bot_window_idx": { - "name": "bot_rate_limits_bot_window_idx", - "columns": [ - { - "expression": "bot_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "window_start", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "bot_rate_limits_bot_id_bots_id_fk": { - "name": "bot_rate_limits_bot_id_bots_id_fk", - "tableFrom": "bot_rate_limits", - "tableTo": "bots", - "columnsFrom": [ - "bot_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.bots": { - "name": "bots", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "owner_id": { - "name": "owner_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "personality_config": { - "name": "personality_config", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "llm_provider": { - "name": "llm_provider", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "llm_model": { - "name": "llm_model", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "llm_api_key_encrypted": { - "name": "llm_api_key_encrypted", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "schedule_config": { - "name": "schedule_config", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "autonomous_mode": { - "name": "autonomous_mode", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "is_active": { - "name": "is_active", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "is_suspended": { - "name": "is_suspended", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "suspension_reason": { - "name": "suspension_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "suspended_at": { - "name": "suspended_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "last_post_at": { - "name": "last_post_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "bots_user_id_idx": { - "name": "bots_user_id_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bots_owner_id_idx": { - "name": "bots_owner_id_idx", - "columns": [ - { - "expression": "owner_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bots_active_idx": { - "name": "bots_active_idx", - "columns": [ - { - "expression": "is_active", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "bots_user_id_users_id_fk": { - "name": "bots_user_id_users_id_fk", - "tableFrom": "bots", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "bots_owner_id_users_id_fk": { - "name": "bots_owner_id_users_id_fk", - "tableFrom": "bots", - "tableTo": "users", - "columnsFrom": [ - "owner_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.follows": { - "name": "follows", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "follower_id": { - "name": "follower_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "following_id": { - "name": "following_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "ap_id": { - "name": "ap_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "pending": { - "name": "pending", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "follows_follower_idx": { - "name": "follows_follower_idx", - "columns": [ - { - "expression": "follower_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "follows_following_idx": { - "name": "follows_following_idx", - "columns": [ - { - "expression": "following_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "follows_follower_id_users_id_fk": { - "name": "follows_follower_id_users_id_fk", - "tableFrom": "follows", - "tableTo": "users", - "columnsFrom": [ - "follower_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "follows_following_id_users_id_fk": { - "name": "follows_following_id_users_id_fk", - "tableFrom": "follows", - "tableTo": "users", - "columnsFrom": [ - "following_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "follows_ap_id_unique": { - "name": "follows_ap_id_unique", - "nullsNotDistinct": false, - "columns": [ - "ap_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.handle_registry": { - "name": "handle_registry", - "schema": "", - "columns": { - "handle": { - "name": "handle", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "did": { - "name": "did", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "node_domain": { - "name": "node_domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "registered_at": { - "name": "registered_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "handle_registry_updated_idx": { - "name": "handle_registry_updated_idx", - "columns": [ - { - "expression": "updated_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.likes": { - "name": "likes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "post_id": { - "name": "post_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "ap_id": { - "name": "ap_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "likes_user_post_idx": { - "name": "likes_user_post_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "post_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "likes_user_id_users_id_fk": { - "name": "likes_user_id_users_id_fk", - "tableFrom": "likes", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "likes_post_id_posts_id_fk": { - "name": "likes_post_id_posts_id_fk", - "tableFrom": "likes", - "tableTo": "posts", - "columnsFrom": [ - "post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "likes_ap_id_unique": { - "name": "likes_ap_id_unique", - "nullsNotDistinct": false, - "columns": [ - "ap_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.media": { - "name": "media", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "post_id": { - "name": "post_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "url": { - "name": "url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "alt_text": { - "name": "alt_text", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "mime_type": { - "name": "mime_type", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "width": { - "name": "width", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "height": { - "name": "height", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "media_user_idx": { - "name": "media_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "media_post_idx": { - "name": "media_post_idx", - "columns": [ - { - "expression": "post_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "media_user_id_users_id_fk": { - "name": "media_user_id_users_id_fk", - "tableFrom": "media", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "media_post_id_posts_id_fk": { - "name": "media_post_id_posts_id_fk", - "tableFrom": "media", - "tableTo": "posts", - "columnsFrom": [ - "post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.muted_nodes": { - "name": "muted_nodes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "node_domain": { - "name": "node_domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "muted_nodes_user_idx": { - "name": "muted_nodes_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "muted_nodes_domain_idx": { - "name": "muted_nodes_domain_idx", - "columns": [ - { - "expression": "node_domain", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "muted_nodes_user_id_users_id_fk": { - "name": "muted_nodes_user_id_users_id_fk", - "tableFrom": "muted_nodes", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.mutes": { - "name": "mutes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "muted_user_id": { - "name": "muted_user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "mutes_user_idx": { - "name": "mutes_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "mutes_muted_user_idx": { - "name": "mutes_muted_user_idx", - "columns": [ - { - "expression": "muted_user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "mutes_user_id_users_id_fk": { - "name": "mutes_user_id_users_id_fk", - "tableFrom": "mutes", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "mutes_muted_user_id_users_id_fk": { - "name": "mutes_muted_user_id_users_id_fk", - "tableFrom": "mutes", - "tableTo": "users", - "columnsFrom": [ - "muted_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.nodes": { - "name": "nodes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "domain": { - "name": "domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "long_description": { - "name": "long_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "rules": { - "name": "rules", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "banner_url": { - "name": "banner_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "logo_url": { - "name": "logo_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "accent_color": { - "name": "accent_color", - "type": "text", - "primaryKey": false, - "notNull": false, - "default": "'#FFFFFF'" - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "is_nsfw": { - "name": "is_nsfw", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "nodes_domain_unique": { - "name": "nodes_domain_unique", - "nullsNotDistinct": false, - "columns": [ - "domain" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.notifications": { - "name": "notifications", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "actor_id": { - "name": "actor_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "post_id": { - "name": "post_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "read_at": { - "name": "read_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "notifications_user_idx": { - "name": "notifications_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "notifications_created_idx": { - "name": "notifications_created_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "notifications_user_id_users_id_fk": { - "name": "notifications_user_id_users_id_fk", - "tableFrom": "notifications", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "notifications_actor_id_users_id_fk": { - "name": "notifications_actor_id_users_id_fk", - "tableFrom": "notifications", - "tableTo": "users", - "columnsFrom": [ - "actor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "notifications_post_id_posts_id_fk": { - "name": "notifications_post_id_posts_id_fk", - "tableFrom": "notifications", - "tableTo": "posts", - "columnsFrom": [ - "post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.posts": { - "name": "posts", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "bot_id": { - "name": "bot_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "reply_to_id": { - "name": "reply_to_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "repost_of_id": { - "name": "repost_of_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "likes_count": { - "name": "likes_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "reposts_count": { - "name": "reposts_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "replies_count": { - "name": "replies_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "is_nsfw": { - "name": "is_nsfw", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "is_removed": { - "name": "is_removed", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "removed_at": { - "name": "removed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "removed_by": { - "name": "removed_by", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "removed_reason": { - "name": "removed_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "ap_id": { - "name": "ap_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "ap_url": { - "name": "ap_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_url": { - "name": "link_preview_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_title": { - "name": "link_preview_title", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_description": { - "name": "link_preview_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_image": { - "name": "link_preview_image", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "posts_user_id_idx": { - "name": "posts_user_id_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "posts_bot_id_idx": { - "name": "posts_bot_id_idx", - "columns": [ - { - "expression": "bot_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "posts_created_at_idx": { - "name": "posts_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "posts_reply_to_idx": { - "name": "posts_reply_to_idx", - "columns": [ - { - "expression": "reply_to_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "posts_removed_idx": { - "name": "posts_removed_idx", - "columns": [ - { - "expression": "is_removed", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "posts_nsfw_idx": { - "name": "posts_nsfw_idx", - "columns": [ - { - "expression": "is_nsfw", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "posts_user_id_users_id_fk": { - "name": "posts_user_id_users_id_fk", - "tableFrom": "posts", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "posts_bot_id_bots_id_fk": { - "name": "posts_bot_id_bots_id_fk", - "tableFrom": "posts", - "tableTo": "bots", - "columnsFrom": [ - "bot_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "posts_removed_by_users_id_fk": { - "name": "posts_removed_by_users_id_fk", - "tableFrom": "posts", - "tableTo": "users", - "columnsFrom": [ - "removed_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "posts_ap_id_unique": { - "name": "posts_ap_id_unique", - "nullsNotDistinct": false, - "columns": [ - "ap_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.remote_followers": { - "name": "remote_followers", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "actor_url": { - "name": "actor_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "inbox_url": { - "name": "inbox_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "shared_inbox_url": { - "name": "shared_inbox_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "handle": { - "name": "handle", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "activity_id": { - "name": "activity_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "remote_followers_user_idx": { - "name": "remote_followers_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_followers_actor_idx": { - "name": "remote_followers_actor_idx", - "columns": [ - { - "expression": "actor_url", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "remote_followers_user_id_users_id_fk": { - "name": "remote_followers_user_id_users_id_fk", - "tableFrom": "remote_followers", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "remote_followers_actor_url_unique": { - "name": "remote_followers_actor_url_unique", - "nullsNotDistinct": false, - "columns": [ - "actor_url" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.remote_follows": { - "name": "remote_follows", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "follower_id": { - "name": "follower_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "target_handle": { - "name": "target_handle", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "target_actor_url": { - "name": "target_actor_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "inbox_url": { - "name": "inbox_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "activity_id": { - "name": "activity_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "display_name": { - "name": "display_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "bio": { - "name": "bio", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "avatar_url": { - "name": "avatar_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "remote_follows_follower_idx": { - "name": "remote_follows_follower_idx", - "columns": [ - { - "expression": "follower_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_follows_target_idx": { - "name": "remote_follows_target_idx", - "columns": [ - { - "expression": "target_handle", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "remote_follows_follower_id_users_id_fk": { - "name": "remote_follows_follower_id_users_id_fk", - "tableFrom": "remote_follows", - "tableTo": "users", - "columnsFrom": [ - "follower_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.remote_posts": { - "name": "remote_posts", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "ap_id": { - "name": "ap_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "author_handle": { - "name": "author_handle", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "author_actor_url": { - "name": "author_actor_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "author_display_name": { - "name": "author_display_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "author_avatar_url": { - "name": "author_avatar_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "published_at": { - "name": "published_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "link_preview_url": { - "name": "link_preview_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_title": { - "name": "link_preview_title", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_description": { - "name": "link_preview_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_image": { - "name": "link_preview_image", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "media_json": { - "name": "media_json", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "fetched_at": { - "name": "fetched_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "remote_posts_author_idx": { - "name": "remote_posts_author_idx", - "columns": [ - { - "expression": "author_handle", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_posts_published_idx": { - "name": "remote_posts_published_idx", - "columns": [ - { - "expression": "published_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_posts_ap_id_idx": { - "name": "remote_posts_ap_id_idx", - "columns": [ - { - "expression": "ap_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "remote_posts_ap_id_unique": { - "name": "remote_posts_ap_id_unique", - "nullsNotDistinct": false, - "columns": [ - "ap_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.reports": { - "name": "reports", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "reporter_id": { - "name": "reporter_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "target_type": { - "name": "target_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "target_id": { - "name": "target_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'open'" - }, - "resolved_at": { - "name": "resolved_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "resolved_by": { - "name": "resolved_by", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "resolution_note": { - "name": "resolution_note", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "reports_status_idx": { - "name": "reports_status_idx", - "columns": [ - { - "expression": "status", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "reports_target_idx": { - "name": "reports_target_idx", - "columns": [ - { - "expression": "target_type", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "target_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "reports_reporter_idx": { - "name": "reports_reporter_idx", - "columns": [ - { - "expression": "reporter_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "reports_reporter_id_users_id_fk": { - "name": "reports_reporter_id_users_id_fk", - "tableFrom": "reports", - "tableTo": "users", - "columnsFrom": [ - "reporter_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "reports_resolved_by_users_id_fk": { - "name": "reports_resolved_by_users_id_fk", - "tableFrom": "reports", - "tableTo": "users", - "columnsFrom": [ - "resolved_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.sessions": { - "name": "sessions", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "sessions_token_idx": { - "name": "sessions_token_idx", - "columns": [ - { - "expression": "token", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "sessions_user_idx": { - "name": "sessions_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "sessions_user_id_users_id_fk": { - "name": "sessions_user_id_users_id_fk", - "tableFrom": "sessions", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "sessions_token_unique": { - "name": "sessions_token_unique", - "nullsNotDistinct": false, - "columns": [ - "token" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.swarm_nodes": { - "name": "swarm_nodes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "domain": { - "name": "domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "logo_url": { - "name": "logo_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "software_version": { - "name": "software_version", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "user_count": { - "name": "user_count", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "post_count": { - "name": "post_count", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "is_nsfw": { - "name": "is_nsfw", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "discovered_via": { - "name": "discovered_via", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "discovered_at": { - "name": "discovered_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "last_seen_at": { - "name": "last_seen_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "last_sync_at": { - "name": "last_sync_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "consecutive_failures": { - "name": "consecutive_failures", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "is_active": { - "name": "is_active", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "trust_score": { - "name": "trust_score", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 50 - }, - "capabilities": { - "name": "capabilities", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "swarm_nodes_domain_idx": { - "name": "swarm_nodes_domain_idx", - "columns": [ - { - "expression": "domain", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "swarm_nodes_active_idx": { - "name": "swarm_nodes_active_idx", - "columns": [ - { - "expression": "is_active", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "swarm_nodes_last_seen_idx": { - "name": "swarm_nodes_last_seen_idx", - "columns": [ - { - "expression": "last_seen_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "swarm_nodes_trust_idx": { - "name": "swarm_nodes_trust_idx", - "columns": [ - { - "expression": "trust_score", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "swarm_nodes_nsfw_idx": { - "name": "swarm_nodes_nsfw_idx", - "columns": [ - { - "expression": "is_nsfw", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "swarm_nodes_domain_unique": { - "name": "swarm_nodes_domain_unique", - "nullsNotDistinct": false, - "columns": [ - "domain" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.swarm_seeds": { - "name": "swarm_seeds", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "domain": { - "name": "domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "priority": { - "name": "priority", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 100 - }, - "is_enabled": { - "name": "is_enabled", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "last_contact_at": { - "name": "last_contact_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "consecutive_failures": { - "name": "consecutive_failures", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "swarm_seeds_enabled_idx": { - "name": "swarm_seeds_enabled_idx", - "columns": [ - { - "expression": "is_enabled", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "swarm_seeds_priority_idx": { - "name": "swarm_seeds_priority_idx", - "columns": [ - { - "expression": "priority", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "swarm_seeds_domain_unique": { - "name": "swarm_seeds_domain_unique", - "nullsNotDistinct": false, - "columns": [ - "domain" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.swarm_sync_log": { - "name": "swarm_sync_log", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "remote_domain": { - "name": "remote_domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "direction": { - "name": "direction", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "nodes_received": { - "name": "nodes_received", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "nodes_sent": { - "name": "nodes_sent", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "handles_received": { - "name": "handles_received", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "handles_sent": { - "name": "handles_sent", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "success": { - "name": "success", - "type": "boolean", - "primaryKey": false, - "notNull": true - }, - "error_message": { - "name": "error_message", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "duration_ms": { - "name": "duration_ms", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "swarm_sync_log_remote_idx": { - "name": "swarm_sync_log_remote_idx", - "columns": [ - { - "expression": "remote_domain", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "swarm_sync_log_created_idx": { - "name": "swarm_sync_log_created_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.users": { - "name": "users", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "did": { - "name": "did", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "handle": { - "name": "handle", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "password_hash": { - "name": "password_hash", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "display_name": { - "name": "display_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "bio": { - "name": "bio", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "avatar_url": { - "name": "avatar_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "header_url": { - "name": "header_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "private_key_encrypted": { - "name": "private_key_encrypted", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "node_id": { - "name": "node_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "is_bot": { - "name": "is_bot", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "bot_owner_id": { - "name": "bot_owner_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "is_nsfw": { - "name": "is_nsfw", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "nsfw_enabled": { - "name": "nsfw_enabled", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "age_verified_at": { - "name": "age_verified_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "is_suspended": { - "name": "is_suspended", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "suspension_reason": { - "name": "suspension_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "suspended_at": { - "name": "suspended_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "is_silenced": { - "name": "is_silenced", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "silence_reason": { - "name": "silence_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "silenced_at": { - "name": "silenced_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "moved_to": { - "name": "moved_to", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "moved_from": { - "name": "moved_from", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "migrated_at": { - "name": "migrated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "followers_count": { - "name": "followers_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "following_count": { - "name": "following_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "posts_count": { - "name": "posts_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "website": { - "name": "website", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "users_handle_idx": { - "name": "users_handle_idx", - "columns": [ - { - "expression": "handle", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_did_idx": { - "name": "users_did_idx", - "columns": [ - { - "expression": "did", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_suspended_idx": { - "name": "users_suspended_idx", - "columns": [ - { - "expression": "is_suspended", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_silenced_idx": { - "name": "users_silenced_idx", - "columns": [ - { - "expression": "is_silenced", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_is_bot_idx": { - "name": "users_is_bot_idx", - "columns": [ - { - "expression": "is_bot", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_bot_owner_idx": { - "name": "users_bot_owner_idx", - "columns": [ - { - "expression": "bot_owner_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_nsfw_idx": { - "name": "users_nsfw_idx", - "columns": [ - { - "expression": "is_nsfw", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "users_node_id_nodes_id_fk": { - "name": "users_node_id_nodes_id_fk", - "tableFrom": "users", - "tableTo": "nodes", - "columnsFrom": [ - "node_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "users_bot_owner_id_users_id_fk": { - "name": "users_bot_owner_id_users_id_fk", - "tableFrom": "users", - "tableTo": "users", - "columnsFrom": [ - "bot_owner_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "users_did_unique": { - "name": "users_did_unique", - "nullsNotDistinct": false, - "columns": [ - "did" - ] - }, - "users_handle_unique": { - "name": "users_handle_unique", - "nullsNotDistinct": false, - "columns": [ - "handle" - ] - }, - "users_email_unique": { - "name": "users_email_unique", - "nullsNotDistinct": false, - "columns": [ - "email" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": {}, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/drizzle/meta/0005_snapshot.json b/drizzle/meta/0005_snapshot.json deleted file mode 100644 index 5f10789..0000000 --- a/drizzle/meta/0005_snapshot.json +++ /dev/null @@ -1,3611 +0,0 @@ -{ - "id": "440d7707-5838-4c3a-a4ce-5b82353242d4", - "prevId": "3e8b2279-a62d-4851-9c43-81c2ed361d67", - "version": "7", - "dialect": "postgresql", - "tables": { - "public.blocks": { - "name": "blocks", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "blocked_user_id": { - "name": "blocked_user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "blocks_user_idx": { - "name": "blocks_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "blocks_blocked_user_idx": { - "name": "blocks_blocked_user_idx", - "columns": [ - { - "expression": "blocked_user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "blocks_user_id_users_id_fk": { - "name": "blocks_user_id_users_id_fk", - "tableFrom": "blocks", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "blocks_blocked_user_id_users_id_fk": { - "name": "blocks_blocked_user_id_users_id_fk", - "tableFrom": "blocks", - "tableTo": "users", - "columnsFrom": [ - "blocked_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.bot_activity_logs": { - "name": "bot_activity_logs", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "bot_id": { - "name": "bot_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "details": { - "name": "details", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "success": { - "name": "success", - "type": "boolean", - "primaryKey": false, - "notNull": true - }, - "error_message": { - "name": "error_message", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "bot_activity_logs_bot_idx": { - "name": "bot_activity_logs_bot_idx", - "columns": [ - { - "expression": "bot_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_activity_logs_action_idx": { - "name": "bot_activity_logs_action_idx", - "columns": [ - { - "expression": "action", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_activity_logs_created_idx": { - "name": "bot_activity_logs_created_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "bot_activity_logs_bot_id_bots_id_fk": { - "name": "bot_activity_logs_bot_id_bots_id_fk", - "tableFrom": "bot_activity_logs", - "tableTo": "bots", - "columnsFrom": [ - "bot_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.bot_content_items": { - "name": "bot_content_items", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "source_id": { - "name": "source_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "external_id": { - "name": "external_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "title": { - "name": "title", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "url": { - "name": "url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "published_at": { - "name": "published_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "fetched_at": { - "name": "fetched_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "is_processed": { - "name": "is_processed", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "processed_at": { - "name": "processed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "post_id": { - "name": "post_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "interest_score": { - "name": "interest_score", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "interest_reason": { - "name": "interest_reason", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "bot_content_items_source_idx": { - "name": "bot_content_items_source_idx", - "columns": [ - { - "expression": "source_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_content_items_processed_idx": { - "name": "bot_content_items_processed_idx", - "columns": [ - { - "expression": "is_processed", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_content_items_external_idx": { - "name": "bot_content_items_external_idx", - "columns": [ - { - "expression": "external_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "bot_content_items_source_id_bot_content_sources_id_fk": { - "name": "bot_content_items_source_id_bot_content_sources_id_fk", - "tableFrom": "bot_content_items", - "tableTo": "bot_content_sources", - "columnsFrom": [ - "source_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "bot_content_items_post_id_posts_id_fk": { - "name": "bot_content_items_post_id_posts_id_fk", - "tableFrom": "bot_content_items", - "tableTo": "posts", - "columnsFrom": [ - "post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.bot_content_sources": { - "name": "bot_content_sources", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "bot_id": { - "name": "bot_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "url": { - "name": "url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "subreddit": { - "name": "subreddit", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "api_key_encrypted": { - "name": "api_key_encrypted", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "source_config": { - "name": "source_config", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "keywords": { - "name": "keywords", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "is_active": { - "name": "is_active", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "last_fetch_at": { - "name": "last_fetch_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "last_error": { - "name": "last_error", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "consecutive_errors": { - "name": "consecutive_errors", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "bot_content_sources_bot_idx": { - "name": "bot_content_sources_bot_idx", - "columns": [ - { - "expression": "bot_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_content_sources_type_idx": { - "name": "bot_content_sources_type_idx", - "columns": [ - { - "expression": "type", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "bot_content_sources_bot_id_bots_id_fk": { - "name": "bot_content_sources_bot_id_bots_id_fk", - "tableFrom": "bot_content_sources", - "tableTo": "bots", - "columnsFrom": [ - "bot_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.bot_mentions": { - "name": "bot_mentions", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "bot_id": { - "name": "bot_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "post_id": { - "name": "post_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "author_id": { - "name": "author_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "is_processed": { - "name": "is_processed", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "processed_at": { - "name": "processed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "response_post_id": { - "name": "response_post_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "is_remote": { - "name": "is_remote", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "remote_actor_url": { - "name": "remote_actor_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "bot_mentions_bot_idx": { - "name": "bot_mentions_bot_idx", - "columns": [ - { - "expression": "bot_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_mentions_processed_idx": { - "name": "bot_mentions_processed_idx", - "columns": [ - { - "expression": "is_processed", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_mentions_created_idx": { - "name": "bot_mentions_created_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "bot_mentions_bot_id_bots_id_fk": { - "name": "bot_mentions_bot_id_bots_id_fk", - "tableFrom": "bot_mentions", - "tableTo": "bots", - "columnsFrom": [ - "bot_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "bot_mentions_post_id_posts_id_fk": { - "name": "bot_mentions_post_id_posts_id_fk", - "tableFrom": "bot_mentions", - "tableTo": "posts", - "columnsFrom": [ - "post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "bot_mentions_author_id_users_id_fk": { - "name": "bot_mentions_author_id_users_id_fk", - "tableFrom": "bot_mentions", - "tableTo": "users", - "columnsFrom": [ - "author_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "bot_mentions_response_post_id_posts_id_fk": { - "name": "bot_mentions_response_post_id_posts_id_fk", - "tableFrom": "bot_mentions", - "tableTo": "posts", - "columnsFrom": [ - "response_post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.bot_rate_limits": { - "name": "bot_rate_limits", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "bot_id": { - "name": "bot_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "window_start": { - "name": "window_start", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "window_type": { - "name": "window_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "post_count": { - "name": "post_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "reply_count": { - "name": "reply_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "bot_rate_limits_bot_window_idx": { - "name": "bot_rate_limits_bot_window_idx", - "columns": [ - { - "expression": "bot_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "window_start", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "bot_rate_limits_bot_id_bots_id_fk": { - "name": "bot_rate_limits_bot_id_bots_id_fk", - "tableFrom": "bot_rate_limits", - "tableTo": "bots", - "columnsFrom": [ - "bot_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.bots": { - "name": "bots", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "owner_id": { - "name": "owner_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "personality_config": { - "name": "personality_config", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "llm_provider": { - "name": "llm_provider", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "llm_model": { - "name": "llm_model", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "llm_api_key_encrypted": { - "name": "llm_api_key_encrypted", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "schedule_config": { - "name": "schedule_config", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "autonomous_mode": { - "name": "autonomous_mode", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "is_active": { - "name": "is_active", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "is_suspended": { - "name": "is_suspended", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "suspension_reason": { - "name": "suspension_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "suspended_at": { - "name": "suspended_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "last_post_at": { - "name": "last_post_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "bots_user_id_idx": { - "name": "bots_user_id_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bots_owner_id_idx": { - "name": "bots_owner_id_idx", - "columns": [ - { - "expression": "owner_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bots_active_idx": { - "name": "bots_active_idx", - "columns": [ - { - "expression": "is_active", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "bots_user_id_users_id_fk": { - "name": "bots_user_id_users_id_fk", - "tableFrom": "bots", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "bots_owner_id_users_id_fk": { - "name": "bots_owner_id_users_id_fk", - "tableFrom": "bots", - "tableTo": "users", - "columnsFrom": [ - "owner_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.follows": { - "name": "follows", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "follower_id": { - "name": "follower_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "following_id": { - "name": "following_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "ap_id": { - "name": "ap_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "pending": { - "name": "pending", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "follows_follower_idx": { - "name": "follows_follower_idx", - "columns": [ - { - "expression": "follower_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "follows_following_idx": { - "name": "follows_following_idx", - "columns": [ - { - "expression": "following_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "follows_follower_id_users_id_fk": { - "name": "follows_follower_id_users_id_fk", - "tableFrom": "follows", - "tableTo": "users", - "columnsFrom": [ - "follower_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "follows_following_id_users_id_fk": { - "name": "follows_following_id_users_id_fk", - "tableFrom": "follows", - "tableTo": "users", - "columnsFrom": [ - "following_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "follows_ap_id_unique": { - "name": "follows_ap_id_unique", - "nullsNotDistinct": false, - "columns": [ - "ap_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.handle_registry": { - "name": "handle_registry", - "schema": "", - "columns": { - "handle": { - "name": "handle", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "did": { - "name": "did", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "node_domain": { - "name": "node_domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "registered_at": { - "name": "registered_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "handle_registry_updated_idx": { - "name": "handle_registry_updated_idx", - "columns": [ - { - "expression": "updated_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.likes": { - "name": "likes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "post_id": { - "name": "post_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "ap_id": { - "name": "ap_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "likes_user_post_idx": { - "name": "likes_user_post_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "post_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "likes_user_id_users_id_fk": { - "name": "likes_user_id_users_id_fk", - "tableFrom": "likes", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "likes_post_id_posts_id_fk": { - "name": "likes_post_id_posts_id_fk", - "tableFrom": "likes", - "tableTo": "posts", - "columnsFrom": [ - "post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "likes_ap_id_unique": { - "name": "likes_ap_id_unique", - "nullsNotDistinct": false, - "columns": [ - "ap_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.media": { - "name": "media", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "post_id": { - "name": "post_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "url": { - "name": "url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "alt_text": { - "name": "alt_text", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "mime_type": { - "name": "mime_type", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "width": { - "name": "width", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "height": { - "name": "height", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "media_user_idx": { - "name": "media_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "media_post_idx": { - "name": "media_post_idx", - "columns": [ - { - "expression": "post_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "media_user_id_users_id_fk": { - "name": "media_user_id_users_id_fk", - "tableFrom": "media", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "media_post_id_posts_id_fk": { - "name": "media_post_id_posts_id_fk", - "tableFrom": "media", - "tableTo": "posts", - "columnsFrom": [ - "post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.muted_nodes": { - "name": "muted_nodes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "node_domain": { - "name": "node_domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "muted_nodes_user_idx": { - "name": "muted_nodes_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "muted_nodes_domain_idx": { - "name": "muted_nodes_domain_idx", - "columns": [ - { - "expression": "node_domain", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "muted_nodes_user_id_users_id_fk": { - "name": "muted_nodes_user_id_users_id_fk", - "tableFrom": "muted_nodes", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.mutes": { - "name": "mutes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "muted_user_id": { - "name": "muted_user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "mutes_user_idx": { - "name": "mutes_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "mutes_muted_user_idx": { - "name": "mutes_muted_user_idx", - "columns": [ - { - "expression": "muted_user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "mutes_user_id_users_id_fk": { - "name": "mutes_user_id_users_id_fk", - "tableFrom": "mutes", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "mutes_muted_user_id_users_id_fk": { - "name": "mutes_muted_user_id_users_id_fk", - "tableFrom": "mutes", - "tableTo": "users", - "columnsFrom": [ - "muted_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.nodes": { - "name": "nodes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "domain": { - "name": "domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "long_description": { - "name": "long_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "rules": { - "name": "rules", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "banner_url": { - "name": "banner_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "logo_url": { - "name": "logo_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "favicon_url": { - "name": "favicon_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "accent_color": { - "name": "accent_color", - "type": "text", - "primaryKey": false, - "notNull": false, - "default": "'#FFFFFF'" - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "is_nsfw": { - "name": "is_nsfw", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "nodes_domain_unique": { - "name": "nodes_domain_unique", - "nullsNotDistinct": false, - "columns": [ - "domain" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.notifications": { - "name": "notifications", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "actor_id": { - "name": "actor_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "post_id": { - "name": "post_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "read_at": { - "name": "read_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "notifications_user_idx": { - "name": "notifications_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "notifications_created_idx": { - "name": "notifications_created_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "notifications_user_id_users_id_fk": { - "name": "notifications_user_id_users_id_fk", - "tableFrom": "notifications", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "notifications_actor_id_users_id_fk": { - "name": "notifications_actor_id_users_id_fk", - "tableFrom": "notifications", - "tableTo": "users", - "columnsFrom": [ - "actor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "notifications_post_id_posts_id_fk": { - "name": "notifications_post_id_posts_id_fk", - "tableFrom": "notifications", - "tableTo": "posts", - "columnsFrom": [ - "post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.posts": { - "name": "posts", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "bot_id": { - "name": "bot_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "reply_to_id": { - "name": "reply_to_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "repost_of_id": { - "name": "repost_of_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "likes_count": { - "name": "likes_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "reposts_count": { - "name": "reposts_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "replies_count": { - "name": "replies_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "is_nsfw": { - "name": "is_nsfw", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "is_removed": { - "name": "is_removed", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "removed_at": { - "name": "removed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "removed_by": { - "name": "removed_by", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "removed_reason": { - "name": "removed_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "ap_id": { - "name": "ap_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "ap_url": { - "name": "ap_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_url": { - "name": "link_preview_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_title": { - "name": "link_preview_title", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_description": { - "name": "link_preview_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_image": { - "name": "link_preview_image", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "posts_user_id_idx": { - "name": "posts_user_id_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "posts_bot_id_idx": { - "name": "posts_bot_id_idx", - "columns": [ - { - "expression": "bot_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "posts_created_at_idx": { - "name": "posts_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "posts_reply_to_idx": { - "name": "posts_reply_to_idx", - "columns": [ - { - "expression": "reply_to_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "posts_removed_idx": { - "name": "posts_removed_idx", - "columns": [ - { - "expression": "is_removed", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "posts_nsfw_idx": { - "name": "posts_nsfw_idx", - "columns": [ - { - "expression": "is_nsfw", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "posts_user_id_users_id_fk": { - "name": "posts_user_id_users_id_fk", - "tableFrom": "posts", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "posts_bot_id_bots_id_fk": { - "name": "posts_bot_id_bots_id_fk", - "tableFrom": "posts", - "tableTo": "bots", - "columnsFrom": [ - "bot_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "posts_removed_by_users_id_fk": { - "name": "posts_removed_by_users_id_fk", - "tableFrom": "posts", - "tableTo": "users", - "columnsFrom": [ - "removed_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "posts_ap_id_unique": { - "name": "posts_ap_id_unique", - "nullsNotDistinct": false, - "columns": [ - "ap_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.remote_followers": { - "name": "remote_followers", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "actor_url": { - "name": "actor_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "inbox_url": { - "name": "inbox_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "shared_inbox_url": { - "name": "shared_inbox_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "handle": { - "name": "handle", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "activity_id": { - "name": "activity_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "remote_followers_user_idx": { - "name": "remote_followers_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_followers_actor_idx": { - "name": "remote_followers_actor_idx", - "columns": [ - { - "expression": "actor_url", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_followers_user_actor_unique": { - "name": "remote_followers_user_actor_unique", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "actor_url", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "remote_followers_user_id_users_id_fk": { - "name": "remote_followers_user_id_users_id_fk", - "tableFrom": "remote_followers", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.remote_follows": { - "name": "remote_follows", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "follower_id": { - "name": "follower_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "target_handle": { - "name": "target_handle", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "target_actor_url": { - "name": "target_actor_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "inbox_url": { - "name": "inbox_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "activity_id": { - "name": "activity_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "display_name": { - "name": "display_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "bio": { - "name": "bio", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "avatar_url": { - "name": "avatar_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "remote_follows_follower_idx": { - "name": "remote_follows_follower_idx", - "columns": [ - { - "expression": "follower_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_follows_target_idx": { - "name": "remote_follows_target_idx", - "columns": [ - { - "expression": "target_handle", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "remote_follows_follower_id_users_id_fk": { - "name": "remote_follows_follower_id_users_id_fk", - "tableFrom": "remote_follows", - "tableTo": "users", - "columnsFrom": [ - "follower_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.remote_posts": { - "name": "remote_posts", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "ap_id": { - "name": "ap_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "author_handle": { - "name": "author_handle", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "author_actor_url": { - "name": "author_actor_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "author_display_name": { - "name": "author_display_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "author_avatar_url": { - "name": "author_avatar_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "published_at": { - "name": "published_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "link_preview_url": { - "name": "link_preview_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_title": { - "name": "link_preview_title", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_description": { - "name": "link_preview_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_image": { - "name": "link_preview_image", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "media_json": { - "name": "media_json", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "fetched_at": { - "name": "fetched_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "remote_posts_author_idx": { - "name": "remote_posts_author_idx", - "columns": [ - { - "expression": "author_handle", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_posts_published_idx": { - "name": "remote_posts_published_idx", - "columns": [ - { - "expression": "published_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_posts_ap_id_idx": { - "name": "remote_posts_ap_id_idx", - "columns": [ - { - "expression": "ap_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "remote_posts_ap_id_unique": { - "name": "remote_posts_ap_id_unique", - "nullsNotDistinct": false, - "columns": [ - "ap_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.reports": { - "name": "reports", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "reporter_id": { - "name": "reporter_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "target_type": { - "name": "target_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "target_id": { - "name": "target_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'open'" - }, - "resolved_at": { - "name": "resolved_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "resolved_by": { - "name": "resolved_by", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "resolution_note": { - "name": "resolution_note", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "reports_status_idx": { - "name": "reports_status_idx", - "columns": [ - { - "expression": "status", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "reports_target_idx": { - "name": "reports_target_idx", - "columns": [ - { - "expression": "target_type", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "target_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "reports_reporter_idx": { - "name": "reports_reporter_idx", - "columns": [ - { - "expression": "reporter_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "reports_reporter_id_users_id_fk": { - "name": "reports_reporter_id_users_id_fk", - "tableFrom": "reports", - "tableTo": "users", - "columnsFrom": [ - "reporter_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "reports_resolved_by_users_id_fk": { - "name": "reports_resolved_by_users_id_fk", - "tableFrom": "reports", - "tableTo": "users", - "columnsFrom": [ - "resolved_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.sessions": { - "name": "sessions", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "sessions_token_idx": { - "name": "sessions_token_idx", - "columns": [ - { - "expression": "token", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "sessions_user_idx": { - "name": "sessions_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "sessions_user_id_users_id_fk": { - "name": "sessions_user_id_users_id_fk", - "tableFrom": "sessions", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "sessions_token_unique": { - "name": "sessions_token_unique", - "nullsNotDistinct": false, - "columns": [ - "token" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.swarm_nodes": { - "name": "swarm_nodes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "domain": { - "name": "domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "logo_url": { - "name": "logo_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "software_version": { - "name": "software_version", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "user_count": { - "name": "user_count", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "post_count": { - "name": "post_count", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "is_nsfw": { - "name": "is_nsfw", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "discovered_via": { - "name": "discovered_via", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "discovered_at": { - "name": "discovered_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "last_seen_at": { - "name": "last_seen_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "last_sync_at": { - "name": "last_sync_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "consecutive_failures": { - "name": "consecutive_failures", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "is_active": { - "name": "is_active", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "trust_score": { - "name": "trust_score", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 50 - }, - "capabilities": { - "name": "capabilities", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "swarm_nodes_domain_idx": { - "name": "swarm_nodes_domain_idx", - "columns": [ - { - "expression": "domain", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "swarm_nodes_active_idx": { - "name": "swarm_nodes_active_idx", - "columns": [ - { - "expression": "is_active", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "swarm_nodes_last_seen_idx": { - "name": "swarm_nodes_last_seen_idx", - "columns": [ - { - "expression": "last_seen_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "swarm_nodes_trust_idx": { - "name": "swarm_nodes_trust_idx", - "columns": [ - { - "expression": "trust_score", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "swarm_nodes_nsfw_idx": { - "name": "swarm_nodes_nsfw_idx", - "columns": [ - { - "expression": "is_nsfw", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "swarm_nodes_domain_unique": { - "name": "swarm_nodes_domain_unique", - "nullsNotDistinct": false, - "columns": [ - "domain" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.swarm_seeds": { - "name": "swarm_seeds", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "domain": { - "name": "domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "priority": { - "name": "priority", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 100 - }, - "is_enabled": { - "name": "is_enabled", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "last_contact_at": { - "name": "last_contact_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "consecutive_failures": { - "name": "consecutive_failures", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "swarm_seeds_enabled_idx": { - "name": "swarm_seeds_enabled_idx", - "columns": [ - { - "expression": "is_enabled", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "swarm_seeds_priority_idx": { - "name": "swarm_seeds_priority_idx", - "columns": [ - { - "expression": "priority", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "swarm_seeds_domain_unique": { - "name": "swarm_seeds_domain_unique", - "nullsNotDistinct": false, - "columns": [ - "domain" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.swarm_sync_log": { - "name": "swarm_sync_log", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "remote_domain": { - "name": "remote_domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "direction": { - "name": "direction", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "nodes_received": { - "name": "nodes_received", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "nodes_sent": { - "name": "nodes_sent", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "handles_received": { - "name": "handles_received", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "handles_sent": { - "name": "handles_sent", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "success": { - "name": "success", - "type": "boolean", - "primaryKey": false, - "notNull": true - }, - "error_message": { - "name": "error_message", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "duration_ms": { - "name": "duration_ms", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "swarm_sync_log_remote_idx": { - "name": "swarm_sync_log_remote_idx", - "columns": [ - { - "expression": "remote_domain", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "swarm_sync_log_created_idx": { - "name": "swarm_sync_log_created_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.users": { - "name": "users", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "did": { - "name": "did", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "handle": { - "name": "handle", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "password_hash": { - "name": "password_hash", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "display_name": { - "name": "display_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "bio": { - "name": "bio", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "avatar_url": { - "name": "avatar_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "header_url": { - "name": "header_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "private_key_encrypted": { - "name": "private_key_encrypted", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "node_id": { - "name": "node_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "is_bot": { - "name": "is_bot", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "bot_owner_id": { - "name": "bot_owner_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "is_nsfw": { - "name": "is_nsfw", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "nsfw_enabled": { - "name": "nsfw_enabled", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "age_verified_at": { - "name": "age_verified_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "is_suspended": { - "name": "is_suspended", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "suspension_reason": { - "name": "suspension_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "suspended_at": { - "name": "suspended_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "is_silenced": { - "name": "is_silenced", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "silence_reason": { - "name": "silence_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "silenced_at": { - "name": "silenced_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "moved_to": { - "name": "moved_to", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "moved_from": { - "name": "moved_from", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "migrated_at": { - "name": "migrated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "followers_count": { - "name": "followers_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "following_count": { - "name": "following_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "posts_count": { - "name": "posts_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "website": { - "name": "website", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "users_handle_idx": { - "name": "users_handle_idx", - "columns": [ - { - "expression": "handle", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_did_idx": { - "name": "users_did_idx", - "columns": [ - { - "expression": "did", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_suspended_idx": { - "name": "users_suspended_idx", - "columns": [ - { - "expression": "is_suspended", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_silenced_idx": { - "name": "users_silenced_idx", - "columns": [ - { - "expression": "is_silenced", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_is_bot_idx": { - "name": "users_is_bot_idx", - "columns": [ - { - "expression": "is_bot", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_bot_owner_idx": { - "name": "users_bot_owner_idx", - "columns": [ - { - "expression": "bot_owner_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_nsfw_idx": { - "name": "users_nsfw_idx", - "columns": [ - { - "expression": "is_nsfw", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "users_node_id_nodes_id_fk": { - "name": "users_node_id_nodes_id_fk", - "tableFrom": "users", - "tableTo": "nodes", - "columnsFrom": [ - "node_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "users_bot_owner_id_users_id_fk": { - "name": "users_bot_owner_id_users_id_fk", - "tableFrom": "users", - "tableTo": "users", - "columnsFrom": [ - "bot_owner_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "users_did_unique": { - "name": "users_did_unique", - "nullsNotDistinct": false, - "columns": [ - "did" - ] - }, - "users_handle_unique": { - "name": "users_handle_unique", - "nullsNotDistinct": false, - "columns": [ - "handle" - ] - }, - "users_email_unique": { - "name": "users_email_unique", - "nullsNotDistinct": false, - "columns": [ - "email" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": {}, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/drizzle/meta/0006_snapshot.json b/drizzle/meta/0006_snapshot.json deleted file mode 100644 index b73b3a3..0000000 --- a/drizzle/meta/0006_snapshot.json +++ /dev/null @@ -1,3641 +0,0 @@ -{ - "id": "21fb326c-a0b1-4357-bc7d-b0f341d505fb", - "prevId": "440d7707-5838-4c3a-a4ce-5b82353242d4", - "version": "7", - "dialect": "postgresql", - "tables": { - "public.blocks": { - "name": "blocks", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "blocked_user_id": { - "name": "blocked_user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "blocks_user_idx": { - "name": "blocks_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "blocks_blocked_user_idx": { - "name": "blocks_blocked_user_idx", - "columns": [ - { - "expression": "blocked_user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "blocks_user_id_users_id_fk": { - "name": "blocks_user_id_users_id_fk", - "tableFrom": "blocks", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "blocks_blocked_user_id_users_id_fk": { - "name": "blocks_blocked_user_id_users_id_fk", - "tableFrom": "blocks", - "tableTo": "users", - "columnsFrom": [ - "blocked_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.bot_activity_logs": { - "name": "bot_activity_logs", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "bot_id": { - "name": "bot_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "details": { - "name": "details", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "success": { - "name": "success", - "type": "boolean", - "primaryKey": false, - "notNull": true - }, - "error_message": { - "name": "error_message", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "bot_activity_logs_bot_idx": { - "name": "bot_activity_logs_bot_idx", - "columns": [ - { - "expression": "bot_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_activity_logs_action_idx": { - "name": "bot_activity_logs_action_idx", - "columns": [ - { - "expression": "action", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_activity_logs_created_idx": { - "name": "bot_activity_logs_created_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "bot_activity_logs_bot_id_bots_id_fk": { - "name": "bot_activity_logs_bot_id_bots_id_fk", - "tableFrom": "bot_activity_logs", - "tableTo": "bots", - "columnsFrom": [ - "bot_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.bot_content_items": { - "name": "bot_content_items", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "source_id": { - "name": "source_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "external_id": { - "name": "external_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "title": { - "name": "title", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "url": { - "name": "url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "published_at": { - "name": "published_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "fetched_at": { - "name": "fetched_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "is_processed": { - "name": "is_processed", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "processed_at": { - "name": "processed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "post_id": { - "name": "post_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "interest_score": { - "name": "interest_score", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "interest_reason": { - "name": "interest_reason", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "bot_content_items_source_idx": { - "name": "bot_content_items_source_idx", - "columns": [ - { - "expression": "source_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_content_items_processed_idx": { - "name": "bot_content_items_processed_idx", - "columns": [ - { - "expression": "is_processed", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_content_items_external_idx": { - "name": "bot_content_items_external_idx", - "columns": [ - { - "expression": "external_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "bot_content_items_source_id_bot_content_sources_id_fk": { - "name": "bot_content_items_source_id_bot_content_sources_id_fk", - "tableFrom": "bot_content_items", - "tableTo": "bot_content_sources", - "columnsFrom": [ - "source_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "bot_content_items_post_id_posts_id_fk": { - "name": "bot_content_items_post_id_posts_id_fk", - "tableFrom": "bot_content_items", - "tableTo": "posts", - "columnsFrom": [ - "post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.bot_content_sources": { - "name": "bot_content_sources", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "bot_id": { - "name": "bot_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "url": { - "name": "url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "subreddit": { - "name": "subreddit", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "api_key_encrypted": { - "name": "api_key_encrypted", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "source_config": { - "name": "source_config", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "keywords": { - "name": "keywords", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "is_active": { - "name": "is_active", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "last_fetch_at": { - "name": "last_fetch_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "last_error": { - "name": "last_error", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "consecutive_errors": { - "name": "consecutive_errors", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "bot_content_sources_bot_idx": { - "name": "bot_content_sources_bot_idx", - "columns": [ - { - "expression": "bot_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_content_sources_type_idx": { - "name": "bot_content_sources_type_idx", - "columns": [ - { - "expression": "type", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "bot_content_sources_bot_id_bots_id_fk": { - "name": "bot_content_sources_bot_id_bots_id_fk", - "tableFrom": "bot_content_sources", - "tableTo": "bots", - "columnsFrom": [ - "bot_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.bot_mentions": { - "name": "bot_mentions", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "bot_id": { - "name": "bot_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "post_id": { - "name": "post_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "author_id": { - "name": "author_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "is_processed": { - "name": "is_processed", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "processed_at": { - "name": "processed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "response_post_id": { - "name": "response_post_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "is_remote": { - "name": "is_remote", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "remote_actor_url": { - "name": "remote_actor_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "bot_mentions_bot_idx": { - "name": "bot_mentions_bot_idx", - "columns": [ - { - "expression": "bot_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_mentions_processed_idx": { - "name": "bot_mentions_processed_idx", - "columns": [ - { - "expression": "is_processed", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_mentions_created_idx": { - "name": "bot_mentions_created_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "bot_mentions_bot_id_bots_id_fk": { - "name": "bot_mentions_bot_id_bots_id_fk", - "tableFrom": "bot_mentions", - "tableTo": "bots", - "columnsFrom": [ - "bot_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "bot_mentions_post_id_posts_id_fk": { - "name": "bot_mentions_post_id_posts_id_fk", - "tableFrom": "bot_mentions", - "tableTo": "posts", - "columnsFrom": [ - "post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "bot_mentions_author_id_users_id_fk": { - "name": "bot_mentions_author_id_users_id_fk", - "tableFrom": "bot_mentions", - "tableTo": "users", - "columnsFrom": [ - "author_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "bot_mentions_response_post_id_posts_id_fk": { - "name": "bot_mentions_response_post_id_posts_id_fk", - "tableFrom": "bot_mentions", - "tableTo": "posts", - "columnsFrom": [ - "response_post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.bot_rate_limits": { - "name": "bot_rate_limits", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "bot_id": { - "name": "bot_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "window_start": { - "name": "window_start", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "window_type": { - "name": "window_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "post_count": { - "name": "post_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "reply_count": { - "name": "reply_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "bot_rate_limits_bot_window_idx": { - "name": "bot_rate_limits_bot_window_idx", - "columns": [ - { - "expression": "bot_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "window_start", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "bot_rate_limits_bot_id_bots_id_fk": { - "name": "bot_rate_limits_bot_id_bots_id_fk", - "tableFrom": "bot_rate_limits", - "tableTo": "bots", - "columnsFrom": [ - "bot_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.bots": { - "name": "bots", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "owner_id": { - "name": "owner_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "personality_config": { - "name": "personality_config", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "llm_provider": { - "name": "llm_provider", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "llm_model": { - "name": "llm_model", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "llm_api_key_encrypted": { - "name": "llm_api_key_encrypted", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "schedule_config": { - "name": "schedule_config", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "autonomous_mode": { - "name": "autonomous_mode", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "is_active": { - "name": "is_active", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "is_suspended": { - "name": "is_suspended", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "suspension_reason": { - "name": "suspension_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "suspended_at": { - "name": "suspended_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "last_post_at": { - "name": "last_post_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "bots_user_id_idx": { - "name": "bots_user_id_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bots_owner_id_idx": { - "name": "bots_owner_id_idx", - "columns": [ - { - "expression": "owner_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bots_active_idx": { - "name": "bots_active_idx", - "columns": [ - { - "expression": "is_active", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "bots_user_id_users_id_fk": { - "name": "bots_user_id_users_id_fk", - "tableFrom": "bots", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "bots_owner_id_users_id_fk": { - "name": "bots_owner_id_users_id_fk", - "tableFrom": "bots", - "tableTo": "users", - "columnsFrom": [ - "owner_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.follows": { - "name": "follows", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "follower_id": { - "name": "follower_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "following_id": { - "name": "following_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "ap_id": { - "name": "ap_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "pending": { - "name": "pending", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "follows_follower_idx": { - "name": "follows_follower_idx", - "columns": [ - { - "expression": "follower_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "follows_following_idx": { - "name": "follows_following_idx", - "columns": [ - { - "expression": "following_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "follows_follower_id_users_id_fk": { - "name": "follows_follower_id_users_id_fk", - "tableFrom": "follows", - "tableTo": "users", - "columnsFrom": [ - "follower_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "follows_following_id_users_id_fk": { - "name": "follows_following_id_users_id_fk", - "tableFrom": "follows", - "tableTo": "users", - "columnsFrom": [ - "following_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "follows_ap_id_unique": { - "name": "follows_ap_id_unique", - "nullsNotDistinct": false, - "columns": [ - "ap_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.handle_registry": { - "name": "handle_registry", - "schema": "", - "columns": { - "handle": { - "name": "handle", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "did": { - "name": "did", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "node_domain": { - "name": "node_domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "registered_at": { - "name": "registered_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "handle_registry_updated_idx": { - "name": "handle_registry_updated_idx", - "columns": [ - { - "expression": "updated_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.likes": { - "name": "likes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "post_id": { - "name": "post_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "ap_id": { - "name": "ap_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "likes_user_post_idx": { - "name": "likes_user_post_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "post_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "likes_user_id_users_id_fk": { - "name": "likes_user_id_users_id_fk", - "tableFrom": "likes", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "likes_post_id_posts_id_fk": { - "name": "likes_post_id_posts_id_fk", - "tableFrom": "likes", - "tableTo": "posts", - "columnsFrom": [ - "post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "likes_ap_id_unique": { - "name": "likes_ap_id_unique", - "nullsNotDistinct": false, - "columns": [ - "ap_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.media": { - "name": "media", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "post_id": { - "name": "post_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "url": { - "name": "url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "alt_text": { - "name": "alt_text", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "mime_type": { - "name": "mime_type", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "width": { - "name": "width", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "height": { - "name": "height", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "media_user_idx": { - "name": "media_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "media_post_idx": { - "name": "media_post_idx", - "columns": [ - { - "expression": "post_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "media_user_id_users_id_fk": { - "name": "media_user_id_users_id_fk", - "tableFrom": "media", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "media_post_id_posts_id_fk": { - "name": "media_post_id_posts_id_fk", - "tableFrom": "media", - "tableTo": "posts", - "columnsFrom": [ - "post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.muted_nodes": { - "name": "muted_nodes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "node_domain": { - "name": "node_domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "muted_nodes_user_idx": { - "name": "muted_nodes_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "muted_nodes_domain_idx": { - "name": "muted_nodes_domain_idx", - "columns": [ - { - "expression": "node_domain", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "muted_nodes_user_id_users_id_fk": { - "name": "muted_nodes_user_id_users_id_fk", - "tableFrom": "muted_nodes", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.mutes": { - "name": "mutes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "muted_user_id": { - "name": "muted_user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "mutes_user_idx": { - "name": "mutes_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "mutes_muted_user_idx": { - "name": "mutes_muted_user_idx", - "columns": [ - { - "expression": "muted_user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "mutes_user_id_users_id_fk": { - "name": "mutes_user_id_users_id_fk", - "tableFrom": "mutes", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "mutes_muted_user_id_users_id_fk": { - "name": "mutes_muted_user_id_users_id_fk", - "tableFrom": "mutes", - "tableTo": "users", - "columnsFrom": [ - "muted_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.nodes": { - "name": "nodes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "domain": { - "name": "domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "long_description": { - "name": "long_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "rules": { - "name": "rules", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "banner_url": { - "name": "banner_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "logo_url": { - "name": "logo_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "favicon_url": { - "name": "favicon_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "accent_color": { - "name": "accent_color", - "type": "text", - "primaryKey": false, - "notNull": false, - "default": "'#FFFFFF'" - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "is_nsfw": { - "name": "is_nsfw", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "nodes_domain_unique": { - "name": "nodes_domain_unique", - "nullsNotDistinct": false, - "columns": [ - "domain" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.notifications": { - "name": "notifications", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "actor_id": { - "name": "actor_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "actor_handle": { - "name": "actor_handle", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "actor_display_name": { - "name": "actor_display_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "actor_avatar_url": { - "name": "actor_avatar_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "actor_node_domain": { - "name": "actor_node_domain", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "post_id": { - "name": "post_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "post_content": { - "name": "post_content", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "read_at": { - "name": "read_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "notifications_user_idx": { - "name": "notifications_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "notifications_created_idx": { - "name": "notifications_created_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "notifications_user_id_users_id_fk": { - "name": "notifications_user_id_users_id_fk", - "tableFrom": "notifications", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "notifications_actor_id_users_id_fk": { - "name": "notifications_actor_id_users_id_fk", - "tableFrom": "notifications", - "tableTo": "users", - "columnsFrom": [ - "actor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "notifications_post_id_posts_id_fk": { - "name": "notifications_post_id_posts_id_fk", - "tableFrom": "notifications", - "tableTo": "posts", - "columnsFrom": [ - "post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.posts": { - "name": "posts", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "bot_id": { - "name": "bot_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "reply_to_id": { - "name": "reply_to_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "repost_of_id": { - "name": "repost_of_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "likes_count": { - "name": "likes_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "reposts_count": { - "name": "reposts_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "replies_count": { - "name": "replies_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "is_nsfw": { - "name": "is_nsfw", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "is_removed": { - "name": "is_removed", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "removed_at": { - "name": "removed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "removed_by": { - "name": "removed_by", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "removed_reason": { - "name": "removed_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "ap_id": { - "name": "ap_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "ap_url": { - "name": "ap_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_url": { - "name": "link_preview_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_title": { - "name": "link_preview_title", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_description": { - "name": "link_preview_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_image": { - "name": "link_preview_image", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "posts_user_id_idx": { - "name": "posts_user_id_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "posts_bot_id_idx": { - "name": "posts_bot_id_idx", - "columns": [ - { - "expression": "bot_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "posts_created_at_idx": { - "name": "posts_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "posts_reply_to_idx": { - "name": "posts_reply_to_idx", - "columns": [ - { - "expression": "reply_to_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "posts_removed_idx": { - "name": "posts_removed_idx", - "columns": [ - { - "expression": "is_removed", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "posts_nsfw_idx": { - "name": "posts_nsfw_idx", - "columns": [ - { - "expression": "is_nsfw", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "posts_user_id_users_id_fk": { - "name": "posts_user_id_users_id_fk", - "tableFrom": "posts", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "posts_bot_id_bots_id_fk": { - "name": "posts_bot_id_bots_id_fk", - "tableFrom": "posts", - "tableTo": "bots", - "columnsFrom": [ - "bot_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "posts_removed_by_users_id_fk": { - "name": "posts_removed_by_users_id_fk", - "tableFrom": "posts", - "tableTo": "users", - "columnsFrom": [ - "removed_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "posts_ap_id_unique": { - "name": "posts_ap_id_unique", - "nullsNotDistinct": false, - "columns": [ - "ap_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.remote_followers": { - "name": "remote_followers", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "actor_url": { - "name": "actor_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "inbox_url": { - "name": "inbox_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "shared_inbox_url": { - "name": "shared_inbox_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "handle": { - "name": "handle", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "activity_id": { - "name": "activity_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "remote_followers_user_idx": { - "name": "remote_followers_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_followers_actor_idx": { - "name": "remote_followers_actor_idx", - "columns": [ - { - "expression": "actor_url", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_followers_user_actor_unique": { - "name": "remote_followers_user_actor_unique", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "actor_url", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "remote_followers_user_id_users_id_fk": { - "name": "remote_followers_user_id_users_id_fk", - "tableFrom": "remote_followers", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.remote_follows": { - "name": "remote_follows", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "follower_id": { - "name": "follower_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "target_handle": { - "name": "target_handle", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "target_actor_url": { - "name": "target_actor_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "inbox_url": { - "name": "inbox_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "activity_id": { - "name": "activity_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "display_name": { - "name": "display_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "bio": { - "name": "bio", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "avatar_url": { - "name": "avatar_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "remote_follows_follower_idx": { - "name": "remote_follows_follower_idx", - "columns": [ - { - "expression": "follower_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_follows_target_idx": { - "name": "remote_follows_target_idx", - "columns": [ - { - "expression": "target_handle", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "remote_follows_follower_id_users_id_fk": { - "name": "remote_follows_follower_id_users_id_fk", - "tableFrom": "remote_follows", - "tableTo": "users", - "columnsFrom": [ - "follower_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.remote_posts": { - "name": "remote_posts", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "ap_id": { - "name": "ap_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "author_handle": { - "name": "author_handle", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "author_actor_url": { - "name": "author_actor_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "author_display_name": { - "name": "author_display_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "author_avatar_url": { - "name": "author_avatar_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "published_at": { - "name": "published_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "link_preview_url": { - "name": "link_preview_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_title": { - "name": "link_preview_title", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_description": { - "name": "link_preview_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_image": { - "name": "link_preview_image", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "media_json": { - "name": "media_json", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "fetched_at": { - "name": "fetched_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "remote_posts_author_idx": { - "name": "remote_posts_author_idx", - "columns": [ - { - "expression": "author_handle", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_posts_published_idx": { - "name": "remote_posts_published_idx", - "columns": [ - { - "expression": "published_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_posts_ap_id_idx": { - "name": "remote_posts_ap_id_idx", - "columns": [ - { - "expression": "ap_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "remote_posts_ap_id_unique": { - "name": "remote_posts_ap_id_unique", - "nullsNotDistinct": false, - "columns": [ - "ap_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.reports": { - "name": "reports", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "reporter_id": { - "name": "reporter_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "target_type": { - "name": "target_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "target_id": { - "name": "target_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'open'" - }, - "resolved_at": { - "name": "resolved_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "resolved_by": { - "name": "resolved_by", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "resolution_note": { - "name": "resolution_note", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "reports_status_idx": { - "name": "reports_status_idx", - "columns": [ - { - "expression": "status", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "reports_target_idx": { - "name": "reports_target_idx", - "columns": [ - { - "expression": "target_type", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "target_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "reports_reporter_idx": { - "name": "reports_reporter_idx", - "columns": [ - { - "expression": "reporter_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "reports_reporter_id_users_id_fk": { - "name": "reports_reporter_id_users_id_fk", - "tableFrom": "reports", - "tableTo": "users", - "columnsFrom": [ - "reporter_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "reports_resolved_by_users_id_fk": { - "name": "reports_resolved_by_users_id_fk", - "tableFrom": "reports", - "tableTo": "users", - "columnsFrom": [ - "resolved_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.sessions": { - "name": "sessions", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "sessions_token_idx": { - "name": "sessions_token_idx", - "columns": [ - { - "expression": "token", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "sessions_user_idx": { - "name": "sessions_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "sessions_user_id_users_id_fk": { - "name": "sessions_user_id_users_id_fk", - "tableFrom": "sessions", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "sessions_token_unique": { - "name": "sessions_token_unique", - "nullsNotDistinct": false, - "columns": [ - "token" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.swarm_nodes": { - "name": "swarm_nodes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "domain": { - "name": "domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "logo_url": { - "name": "logo_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "software_version": { - "name": "software_version", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "user_count": { - "name": "user_count", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "post_count": { - "name": "post_count", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "is_nsfw": { - "name": "is_nsfw", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "discovered_via": { - "name": "discovered_via", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "discovered_at": { - "name": "discovered_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "last_seen_at": { - "name": "last_seen_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "last_sync_at": { - "name": "last_sync_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "consecutive_failures": { - "name": "consecutive_failures", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "is_active": { - "name": "is_active", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "trust_score": { - "name": "trust_score", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 50 - }, - "capabilities": { - "name": "capabilities", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "swarm_nodes_domain_idx": { - "name": "swarm_nodes_domain_idx", - "columns": [ - { - "expression": "domain", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "swarm_nodes_active_idx": { - "name": "swarm_nodes_active_idx", - "columns": [ - { - "expression": "is_active", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "swarm_nodes_last_seen_idx": { - "name": "swarm_nodes_last_seen_idx", - "columns": [ - { - "expression": "last_seen_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "swarm_nodes_trust_idx": { - "name": "swarm_nodes_trust_idx", - "columns": [ - { - "expression": "trust_score", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "swarm_nodes_nsfw_idx": { - "name": "swarm_nodes_nsfw_idx", - "columns": [ - { - "expression": "is_nsfw", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "swarm_nodes_domain_unique": { - "name": "swarm_nodes_domain_unique", - "nullsNotDistinct": false, - "columns": [ - "domain" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.swarm_seeds": { - "name": "swarm_seeds", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "domain": { - "name": "domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "priority": { - "name": "priority", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 100 - }, - "is_enabled": { - "name": "is_enabled", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "last_contact_at": { - "name": "last_contact_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "consecutive_failures": { - "name": "consecutive_failures", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "swarm_seeds_enabled_idx": { - "name": "swarm_seeds_enabled_idx", - "columns": [ - { - "expression": "is_enabled", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "swarm_seeds_priority_idx": { - "name": "swarm_seeds_priority_idx", - "columns": [ - { - "expression": "priority", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "swarm_seeds_domain_unique": { - "name": "swarm_seeds_domain_unique", - "nullsNotDistinct": false, - "columns": [ - "domain" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.swarm_sync_log": { - "name": "swarm_sync_log", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "remote_domain": { - "name": "remote_domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "direction": { - "name": "direction", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "nodes_received": { - "name": "nodes_received", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "nodes_sent": { - "name": "nodes_sent", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "handles_received": { - "name": "handles_received", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "handles_sent": { - "name": "handles_sent", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "success": { - "name": "success", - "type": "boolean", - "primaryKey": false, - "notNull": true - }, - "error_message": { - "name": "error_message", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "duration_ms": { - "name": "duration_ms", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "swarm_sync_log_remote_idx": { - "name": "swarm_sync_log_remote_idx", - "columns": [ - { - "expression": "remote_domain", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "swarm_sync_log_created_idx": { - "name": "swarm_sync_log_created_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.users": { - "name": "users", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "did": { - "name": "did", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "handle": { - "name": "handle", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "password_hash": { - "name": "password_hash", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "display_name": { - "name": "display_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "bio": { - "name": "bio", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "avatar_url": { - "name": "avatar_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "header_url": { - "name": "header_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "private_key_encrypted": { - "name": "private_key_encrypted", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "node_id": { - "name": "node_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "is_bot": { - "name": "is_bot", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "bot_owner_id": { - "name": "bot_owner_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "is_nsfw": { - "name": "is_nsfw", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "nsfw_enabled": { - "name": "nsfw_enabled", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "age_verified_at": { - "name": "age_verified_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "is_suspended": { - "name": "is_suspended", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "suspension_reason": { - "name": "suspension_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "suspended_at": { - "name": "suspended_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "is_silenced": { - "name": "is_silenced", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "silence_reason": { - "name": "silence_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "silenced_at": { - "name": "silenced_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "moved_to": { - "name": "moved_to", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "moved_from": { - "name": "moved_from", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "migrated_at": { - "name": "migrated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "followers_count": { - "name": "followers_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "following_count": { - "name": "following_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "posts_count": { - "name": "posts_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "website": { - "name": "website", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "users_handle_idx": { - "name": "users_handle_idx", - "columns": [ - { - "expression": "handle", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_did_idx": { - "name": "users_did_idx", - "columns": [ - { - "expression": "did", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_suspended_idx": { - "name": "users_suspended_idx", - "columns": [ - { - "expression": "is_suspended", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_silenced_idx": { - "name": "users_silenced_idx", - "columns": [ - { - "expression": "is_silenced", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_is_bot_idx": { - "name": "users_is_bot_idx", - "columns": [ - { - "expression": "is_bot", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_bot_owner_idx": { - "name": "users_bot_owner_idx", - "columns": [ - { - "expression": "bot_owner_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_nsfw_idx": { - "name": "users_nsfw_idx", - "columns": [ - { - "expression": "is_nsfw", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "users_node_id_nodes_id_fk": { - "name": "users_node_id_nodes_id_fk", - "tableFrom": "users", - "tableTo": "nodes", - "columnsFrom": [ - "node_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "users_bot_owner_id_users_id_fk": { - "name": "users_bot_owner_id_users_id_fk", - "tableFrom": "users", - "tableTo": "users", - "columnsFrom": [ - "bot_owner_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "users_did_unique": { - "name": "users_did_unique", - "nullsNotDistinct": false, - "columns": [ - "did" - ] - }, - "users_handle_unique": { - "name": "users_handle_unique", - "nullsNotDistinct": false, - "columns": [ - "handle" - ] - }, - "users_email_unique": { - "name": "users_email_unique", - "nullsNotDistinct": false, - "columns": [ - "email" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": {}, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/drizzle/meta/0007_snapshot.json b/drizzle/meta/0007_snapshot.json deleted file mode 100644 index da192a1..0000000 --- a/drizzle/meta/0007_snapshot.json +++ /dev/null @@ -1,3917 +0,0 @@ -{ - "id": "7eb1ca27-9c1e-4783-ab75-9b2c26c06b52", - "prevId": "21fb326c-a0b1-4357-bc7d-b0f341d505fb", - "version": "7", - "dialect": "postgresql", - "tables": { - "public.blocks": { - "name": "blocks", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "blocked_user_id": { - "name": "blocked_user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "blocks_user_idx": { - "name": "blocks_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "blocks_blocked_user_idx": { - "name": "blocks_blocked_user_idx", - "columns": [ - { - "expression": "blocked_user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "blocks_user_id_users_id_fk": { - "name": "blocks_user_id_users_id_fk", - "tableFrom": "blocks", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "blocks_blocked_user_id_users_id_fk": { - "name": "blocks_blocked_user_id_users_id_fk", - "tableFrom": "blocks", - "tableTo": "users", - "columnsFrom": [ - "blocked_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.bot_activity_logs": { - "name": "bot_activity_logs", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "bot_id": { - "name": "bot_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "details": { - "name": "details", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "success": { - "name": "success", - "type": "boolean", - "primaryKey": false, - "notNull": true - }, - "error_message": { - "name": "error_message", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "bot_activity_logs_bot_idx": { - "name": "bot_activity_logs_bot_idx", - "columns": [ - { - "expression": "bot_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_activity_logs_action_idx": { - "name": "bot_activity_logs_action_idx", - "columns": [ - { - "expression": "action", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_activity_logs_created_idx": { - "name": "bot_activity_logs_created_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "bot_activity_logs_bot_id_bots_id_fk": { - "name": "bot_activity_logs_bot_id_bots_id_fk", - "tableFrom": "bot_activity_logs", - "tableTo": "bots", - "columnsFrom": [ - "bot_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.bot_content_items": { - "name": "bot_content_items", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "source_id": { - "name": "source_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "external_id": { - "name": "external_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "title": { - "name": "title", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "url": { - "name": "url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "published_at": { - "name": "published_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "fetched_at": { - "name": "fetched_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "is_processed": { - "name": "is_processed", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "processed_at": { - "name": "processed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "post_id": { - "name": "post_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "interest_score": { - "name": "interest_score", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "interest_reason": { - "name": "interest_reason", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "bot_content_items_source_idx": { - "name": "bot_content_items_source_idx", - "columns": [ - { - "expression": "source_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_content_items_processed_idx": { - "name": "bot_content_items_processed_idx", - "columns": [ - { - "expression": "is_processed", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_content_items_external_idx": { - "name": "bot_content_items_external_idx", - "columns": [ - { - "expression": "external_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "bot_content_items_source_id_bot_content_sources_id_fk": { - "name": "bot_content_items_source_id_bot_content_sources_id_fk", - "tableFrom": "bot_content_items", - "tableTo": "bot_content_sources", - "columnsFrom": [ - "source_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "bot_content_items_post_id_posts_id_fk": { - "name": "bot_content_items_post_id_posts_id_fk", - "tableFrom": "bot_content_items", - "tableTo": "posts", - "columnsFrom": [ - "post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.bot_content_sources": { - "name": "bot_content_sources", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "bot_id": { - "name": "bot_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "url": { - "name": "url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "subreddit": { - "name": "subreddit", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "api_key_encrypted": { - "name": "api_key_encrypted", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "source_config": { - "name": "source_config", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "keywords": { - "name": "keywords", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "is_active": { - "name": "is_active", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "last_fetch_at": { - "name": "last_fetch_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "last_error": { - "name": "last_error", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "consecutive_errors": { - "name": "consecutive_errors", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "bot_content_sources_bot_idx": { - "name": "bot_content_sources_bot_idx", - "columns": [ - { - "expression": "bot_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_content_sources_type_idx": { - "name": "bot_content_sources_type_idx", - "columns": [ - { - "expression": "type", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "bot_content_sources_bot_id_bots_id_fk": { - "name": "bot_content_sources_bot_id_bots_id_fk", - "tableFrom": "bot_content_sources", - "tableTo": "bots", - "columnsFrom": [ - "bot_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.bot_mentions": { - "name": "bot_mentions", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "bot_id": { - "name": "bot_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "post_id": { - "name": "post_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "author_id": { - "name": "author_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "is_processed": { - "name": "is_processed", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "processed_at": { - "name": "processed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "response_post_id": { - "name": "response_post_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "is_remote": { - "name": "is_remote", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "remote_actor_url": { - "name": "remote_actor_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "bot_mentions_bot_idx": { - "name": "bot_mentions_bot_idx", - "columns": [ - { - "expression": "bot_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_mentions_processed_idx": { - "name": "bot_mentions_processed_idx", - "columns": [ - { - "expression": "is_processed", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_mentions_created_idx": { - "name": "bot_mentions_created_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "bot_mentions_bot_id_bots_id_fk": { - "name": "bot_mentions_bot_id_bots_id_fk", - "tableFrom": "bot_mentions", - "tableTo": "bots", - "columnsFrom": [ - "bot_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "bot_mentions_post_id_posts_id_fk": { - "name": "bot_mentions_post_id_posts_id_fk", - "tableFrom": "bot_mentions", - "tableTo": "posts", - "columnsFrom": [ - "post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "bot_mentions_author_id_users_id_fk": { - "name": "bot_mentions_author_id_users_id_fk", - "tableFrom": "bot_mentions", - "tableTo": "users", - "columnsFrom": [ - "author_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "bot_mentions_response_post_id_posts_id_fk": { - "name": "bot_mentions_response_post_id_posts_id_fk", - "tableFrom": "bot_mentions", - "tableTo": "posts", - "columnsFrom": [ - "response_post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.bot_rate_limits": { - "name": "bot_rate_limits", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "bot_id": { - "name": "bot_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "window_start": { - "name": "window_start", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "window_type": { - "name": "window_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "post_count": { - "name": "post_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "reply_count": { - "name": "reply_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "bot_rate_limits_bot_window_idx": { - "name": "bot_rate_limits_bot_window_idx", - "columns": [ - { - "expression": "bot_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "window_start", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "bot_rate_limits_bot_id_bots_id_fk": { - "name": "bot_rate_limits_bot_id_bots_id_fk", - "tableFrom": "bot_rate_limits", - "tableTo": "bots", - "columnsFrom": [ - "bot_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.bots": { - "name": "bots", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "owner_id": { - "name": "owner_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "personality_config": { - "name": "personality_config", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "llm_provider": { - "name": "llm_provider", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "llm_model": { - "name": "llm_model", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "llm_api_key_encrypted": { - "name": "llm_api_key_encrypted", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "schedule_config": { - "name": "schedule_config", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "autonomous_mode": { - "name": "autonomous_mode", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "is_active": { - "name": "is_active", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "is_suspended": { - "name": "is_suspended", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "suspension_reason": { - "name": "suspension_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "suspended_at": { - "name": "suspended_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "last_post_at": { - "name": "last_post_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "bots_user_id_idx": { - "name": "bots_user_id_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bots_owner_id_idx": { - "name": "bots_owner_id_idx", - "columns": [ - { - "expression": "owner_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bots_active_idx": { - "name": "bots_active_idx", - "columns": [ - { - "expression": "is_active", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "bots_user_id_users_id_fk": { - "name": "bots_user_id_users_id_fk", - "tableFrom": "bots", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "bots_owner_id_users_id_fk": { - "name": "bots_owner_id_users_id_fk", - "tableFrom": "bots", - "tableTo": "users", - "columnsFrom": [ - "owner_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.follows": { - "name": "follows", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "follower_id": { - "name": "follower_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "following_id": { - "name": "following_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "ap_id": { - "name": "ap_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "pending": { - "name": "pending", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "follows_follower_idx": { - "name": "follows_follower_idx", - "columns": [ - { - "expression": "follower_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "follows_following_idx": { - "name": "follows_following_idx", - "columns": [ - { - "expression": "following_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "follows_follower_id_users_id_fk": { - "name": "follows_follower_id_users_id_fk", - "tableFrom": "follows", - "tableTo": "users", - "columnsFrom": [ - "follower_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "follows_following_id_users_id_fk": { - "name": "follows_following_id_users_id_fk", - "tableFrom": "follows", - "tableTo": "users", - "columnsFrom": [ - "following_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "follows_ap_id_unique": { - "name": "follows_ap_id_unique", - "nullsNotDistinct": false, - "columns": [ - "ap_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.handle_registry": { - "name": "handle_registry", - "schema": "", - "columns": { - "handle": { - "name": "handle", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "did": { - "name": "did", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "node_domain": { - "name": "node_domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "registered_at": { - "name": "registered_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "handle_registry_updated_idx": { - "name": "handle_registry_updated_idx", - "columns": [ - { - "expression": "updated_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.likes": { - "name": "likes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "post_id": { - "name": "post_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "ap_id": { - "name": "ap_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "likes_user_post_idx": { - "name": "likes_user_post_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "post_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "likes_user_id_users_id_fk": { - "name": "likes_user_id_users_id_fk", - "tableFrom": "likes", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "likes_post_id_posts_id_fk": { - "name": "likes_post_id_posts_id_fk", - "tableFrom": "likes", - "tableTo": "posts", - "columnsFrom": [ - "post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "likes_ap_id_unique": { - "name": "likes_ap_id_unique", - "nullsNotDistinct": false, - "columns": [ - "ap_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.media": { - "name": "media", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "post_id": { - "name": "post_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "url": { - "name": "url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "alt_text": { - "name": "alt_text", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "mime_type": { - "name": "mime_type", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "width": { - "name": "width", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "height": { - "name": "height", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "media_user_idx": { - "name": "media_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "media_post_idx": { - "name": "media_post_idx", - "columns": [ - { - "expression": "post_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "media_user_id_users_id_fk": { - "name": "media_user_id_users_id_fk", - "tableFrom": "media", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "media_post_id_posts_id_fk": { - "name": "media_post_id_posts_id_fk", - "tableFrom": "media", - "tableTo": "posts", - "columnsFrom": [ - "post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.muted_nodes": { - "name": "muted_nodes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "node_domain": { - "name": "node_domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "muted_nodes_user_idx": { - "name": "muted_nodes_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "muted_nodes_domain_idx": { - "name": "muted_nodes_domain_idx", - "columns": [ - { - "expression": "node_domain", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "muted_nodes_user_id_users_id_fk": { - "name": "muted_nodes_user_id_users_id_fk", - "tableFrom": "muted_nodes", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.mutes": { - "name": "mutes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "muted_user_id": { - "name": "muted_user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "mutes_user_idx": { - "name": "mutes_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "mutes_muted_user_idx": { - "name": "mutes_muted_user_idx", - "columns": [ - { - "expression": "muted_user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "mutes_user_id_users_id_fk": { - "name": "mutes_user_id_users_id_fk", - "tableFrom": "mutes", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "mutes_muted_user_id_users_id_fk": { - "name": "mutes_muted_user_id_users_id_fk", - "tableFrom": "mutes", - "tableTo": "users", - "columnsFrom": [ - "muted_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.nodes": { - "name": "nodes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "domain": { - "name": "domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "long_description": { - "name": "long_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "rules": { - "name": "rules", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "banner_url": { - "name": "banner_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "logo_url": { - "name": "logo_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "favicon_url": { - "name": "favicon_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "accent_color": { - "name": "accent_color", - "type": "text", - "primaryKey": false, - "notNull": false, - "default": "'#FFFFFF'" - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "is_nsfw": { - "name": "is_nsfw", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "turnstile_site_key": { - "name": "turnstile_site_key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "turnstile_secret_key": { - "name": "turnstile_secret_key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "nodes_domain_unique": { - "name": "nodes_domain_unique", - "nullsNotDistinct": false, - "columns": [ - "domain" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.notifications": { - "name": "notifications", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "actor_id": { - "name": "actor_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "actor_handle": { - "name": "actor_handle", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "actor_display_name": { - "name": "actor_display_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "actor_avatar_url": { - "name": "actor_avatar_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "actor_node_domain": { - "name": "actor_node_domain", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "post_id": { - "name": "post_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "post_content": { - "name": "post_content", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "read_at": { - "name": "read_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "notifications_user_idx": { - "name": "notifications_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "notifications_created_idx": { - "name": "notifications_created_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "notifications_user_id_users_id_fk": { - "name": "notifications_user_id_users_id_fk", - "tableFrom": "notifications", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "notifications_actor_id_users_id_fk": { - "name": "notifications_actor_id_users_id_fk", - "tableFrom": "notifications", - "tableTo": "users", - "columnsFrom": [ - "actor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "notifications_post_id_posts_id_fk": { - "name": "notifications_post_id_posts_id_fk", - "tableFrom": "notifications", - "tableTo": "posts", - "columnsFrom": [ - "post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.posts": { - "name": "posts", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "bot_id": { - "name": "bot_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "reply_to_id": { - "name": "reply_to_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "repost_of_id": { - "name": "repost_of_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "swarm_reply_to_id": { - "name": "swarm_reply_to_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "swarm_reply_to_content": { - "name": "swarm_reply_to_content", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "swarm_reply_to_author": { - "name": "swarm_reply_to_author", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "likes_count": { - "name": "likes_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "reposts_count": { - "name": "reposts_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "replies_count": { - "name": "replies_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "is_nsfw": { - "name": "is_nsfw", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "is_removed": { - "name": "is_removed", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "removed_at": { - "name": "removed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "removed_by": { - "name": "removed_by", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "removed_reason": { - "name": "removed_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "ap_id": { - "name": "ap_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "ap_url": { - "name": "ap_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_url": { - "name": "link_preview_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_title": { - "name": "link_preview_title", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_description": { - "name": "link_preview_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_image": { - "name": "link_preview_image", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "posts_user_id_idx": { - "name": "posts_user_id_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "posts_bot_id_idx": { - "name": "posts_bot_id_idx", - "columns": [ - { - "expression": "bot_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "posts_created_at_idx": { - "name": "posts_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "posts_reply_to_idx": { - "name": "posts_reply_to_idx", - "columns": [ - { - "expression": "reply_to_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "posts_removed_idx": { - "name": "posts_removed_idx", - "columns": [ - { - "expression": "is_removed", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "posts_nsfw_idx": { - "name": "posts_nsfw_idx", - "columns": [ - { - "expression": "is_nsfw", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "posts_user_id_users_id_fk": { - "name": "posts_user_id_users_id_fk", - "tableFrom": "posts", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "posts_bot_id_bots_id_fk": { - "name": "posts_bot_id_bots_id_fk", - "tableFrom": "posts", - "tableTo": "bots", - "columnsFrom": [ - "bot_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "posts_removed_by_users_id_fk": { - "name": "posts_removed_by_users_id_fk", - "tableFrom": "posts", - "tableTo": "users", - "columnsFrom": [ - "removed_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "posts_ap_id_unique": { - "name": "posts_ap_id_unique", - "nullsNotDistinct": false, - "columns": [ - "ap_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.remote_followers": { - "name": "remote_followers", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "actor_url": { - "name": "actor_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "inbox_url": { - "name": "inbox_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "shared_inbox_url": { - "name": "shared_inbox_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "handle": { - "name": "handle", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "activity_id": { - "name": "activity_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "remote_followers_user_idx": { - "name": "remote_followers_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_followers_actor_idx": { - "name": "remote_followers_actor_idx", - "columns": [ - { - "expression": "actor_url", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_followers_user_actor_unique": { - "name": "remote_followers_user_actor_unique", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "actor_url", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "remote_followers_user_id_users_id_fk": { - "name": "remote_followers_user_id_users_id_fk", - "tableFrom": "remote_followers", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.remote_follows": { - "name": "remote_follows", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "follower_id": { - "name": "follower_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "target_handle": { - "name": "target_handle", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "target_actor_url": { - "name": "target_actor_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "inbox_url": { - "name": "inbox_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "activity_id": { - "name": "activity_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "display_name": { - "name": "display_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "bio": { - "name": "bio", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "avatar_url": { - "name": "avatar_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "remote_follows_follower_idx": { - "name": "remote_follows_follower_idx", - "columns": [ - { - "expression": "follower_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_follows_target_idx": { - "name": "remote_follows_target_idx", - "columns": [ - { - "expression": "target_handle", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "remote_follows_follower_id_users_id_fk": { - "name": "remote_follows_follower_id_users_id_fk", - "tableFrom": "remote_follows", - "tableTo": "users", - "columnsFrom": [ - "follower_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.remote_likes": { - "name": "remote_likes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "post_id": { - "name": "post_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "actor_handle": { - "name": "actor_handle", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "actor_node_domain": { - "name": "actor_node_domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "remote_likes_post_idx": { - "name": "remote_likes_post_idx", - "columns": [ - { - "expression": "post_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_likes_actor_idx": { - "name": "remote_likes_actor_idx", - "columns": [ - { - "expression": "actor_handle", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "actor_node_domain", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_likes_unique": { - "name": "remote_likes_unique", - "columns": [ - { - "expression": "post_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "actor_handle", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "actor_node_domain", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "remote_likes_post_id_posts_id_fk": { - "name": "remote_likes_post_id_posts_id_fk", - "tableFrom": "remote_likes", - "tableTo": "posts", - "columnsFrom": [ - "post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.remote_posts": { - "name": "remote_posts", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "ap_id": { - "name": "ap_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "author_handle": { - "name": "author_handle", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "author_actor_url": { - "name": "author_actor_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "author_display_name": { - "name": "author_display_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "author_avatar_url": { - "name": "author_avatar_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "published_at": { - "name": "published_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "link_preview_url": { - "name": "link_preview_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_title": { - "name": "link_preview_title", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_description": { - "name": "link_preview_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_image": { - "name": "link_preview_image", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "media_json": { - "name": "media_json", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "fetched_at": { - "name": "fetched_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "remote_posts_author_idx": { - "name": "remote_posts_author_idx", - "columns": [ - { - "expression": "author_handle", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_posts_published_idx": { - "name": "remote_posts_published_idx", - "columns": [ - { - "expression": "published_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_posts_ap_id_idx": { - "name": "remote_posts_ap_id_idx", - "columns": [ - { - "expression": "ap_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "remote_posts_ap_id_unique": { - "name": "remote_posts_ap_id_unique", - "nullsNotDistinct": false, - "columns": [ - "ap_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.remote_reposts": { - "name": "remote_reposts", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "post_id": { - "name": "post_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "actor_handle": { - "name": "actor_handle", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "actor_node_domain": { - "name": "actor_node_domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "remote_reposts_post_idx": { - "name": "remote_reposts_post_idx", - "columns": [ - { - "expression": "post_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_reposts_actor_idx": { - "name": "remote_reposts_actor_idx", - "columns": [ - { - "expression": "actor_handle", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "actor_node_domain", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_reposts_unique": { - "name": "remote_reposts_unique", - "columns": [ - { - "expression": "post_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "actor_handle", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "actor_node_domain", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "remote_reposts_post_id_posts_id_fk": { - "name": "remote_reposts_post_id_posts_id_fk", - "tableFrom": "remote_reposts", - "tableTo": "posts", - "columnsFrom": [ - "post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.reports": { - "name": "reports", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "reporter_id": { - "name": "reporter_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "target_type": { - "name": "target_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "target_id": { - "name": "target_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'open'" - }, - "resolved_at": { - "name": "resolved_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "resolved_by": { - "name": "resolved_by", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "resolution_note": { - "name": "resolution_note", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "reports_status_idx": { - "name": "reports_status_idx", - "columns": [ - { - "expression": "status", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "reports_target_idx": { - "name": "reports_target_idx", - "columns": [ - { - "expression": "target_type", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "target_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "reports_reporter_idx": { - "name": "reports_reporter_idx", - "columns": [ - { - "expression": "reporter_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "reports_reporter_id_users_id_fk": { - "name": "reports_reporter_id_users_id_fk", - "tableFrom": "reports", - "tableTo": "users", - "columnsFrom": [ - "reporter_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "reports_resolved_by_users_id_fk": { - "name": "reports_resolved_by_users_id_fk", - "tableFrom": "reports", - "tableTo": "users", - "columnsFrom": [ - "resolved_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.sessions": { - "name": "sessions", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "sessions_token_idx": { - "name": "sessions_token_idx", - "columns": [ - { - "expression": "token", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "sessions_user_idx": { - "name": "sessions_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "sessions_user_id_users_id_fk": { - "name": "sessions_user_id_users_id_fk", - "tableFrom": "sessions", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "sessions_token_unique": { - "name": "sessions_token_unique", - "nullsNotDistinct": false, - "columns": [ - "token" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.swarm_nodes": { - "name": "swarm_nodes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "domain": { - "name": "domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "logo_url": { - "name": "logo_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "software_version": { - "name": "software_version", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "user_count": { - "name": "user_count", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "post_count": { - "name": "post_count", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "is_nsfw": { - "name": "is_nsfw", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "discovered_via": { - "name": "discovered_via", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "discovered_at": { - "name": "discovered_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "last_seen_at": { - "name": "last_seen_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "last_sync_at": { - "name": "last_sync_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "consecutive_failures": { - "name": "consecutive_failures", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "is_active": { - "name": "is_active", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "trust_score": { - "name": "trust_score", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 50 - }, - "capabilities": { - "name": "capabilities", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "swarm_nodes_domain_idx": { - "name": "swarm_nodes_domain_idx", - "columns": [ - { - "expression": "domain", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "swarm_nodes_active_idx": { - "name": "swarm_nodes_active_idx", - "columns": [ - { - "expression": "is_active", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "swarm_nodes_last_seen_idx": { - "name": "swarm_nodes_last_seen_idx", - "columns": [ - { - "expression": "last_seen_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "swarm_nodes_trust_idx": { - "name": "swarm_nodes_trust_idx", - "columns": [ - { - "expression": "trust_score", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "swarm_nodes_nsfw_idx": { - "name": "swarm_nodes_nsfw_idx", - "columns": [ - { - "expression": "is_nsfw", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "swarm_nodes_domain_unique": { - "name": "swarm_nodes_domain_unique", - "nullsNotDistinct": false, - "columns": [ - "domain" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.swarm_seeds": { - "name": "swarm_seeds", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "domain": { - "name": "domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "priority": { - "name": "priority", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 100 - }, - "is_enabled": { - "name": "is_enabled", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "last_contact_at": { - "name": "last_contact_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "consecutive_failures": { - "name": "consecutive_failures", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "swarm_seeds_enabled_idx": { - "name": "swarm_seeds_enabled_idx", - "columns": [ - { - "expression": "is_enabled", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "swarm_seeds_priority_idx": { - "name": "swarm_seeds_priority_idx", - "columns": [ - { - "expression": "priority", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "swarm_seeds_domain_unique": { - "name": "swarm_seeds_domain_unique", - "nullsNotDistinct": false, - "columns": [ - "domain" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.swarm_sync_log": { - "name": "swarm_sync_log", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "remote_domain": { - "name": "remote_domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "direction": { - "name": "direction", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "nodes_received": { - "name": "nodes_received", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "nodes_sent": { - "name": "nodes_sent", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "handles_received": { - "name": "handles_received", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "handles_sent": { - "name": "handles_sent", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "success": { - "name": "success", - "type": "boolean", - "primaryKey": false, - "notNull": true - }, - "error_message": { - "name": "error_message", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "duration_ms": { - "name": "duration_ms", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "swarm_sync_log_remote_idx": { - "name": "swarm_sync_log_remote_idx", - "columns": [ - { - "expression": "remote_domain", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "swarm_sync_log_created_idx": { - "name": "swarm_sync_log_created_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.users": { - "name": "users", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "did": { - "name": "did", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "handle": { - "name": "handle", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "password_hash": { - "name": "password_hash", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "display_name": { - "name": "display_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "bio": { - "name": "bio", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "avatar_url": { - "name": "avatar_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "header_url": { - "name": "header_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "private_key_encrypted": { - "name": "private_key_encrypted", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "node_id": { - "name": "node_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "is_bot": { - "name": "is_bot", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "bot_owner_id": { - "name": "bot_owner_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "is_nsfw": { - "name": "is_nsfw", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "nsfw_enabled": { - "name": "nsfw_enabled", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "age_verified_at": { - "name": "age_verified_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "is_suspended": { - "name": "is_suspended", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "suspension_reason": { - "name": "suspension_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "suspended_at": { - "name": "suspended_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "is_silenced": { - "name": "is_silenced", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "silence_reason": { - "name": "silence_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "silenced_at": { - "name": "silenced_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "moved_to": { - "name": "moved_to", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "moved_from": { - "name": "moved_from", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "migrated_at": { - "name": "migrated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "followers_count": { - "name": "followers_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "following_count": { - "name": "following_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "posts_count": { - "name": "posts_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "website": { - "name": "website", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "users_handle_idx": { - "name": "users_handle_idx", - "columns": [ - { - "expression": "handle", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_did_idx": { - "name": "users_did_idx", - "columns": [ - { - "expression": "did", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_suspended_idx": { - "name": "users_suspended_idx", - "columns": [ - { - "expression": "is_suspended", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_silenced_idx": { - "name": "users_silenced_idx", - "columns": [ - { - "expression": "is_silenced", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_is_bot_idx": { - "name": "users_is_bot_idx", - "columns": [ - { - "expression": "is_bot", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_bot_owner_idx": { - "name": "users_bot_owner_idx", - "columns": [ - { - "expression": "bot_owner_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_nsfw_idx": { - "name": "users_nsfw_idx", - "columns": [ - { - "expression": "is_nsfw", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "users_node_id_nodes_id_fk": { - "name": "users_node_id_nodes_id_fk", - "tableFrom": "users", - "tableTo": "nodes", - "columnsFrom": [ - "node_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "users_bot_owner_id_users_id_fk": { - "name": "users_bot_owner_id_users_id_fk", - "tableFrom": "users", - "tableTo": "users", - "columnsFrom": [ - "bot_owner_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "users_did_unique": { - "name": "users_did_unique", - "nullsNotDistinct": false, - "columns": [ - "did" - ] - }, - "users_handle_unique": { - "name": "users_handle_unique", - "nullsNotDistinct": false, - "columns": [ - "handle" - ] - }, - "users_email_unique": { - "name": "users_email_unique", - "nullsNotDistinct": false, - "columns": [ - "email" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": {}, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/drizzle/meta/0008_snapshot.json b/drizzle/meta/0008_snapshot.json deleted file mode 100644 index f4ace08..0000000 --- a/drizzle/meta/0008_snapshot.json +++ /dev/null @@ -1,4308 +0,0 @@ -{ - "id": "8199ab3b-1fc4-493c-86c0-5d7bde7ab5cc", - "prevId": "7eb1ca27-9c1e-4783-ab75-9b2c26c06b52", - "version": "7", - "dialect": "postgresql", - "tables": { - "public.blocks": { - "name": "blocks", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "blocked_user_id": { - "name": "blocked_user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "blocks_user_idx": { - "name": "blocks_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "blocks_blocked_user_idx": { - "name": "blocks_blocked_user_idx", - "columns": [ - { - "expression": "blocked_user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "blocks_user_id_users_id_fk": { - "name": "blocks_user_id_users_id_fk", - "tableFrom": "blocks", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "blocks_blocked_user_id_users_id_fk": { - "name": "blocks_blocked_user_id_users_id_fk", - "tableFrom": "blocks", - "tableTo": "users", - "columnsFrom": [ - "blocked_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.bot_activity_logs": { - "name": "bot_activity_logs", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "bot_id": { - "name": "bot_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "details": { - "name": "details", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "success": { - "name": "success", - "type": "boolean", - "primaryKey": false, - "notNull": true - }, - "error_message": { - "name": "error_message", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "bot_activity_logs_bot_idx": { - "name": "bot_activity_logs_bot_idx", - "columns": [ - { - "expression": "bot_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_activity_logs_action_idx": { - "name": "bot_activity_logs_action_idx", - "columns": [ - { - "expression": "action", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_activity_logs_created_idx": { - "name": "bot_activity_logs_created_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "bot_activity_logs_bot_id_bots_id_fk": { - "name": "bot_activity_logs_bot_id_bots_id_fk", - "tableFrom": "bot_activity_logs", - "tableTo": "bots", - "columnsFrom": [ - "bot_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.bot_content_items": { - "name": "bot_content_items", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "source_id": { - "name": "source_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "external_id": { - "name": "external_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "title": { - "name": "title", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "url": { - "name": "url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "published_at": { - "name": "published_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "fetched_at": { - "name": "fetched_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "is_processed": { - "name": "is_processed", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "processed_at": { - "name": "processed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "post_id": { - "name": "post_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "interest_score": { - "name": "interest_score", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "interest_reason": { - "name": "interest_reason", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "bot_content_items_source_idx": { - "name": "bot_content_items_source_idx", - "columns": [ - { - "expression": "source_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_content_items_processed_idx": { - "name": "bot_content_items_processed_idx", - "columns": [ - { - "expression": "is_processed", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_content_items_external_idx": { - "name": "bot_content_items_external_idx", - "columns": [ - { - "expression": "external_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "bot_content_items_source_id_bot_content_sources_id_fk": { - "name": "bot_content_items_source_id_bot_content_sources_id_fk", - "tableFrom": "bot_content_items", - "tableTo": "bot_content_sources", - "columnsFrom": [ - "source_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "bot_content_items_post_id_posts_id_fk": { - "name": "bot_content_items_post_id_posts_id_fk", - "tableFrom": "bot_content_items", - "tableTo": "posts", - "columnsFrom": [ - "post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.bot_content_sources": { - "name": "bot_content_sources", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "bot_id": { - "name": "bot_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "url": { - "name": "url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "subreddit": { - "name": "subreddit", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "api_key_encrypted": { - "name": "api_key_encrypted", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "source_config": { - "name": "source_config", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "keywords": { - "name": "keywords", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "is_active": { - "name": "is_active", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "last_fetch_at": { - "name": "last_fetch_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "last_error": { - "name": "last_error", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "consecutive_errors": { - "name": "consecutive_errors", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "bot_content_sources_bot_idx": { - "name": "bot_content_sources_bot_idx", - "columns": [ - { - "expression": "bot_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_content_sources_type_idx": { - "name": "bot_content_sources_type_idx", - "columns": [ - { - "expression": "type", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "bot_content_sources_bot_id_bots_id_fk": { - "name": "bot_content_sources_bot_id_bots_id_fk", - "tableFrom": "bot_content_sources", - "tableTo": "bots", - "columnsFrom": [ - "bot_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.bot_mentions": { - "name": "bot_mentions", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "bot_id": { - "name": "bot_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "post_id": { - "name": "post_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "author_id": { - "name": "author_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "is_processed": { - "name": "is_processed", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "processed_at": { - "name": "processed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "response_post_id": { - "name": "response_post_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "is_remote": { - "name": "is_remote", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "remote_actor_url": { - "name": "remote_actor_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "bot_mentions_bot_idx": { - "name": "bot_mentions_bot_idx", - "columns": [ - { - "expression": "bot_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_mentions_processed_idx": { - "name": "bot_mentions_processed_idx", - "columns": [ - { - "expression": "is_processed", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_mentions_created_idx": { - "name": "bot_mentions_created_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "bot_mentions_bot_id_bots_id_fk": { - "name": "bot_mentions_bot_id_bots_id_fk", - "tableFrom": "bot_mentions", - "tableTo": "bots", - "columnsFrom": [ - "bot_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "bot_mentions_post_id_posts_id_fk": { - "name": "bot_mentions_post_id_posts_id_fk", - "tableFrom": "bot_mentions", - "tableTo": "posts", - "columnsFrom": [ - "post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "bot_mentions_author_id_users_id_fk": { - "name": "bot_mentions_author_id_users_id_fk", - "tableFrom": "bot_mentions", - "tableTo": "users", - "columnsFrom": [ - "author_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "bot_mentions_response_post_id_posts_id_fk": { - "name": "bot_mentions_response_post_id_posts_id_fk", - "tableFrom": "bot_mentions", - "tableTo": "posts", - "columnsFrom": [ - "response_post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.bot_rate_limits": { - "name": "bot_rate_limits", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "bot_id": { - "name": "bot_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "window_start": { - "name": "window_start", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "window_type": { - "name": "window_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "post_count": { - "name": "post_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "reply_count": { - "name": "reply_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "bot_rate_limits_bot_window_idx": { - "name": "bot_rate_limits_bot_window_idx", - "columns": [ - { - "expression": "bot_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "window_start", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "bot_rate_limits_bot_id_bots_id_fk": { - "name": "bot_rate_limits_bot_id_bots_id_fk", - "tableFrom": "bot_rate_limits", - "tableTo": "bots", - "columnsFrom": [ - "bot_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.bots": { - "name": "bots", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "owner_id": { - "name": "owner_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "personality_config": { - "name": "personality_config", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "llm_provider": { - "name": "llm_provider", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "llm_model": { - "name": "llm_model", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "llm_api_key_encrypted": { - "name": "llm_api_key_encrypted", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "schedule_config": { - "name": "schedule_config", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "autonomous_mode": { - "name": "autonomous_mode", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "is_active": { - "name": "is_active", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "is_suspended": { - "name": "is_suspended", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "suspension_reason": { - "name": "suspension_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "suspended_at": { - "name": "suspended_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "last_post_at": { - "name": "last_post_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "bots_user_id_idx": { - "name": "bots_user_id_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bots_owner_id_idx": { - "name": "bots_owner_id_idx", - "columns": [ - { - "expression": "owner_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bots_active_idx": { - "name": "bots_active_idx", - "columns": [ - { - "expression": "is_active", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "bots_user_id_users_id_fk": { - "name": "bots_user_id_users_id_fk", - "tableFrom": "bots", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "bots_owner_id_users_id_fk": { - "name": "bots_owner_id_users_id_fk", - "tableFrom": "bots", - "tableTo": "users", - "columnsFrom": [ - "owner_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.chat_conversations": { - "name": "chat_conversations", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'direct'" - }, - "participant1_id": { - "name": "participant1_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "participant2_handle": { - "name": "participant2_handle", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "last_message_at": { - "name": "last_message_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "last_message_preview": { - "name": "last_message_preview", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "chat_conversations_participant1_idx": { - "name": "chat_conversations_participant1_idx", - "columns": [ - { - "expression": "participant1_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "chat_conversations_last_message_idx": { - "name": "chat_conversations_last_message_idx", - "columns": [ - { - "expression": "last_message_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "chat_conversations_unique": { - "name": "chat_conversations_unique", - "columns": [ - { - "expression": "participant1_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "participant2_handle", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "chat_conversations_participant1_id_users_id_fk": { - "name": "chat_conversations_participant1_id_users_id_fk", - "tableFrom": "chat_conversations", - "tableTo": "users", - "columnsFrom": [ - "participant1_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.chat_messages": { - "name": "chat_messages", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "conversation_id": { - "name": "conversation_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "sender_handle": { - "name": "sender_handle", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "sender_display_name": { - "name": "sender_display_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "sender_avatar_url": { - "name": "sender_avatar_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "sender_node_domain": { - "name": "sender_node_domain", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "encrypted_content": { - "name": "encrypted_content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "swarm_message_id": { - "name": "swarm_message_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "delivered_at": { - "name": "delivered_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "read_at": { - "name": "read_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "chat_messages_conversation_idx": { - "name": "chat_messages_conversation_idx", - "columns": [ - { - "expression": "conversation_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "chat_messages_created_idx": { - "name": "chat_messages_created_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "chat_messages_swarm_id_idx": { - "name": "chat_messages_swarm_id_idx", - "columns": [ - { - "expression": "swarm_message_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "chat_messages_conversation_id_chat_conversations_id_fk": { - "name": "chat_messages_conversation_id_chat_conversations_id_fk", - "tableFrom": "chat_messages", - "tableTo": "chat_conversations", - "columnsFrom": [ - "conversation_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "chat_messages_swarm_message_id_unique": { - "name": "chat_messages_swarm_message_id_unique", - "nullsNotDistinct": false, - "columns": [ - "swarm_message_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.chat_typing_indicators": { - "name": "chat_typing_indicators", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "conversation_id": { - "name": "conversation_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "user_handle": { - "name": "user_handle", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "chat_typing_conversation_idx": { - "name": "chat_typing_conversation_idx", - "columns": [ - { - "expression": "conversation_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "chat_typing_expires_idx": { - "name": "chat_typing_expires_idx", - "columns": [ - { - "expression": "expires_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "chat_typing_unique": { - "name": "chat_typing_unique", - "columns": [ - { - "expression": "conversation_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "user_handle", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "chat_typing_indicators_conversation_id_chat_conversations_id_fk": { - "name": "chat_typing_indicators_conversation_id_chat_conversations_id_fk", - "tableFrom": "chat_typing_indicators", - "tableTo": "chat_conversations", - "columnsFrom": [ - "conversation_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.follows": { - "name": "follows", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "follower_id": { - "name": "follower_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "following_id": { - "name": "following_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "ap_id": { - "name": "ap_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "pending": { - "name": "pending", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "follows_follower_idx": { - "name": "follows_follower_idx", - "columns": [ - { - "expression": "follower_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "follows_following_idx": { - "name": "follows_following_idx", - "columns": [ - { - "expression": "following_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "follows_follower_id_users_id_fk": { - "name": "follows_follower_id_users_id_fk", - "tableFrom": "follows", - "tableTo": "users", - "columnsFrom": [ - "follower_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "follows_following_id_users_id_fk": { - "name": "follows_following_id_users_id_fk", - "tableFrom": "follows", - "tableTo": "users", - "columnsFrom": [ - "following_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "follows_ap_id_unique": { - "name": "follows_ap_id_unique", - "nullsNotDistinct": false, - "columns": [ - "ap_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.handle_registry": { - "name": "handle_registry", - "schema": "", - "columns": { - "handle": { - "name": "handle", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "did": { - "name": "did", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "node_domain": { - "name": "node_domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "registered_at": { - "name": "registered_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "handle_registry_updated_idx": { - "name": "handle_registry_updated_idx", - "columns": [ - { - "expression": "updated_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.likes": { - "name": "likes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "post_id": { - "name": "post_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "ap_id": { - "name": "ap_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "likes_user_post_idx": { - "name": "likes_user_post_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "post_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "likes_user_id_users_id_fk": { - "name": "likes_user_id_users_id_fk", - "tableFrom": "likes", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "likes_post_id_posts_id_fk": { - "name": "likes_post_id_posts_id_fk", - "tableFrom": "likes", - "tableTo": "posts", - "columnsFrom": [ - "post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "likes_ap_id_unique": { - "name": "likes_ap_id_unique", - "nullsNotDistinct": false, - "columns": [ - "ap_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.media": { - "name": "media", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "post_id": { - "name": "post_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "url": { - "name": "url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "alt_text": { - "name": "alt_text", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "mime_type": { - "name": "mime_type", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "width": { - "name": "width", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "height": { - "name": "height", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "media_user_idx": { - "name": "media_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "media_post_idx": { - "name": "media_post_idx", - "columns": [ - { - "expression": "post_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "media_user_id_users_id_fk": { - "name": "media_user_id_users_id_fk", - "tableFrom": "media", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "media_post_id_posts_id_fk": { - "name": "media_post_id_posts_id_fk", - "tableFrom": "media", - "tableTo": "posts", - "columnsFrom": [ - "post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.muted_nodes": { - "name": "muted_nodes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "node_domain": { - "name": "node_domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "muted_nodes_user_idx": { - "name": "muted_nodes_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "muted_nodes_domain_idx": { - "name": "muted_nodes_domain_idx", - "columns": [ - { - "expression": "node_domain", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "muted_nodes_user_id_users_id_fk": { - "name": "muted_nodes_user_id_users_id_fk", - "tableFrom": "muted_nodes", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.mutes": { - "name": "mutes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "muted_user_id": { - "name": "muted_user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "mutes_user_idx": { - "name": "mutes_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "mutes_muted_user_idx": { - "name": "mutes_muted_user_idx", - "columns": [ - { - "expression": "muted_user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "mutes_user_id_users_id_fk": { - "name": "mutes_user_id_users_id_fk", - "tableFrom": "mutes", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "mutes_muted_user_id_users_id_fk": { - "name": "mutes_muted_user_id_users_id_fk", - "tableFrom": "mutes", - "tableTo": "users", - "columnsFrom": [ - "muted_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.nodes": { - "name": "nodes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "domain": { - "name": "domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "long_description": { - "name": "long_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "rules": { - "name": "rules", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "banner_url": { - "name": "banner_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "logo_url": { - "name": "logo_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "favicon_url": { - "name": "favicon_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "accent_color": { - "name": "accent_color", - "type": "text", - "primaryKey": false, - "notNull": false, - "default": "'#FFFFFF'" - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "is_nsfw": { - "name": "is_nsfw", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "turnstile_site_key": { - "name": "turnstile_site_key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "turnstile_secret_key": { - "name": "turnstile_secret_key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "nodes_domain_unique": { - "name": "nodes_domain_unique", - "nullsNotDistinct": false, - "columns": [ - "domain" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.notifications": { - "name": "notifications", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "actor_id": { - "name": "actor_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "actor_handle": { - "name": "actor_handle", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "actor_display_name": { - "name": "actor_display_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "actor_avatar_url": { - "name": "actor_avatar_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "actor_node_domain": { - "name": "actor_node_domain", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "post_id": { - "name": "post_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "post_content": { - "name": "post_content", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "read_at": { - "name": "read_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "notifications_user_idx": { - "name": "notifications_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "notifications_created_idx": { - "name": "notifications_created_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "notifications_user_id_users_id_fk": { - "name": "notifications_user_id_users_id_fk", - "tableFrom": "notifications", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "notifications_actor_id_users_id_fk": { - "name": "notifications_actor_id_users_id_fk", - "tableFrom": "notifications", - "tableTo": "users", - "columnsFrom": [ - "actor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "notifications_post_id_posts_id_fk": { - "name": "notifications_post_id_posts_id_fk", - "tableFrom": "notifications", - "tableTo": "posts", - "columnsFrom": [ - "post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.posts": { - "name": "posts", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "bot_id": { - "name": "bot_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "reply_to_id": { - "name": "reply_to_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "repost_of_id": { - "name": "repost_of_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "swarm_reply_to_id": { - "name": "swarm_reply_to_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "swarm_reply_to_content": { - "name": "swarm_reply_to_content", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "swarm_reply_to_author": { - "name": "swarm_reply_to_author", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "likes_count": { - "name": "likes_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "reposts_count": { - "name": "reposts_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "replies_count": { - "name": "replies_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "is_nsfw": { - "name": "is_nsfw", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "is_removed": { - "name": "is_removed", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "removed_at": { - "name": "removed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "removed_by": { - "name": "removed_by", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "removed_reason": { - "name": "removed_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "ap_id": { - "name": "ap_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "ap_url": { - "name": "ap_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_url": { - "name": "link_preview_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_title": { - "name": "link_preview_title", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_description": { - "name": "link_preview_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_image": { - "name": "link_preview_image", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "posts_user_id_idx": { - "name": "posts_user_id_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "posts_bot_id_idx": { - "name": "posts_bot_id_idx", - "columns": [ - { - "expression": "bot_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "posts_created_at_idx": { - "name": "posts_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "posts_reply_to_idx": { - "name": "posts_reply_to_idx", - "columns": [ - { - "expression": "reply_to_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "posts_removed_idx": { - "name": "posts_removed_idx", - "columns": [ - { - "expression": "is_removed", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "posts_nsfw_idx": { - "name": "posts_nsfw_idx", - "columns": [ - { - "expression": "is_nsfw", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "posts_user_id_users_id_fk": { - "name": "posts_user_id_users_id_fk", - "tableFrom": "posts", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "posts_bot_id_bots_id_fk": { - "name": "posts_bot_id_bots_id_fk", - "tableFrom": "posts", - "tableTo": "bots", - "columnsFrom": [ - "bot_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "posts_removed_by_users_id_fk": { - "name": "posts_removed_by_users_id_fk", - "tableFrom": "posts", - "tableTo": "users", - "columnsFrom": [ - "removed_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "posts_ap_id_unique": { - "name": "posts_ap_id_unique", - "nullsNotDistinct": false, - "columns": [ - "ap_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.remote_followers": { - "name": "remote_followers", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "actor_url": { - "name": "actor_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "inbox_url": { - "name": "inbox_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "shared_inbox_url": { - "name": "shared_inbox_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "handle": { - "name": "handle", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "activity_id": { - "name": "activity_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "remote_followers_user_idx": { - "name": "remote_followers_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_followers_actor_idx": { - "name": "remote_followers_actor_idx", - "columns": [ - { - "expression": "actor_url", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_followers_user_actor_unique": { - "name": "remote_followers_user_actor_unique", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "actor_url", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "remote_followers_user_id_users_id_fk": { - "name": "remote_followers_user_id_users_id_fk", - "tableFrom": "remote_followers", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.remote_follows": { - "name": "remote_follows", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "follower_id": { - "name": "follower_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "target_handle": { - "name": "target_handle", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "target_actor_url": { - "name": "target_actor_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "inbox_url": { - "name": "inbox_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "activity_id": { - "name": "activity_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "display_name": { - "name": "display_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "bio": { - "name": "bio", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "avatar_url": { - "name": "avatar_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "remote_follows_follower_idx": { - "name": "remote_follows_follower_idx", - "columns": [ - { - "expression": "follower_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_follows_target_idx": { - "name": "remote_follows_target_idx", - "columns": [ - { - "expression": "target_handle", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "remote_follows_follower_id_users_id_fk": { - "name": "remote_follows_follower_id_users_id_fk", - "tableFrom": "remote_follows", - "tableTo": "users", - "columnsFrom": [ - "follower_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.remote_likes": { - "name": "remote_likes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "post_id": { - "name": "post_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "actor_handle": { - "name": "actor_handle", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "actor_node_domain": { - "name": "actor_node_domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "remote_likes_post_idx": { - "name": "remote_likes_post_idx", - "columns": [ - { - "expression": "post_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_likes_actor_idx": { - "name": "remote_likes_actor_idx", - "columns": [ - { - "expression": "actor_handle", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "actor_node_domain", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_likes_unique": { - "name": "remote_likes_unique", - "columns": [ - { - "expression": "post_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "actor_handle", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "actor_node_domain", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "remote_likes_post_id_posts_id_fk": { - "name": "remote_likes_post_id_posts_id_fk", - "tableFrom": "remote_likes", - "tableTo": "posts", - "columnsFrom": [ - "post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.remote_posts": { - "name": "remote_posts", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "ap_id": { - "name": "ap_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "author_handle": { - "name": "author_handle", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "author_actor_url": { - "name": "author_actor_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "author_display_name": { - "name": "author_display_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "author_avatar_url": { - "name": "author_avatar_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "published_at": { - "name": "published_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "link_preview_url": { - "name": "link_preview_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_title": { - "name": "link_preview_title", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_description": { - "name": "link_preview_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_image": { - "name": "link_preview_image", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "media_json": { - "name": "media_json", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "fetched_at": { - "name": "fetched_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "remote_posts_author_idx": { - "name": "remote_posts_author_idx", - "columns": [ - { - "expression": "author_handle", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_posts_published_idx": { - "name": "remote_posts_published_idx", - "columns": [ - { - "expression": "published_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_posts_ap_id_idx": { - "name": "remote_posts_ap_id_idx", - "columns": [ - { - "expression": "ap_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "remote_posts_ap_id_unique": { - "name": "remote_posts_ap_id_unique", - "nullsNotDistinct": false, - "columns": [ - "ap_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.remote_reposts": { - "name": "remote_reposts", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "post_id": { - "name": "post_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "actor_handle": { - "name": "actor_handle", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "actor_node_domain": { - "name": "actor_node_domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "remote_reposts_post_idx": { - "name": "remote_reposts_post_idx", - "columns": [ - { - "expression": "post_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_reposts_actor_idx": { - "name": "remote_reposts_actor_idx", - "columns": [ - { - "expression": "actor_handle", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "actor_node_domain", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_reposts_unique": { - "name": "remote_reposts_unique", - "columns": [ - { - "expression": "post_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "actor_handle", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "actor_node_domain", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "remote_reposts_post_id_posts_id_fk": { - "name": "remote_reposts_post_id_posts_id_fk", - "tableFrom": "remote_reposts", - "tableTo": "posts", - "columnsFrom": [ - "post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.reports": { - "name": "reports", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "reporter_id": { - "name": "reporter_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "target_type": { - "name": "target_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "target_id": { - "name": "target_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'open'" - }, - "resolved_at": { - "name": "resolved_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "resolved_by": { - "name": "resolved_by", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "resolution_note": { - "name": "resolution_note", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "reports_status_idx": { - "name": "reports_status_idx", - "columns": [ - { - "expression": "status", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "reports_target_idx": { - "name": "reports_target_idx", - "columns": [ - { - "expression": "target_type", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "target_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "reports_reporter_idx": { - "name": "reports_reporter_idx", - "columns": [ - { - "expression": "reporter_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "reports_reporter_id_users_id_fk": { - "name": "reports_reporter_id_users_id_fk", - "tableFrom": "reports", - "tableTo": "users", - "columnsFrom": [ - "reporter_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "reports_resolved_by_users_id_fk": { - "name": "reports_resolved_by_users_id_fk", - "tableFrom": "reports", - "tableTo": "users", - "columnsFrom": [ - "resolved_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.sessions": { - "name": "sessions", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "sessions_token_idx": { - "name": "sessions_token_idx", - "columns": [ - { - "expression": "token", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "sessions_user_idx": { - "name": "sessions_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "sessions_user_id_users_id_fk": { - "name": "sessions_user_id_users_id_fk", - "tableFrom": "sessions", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "sessions_token_unique": { - "name": "sessions_token_unique", - "nullsNotDistinct": false, - "columns": [ - "token" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.swarm_nodes": { - "name": "swarm_nodes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "domain": { - "name": "domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "logo_url": { - "name": "logo_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "software_version": { - "name": "software_version", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "user_count": { - "name": "user_count", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "post_count": { - "name": "post_count", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "is_nsfw": { - "name": "is_nsfw", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "discovered_via": { - "name": "discovered_via", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "discovered_at": { - "name": "discovered_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "last_seen_at": { - "name": "last_seen_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "last_sync_at": { - "name": "last_sync_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "consecutive_failures": { - "name": "consecutive_failures", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "is_active": { - "name": "is_active", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "trust_score": { - "name": "trust_score", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 50 - }, - "capabilities": { - "name": "capabilities", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "swarm_nodes_domain_idx": { - "name": "swarm_nodes_domain_idx", - "columns": [ - { - "expression": "domain", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "swarm_nodes_active_idx": { - "name": "swarm_nodes_active_idx", - "columns": [ - { - "expression": "is_active", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "swarm_nodes_last_seen_idx": { - "name": "swarm_nodes_last_seen_idx", - "columns": [ - { - "expression": "last_seen_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "swarm_nodes_trust_idx": { - "name": "swarm_nodes_trust_idx", - "columns": [ - { - "expression": "trust_score", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "swarm_nodes_nsfw_idx": { - "name": "swarm_nodes_nsfw_idx", - "columns": [ - { - "expression": "is_nsfw", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "swarm_nodes_domain_unique": { - "name": "swarm_nodes_domain_unique", - "nullsNotDistinct": false, - "columns": [ - "domain" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.swarm_seeds": { - "name": "swarm_seeds", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "domain": { - "name": "domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "priority": { - "name": "priority", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 100 - }, - "is_enabled": { - "name": "is_enabled", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "last_contact_at": { - "name": "last_contact_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "consecutive_failures": { - "name": "consecutive_failures", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "swarm_seeds_enabled_idx": { - "name": "swarm_seeds_enabled_idx", - "columns": [ - { - "expression": "is_enabled", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "swarm_seeds_priority_idx": { - "name": "swarm_seeds_priority_idx", - "columns": [ - { - "expression": "priority", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "swarm_seeds_domain_unique": { - "name": "swarm_seeds_domain_unique", - "nullsNotDistinct": false, - "columns": [ - "domain" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.swarm_sync_log": { - "name": "swarm_sync_log", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "remote_domain": { - "name": "remote_domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "direction": { - "name": "direction", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "nodes_received": { - "name": "nodes_received", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "nodes_sent": { - "name": "nodes_sent", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "handles_received": { - "name": "handles_received", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "handles_sent": { - "name": "handles_sent", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "success": { - "name": "success", - "type": "boolean", - "primaryKey": false, - "notNull": true - }, - "error_message": { - "name": "error_message", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "duration_ms": { - "name": "duration_ms", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "swarm_sync_log_remote_idx": { - "name": "swarm_sync_log_remote_idx", - "columns": [ - { - "expression": "remote_domain", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "swarm_sync_log_created_idx": { - "name": "swarm_sync_log_created_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.users": { - "name": "users", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "did": { - "name": "did", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "handle": { - "name": "handle", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "password_hash": { - "name": "password_hash", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "display_name": { - "name": "display_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "bio": { - "name": "bio", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "avatar_url": { - "name": "avatar_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "header_url": { - "name": "header_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "private_key_encrypted": { - "name": "private_key_encrypted", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "node_id": { - "name": "node_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "is_bot": { - "name": "is_bot", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "bot_owner_id": { - "name": "bot_owner_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "is_nsfw": { - "name": "is_nsfw", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "nsfw_enabled": { - "name": "nsfw_enabled", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "age_verified_at": { - "name": "age_verified_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "is_suspended": { - "name": "is_suspended", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "suspension_reason": { - "name": "suspension_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "suspended_at": { - "name": "suspended_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "is_silenced": { - "name": "is_silenced", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "silence_reason": { - "name": "silence_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "silenced_at": { - "name": "silenced_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "moved_to": { - "name": "moved_to", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "moved_from": { - "name": "moved_from", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "migrated_at": { - "name": "migrated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "followers_count": { - "name": "followers_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "following_count": { - "name": "following_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "posts_count": { - "name": "posts_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "website": { - "name": "website", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "users_handle_idx": { - "name": "users_handle_idx", - "columns": [ - { - "expression": "handle", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_did_idx": { - "name": "users_did_idx", - "columns": [ - { - "expression": "did", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_suspended_idx": { - "name": "users_suspended_idx", - "columns": [ - { - "expression": "is_suspended", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_silenced_idx": { - "name": "users_silenced_idx", - "columns": [ - { - "expression": "is_silenced", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_is_bot_idx": { - "name": "users_is_bot_idx", - "columns": [ - { - "expression": "is_bot", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_bot_owner_idx": { - "name": "users_bot_owner_idx", - "columns": [ - { - "expression": "bot_owner_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_nsfw_idx": { - "name": "users_nsfw_idx", - "columns": [ - { - "expression": "is_nsfw", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "users_node_id_nodes_id_fk": { - "name": "users_node_id_nodes_id_fk", - "tableFrom": "users", - "tableTo": "nodes", - "columnsFrom": [ - "node_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "users_bot_owner_id_users_id_fk": { - "name": "users_bot_owner_id_users_id_fk", - "tableFrom": "users", - "tableTo": "users", - "columnsFrom": [ - "bot_owner_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "users_did_unique": { - "name": "users_did_unique", - "nullsNotDistinct": false, - "columns": [ - "did" - ] - }, - "users_handle_unique": { - "name": "users_handle_unique", - "nullsNotDistinct": false, - "columns": [ - "handle" - ] - }, - "users_email_unique": { - "name": "users_email_unique", - "nullsNotDistinct": false, - "columns": [ - "email" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": {}, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/drizzle/meta/0009_snapshot.json b/drizzle/meta/0009_snapshot.json deleted file mode 100644 index 2c03736..0000000 --- a/drizzle/meta/0009_snapshot.json +++ /dev/null @@ -1,4435 +0,0 @@ -{ - "id": "be1023ad-691f-4bf7-8882-c2eca57eb1d3", - "prevId": "8199ab3b-1fc4-493c-86c0-5d7bde7ab5cc", - "version": "7", - "dialect": "postgresql", - "tables": { - "public.blocks": { - "name": "blocks", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "blocked_user_id": { - "name": "blocked_user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "blocks_user_idx": { - "name": "blocks_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "blocks_blocked_user_idx": { - "name": "blocks_blocked_user_idx", - "columns": [ - { - "expression": "blocked_user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "blocks_user_id_users_id_fk": { - "name": "blocks_user_id_users_id_fk", - "tableFrom": "blocks", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "blocks_blocked_user_id_users_id_fk": { - "name": "blocks_blocked_user_id_users_id_fk", - "tableFrom": "blocks", - "tableTo": "users", - "columnsFrom": [ - "blocked_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.bot_activity_logs": { - "name": "bot_activity_logs", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "bot_id": { - "name": "bot_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "details": { - "name": "details", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "success": { - "name": "success", - "type": "boolean", - "primaryKey": false, - "notNull": true - }, - "error_message": { - "name": "error_message", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "bot_activity_logs_bot_idx": { - "name": "bot_activity_logs_bot_idx", - "columns": [ - { - "expression": "bot_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_activity_logs_action_idx": { - "name": "bot_activity_logs_action_idx", - "columns": [ - { - "expression": "action", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_activity_logs_created_idx": { - "name": "bot_activity_logs_created_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "bot_activity_logs_bot_id_bots_id_fk": { - "name": "bot_activity_logs_bot_id_bots_id_fk", - "tableFrom": "bot_activity_logs", - "tableTo": "bots", - "columnsFrom": [ - "bot_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.bot_content_items": { - "name": "bot_content_items", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "source_id": { - "name": "source_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "external_id": { - "name": "external_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "title": { - "name": "title", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "url": { - "name": "url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "published_at": { - "name": "published_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "fetched_at": { - "name": "fetched_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "is_processed": { - "name": "is_processed", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "processed_at": { - "name": "processed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "post_id": { - "name": "post_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "interest_score": { - "name": "interest_score", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "interest_reason": { - "name": "interest_reason", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "bot_content_items_source_idx": { - "name": "bot_content_items_source_idx", - "columns": [ - { - "expression": "source_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_content_items_processed_idx": { - "name": "bot_content_items_processed_idx", - "columns": [ - { - "expression": "is_processed", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_content_items_external_idx": { - "name": "bot_content_items_external_idx", - "columns": [ - { - "expression": "external_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "bot_content_items_source_id_bot_content_sources_id_fk": { - "name": "bot_content_items_source_id_bot_content_sources_id_fk", - "tableFrom": "bot_content_items", - "tableTo": "bot_content_sources", - "columnsFrom": [ - "source_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "bot_content_items_post_id_posts_id_fk": { - "name": "bot_content_items_post_id_posts_id_fk", - "tableFrom": "bot_content_items", - "tableTo": "posts", - "columnsFrom": [ - "post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.bot_content_sources": { - "name": "bot_content_sources", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "bot_id": { - "name": "bot_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "url": { - "name": "url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "subreddit": { - "name": "subreddit", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "api_key_encrypted": { - "name": "api_key_encrypted", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "source_config": { - "name": "source_config", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "keywords": { - "name": "keywords", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "is_active": { - "name": "is_active", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "last_fetch_at": { - "name": "last_fetch_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "last_error": { - "name": "last_error", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "consecutive_errors": { - "name": "consecutive_errors", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "bot_content_sources_bot_idx": { - "name": "bot_content_sources_bot_idx", - "columns": [ - { - "expression": "bot_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_content_sources_type_idx": { - "name": "bot_content_sources_type_idx", - "columns": [ - { - "expression": "type", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "bot_content_sources_bot_id_bots_id_fk": { - "name": "bot_content_sources_bot_id_bots_id_fk", - "tableFrom": "bot_content_sources", - "tableTo": "bots", - "columnsFrom": [ - "bot_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.bot_mentions": { - "name": "bot_mentions", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "bot_id": { - "name": "bot_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "post_id": { - "name": "post_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "author_id": { - "name": "author_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "is_processed": { - "name": "is_processed", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "processed_at": { - "name": "processed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "response_post_id": { - "name": "response_post_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "is_remote": { - "name": "is_remote", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "remote_actor_url": { - "name": "remote_actor_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "bot_mentions_bot_idx": { - "name": "bot_mentions_bot_idx", - "columns": [ - { - "expression": "bot_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_mentions_processed_idx": { - "name": "bot_mentions_processed_idx", - "columns": [ - { - "expression": "is_processed", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_mentions_created_idx": { - "name": "bot_mentions_created_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "bot_mentions_bot_id_bots_id_fk": { - "name": "bot_mentions_bot_id_bots_id_fk", - "tableFrom": "bot_mentions", - "tableTo": "bots", - "columnsFrom": [ - "bot_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "bot_mentions_post_id_posts_id_fk": { - "name": "bot_mentions_post_id_posts_id_fk", - "tableFrom": "bot_mentions", - "tableTo": "posts", - "columnsFrom": [ - "post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "bot_mentions_author_id_users_id_fk": { - "name": "bot_mentions_author_id_users_id_fk", - "tableFrom": "bot_mentions", - "tableTo": "users", - "columnsFrom": [ - "author_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "bot_mentions_response_post_id_posts_id_fk": { - "name": "bot_mentions_response_post_id_posts_id_fk", - "tableFrom": "bot_mentions", - "tableTo": "posts", - "columnsFrom": [ - "response_post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.bot_rate_limits": { - "name": "bot_rate_limits", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "bot_id": { - "name": "bot_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "window_start": { - "name": "window_start", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "window_type": { - "name": "window_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "post_count": { - "name": "post_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "reply_count": { - "name": "reply_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "bot_rate_limits_bot_window_idx": { - "name": "bot_rate_limits_bot_window_idx", - "columns": [ - { - "expression": "bot_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "window_start", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "bot_rate_limits_bot_id_bots_id_fk": { - "name": "bot_rate_limits_bot_id_bots_id_fk", - "tableFrom": "bot_rate_limits", - "tableTo": "bots", - "columnsFrom": [ - "bot_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.bots": { - "name": "bots", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "owner_id": { - "name": "owner_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "personality_config": { - "name": "personality_config", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "llm_provider": { - "name": "llm_provider", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "llm_model": { - "name": "llm_model", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "llm_api_key_encrypted": { - "name": "llm_api_key_encrypted", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "schedule_config": { - "name": "schedule_config", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "autonomous_mode": { - "name": "autonomous_mode", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "is_active": { - "name": "is_active", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "is_suspended": { - "name": "is_suspended", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "suspension_reason": { - "name": "suspension_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "suspended_at": { - "name": "suspended_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "last_post_at": { - "name": "last_post_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "bots_user_id_idx": { - "name": "bots_user_id_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bots_owner_id_idx": { - "name": "bots_owner_id_idx", - "columns": [ - { - "expression": "owner_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bots_active_idx": { - "name": "bots_active_idx", - "columns": [ - { - "expression": "is_active", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "bots_user_id_users_id_fk": { - "name": "bots_user_id_users_id_fk", - "tableFrom": "bots", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "bots_owner_id_users_id_fk": { - "name": "bots_owner_id_users_id_fk", - "tableFrom": "bots", - "tableTo": "users", - "columnsFrom": [ - "owner_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.chat_conversations": { - "name": "chat_conversations", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'direct'" - }, - "participant1_id": { - "name": "participant1_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "participant2_handle": { - "name": "participant2_handle", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "last_message_at": { - "name": "last_message_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "last_message_preview": { - "name": "last_message_preview", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "chat_conversations_participant1_idx": { - "name": "chat_conversations_participant1_idx", - "columns": [ - { - "expression": "participant1_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "chat_conversations_last_message_idx": { - "name": "chat_conversations_last_message_idx", - "columns": [ - { - "expression": "last_message_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "chat_conversations_unique": { - "name": "chat_conversations_unique", - "columns": [ - { - "expression": "participant1_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "participant2_handle", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "chat_conversations_participant1_id_users_id_fk": { - "name": "chat_conversations_participant1_id_users_id_fk", - "tableFrom": "chat_conversations", - "tableTo": "users", - "columnsFrom": [ - "participant1_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.chat_messages": { - "name": "chat_messages", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "conversation_id": { - "name": "conversation_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "sender_handle": { - "name": "sender_handle", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "sender_display_name": { - "name": "sender_display_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "sender_avatar_url": { - "name": "sender_avatar_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "sender_node_domain": { - "name": "sender_node_domain", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "encrypted_content": { - "name": "encrypted_content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "sender_encrypted_content": { - "name": "sender_encrypted_content", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "sender_chat_public_key": { - "name": "sender_chat_public_key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "swarm_message_id": { - "name": "swarm_message_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "delivered_at": { - "name": "delivered_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "read_at": { - "name": "read_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "chat_messages_conversation_idx": { - "name": "chat_messages_conversation_idx", - "columns": [ - { - "expression": "conversation_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "chat_messages_created_idx": { - "name": "chat_messages_created_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "chat_messages_swarm_id_idx": { - "name": "chat_messages_swarm_id_idx", - "columns": [ - { - "expression": "swarm_message_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "chat_messages_conversation_id_chat_conversations_id_fk": { - "name": "chat_messages_conversation_id_chat_conversations_id_fk", - "tableFrom": "chat_messages", - "tableTo": "chat_conversations", - "columnsFrom": [ - "conversation_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "chat_messages_swarm_message_id_unique": { - "name": "chat_messages_swarm_message_id_unique", - "nullsNotDistinct": false, - "columns": [ - "swarm_message_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.chat_typing_indicators": { - "name": "chat_typing_indicators", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "conversation_id": { - "name": "conversation_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "user_handle": { - "name": "user_handle", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "chat_typing_conversation_idx": { - "name": "chat_typing_conversation_idx", - "columns": [ - { - "expression": "conversation_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "chat_typing_expires_idx": { - "name": "chat_typing_expires_idx", - "columns": [ - { - "expression": "expires_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "chat_typing_unique": { - "name": "chat_typing_unique", - "columns": [ - { - "expression": "conversation_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "user_handle", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "chat_typing_indicators_conversation_id_chat_conversations_id_fk": { - "name": "chat_typing_indicators_conversation_id_chat_conversations_id_fk", - "tableFrom": "chat_typing_indicators", - "tableTo": "chat_conversations", - "columnsFrom": [ - "conversation_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.follows": { - "name": "follows", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "follower_id": { - "name": "follower_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "following_id": { - "name": "following_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "ap_id": { - "name": "ap_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "pending": { - "name": "pending", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "follows_follower_idx": { - "name": "follows_follower_idx", - "columns": [ - { - "expression": "follower_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "follows_following_idx": { - "name": "follows_following_idx", - "columns": [ - { - "expression": "following_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "follows_follower_id_users_id_fk": { - "name": "follows_follower_id_users_id_fk", - "tableFrom": "follows", - "tableTo": "users", - "columnsFrom": [ - "follower_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "follows_following_id_users_id_fk": { - "name": "follows_following_id_users_id_fk", - "tableFrom": "follows", - "tableTo": "users", - "columnsFrom": [ - "following_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "follows_ap_id_unique": { - "name": "follows_ap_id_unique", - "nullsNotDistinct": false, - "columns": [ - "ap_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.handle_registry": { - "name": "handle_registry", - "schema": "", - "columns": { - "handle": { - "name": "handle", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "did": { - "name": "did", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "node_domain": { - "name": "node_domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "registered_at": { - "name": "registered_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "handle_registry_updated_idx": { - "name": "handle_registry_updated_idx", - "columns": [ - { - "expression": "updated_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.likes": { - "name": "likes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "post_id": { - "name": "post_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "ap_id": { - "name": "ap_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "likes_user_post_idx": { - "name": "likes_user_post_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "post_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "likes_user_id_users_id_fk": { - "name": "likes_user_id_users_id_fk", - "tableFrom": "likes", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "likes_post_id_posts_id_fk": { - "name": "likes_post_id_posts_id_fk", - "tableFrom": "likes", - "tableTo": "posts", - "columnsFrom": [ - "post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "likes_ap_id_unique": { - "name": "likes_ap_id_unique", - "nullsNotDistinct": false, - "columns": [ - "ap_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.media": { - "name": "media", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "post_id": { - "name": "post_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "url": { - "name": "url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "alt_text": { - "name": "alt_text", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "mime_type": { - "name": "mime_type", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "width": { - "name": "width", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "height": { - "name": "height", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "media_user_idx": { - "name": "media_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "media_post_idx": { - "name": "media_post_idx", - "columns": [ - { - "expression": "post_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "media_user_id_users_id_fk": { - "name": "media_user_id_users_id_fk", - "tableFrom": "media", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "media_post_id_posts_id_fk": { - "name": "media_post_id_posts_id_fk", - "tableFrom": "media", - "tableTo": "posts", - "columnsFrom": [ - "post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.muted_nodes": { - "name": "muted_nodes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "node_domain": { - "name": "node_domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "muted_nodes_user_idx": { - "name": "muted_nodes_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "muted_nodes_domain_idx": { - "name": "muted_nodes_domain_idx", - "columns": [ - { - "expression": "node_domain", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "muted_nodes_user_id_users_id_fk": { - "name": "muted_nodes_user_id_users_id_fk", - "tableFrom": "muted_nodes", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.mutes": { - "name": "mutes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "muted_user_id": { - "name": "muted_user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "mutes_user_idx": { - "name": "mutes_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "mutes_muted_user_idx": { - "name": "mutes_muted_user_idx", - "columns": [ - { - "expression": "muted_user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "mutes_user_id_users_id_fk": { - "name": "mutes_user_id_users_id_fk", - "tableFrom": "mutes", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "mutes_muted_user_id_users_id_fk": { - "name": "mutes_muted_user_id_users_id_fk", - "tableFrom": "mutes", - "tableTo": "users", - "columnsFrom": [ - "muted_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.nodes": { - "name": "nodes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "domain": { - "name": "domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "long_description": { - "name": "long_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "rules": { - "name": "rules", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "banner_url": { - "name": "banner_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "logo_url": { - "name": "logo_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "favicon_url": { - "name": "favicon_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "accent_color": { - "name": "accent_color", - "type": "text", - "primaryKey": false, - "notNull": false, - "default": "'#FFFFFF'" - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "private_key_encrypted": { - "name": "private_key_encrypted", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "is_nsfw": { - "name": "is_nsfw", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "turnstile_site_key": { - "name": "turnstile_site_key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "turnstile_secret_key": { - "name": "turnstile_secret_key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "nodes_domain_unique": { - "name": "nodes_domain_unique", - "nullsNotDistinct": false, - "columns": [ - "domain" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.notifications": { - "name": "notifications", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "actor_id": { - "name": "actor_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "actor_handle": { - "name": "actor_handle", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "actor_display_name": { - "name": "actor_display_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "actor_avatar_url": { - "name": "actor_avatar_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "actor_node_domain": { - "name": "actor_node_domain", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "post_id": { - "name": "post_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "post_content": { - "name": "post_content", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "read_at": { - "name": "read_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "notifications_user_idx": { - "name": "notifications_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "notifications_created_idx": { - "name": "notifications_created_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "notifications_user_id_users_id_fk": { - "name": "notifications_user_id_users_id_fk", - "tableFrom": "notifications", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "notifications_actor_id_users_id_fk": { - "name": "notifications_actor_id_users_id_fk", - "tableFrom": "notifications", - "tableTo": "users", - "columnsFrom": [ - "actor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "notifications_post_id_posts_id_fk": { - "name": "notifications_post_id_posts_id_fk", - "tableFrom": "notifications", - "tableTo": "posts", - "columnsFrom": [ - "post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.posts": { - "name": "posts", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "bot_id": { - "name": "bot_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "reply_to_id": { - "name": "reply_to_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "repost_of_id": { - "name": "repost_of_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "swarm_reply_to_id": { - "name": "swarm_reply_to_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "swarm_reply_to_content": { - "name": "swarm_reply_to_content", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "swarm_reply_to_author": { - "name": "swarm_reply_to_author", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "likes_count": { - "name": "likes_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "reposts_count": { - "name": "reposts_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "replies_count": { - "name": "replies_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "is_nsfw": { - "name": "is_nsfw", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "is_removed": { - "name": "is_removed", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "removed_at": { - "name": "removed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "removed_by": { - "name": "removed_by", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "removed_reason": { - "name": "removed_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "ap_id": { - "name": "ap_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "ap_url": { - "name": "ap_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_url": { - "name": "link_preview_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_title": { - "name": "link_preview_title", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_description": { - "name": "link_preview_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_image": { - "name": "link_preview_image", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "posts_user_id_idx": { - "name": "posts_user_id_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "posts_bot_id_idx": { - "name": "posts_bot_id_idx", - "columns": [ - { - "expression": "bot_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "posts_created_at_idx": { - "name": "posts_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "posts_reply_to_idx": { - "name": "posts_reply_to_idx", - "columns": [ - { - "expression": "reply_to_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "posts_removed_idx": { - "name": "posts_removed_idx", - "columns": [ - { - "expression": "is_removed", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "posts_nsfw_idx": { - "name": "posts_nsfw_idx", - "columns": [ - { - "expression": "is_nsfw", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "posts_user_id_users_id_fk": { - "name": "posts_user_id_users_id_fk", - "tableFrom": "posts", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "posts_bot_id_bots_id_fk": { - "name": "posts_bot_id_bots_id_fk", - "tableFrom": "posts", - "tableTo": "bots", - "columnsFrom": [ - "bot_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "posts_removed_by_users_id_fk": { - "name": "posts_removed_by_users_id_fk", - "tableFrom": "posts", - "tableTo": "users", - "columnsFrom": [ - "removed_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "posts_ap_id_unique": { - "name": "posts_ap_id_unique", - "nullsNotDistinct": false, - "columns": [ - "ap_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.remote_followers": { - "name": "remote_followers", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "actor_url": { - "name": "actor_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "inbox_url": { - "name": "inbox_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "shared_inbox_url": { - "name": "shared_inbox_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "handle": { - "name": "handle", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "activity_id": { - "name": "activity_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "remote_followers_user_idx": { - "name": "remote_followers_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_followers_actor_idx": { - "name": "remote_followers_actor_idx", - "columns": [ - { - "expression": "actor_url", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_followers_user_actor_unique": { - "name": "remote_followers_user_actor_unique", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "actor_url", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "remote_followers_user_id_users_id_fk": { - "name": "remote_followers_user_id_users_id_fk", - "tableFrom": "remote_followers", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.remote_follows": { - "name": "remote_follows", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "follower_id": { - "name": "follower_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "target_handle": { - "name": "target_handle", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "target_actor_url": { - "name": "target_actor_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "inbox_url": { - "name": "inbox_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "activity_id": { - "name": "activity_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "display_name": { - "name": "display_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "bio": { - "name": "bio", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "avatar_url": { - "name": "avatar_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "remote_follows_follower_idx": { - "name": "remote_follows_follower_idx", - "columns": [ - { - "expression": "follower_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_follows_target_idx": { - "name": "remote_follows_target_idx", - "columns": [ - { - "expression": "target_handle", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "remote_follows_follower_id_users_id_fk": { - "name": "remote_follows_follower_id_users_id_fk", - "tableFrom": "remote_follows", - "tableTo": "users", - "columnsFrom": [ - "follower_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.remote_identity_cache": { - "name": "remote_identity_cache", - "schema": "", - "columns": { - "did": { - "name": "did", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "fetched_at": { - "name": "fetched_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.remote_likes": { - "name": "remote_likes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "post_id": { - "name": "post_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "actor_handle": { - "name": "actor_handle", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "actor_node_domain": { - "name": "actor_node_domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "remote_likes_post_idx": { - "name": "remote_likes_post_idx", - "columns": [ - { - "expression": "post_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_likes_actor_idx": { - "name": "remote_likes_actor_idx", - "columns": [ - { - "expression": "actor_handle", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "actor_node_domain", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_likes_unique": { - "name": "remote_likes_unique", - "columns": [ - { - "expression": "post_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "actor_handle", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "actor_node_domain", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "remote_likes_post_id_posts_id_fk": { - "name": "remote_likes_post_id_posts_id_fk", - "tableFrom": "remote_likes", - "tableTo": "posts", - "columnsFrom": [ - "post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.remote_posts": { - "name": "remote_posts", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "ap_id": { - "name": "ap_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "author_handle": { - "name": "author_handle", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "author_actor_url": { - "name": "author_actor_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "author_display_name": { - "name": "author_display_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "author_avatar_url": { - "name": "author_avatar_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "published_at": { - "name": "published_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "link_preview_url": { - "name": "link_preview_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_title": { - "name": "link_preview_title", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_description": { - "name": "link_preview_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_image": { - "name": "link_preview_image", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "media_json": { - "name": "media_json", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "fetched_at": { - "name": "fetched_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "remote_posts_author_idx": { - "name": "remote_posts_author_idx", - "columns": [ - { - "expression": "author_handle", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_posts_published_idx": { - "name": "remote_posts_published_idx", - "columns": [ - { - "expression": "published_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_posts_ap_id_idx": { - "name": "remote_posts_ap_id_idx", - "columns": [ - { - "expression": "ap_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "remote_posts_ap_id_unique": { - "name": "remote_posts_ap_id_unique", - "nullsNotDistinct": false, - "columns": [ - "ap_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.remote_reposts": { - "name": "remote_reposts", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "post_id": { - "name": "post_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "actor_handle": { - "name": "actor_handle", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "actor_node_domain": { - "name": "actor_node_domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "remote_reposts_post_idx": { - "name": "remote_reposts_post_idx", - "columns": [ - { - "expression": "post_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_reposts_actor_idx": { - "name": "remote_reposts_actor_idx", - "columns": [ - { - "expression": "actor_handle", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "actor_node_domain", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_reposts_unique": { - "name": "remote_reposts_unique", - "columns": [ - { - "expression": "post_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "actor_handle", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "actor_node_domain", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "remote_reposts_post_id_posts_id_fk": { - "name": "remote_reposts_post_id_posts_id_fk", - "tableFrom": "remote_reposts", - "tableTo": "posts", - "columnsFrom": [ - "post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.reports": { - "name": "reports", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "reporter_id": { - "name": "reporter_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "target_type": { - "name": "target_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "target_id": { - "name": "target_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'open'" - }, - "resolved_at": { - "name": "resolved_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "resolved_by": { - "name": "resolved_by", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "resolution_note": { - "name": "resolution_note", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "reports_status_idx": { - "name": "reports_status_idx", - "columns": [ - { - "expression": "status", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "reports_target_idx": { - "name": "reports_target_idx", - "columns": [ - { - "expression": "target_type", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "target_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "reports_reporter_idx": { - "name": "reports_reporter_idx", - "columns": [ - { - "expression": "reporter_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "reports_reporter_id_users_id_fk": { - "name": "reports_reporter_id_users_id_fk", - "tableFrom": "reports", - "tableTo": "users", - "columnsFrom": [ - "reporter_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "reports_resolved_by_users_id_fk": { - "name": "reports_resolved_by_users_id_fk", - "tableFrom": "reports", - "tableTo": "users", - "columnsFrom": [ - "resolved_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.sessions": { - "name": "sessions", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "sessions_token_idx": { - "name": "sessions_token_idx", - "columns": [ - { - "expression": "token", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "sessions_user_idx": { - "name": "sessions_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "sessions_user_id_users_id_fk": { - "name": "sessions_user_id_users_id_fk", - "tableFrom": "sessions", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "sessions_token_unique": { - "name": "sessions_token_unique", - "nullsNotDistinct": false, - "columns": [ - "token" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.signed_action_dedupe": { - "name": "signed_action_dedupe", - "schema": "", - "columns": { - "action_id": { - "name": "action_id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "did": { - "name": "did", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "nonce": { - "name": "nonce", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "ts": { - "name": "ts", - "type": "bigint", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "signed_action_dedupe_created_idx": { - "name": "signed_action_dedupe_created_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.swarm_nodes": { - "name": "swarm_nodes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "domain": { - "name": "domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "logo_url": { - "name": "logo_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "software_version": { - "name": "software_version", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "user_count": { - "name": "user_count", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "post_count": { - "name": "post_count", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "is_nsfw": { - "name": "is_nsfw", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "discovered_via": { - "name": "discovered_via", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "discovered_at": { - "name": "discovered_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "last_seen_at": { - "name": "last_seen_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "last_sync_at": { - "name": "last_sync_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "consecutive_failures": { - "name": "consecutive_failures", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "is_active": { - "name": "is_active", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "trust_score": { - "name": "trust_score", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 50 - }, - "capabilities": { - "name": "capabilities", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "swarm_nodes_domain_idx": { - "name": "swarm_nodes_domain_idx", - "columns": [ - { - "expression": "domain", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "swarm_nodes_active_idx": { - "name": "swarm_nodes_active_idx", - "columns": [ - { - "expression": "is_active", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "swarm_nodes_last_seen_idx": { - "name": "swarm_nodes_last_seen_idx", - "columns": [ - { - "expression": "last_seen_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "swarm_nodes_trust_idx": { - "name": "swarm_nodes_trust_idx", - "columns": [ - { - "expression": "trust_score", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "swarm_nodes_nsfw_idx": { - "name": "swarm_nodes_nsfw_idx", - "columns": [ - { - "expression": "is_nsfw", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "swarm_nodes_domain_unique": { - "name": "swarm_nodes_domain_unique", - "nullsNotDistinct": false, - "columns": [ - "domain" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.swarm_seeds": { - "name": "swarm_seeds", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "domain": { - "name": "domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "priority": { - "name": "priority", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 100 - }, - "is_enabled": { - "name": "is_enabled", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "last_contact_at": { - "name": "last_contact_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "consecutive_failures": { - "name": "consecutive_failures", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "swarm_seeds_enabled_idx": { - "name": "swarm_seeds_enabled_idx", - "columns": [ - { - "expression": "is_enabled", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "swarm_seeds_priority_idx": { - "name": "swarm_seeds_priority_idx", - "columns": [ - { - "expression": "priority", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "swarm_seeds_domain_unique": { - "name": "swarm_seeds_domain_unique", - "nullsNotDistinct": false, - "columns": [ - "domain" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.swarm_sync_log": { - "name": "swarm_sync_log", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "remote_domain": { - "name": "remote_domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "direction": { - "name": "direction", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "nodes_received": { - "name": "nodes_received", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "nodes_sent": { - "name": "nodes_sent", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "handles_received": { - "name": "handles_received", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "handles_sent": { - "name": "handles_sent", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "success": { - "name": "success", - "type": "boolean", - "primaryKey": false, - "notNull": true - }, - "error_message": { - "name": "error_message", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "duration_ms": { - "name": "duration_ms", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "swarm_sync_log_remote_idx": { - "name": "swarm_sync_log_remote_idx", - "columns": [ - { - "expression": "remote_domain", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "swarm_sync_log_created_idx": { - "name": "swarm_sync_log_created_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.users": { - "name": "users", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "did": { - "name": "did", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "handle": { - "name": "handle", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "password_hash": { - "name": "password_hash", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "display_name": { - "name": "display_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "bio": { - "name": "bio", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "avatar_url": { - "name": "avatar_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "header_url": { - "name": "header_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "private_key_encrypted": { - "name": "private_key_encrypted", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "chat_public_key": { - "name": "chat_public_key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "chat_private_key_encrypted": { - "name": "chat_private_key_encrypted", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "node_id": { - "name": "node_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "is_bot": { - "name": "is_bot", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "bot_owner_id": { - "name": "bot_owner_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "is_nsfw": { - "name": "is_nsfw", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "nsfw_enabled": { - "name": "nsfw_enabled", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "age_verified_at": { - "name": "age_verified_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "is_suspended": { - "name": "is_suspended", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "suspension_reason": { - "name": "suspension_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "suspended_at": { - "name": "suspended_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "is_silenced": { - "name": "is_silenced", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "silence_reason": { - "name": "silence_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "silenced_at": { - "name": "silenced_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "moved_to": { - "name": "moved_to", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "moved_from": { - "name": "moved_from", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "migrated_at": { - "name": "migrated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "followers_count": { - "name": "followers_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "following_count": { - "name": "following_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "posts_count": { - "name": "posts_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "website": { - "name": "website", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "users_handle_idx": { - "name": "users_handle_idx", - "columns": [ - { - "expression": "handle", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_did_idx": { - "name": "users_did_idx", - "columns": [ - { - "expression": "did", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_suspended_idx": { - "name": "users_suspended_idx", - "columns": [ - { - "expression": "is_suspended", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_silenced_idx": { - "name": "users_silenced_idx", - "columns": [ - { - "expression": "is_silenced", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_is_bot_idx": { - "name": "users_is_bot_idx", - "columns": [ - { - "expression": "is_bot", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_bot_owner_idx": { - "name": "users_bot_owner_idx", - "columns": [ - { - "expression": "bot_owner_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_nsfw_idx": { - "name": "users_nsfw_idx", - "columns": [ - { - "expression": "is_nsfw", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "users_node_id_nodes_id_fk": { - "name": "users_node_id_nodes_id_fk", - "tableFrom": "users", - "tableTo": "nodes", - "columnsFrom": [ - "node_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "users_bot_owner_id_users_id_fk": { - "name": "users_bot_owner_id_users_id_fk", - "tableFrom": "users", - "tableTo": "users", - "columnsFrom": [ - "bot_owner_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "users_did_unique": { - "name": "users_did_unique", - "nullsNotDistinct": false, - "columns": [ - "did" - ] - }, - "users_handle_unique": { - "name": "users_handle_unique", - "nullsNotDistinct": false, - "columns": [ - "handle" - ] - }, - "users_email_unique": { - "name": "users_email_unique", - "nullsNotDistinct": false, - "columns": [ - "email" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": {}, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/drizzle/meta/0010_snapshot.json b/drizzle/meta/0010_snapshot.json deleted file mode 100644 index 0b9241a..0000000 --- a/drizzle/meta/0010_snapshot.json +++ /dev/null @@ -1,4793 +0,0 @@ -{ - "id": "d1ed0ac7-89ac-4e64-b931-e1b148e49f62", - "prevId": "be1023ad-691f-4bf7-8882-c2eca57eb1d3", - "version": "7", - "dialect": "postgresql", - "tables": { - "public.blocks": { - "name": "blocks", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "blocked_user_id": { - "name": "blocked_user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "blocks_user_idx": { - "name": "blocks_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "blocks_blocked_user_idx": { - "name": "blocks_blocked_user_idx", - "columns": [ - { - "expression": "blocked_user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "blocks_user_id_users_id_fk": { - "name": "blocks_user_id_users_id_fk", - "tableFrom": "blocks", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "blocks_blocked_user_id_users_id_fk": { - "name": "blocks_blocked_user_id_users_id_fk", - "tableFrom": "blocks", - "tableTo": "users", - "columnsFrom": [ - "blocked_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.bot_activity_logs": { - "name": "bot_activity_logs", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "bot_id": { - "name": "bot_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "details": { - "name": "details", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "success": { - "name": "success", - "type": "boolean", - "primaryKey": false, - "notNull": true - }, - "error_message": { - "name": "error_message", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "bot_activity_logs_bot_idx": { - "name": "bot_activity_logs_bot_idx", - "columns": [ - { - "expression": "bot_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_activity_logs_action_idx": { - "name": "bot_activity_logs_action_idx", - "columns": [ - { - "expression": "action", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_activity_logs_created_idx": { - "name": "bot_activity_logs_created_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "bot_activity_logs_bot_id_bots_id_fk": { - "name": "bot_activity_logs_bot_id_bots_id_fk", - "tableFrom": "bot_activity_logs", - "tableTo": "bots", - "columnsFrom": [ - "bot_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.bot_content_items": { - "name": "bot_content_items", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "source_id": { - "name": "source_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "external_id": { - "name": "external_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "title": { - "name": "title", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "url": { - "name": "url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "published_at": { - "name": "published_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "fetched_at": { - "name": "fetched_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "is_processed": { - "name": "is_processed", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "processed_at": { - "name": "processed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "post_id": { - "name": "post_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "interest_score": { - "name": "interest_score", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "interest_reason": { - "name": "interest_reason", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "bot_content_items_source_idx": { - "name": "bot_content_items_source_idx", - "columns": [ - { - "expression": "source_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_content_items_processed_idx": { - "name": "bot_content_items_processed_idx", - "columns": [ - { - "expression": "is_processed", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_content_items_external_idx": { - "name": "bot_content_items_external_idx", - "columns": [ - { - "expression": "external_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "bot_content_items_source_id_bot_content_sources_id_fk": { - "name": "bot_content_items_source_id_bot_content_sources_id_fk", - "tableFrom": "bot_content_items", - "tableTo": "bot_content_sources", - "columnsFrom": [ - "source_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "bot_content_items_post_id_posts_id_fk": { - "name": "bot_content_items_post_id_posts_id_fk", - "tableFrom": "bot_content_items", - "tableTo": "posts", - "columnsFrom": [ - "post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.bot_content_sources": { - "name": "bot_content_sources", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "bot_id": { - "name": "bot_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "url": { - "name": "url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "subreddit": { - "name": "subreddit", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "api_key_encrypted": { - "name": "api_key_encrypted", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "source_config": { - "name": "source_config", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "keywords": { - "name": "keywords", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "is_active": { - "name": "is_active", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "last_fetch_at": { - "name": "last_fetch_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "last_error": { - "name": "last_error", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "consecutive_errors": { - "name": "consecutive_errors", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "bot_content_sources_bot_idx": { - "name": "bot_content_sources_bot_idx", - "columns": [ - { - "expression": "bot_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_content_sources_type_idx": { - "name": "bot_content_sources_type_idx", - "columns": [ - { - "expression": "type", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "bot_content_sources_bot_id_bots_id_fk": { - "name": "bot_content_sources_bot_id_bots_id_fk", - "tableFrom": "bot_content_sources", - "tableTo": "bots", - "columnsFrom": [ - "bot_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.bot_mentions": { - "name": "bot_mentions", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "bot_id": { - "name": "bot_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "post_id": { - "name": "post_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "author_id": { - "name": "author_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "is_processed": { - "name": "is_processed", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "processed_at": { - "name": "processed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "response_post_id": { - "name": "response_post_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "is_remote": { - "name": "is_remote", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "remote_actor_url": { - "name": "remote_actor_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "bot_mentions_bot_idx": { - "name": "bot_mentions_bot_idx", - "columns": [ - { - "expression": "bot_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_mentions_processed_idx": { - "name": "bot_mentions_processed_idx", - "columns": [ - { - "expression": "is_processed", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_mentions_created_idx": { - "name": "bot_mentions_created_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "bot_mentions_bot_id_bots_id_fk": { - "name": "bot_mentions_bot_id_bots_id_fk", - "tableFrom": "bot_mentions", - "tableTo": "bots", - "columnsFrom": [ - "bot_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "bot_mentions_post_id_posts_id_fk": { - "name": "bot_mentions_post_id_posts_id_fk", - "tableFrom": "bot_mentions", - "tableTo": "posts", - "columnsFrom": [ - "post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "bot_mentions_author_id_users_id_fk": { - "name": "bot_mentions_author_id_users_id_fk", - "tableFrom": "bot_mentions", - "tableTo": "users", - "columnsFrom": [ - "author_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "bot_mentions_response_post_id_posts_id_fk": { - "name": "bot_mentions_response_post_id_posts_id_fk", - "tableFrom": "bot_mentions", - "tableTo": "posts", - "columnsFrom": [ - "response_post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.bot_rate_limits": { - "name": "bot_rate_limits", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "bot_id": { - "name": "bot_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "window_start": { - "name": "window_start", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "window_type": { - "name": "window_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "post_count": { - "name": "post_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "reply_count": { - "name": "reply_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "bot_rate_limits_bot_window_idx": { - "name": "bot_rate_limits_bot_window_idx", - "columns": [ - { - "expression": "bot_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "window_start", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "bot_rate_limits_bot_id_bots_id_fk": { - "name": "bot_rate_limits_bot_id_bots_id_fk", - "tableFrom": "bot_rate_limits", - "tableTo": "bots", - "columnsFrom": [ - "bot_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.bots": { - "name": "bots", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "owner_id": { - "name": "owner_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "personality_config": { - "name": "personality_config", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "llm_provider": { - "name": "llm_provider", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "llm_model": { - "name": "llm_model", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "llm_api_key_encrypted": { - "name": "llm_api_key_encrypted", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "schedule_config": { - "name": "schedule_config", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "autonomous_mode": { - "name": "autonomous_mode", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "is_active": { - "name": "is_active", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "is_suspended": { - "name": "is_suspended", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "suspension_reason": { - "name": "suspension_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "suspended_at": { - "name": "suspended_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "last_post_at": { - "name": "last_post_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "bots_user_id_idx": { - "name": "bots_user_id_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bots_owner_id_idx": { - "name": "bots_owner_id_idx", - "columns": [ - { - "expression": "owner_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bots_active_idx": { - "name": "bots_active_idx", - "columns": [ - { - "expression": "is_active", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "bots_user_id_users_id_fk": { - "name": "bots_user_id_users_id_fk", - "tableFrom": "bots", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "bots_owner_id_users_id_fk": { - "name": "bots_owner_id_users_id_fk", - "tableFrom": "bots", - "tableTo": "users", - "columnsFrom": [ - "owner_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.chat_conversations": { - "name": "chat_conversations", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'direct'" - }, - "participant1_id": { - "name": "participant1_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "participant2_handle": { - "name": "participant2_handle", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "last_message_at": { - "name": "last_message_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "last_message_preview": { - "name": "last_message_preview", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "chat_conversations_participant1_idx": { - "name": "chat_conversations_participant1_idx", - "columns": [ - { - "expression": "participant1_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "chat_conversations_last_message_idx": { - "name": "chat_conversations_last_message_idx", - "columns": [ - { - "expression": "last_message_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "chat_conversations_unique": { - "name": "chat_conversations_unique", - "columns": [ - { - "expression": "participant1_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "participant2_handle", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "chat_conversations_participant1_id_users_id_fk": { - "name": "chat_conversations_participant1_id_users_id_fk", - "tableFrom": "chat_conversations", - "tableTo": "users", - "columnsFrom": [ - "participant1_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.chat_device_bundles": { - "name": "chat_device_bundles", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "did": { - "name": "did", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "device_id": { - "name": "device_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "identity_key": { - "name": "identity_key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "signed_pre_key": { - "name": "signed_pre_key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "signature": { - "name": "signature", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "last_seen_at": { - "name": "last_seen_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "chat_bundles_user_idx": { - "name": "chat_bundles_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "chat_bundles_did_idx": { - "name": "chat_bundles_did_idx", - "columns": [ - { - "expression": "did", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "chat_bundles_device_unique": { - "name": "chat_bundles_device_unique", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "device_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "chat_device_bundles_user_id_users_id_fk": { - "name": "chat_device_bundles_user_id_users_id_fk", - "tableFrom": "chat_device_bundles", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.chat_inbox": { - "name": "chat_inbox", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "recipient_did": { - "name": "recipient_did", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "recipient_device_id": { - "name": "recipient_device_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "sender_did": { - "name": "sender_did", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "envelope_json": { - "name": "envelope_json", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "is_read": { - "name": "is_read", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "chat_inbox_recipient_idx": { - "name": "chat_inbox_recipient_idx", - "columns": [ - { - "expression": "recipient_did", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "recipient_device_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "chat_inbox_created_idx": { - "name": "chat_inbox_created_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.chat_messages": { - "name": "chat_messages", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "conversation_id": { - "name": "conversation_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "sender_handle": { - "name": "sender_handle", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "sender_did": { - "name": "sender_did", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "sender_display_name": { - "name": "sender_display_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "sender_avatar_url": { - "name": "sender_avatar_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "sender_node_domain": { - "name": "sender_node_domain", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "encrypted_content": { - "name": "encrypted_content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "sender_encrypted_content": { - "name": "sender_encrypted_content", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "sender_chat_public_key": { - "name": "sender_chat_public_key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "swarm_message_id": { - "name": "swarm_message_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "delivered_at": { - "name": "delivered_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "read_at": { - "name": "read_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "chat_messages_conversation_idx": { - "name": "chat_messages_conversation_idx", - "columns": [ - { - "expression": "conversation_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "chat_messages_created_idx": { - "name": "chat_messages_created_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "chat_messages_swarm_id_idx": { - "name": "chat_messages_swarm_id_idx", - "columns": [ - { - "expression": "swarm_message_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "chat_messages_conversation_id_chat_conversations_id_fk": { - "name": "chat_messages_conversation_id_chat_conversations_id_fk", - "tableFrom": "chat_messages", - "tableTo": "chat_conversations", - "columnsFrom": [ - "conversation_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "chat_messages_swarm_message_id_unique": { - "name": "chat_messages_swarm_message_id_unique", - "nullsNotDistinct": false, - "columns": [ - "swarm_message_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.chat_one_time_keys": { - "name": "chat_one_time_keys", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "bundle_id": { - "name": "bundle_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "key_id": { - "name": "key_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "chat_otk_bundle_idx": { - "name": "chat_otk_bundle_idx", - "columns": [ - { - "expression": "bundle_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "chat_otk_unique": { - "name": "chat_otk_unique", - "columns": [ - { - "expression": "bundle_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "key_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "chat_one_time_keys_user_id_users_id_fk": { - "name": "chat_one_time_keys_user_id_users_id_fk", - "tableFrom": "chat_one_time_keys", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "chat_one_time_keys_bundle_id_chat_device_bundles_id_fk": { - "name": "chat_one_time_keys_bundle_id_chat_device_bundles_id_fk", - "tableFrom": "chat_one_time_keys", - "tableTo": "chat_device_bundles", - "columnsFrom": [ - "bundle_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.chat_typing_indicators": { - "name": "chat_typing_indicators", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "conversation_id": { - "name": "conversation_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "user_handle": { - "name": "user_handle", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "chat_typing_conversation_idx": { - "name": "chat_typing_conversation_idx", - "columns": [ - { - "expression": "conversation_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "chat_typing_expires_idx": { - "name": "chat_typing_expires_idx", - "columns": [ - { - "expression": "expires_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "chat_typing_unique": { - "name": "chat_typing_unique", - "columns": [ - { - "expression": "conversation_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "user_handle", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "chat_typing_indicators_conversation_id_chat_conversations_id_fk": { - "name": "chat_typing_indicators_conversation_id_chat_conversations_id_fk", - "tableFrom": "chat_typing_indicators", - "tableTo": "chat_conversations", - "columnsFrom": [ - "conversation_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.follows": { - "name": "follows", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "follower_id": { - "name": "follower_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "following_id": { - "name": "following_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "ap_id": { - "name": "ap_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "pending": { - "name": "pending", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "follows_follower_idx": { - "name": "follows_follower_idx", - "columns": [ - { - "expression": "follower_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "follows_following_idx": { - "name": "follows_following_idx", - "columns": [ - { - "expression": "following_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "follows_follower_id_users_id_fk": { - "name": "follows_follower_id_users_id_fk", - "tableFrom": "follows", - "tableTo": "users", - "columnsFrom": [ - "follower_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "follows_following_id_users_id_fk": { - "name": "follows_following_id_users_id_fk", - "tableFrom": "follows", - "tableTo": "users", - "columnsFrom": [ - "following_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "follows_ap_id_unique": { - "name": "follows_ap_id_unique", - "nullsNotDistinct": false, - "columns": [ - "ap_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.handle_registry": { - "name": "handle_registry", - "schema": "", - "columns": { - "handle": { - "name": "handle", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "did": { - "name": "did", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "node_domain": { - "name": "node_domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "registered_at": { - "name": "registered_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "handle_registry_updated_idx": { - "name": "handle_registry_updated_idx", - "columns": [ - { - "expression": "updated_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.likes": { - "name": "likes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "post_id": { - "name": "post_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "ap_id": { - "name": "ap_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "likes_user_post_idx": { - "name": "likes_user_post_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "post_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "likes_user_id_users_id_fk": { - "name": "likes_user_id_users_id_fk", - "tableFrom": "likes", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "likes_post_id_posts_id_fk": { - "name": "likes_post_id_posts_id_fk", - "tableFrom": "likes", - "tableTo": "posts", - "columnsFrom": [ - "post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "likes_ap_id_unique": { - "name": "likes_ap_id_unique", - "nullsNotDistinct": false, - "columns": [ - "ap_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.media": { - "name": "media", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "post_id": { - "name": "post_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "url": { - "name": "url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "alt_text": { - "name": "alt_text", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "mime_type": { - "name": "mime_type", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "width": { - "name": "width", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "height": { - "name": "height", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "media_user_idx": { - "name": "media_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "media_post_idx": { - "name": "media_post_idx", - "columns": [ - { - "expression": "post_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "media_user_id_users_id_fk": { - "name": "media_user_id_users_id_fk", - "tableFrom": "media", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "media_post_id_posts_id_fk": { - "name": "media_post_id_posts_id_fk", - "tableFrom": "media", - "tableTo": "posts", - "columnsFrom": [ - "post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.muted_nodes": { - "name": "muted_nodes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "node_domain": { - "name": "node_domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "muted_nodes_user_idx": { - "name": "muted_nodes_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "muted_nodes_domain_idx": { - "name": "muted_nodes_domain_idx", - "columns": [ - { - "expression": "node_domain", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "muted_nodes_user_id_users_id_fk": { - "name": "muted_nodes_user_id_users_id_fk", - "tableFrom": "muted_nodes", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.mutes": { - "name": "mutes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "muted_user_id": { - "name": "muted_user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "mutes_user_idx": { - "name": "mutes_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "mutes_muted_user_idx": { - "name": "mutes_muted_user_idx", - "columns": [ - { - "expression": "muted_user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "mutes_user_id_users_id_fk": { - "name": "mutes_user_id_users_id_fk", - "tableFrom": "mutes", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "mutes_muted_user_id_users_id_fk": { - "name": "mutes_muted_user_id_users_id_fk", - "tableFrom": "mutes", - "tableTo": "users", - "columnsFrom": [ - "muted_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.nodes": { - "name": "nodes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "domain": { - "name": "domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "long_description": { - "name": "long_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "rules": { - "name": "rules", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "banner_url": { - "name": "banner_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "logo_url": { - "name": "logo_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "favicon_url": { - "name": "favicon_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "accent_color": { - "name": "accent_color", - "type": "text", - "primaryKey": false, - "notNull": false, - "default": "'#FFFFFF'" - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "private_key_encrypted": { - "name": "private_key_encrypted", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "is_nsfw": { - "name": "is_nsfw", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "turnstile_site_key": { - "name": "turnstile_site_key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "turnstile_secret_key": { - "name": "turnstile_secret_key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "nodes_domain_unique": { - "name": "nodes_domain_unique", - "nullsNotDistinct": false, - "columns": [ - "domain" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.notifications": { - "name": "notifications", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "actor_id": { - "name": "actor_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "actor_handle": { - "name": "actor_handle", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "actor_display_name": { - "name": "actor_display_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "actor_avatar_url": { - "name": "actor_avatar_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "actor_node_domain": { - "name": "actor_node_domain", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "post_id": { - "name": "post_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "post_content": { - "name": "post_content", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "read_at": { - "name": "read_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "notifications_user_idx": { - "name": "notifications_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "notifications_created_idx": { - "name": "notifications_created_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "notifications_user_id_users_id_fk": { - "name": "notifications_user_id_users_id_fk", - "tableFrom": "notifications", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "notifications_actor_id_users_id_fk": { - "name": "notifications_actor_id_users_id_fk", - "tableFrom": "notifications", - "tableTo": "users", - "columnsFrom": [ - "actor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "notifications_post_id_posts_id_fk": { - "name": "notifications_post_id_posts_id_fk", - "tableFrom": "notifications", - "tableTo": "posts", - "columnsFrom": [ - "post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.posts": { - "name": "posts", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "bot_id": { - "name": "bot_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "reply_to_id": { - "name": "reply_to_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "repost_of_id": { - "name": "repost_of_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "swarm_reply_to_id": { - "name": "swarm_reply_to_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "swarm_reply_to_content": { - "name": "swarm_reply_to_content", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "swarm_reply_to_author": { - "name": "swarm_reply_to_author", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "likes_count": { - "name": "likes_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "reposts_count": { - "name": "reposts_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "replies_count": { - "name": "replies_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "is_nsfw": { - "name": "is_nsfw", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "is_removed": { - "name": "is_removed", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "removed_at": { - "name": "removed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "removed_by": { - "name": "removed_by", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "removed_reason": { - "name": "removed_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "ap_id": { - "name": "ap_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "ap_url": { - "name": "ap_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_url": { - "name": "link_preview_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_title": { - "name": "link_preview_title", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_description": { - "name": "link_preview_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_image": { - "name": "link_preview_image", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "posts_user_id_idx": { - "name": "posts_user_id_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "posts_bot_id_idx": { - "name": "posts_bot_id_idx", - "columns": [ - { - "expression": "bot_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "posts_created_at_idx": { - "name": "posts_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "posts_reply_to_idx": { - "name": "posts_reply_to_idx", - "columns": [ - { - "expression": "reply_to_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "posts_removed_idx": { - "name": "posts_removed_idx", - "columns": [ - { - "expression": "is_removed", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "posts_nsfw_idx": { - "name": "posts_nsfw_idx", - "columns": [ - { - "expression": "is_nsfw", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "posts_user_id_users_id_fk": { - "name": "posts_user_id_users_id_fk", - "tableFrom": "posts", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "posts_bot_id_bots_id_fk": { - "name": "posts_bot_id_bots_id_fk", - "tableFrom": "posts", - "tableTo": "bots", - "columnsFrom": [ - "bot_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "posts_removed_by_users_id_fk": { - "name": "posts_removed_by_users_id_fk", - "tableFrom": "posts", - "tableTo": "users", - "columnsFrom": [ - "removed_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "posts_ap_id_unique": { - "name": "posts_ap_id_unique", - "nullsNotDistinct": false, - "columns": [ - "ap_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.remote_followers": { - "name": "remote_followers", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "actor_url": { - "name": "actor_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "inbox_url": { - "name": "inbox_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "shared_inbox_url": { - "name": "shared_inbox_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "handle": { - "name": "handle", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "activity_id": { - "name": "activity_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "remote_followers_user_idx": { - "name": "remote_followers_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_followers_actor_idx": { - "name": "remote_followers_actor_idx", - "columns": [ - { - "expression": "actor_url", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_followers_user_actor_unique": { - "name": "remote_followers_user_actor_unique", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "actor_url", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "remote_followers_user_id_users_id_fk": { - "name": "remote_followers_user_id_users_id_fk", - "tableFrom": "remote_followers", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.remote_follows": { - "name": "remote_follows", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "follower_id": { - "name": "follower_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "target_handle": { - "name": "target_handle", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "target_actor_url": { - "name": "target_actor_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "inbox_url": { - "name": "inbox_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "activity_id": { - "name": "activity_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "display_name": { - "name": "display_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "bio": { - "name": "bio", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "avatar_url": { - "name": "avatar_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "remote_follows_follower_idx": { - "name": "remote_follows_follower_idx", - "columns": [ - { - "expression": "follower_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_follows_target_idx": { - "name": "remote_follows_target_idx", - "columns": [ - { - "expression": "target_handle", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "remote_follows_follower_id_users_id_fk": { - "name": "remote_follows_follower_id_users_id_fk", - "tableFrom": "remote_follows", - "tableTo": "users", - "columnsFrom": [ - "follower_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.remote_identity_cache": { - "name": "remote_identity_cache", - "schema": "", - "columns": { - "did": { - "name": "did", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "fetched_at": { - "name": "fetched_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.remote_likes": { - "name": "remote_likes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "post_id": { - "name": "post_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "actor_handle": { - "name": "actor_handle", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "actor_node_domain": { - "name": "actor_node_domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "remote_likes_post_idx": { - "name": "remote_likes_post_idx", - "columns": [ - { - "expression": "post_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_likes_actor_idx": { - "name": "remote_likes_actor_idx", - "columns": [ - { - "expression": "actor_handle", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "actor_node_domain", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_likes_unique": { - "name": "remote_likes_unique", - "columns": [ - { - "expression": "post_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "actor_handle", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "actor_node_domain", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "remote_likes_post_id_posts_id_fk": { - "name": "remote_likes_post_id_posts_id_fk", - "tableFrom": "remote_likes", - "tableTo": "posts", - "columnsFrom": [ - "post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.remote_posts": { - "name": "remote_posts", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "ap_id": { - "name": "ap_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "author_handle": { - "name": "author_handle", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "author_actor_url": { - "name": "author_actor_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "author_display_name": { - "name": "author_display_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "author_avatar_url": { - "name": "author_avatar_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "published_at": { - "name": "published_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "link_preview_url": { - "name": "link_preview_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_title": { - "name": "link_preview_title", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_description": { - "name": "link_preview_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_image": { - "name": "link_preview_image", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "media_json": { - "name": "media_json", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "fetched_at": { - "name": "fetched_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "remote_posts_author_idx": { - "name": "remote_posts_author_idx", - "columns": [ - { - "expression": "author_handle", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_posts_published_idx": { - "name": "remote_posts_published_idx", - "columns": [ - { - "expression": "published_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_posts_ap_id_idx": { - "name": "remote_posts_ap_id_idx", - "columns": [ - { - "expression": "ap_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "remote_posts_ap_id_unique": { - "name": "remote_posts_ap_id_unique", - "nullsNotDistinct": false, - "columns": [ - "ap_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.remote_reposts": { - "name": "remote_reposts", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "post_id": { - "name": "post_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "actor_handle": { - "name": "actor_handle", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "actor_node_domain": { - "name": "actor_node_domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "remote_reposts_post_idx": { - "name": "remote_reposts_post_idx", - "columns": [ - { - "expression": "post_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_reposts_actor_idx": { - "name": "remote_reposts_actor_idx", - "columns": [ - { - "expression": "actor_handle", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "actor_node_domain", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_reposts_unique": { - "name": "remote_reposts_unique", - "columns": [ - { - "expression": "post_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "actor_handle", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "actor_node_domain", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "remote_reposts_post_id_posts_id_fk": { - "name": "remote_reposts_post_id_posts_id_fk", - "tableFrom": "remote_reposts", - "tableTo": "posts", - "columnsFrom": [ - "post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.reports": { - "name": "reports", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "reporter_id": { - "name": "reporter_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "target_type": { - "name": "target_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "target_id": { - "name": "target_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'open'" - }, - "resolved_at": { - "name": "resolved_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "resolved_by": { - "name": "resolved_by", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "resolution_note": { - "name": "resolution_note", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "reports_status_idx": { - "name": "reports_status_idx", - "columns": [ - { - "expression": "status", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "reports_target_idx": { - "name": "reports_target_idx", - "columns": [ - { - "expression": "target_type", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "target_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "reports_reporter_idx": { - "name": "reports_reporter_idx", - "columns": [ - { - "expression": "reporter_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "reports_reporter_id_users_id_fk": { - "name": "reports_reporter_id_users_id_fk", - "tableFrom": "reports", - "tableTo": "users", - "columnsFrom": [ - "reporter_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "reports_resolved_by_users_id_fk": { - "name": "reports_resolved_by_users_id_fk", - "tableFrom": "reports", - "tableTo": "users", - "columnsFrom": [ - "resolved_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.sessions": { - "name": "sessions", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "sessions_token_idx": { - "name": "sessions_token_idx", - "columns": [ - { - "expression": "token", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "sessions_user_idx": { - "name": "sessions_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "sessions_user_id_users_id_fk": { - "name": "sessions_user_id_users_id_fk", - "tableFrom": "sessions", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "sessions_token_unique": { - "name": "sessions_token_unique", - "nullsNotDistinct": false, - "columns": [ - "token" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.signed_action_dedupe": { - "name": "signed_action_dedupe", - "schema": "", - "columns": { - "action_id": { - "name": "action_id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "did": { - "name": "did", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "nonce": { - "name": "nonce", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "ts": { - "name": "ts", - "type": "bigint", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "signed_action_dedupe_created_idx": { - "name": "signed_action_dedupe_created_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.swarm_nodes": { - "name": "swarm_nodes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "domain": { - "name": "domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "logo_url": { - "name": "logo_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "software_version": { - "name": "software_version", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "user_count": { - "name": "user_count", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "post_count": { - "name": "post_count", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "is_nsfw": { - "name": "is_nsfw", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "discovered_via": { - "name": "discovered_via", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "discovered_at": { - "name": "discovered_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "last_seen_at": { - "name": "last_seen_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "last_sync_at": { - "name": "last_sync_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "consecutive_failures": { - "name": "consecutive_failures", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "is_active": { - "name": "is_active", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "trust_score": { - "name": "trust_score", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 50 - }, - "capabilities": { - "name": "capabilities", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "swarm_nodes_domain_idx": { - "name": "swarm_nodes_domain_idx", - "columns": [ - { - "expression": "domain", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "swarm_nodes_active_idx": { - "name": "swarm_nodes_active_idx", - "columns": [ - { - "expression": "is_active", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "swarm_nodes_last_seen_idx": { - "name": "swarm_nodes_last_seen_idx", - "columns": [ - { - "expression": "last_seen_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "swarm_nodes_trust_idx": { - "name": "swarm_nodes_trust_idx", - "columns": [ - { - "expression": "trust_score", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "swarm_nodes_nsfw_idx": { - "name": "swarm_nodes_nsfw_idx", - "columns": [ - { - "expression": "is_nsfw", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "swarm_nodes_domain_unique": { - "name": "swarm_nodes_domain_unique", - "nullsNotDistinct": false, - "columns": [ - "domain" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.swarm_seeds": { - "name": "swarm_seeds", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "domain": { - "name": "domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "priority": { - "name": "priority", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 100 - }, - "is_enabled": { - "name": "is_enabled", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "last_contact_at": { - "name": "last_contact_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "consecutive_failures": { - "name": "consecutive_failures", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "swarm_seeds_enabled_idx": { - "name": "swarm_seeds_enabled_idx", - "columns": [ - { - "expression": "is_enabled", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "swarm_seeds_priority_idx": { - "name": "swarm_seeds_priority_idx", - "columns": [ - { - "expression": "priority", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "swarm_seeds_domain_unique": { - "name": "swarm_seeds_domain_unique", - "nullsNotDistinct": false, - "columns": [ - "domain" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.swarm_sync_log": { - "name": "swarm_sync_log", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "remote_domain": { - "name": "remote_domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "direction": { - "name": "direction", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "nodes_received": { - "name": "nodes_received", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "nodes_sent": { - "name": "nodes_sent", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "handles_received": { - "name": "handles_received", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "handles_sent": { - "name": "handles_sent", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "success": { - "name": "success", - "type": "boolean", - "primaryKey": false, - "notNull": true - }, - "error_message": { - "name": "error_message", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "duration_ms": { - "name": "duration_ms", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "swarm_sync_log_remote_idx": { - "name": "swarm_sync_log_remote_idx", - "columns": [ - { - "expression": "remote_domain", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "swarm_sync_log_created_idx": { - "name": "swarm_sync_log_created_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.users": { - "name": "users", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "did": { - "name": "did", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "handle": { - "name": "handle", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "password_hash": { - "name": "password_hash", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "display_name": { - "name": "display_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "bio": { - "name": "bio", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "avatar_url": { - "name": "avatar_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "header_url": { - "name": "header_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "private_key_encrypted": { - "name": "private_key_encrypted", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "chat_public_key": { - "name": "chat_public_key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "chat_private_key_encrypted": { - "name": "chat_private_key_encrypted", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "node_id": { - "name": "node_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "is_bot": { - "name": "is_bot", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "bot_owner_id": { - "name": "bot_owner_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "is_nsfw": { - "name": "is_nsfw", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "nsfw_enabled": { - "name": "nsfw_enabled", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "age_verified_at": { - "name": "age_verified_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "is_suspended": { - "name": "is_suspended", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "suspension_reason": { - "name": "suspension_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "suspended_at": { - "name": "suspended_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "is_silenced": { - "name": "is_silenced", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "silence_reason": { - "name": "silence_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "silenced_at": { - "name": "silenced_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "moved_to": { - "name": "moved_to", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "moved_from": { - "name": "moved_from", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "migrated_at": { - "name": "migrated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "followers_count": { - "name": "followers_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "following_count": { - "name": "following_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "posts_count": { - "name": "posts_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "website": { - "name": "website", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "users_handle_idx": { - "name": "users_handle_idx", - "columns": [ - { - "expression": "handle", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_did_idx": { - "name": "users_did_idx", - "columns": [ - { - "expression": "did", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_suspended_idx": { - "name": "users_suspended_idx", - "columns": [ - { - "expression": "is_suspended", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_silenced_idx": { - "name": "users_silenced_idx", - "columns": [ - { - "expression": "is_silenced", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_is_bot_idx": { - "name": "users_is_bot_idx", - "columns": [ - { - "expression": "is_bot", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_bot_owner_idx": { - "name": "users_bot_owner_idx", - "columns": [ - { - "expression": "bot_owner_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_nsfw_idx": { - "name": "users_nsfw_idx", - "columns": [ - { - "expression": "is_nsfw", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "users_node_id_nodes_id_fk": { - "name": "users_node_id_nodes_id_fk", - "tableFrom": "users", - "tableTo": "nodes", - "columnsFrom": [ - "node_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "users_bot_owner_id_users_id_fk": { - "name": "users_bot_owner_id_users_id_fk", - "tableFrom": "users", - "tableTo": "users", - "columnsFrom": [ - "bot_owner_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "users_did_unique": { - "name": "users_did_unique", - "nullsNotDistinct": false, - "columns": [ - "did" - ] - }, - "users_handle_unique": { - "name": "users_handle_unique", - "nullsNotDistinct": false, - "columns": [ - "handle" - ] - }, - "users_email_unique": { - "name": "users_email_unique", - "nullsNotDistinct": false, - "columns": [ - "email" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": {}, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/drizzle/meta/0011_snapshot.json b/drizzle/meta/0011_snapshot.json deleted file mode 100644 index 8b6da28..0000000 --- a/drizzle/meta/0011_snapshot.json +++ /dev/null @@ -1,4799 +0,0 @@ -{ - "id": "9c5ad998-ee99-4677-894a-21969787a20c", - "prevId": "d1ed0ac7-89ac-4e64-b931-e1b148e49f62", - "version": "7", - "dialect": "postgresql", - "tables": { - "public.blocks": { - "name": "blocks", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "blocked_user_id": { - "name": "blocked_user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "blocks_user_idx": { - "name": "blocks_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "blocks_blocked_user_idx": { - "name": "blocks_blocked_user_idx", - "columns": [ - { - "expression": "blocked_user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "blocks_user_id_users_id_fk": { - "name": "blocks_user_id_users_id_fk", - "tableFrom": "blocks", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "blocks_blocked_user_id_users_id_fk": { - "name": "blocks_blocked_user_id_users_id_fk", - "tableFrom": "blocks", - "tableTo": "users", - "columnsFrom": [ - "blocked_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.bot_activity_logs": { - "name": "bot_activity_logs", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "bot_id": { - "name": "bot_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "details": { - "name": "details", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "success": { - "name": "success", - "type": "boolean", - "primaryKey": false, - "notNull": true - }, - "error_message": { - "name": "error_message", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "bot_activity_logs_bot_idx": { - "name": "bot_activity_logs_bot_idx", - "columns": [ - { - "expression": "bot_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_activity_logs_action_idx": { - "name": "bot_activity_logs_action_idx", - "columns": [ - { - "expression": "action", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_activity_logs_created_idx": { - "name": "bot_activity_logs_created_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "bot_activity_logs_bot_id_bots_id_fk": { - "name": "bot_activity_logs_bot_id_bots_id_fk", - "tableFrom": "bot_activity_logs", - "tableTo": "bots", - "columnsFrom": [ - "bot_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.bot_content_items": { - "name": "bot_content_items", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "source_id": { - "name": "source_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "external_id": { - "name": "external_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "title": { - "name": "title", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "url": { - "name": "url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "published_at": { - "name": "published_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "fetched_at": { - "name": "fetched_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "is_processed": { - "name": "is_processed", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "processed_at": { - "name": "processed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "post_id": { - "name": "post_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "interest_score": { - "name": "interest_score", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "interest_reason": { - "name": "interest_reason", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "bot_content_items_source_idx": { - "name": "bot_content_items_source_idx", - "columns": [ - { - "expression": "source_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_content_items_processed_idx": { - "name": "bot_content_items_processed_idx", - "columns": [ - { - "expression": "is_processed", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_content_items_external_idx": { - "name": "bot_content_items_external_idx", - "columns": [ - { - "expression": "external_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "bot_content_items_source_id_bot_content_sources_id_fk": { - "name": "bot_content_items_source_id_bot_content_sources_id_fk", - "tableFrom": "bot_content_items", - "tableTo": "bot_content_sources", - "columnsFrom": [ - "source_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "bot_content_items_post_id_posts_id_fk": { - "name": "bot_content_items_post_id_posts_id_fk", - "tableFrom": "bot_content_items", - "tableTo": "posts", - "columnsFrom": [ - "post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.bot_content_sources": { - "name": "bot_content_sources", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "bot_id": { - "name": "bot_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "url": { - "name": "url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "subreddit": { - "name": "subreddit", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "api_key_encrypted": { - "name": "api_key_encrypted", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "source_config": { - "name": "source_config", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "keywords": { - "name": "keywords", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "is_active": { - "name": "is_active", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "last_fetch_at": { - "name": "last_fetch_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "last_error": { - "name": "last_error", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "consecutive_errors": { - "name": "consecutive_errors", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "bot_content_sources_bot_idx": { - "name": "bot_content_sources_bot_idx", - "columns": [ - { - "expression": "bot_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_content_sources_type_idx": { - "name": "bot_content_sources_type_idx", - "columns": [ - { - "expression": "type", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "bot_content_sources_bot_id_bots_id_fk": { - "name": "bot_content_sources_bot_id_bots_id_fk", - "tableFrom": "bot_content_sources", - "tableTo": "bots", - "columnsFrom": [ - "bot_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.bot_mentions": { - "name": "bot_mentions", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "bot_id": { - "name": "bot_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "post_id": { - "name": "post_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "author_id": { - "name": "author_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "is_processed": { - "name": "is_processed", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "processed_at": { - "name": "processed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "response_post_id": { - "name": "response_post_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "is_remote": { - "name": "is_remote", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "remote_actor_url": { - "name": "remote_actor_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "bot_mentions_bot_idx": { - "name": "bot_mentions_bot_idx", - "columns": [ - { - "expression": "bot_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_mentions_processed_idx": { - "name": "bot_mentions_processed_idx", - "columns": [ - { - "expression": "is_processed", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_mentions_created_idx": { - "name": "bot_mentions_created_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "bot_mentions_bot_id_bots_id_fk": { - "name": "bot_mentions_bot_id_bots_id_fk", - "tableFrom": "bot_mentions", - "tableTo": "bots", - "columnsFrom": [ - "bot_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "bot_mentions_post_id_posts_id_fk": { - "name": "bot_mentions_post_id_posts_id_fk", - "tableFrom": "bot_mentions", - "tableTo": "posts", - "columnsFrom": [ - "post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "bot_mentions_author_id_users_id_fk": { - "name": "bot_mentions_author_id_users_id_fk", - "tableFrom": "bot_mentions", - "tableTo": "users", - "columnsFrom": [ - "author_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "bot_mentions_response_post_id_posts_id_fk": { - "name": "bot_mentions_response_post_id_posts_id_fk", - "tableFrom": "bot_mentions", - "tableTo": "posts", - "columnsFrom": [ - "response_post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.bot_rate_limits": { - "name": "bot_rate_limits", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "bot_id": { - "name": "bot_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "window_start": { - "name": "window_start", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "window_type": { - "name": "window_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "post_count": { - "name": "post_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "reply_count": { - "name": "reply_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "bot_rate_limits_bot_window_idx": { - "name": "bot_rate_limits_bot_window_idx", - "columns": [ - { - "expression": "bot_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "window_start", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "bot_rate_limits_bot_id_bots_id_fk": { - "name": "bot_rate_limits_bot_id_bots_id_fk", - "tableFrom": "bot_rate_limits", - "tableTo": "bots", - "columnsFrom": [ - "bot_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.bots": { - "name": "bots", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "owner_id": { - "name": "owner_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "personality_config": { - "name": "personality_config", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "llm_provider": { - "name": "llm_provider", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "llm_model": { - "name": "llm_model", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "llm_api_key_encrypted": { - "name": "llm_api_key_encrypted", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "schedule_config": { - "name": "schedule_config", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "autonomous_mode": { - "name": "autonomous_mode", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "is_active": { - "name": "is_active", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "is_suspended": { - "name": "is_suspended", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "suspension_reason": { - "name": "suspension_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "suspended_at": { - "name": "suspended_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "last_post_at": { - "name": "last_post_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "bots_user_id_idx": { - "name": "bots_user_id_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bots_owner_id_idx": { - "name": "bots_owner_id_idx", - "columns": [ - { - "expression": "owner_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bots_active_idx": { - "name": "bots_active_idx", - "columns": [ - { - "expression": "is_active", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "bots_user_id_users_id_fk": { - "name": "bots_user_id_users_id_fk", - "tableFrom": "bots", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "bots_owner_id_users_id_fk": { - "name": "bots_owner_id_users_id_fk", - "tableFrom": "bots", - "tableTo": "users", - "columnsFrom": [ - "owner_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.chat_conversations": { - "name": "chat_conversations", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'direct'" - }, - "participant1_id": { - "name": "participant1_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "participant2_handle": { - "name": "participant2_handle", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "last_message_at": { - "name": "last_message_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "last_message_preview": { - "name": "last_message_preview", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "chat_conversations_participant1_idx": { - "name": "chat_conversations_participant1_idx", - "columns": [ - { - "expression": "participant1_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "chat_conversations_last_message_idx": { - "name": "chat_conversations_last_message_idx", - "columns": [ - { - "expression": "last_message_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "chat_conversations_unique": { - "name": "chat_conversations_unique", - "columns": [ - { - "expression": "participant1_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "participant2_handle", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "chat_conversations_participant1_id_users_id_fk": { - "name": "chat_conversations_participant1_id_users_id_fk", - "tableFrom": "chat_conversations", - "tableTo": "users", - "columnsFrom": [ - "participant1_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.chat_device_bundles": { - "name": "chat_device_bundles", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "did": { - "name": "did", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "device_id": { - "name": "device_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "registration_id": { - "name": "registration_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "identity_key": { - "name": "identity_key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "signed_pre_key": { - "name": "signed_pre_key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "kyber_pre_key": { - "name": "kyber_pre_key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "signature": { - "name": "signature", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "last_seen_at": { - "name": "last_seen_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "chat_bundles_user_idx": { - "name": "chat_bundles_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "chat_bundles_did_idx": { - "name": "chat_bundles_did_idx", - "columns": [ - { - "expression": "did", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "chat_bundles_device_unique": { - "name": "chat_bundles_device_unique", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "device_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "chat_device_bundles_user_id_users_id_fk": { - "name": "chat_device_bundles_user_id_users_id_fk", - "tableFrom": "chat_device_bundles", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.chat_inbox": { - "name": "chat_inbox", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "recipient_did": { - "name": "recipient_did", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "recipient_device_id": { - "name": "recipient_device_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "sender_did": { - "name": "sender_did", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "envelope_json": { - "name": "envelope_json", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "is_read": { - "name": "is_read", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "chat_inbox_recipient_idx": { - "name": "chat_inbox_recipient_idx", - "columns": [ - { - "expression": "recipient_did", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "recipient_device_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "chat_inbox_created_idx": { - "name": "chat_inbox_created_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.chat_messages": { - "name": "chat_messages", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "conversation_id": { - "name": "conversation_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "sender_handle": { - "name": "sender_handle", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "sender_display_name": { - "name": "sender_display_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "sender_avatar_url": { - "name": "sender_avatar_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "sender_node_domain": { - "name": "sender_node_domain", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "encrypted_content": { - "name": "encrypted_content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "sender_encrypted_content": { - "name": "sender_encrypted_content", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "sender_chat_public_key": { - "name": "sender_chat_public_key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "swarm_message_id": { - "name": "swarm_message_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "delivered_at": { - "name": "delivered_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "read_at": { - "name": "read_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "chat_messages_conversation_idx": { - "name": "chat_messages_conversation_idx", - "columns": [ - { - "expression": "conversation_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "chat_messages_created_idx": { - "name": "chat_messages_created_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "chat_messages_swarm_id_idx": { - "name": "chat_messages_swarm_id_idx", - "columns": [ - { - "expression": "swarm_message_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "chat_messages_conversation_id_chat_conversations_id_fk": { - "name": "chat_messages_conversation_id_chat_conversations_id_fk", - "tableFrom": "chat_messages", - "tableTo": "chat_conversations", - "columnsFrom": [ - "conversation_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "chat_messages_swarm_message_id_unique": { - "name": "chat_messages_swarm_message_id_unique", - "nullsNotDistinct": false, - "columns": [ - "swarm_message_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.chat_one_time_keys": { - "name": "chat_one_time_keys", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "bundle_id": { - "name": "bundle_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "key_id": { - "name": "key_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "chat_otk_bundle_idx": { - "name": "chat_otk_bundle_idx", - "columns": [ - { - "expression": "bundle_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "chat_otk_unique": { - "name": "chat_otk_unique", - "columns": [ - { - "expression": "bundle_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "key_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "chat_one_time_keys_user_id_users_id_fk": { - "name": "chat_one_time_keys_user_id_users_id_fk", - "tableFrom": "chat_one_time_keys", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "chat_one_time_keys_bundle_id_chat_device_bundles_id_fk": { - "name": "chat_one_time_keys_bundle_id_chat_device_bundles_id_fk", - "tableFrom": "chat_one_time_keys", - "tableTo": "chat_device_bundles", - "columnsFrom": [ - "bundle_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.chat_typing_indicators": { - "name": "chat_typing_indicators", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "conversation_id": { - "name": "conversation_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "user_handle": { - "name": "user_handle", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "chat_typing_conversation_idx": { - "name": "chat_typing_conversation_idx", - "columns": [ - { - "expression": "conversation_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "chat_typing_expires_idx": { - "name": "chat_typing_expires_idx", - "columns": [ - { - "expression": "expires_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "chat_typing_unique": { - "name": "chat_typing_unique", - "columns": [ - { - "expression": "conversation_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "user_handle", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "chat_typing_indicators_conversation_id_chat_conversations_id_fk": { - "name": "chat_typing_indicators_conversation_id_chat_conversations_id_fk", - "tableFrom": "chat_typing_indicators", - "tableTo": "chat_conversations", - "columnsFrom": [ - "conversation_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.follows": { - "name": "follows", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "follower_id": { - "name": "follower_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "following_id": { - "name": "following_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "ap_id": { - "name": "ap_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "pending": { - "name": "pending", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "follows_follower_idx": { - "name": "follows_follower_idx", - "columns": [ - { - "expression": "follower_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "follows_following_idx": { - "name": "follows_following_idx", - "columns": [ - { - "expression": "following_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "follows_follower_id_users_id_fk": { - "name": "follows_follower_id_users_id_fk", - "tableFrom": "follows", - "tableTo": "users", - "columnsFrom": [ - "follower_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "follows_following_id_users_id_fk": { - "name": "follows_following_id_users_id_fk", - "tableFrom": "follows", - "tableTo": "users", - "columnsFrom": [ - "following_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "follows_ap_id_unique": { - "name": "follows_ap_id_unique", - "nullsNotDistinct": false, - "columns": [ - "ap_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.handle_registry": { - "name": "handle_registry", - "schema": "", - "columns": { - "handle": { - "name": "handle", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "did": { - "name": "did", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "node_domain": { - "name": "node_domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "registered_at": { - "name": "registered_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "handle_registry_updated_idx": { - "name": "handle_registry_updated_idx", - "columns": [ - { - "expression": "updated_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.likes": { - "name": "likes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "post_id": { - "name": "post_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "ap_id": { - "name": "ap_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "likes_user_post_idx": { - "name": "likes_user_post_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "post_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "likes_user_id_users_id_fk": { - "name": "likes_user_id_users_id_fk", - "tableFrom": "likes", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "likes_post_id_posts_id_fk": { - "name": "likes_post_id_posts_id_fk", - "tableFrom": "likes", - "tableTo": "posts", - "columnsFrom": [ - "post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "likes_ap_id_unique": { - "name": "likes_ap_id_unique", - "nullsNotDistinct": false, - "columns": [ - "ap_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.media": { - "name": "media", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "post_id": { - "name": "post_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "url": { - "name": "url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "alt_text": { - "name": "alt_text", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "mime_type": { - "name": "mime_type", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "width": { - "name": "width", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "height": { - "name": "height", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "media_user_idx": { - "name": "media_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "media_post_idx": { - "name": "media_post_idx", - "columns": [ - { - "expression": "post_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "media_user_id_users_id_fk": { - "name": "media_user_id_users_id_fk", - "tableFrom": "media", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "media_post_id_posts_id_fk": { - "name": "media_post_id_posts_id_fk", - "tableFrom": "media", - "tableTo": "posts", - "columnsFrom": [ - "post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.muted_nodes": { - "name": "muted_nodes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "node_domain": { - "name": "node_domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "muted_nodes_user_idx": { - "name": "muted_nodes_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "muted_nodes_domain_idx": { - "name": "muted_nodes_domain_idx", - "columns": [ - { - "expression": "node_domain", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "muted_nodes_user_id_users_id_fk": { - "name": "muted_nodes_user_id_users_id_fk", - "tableFrom": "muted_nodes", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.mutes": { - "name": "mutes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "muted_user_id": { - "name": "muted_user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "mutes_user_idx": { - "name": "mutes_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "mutes_muted_user_idx": { - "name": "mutes_muted_user_idx", - "columns": [ - { - "expression": "muted_user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "mutes_user_id_users_id_fk": { - "name": "mutes_user_id_users_id_fk", - "tableFrom": "mutes", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "mutes_muted_user_id_users_id_fk": { - "name": "mutes_muted_user_id_users_id_fk", - "tableFrom": "mutes", - "tableTo": "users", - "columnsFrom": [ - "muted_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.nodes": { - "name": "nodes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "domain": { - "name": "domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "long_description": { - "name": "long_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "rules": { - "name": "rules", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "banner_url": { - "name": "banner_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "logo_url": { - "name": "logo_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "favicon_url": { - "name": "favicon_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "accent_color": { - "name": "accent_color", - "type": "text", - "primaryKey": false, - "notNull": false, - "default": "'#FFFFFF'" - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "private_key_encrypted": { - "name": "private_key_encrypted", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "is_nsfw": { - "name": "is_nsfw", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "turnstile_site_key": { - "name": "turnstile_site_key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "turnstile_secret_key": { - "name": "turnstile_secret_key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "nodes_domain_unique": { - "name": "nodes_domain_unique", - "nullsNotDistinct": false, - "columns": [ - "domain" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.notifications": { - "name": "notifications", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "actor_id": { - "name": "actor_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "actor_handle": { - "name": "actor_handle", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "actor_display_name": { - "name": "actor_display_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "actor_avatar_url": { - "name": "actor_avatar_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "actor_node_domain": { - "name": "actor_node_domain", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "post_id": { - "name": "post_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "post_content": { - "name": "post_content", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "read_at": { - "name": "read_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "notifications_user_idx": { - "name": "notifications_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "notifications_created_idx": { - "name": "notifications_created_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "notifications_user_id_users_id_fk": { - "name": "notifications_user_id_users_id_fk", - "tableFrom": "notifications", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "notifications_actor_id_users_id_fk": { - "name": "notifications_actor_id_users_id_fk", - "tableFrom": "notifications", - "tableTo": "users", - "columnsFrom": [ - "actor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "notifications_post_id_posts_id_fk": { - "name": "notifications_post_id_posts_id_fk", - "tableFrom": "notifications", - "tableTo": "posts", - "columnsFrom": [ - "post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.posts": { - "name": "posts", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "bot_id": { - "name": "bot_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "reply_to_id": { - "name": "reply_to_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "repost_of_id": { - "name": "repost_of_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "swarm_reply_to_id": { - "name": "swarm_reply_to_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "swarm_reply_to_content": { - "name": "swarm_reply_to_content", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "swarm_reply_to_author": { - "name": "swarm_reply_to_author", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "likes_count": { - "name": "likes_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "reposts_count": { - "name": "reposts_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "replies_count": { - "name": "replies_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "is_nsfw": { - "name": "is_nsfw", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "is_removed": { - "name": "is_removed", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "removed_at": { - "name": "removed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "removed_by": { - "name": "removed_by", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "removed_reason": { - "name": "removed_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "ap_id": { - "name": "ap_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "ap_url": { - "name": "ap_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_url": { - "name": "link_preview_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_title": { - "name": "link_preview_title", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_description": { - "name": "link_preview_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_image": { - "name": "link_preview_image", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "posts_user_id_idx": { - "name": "posts_user_id_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "posts_bot_id_idx": { - "name": "posts_bot_id_idx", - "columns": [ - { - "expression": "bot_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "posts_created_at_idx": { - "name": "posts_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "posts_reply_to_idx": { - "name": "posts_reply_to_idx", - "columns": [ - { - "expression": "reply_to_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "posts_removed_idx": { - "name": "posts_removed_idx", - "columns": [ - { - "expression": "is_removed", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "posts_nsfw_idx": { - "name": "posts_nsfw_idx", - "columns": [ - { - "expression": "is_nsfw", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "posts_user_id_users_id_fk": { - "name": "posts_user_id_users_id_fk", - "tableFrom": "posts", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "posts_bot_id_bots_id_fk": { - "name": "posts_bot_id_bots_id_fk", - "tableFrom": "posts", - "tableTo": "bots", - "columnsFrom": [ - "bot_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "posts_removed_by_users_id_fk": { - "name": "posts_removed_by_users_id_fk", - "tableFrom": "posts", - "tableTo": "users", - "columnsFrom": [ - "removed_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "posts_ap_id_unique": { - "name": "posts_ap_id_unique", - "nullsNotDistinct": false, - "columns": [ - "ap_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.remote_followers": { - "name": "remote_followers", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "actor_url": { - "name": "actor_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "inbox_url": { - "name": "inbox_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "shared_inbox_url": { - "name": "shared_inbox_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "handle": { - "name": "handle", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "activity_id": { - "name": "activity_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "remote_followers_user_idx": { - "name": "remote_followers_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_followers_actor_idx": { - "name": "remote_followers_actor_idx", - "columns": [ - { - "expression": "actor_url", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_followers_user_actor_unique": { - "name": "remote_followers_user_actor_unique", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "actor_url", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "remote_followers_user_id_users_id_fk": { - "name": "remote_followers_user_id_users_id_fk", - "tableFrom": "remote_followers", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.remote_follows": { - "name": "remote_follows", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "follower_id": { - "name": "follower_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "target_handle": { - "name": "target_handle", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "target_actor_url": { - "name": "target_actor_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "inbox_url": { - "name": "inbox_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "activity_id": { - "name": "activity_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "display_name": { - "name": "display_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "bio": { - "name": "bio", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "avatar_url": { - "name": "avatar_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "remote_follows_follower_idx": { - "name": "remote_follows_follower_idx", - "columns": [ - { - "expression": "follower_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_follows_target_idx": { - "name": "remote_follows_target_idx", - "columns": [ - { - "expression": "target_handle", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "remote_follows_follower_id_users_id_fk": { - "name": "remote_follows_follower_id_users_id_fk", - "tableFrom": "remote_follows", - "tableTo": "users", - "columnsFrom": [ - "follower_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.remote_identity_cache": { - "name": "remote_identity_cache", - "schema": "", - "columns": { - "did": { - "name": "did", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "fetched_at": { - "name": "fetched_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.remote_likes": { - "name": "remote_likes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "post_id": { - "name": "post_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "actor_handle": { - "name": "actor_handle", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "actor_node_domain": { - "name": "actor_node_domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "remote_likes_post_idx": { - "name": "remote_likes_post_idx", - "columns": [ - { - "expression": "post_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_likes_actor_idx": { - "name": "remote_likes_actor_idx", - "columns": [ - { - "expression": "actor_handle", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "actor_node_domain", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_likes_unique": { - "name": "remote_likes_unique", - "columns": [ - { - "expression": "post_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "actor_handle", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "actor_node_domain", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "remote_likes_post_id_posts_id_fk": { - "name": "remote_likes_post_id_posts_id_fk", - "tableFrom": "remote_likes", - "tableTo": "posts", - "columnsFrom": [ - "post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.remote_posts": { - "name": "remote_posts", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "ap_id": { - "name": "ap_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "author_handle": { - "name": "author_handle", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "author_actor_url": { - "name": "author_actor_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "author_display_name": { - "name": "author_display_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "author_avatar_url": { - "name": "author_avatar_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "published_at": { - "name": "published_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "link_preview_url": { - "name": "link_preview_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_title": { - "name": "link_preview_title", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_description": { - "name": "link_preview_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_image": { - "name": "link_preview_image", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "media_json": { - "name": "media_json", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "fetched_at": { - "name": "fetched_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "remote_posts_author_idx": { - "name": "remote_posts_author_idx", - "columns": [ - { - "expression": "author_handle", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_posts_published_idx": { - "name": "remote_posts_published_idx", - "columns": [ - { - "expression": "published_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_posts_ap_id_idx": { - "name": "remote_posts_ap_id_idx", - "columns": [ - { - "expression": "ap_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "remote_posts_ap_id_unique": { - "name": "remote_posts_ap_id_unique", - "nullsNotDistinct": false, - "columns": [ - "ap_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.remote_reposts": { - "name": "remote_reposts", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "post_id": { - "name": "post_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "actor_handle": { - "name": "actor_handle", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "actor_node_domain": { - "name": "actor_node_domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "remote_reposts_post_idx": { - "name": "remote_reposts_post_idx", - "columns": [ - { - "expression": "post_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_reposts_actor_idx": { - "name": "remote_reposts_actor_idx", - "columns": [ - { - "expression": "actor_handle", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "actor_node_domain", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_reposts_unique": { - "name": "remote_reposts_unique", - "columns": [ - { - "expression": "post_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "actor_handle", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "actor_node_domain", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "remote_reposts_post_id_posts_id_fk": { - "name": "remote_reposts_post_id_posts_id_fk", - "tableFrom": "remote_reposts", - "tableTo": "posts", - "columnsFrom": [ - "post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.reports": { - "name": "reports", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "reporter_id": { - "name": "reporter_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "target_type": { - "name": "target_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "target_id": { - "name": "target_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'open'" - }, - "resolved_at": { - "name": "resolved_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "resolved_by": { - "name": "resolved_by", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "resolution_note": { - "name": "resolution_note", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "reports_status_idx": { - "name": "reports_status_idx", - "columns": [ - { - "expression": "status", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "reports_target_idx": { - "name": "reports_target_idx", - "columns": [ - { - "expression": "target_type", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "target_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "reports_reporter_idx": { - "name": "reports_reporter_idx", - "columns": [ - { - "expression": "reporter_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "reports_reporter_id_users_id_fk": { - "name": "reports_reporter_id_users_id_fk", - "tableFrom": "reports", - "tableTo": "users", - "columnsFrom": [ - "reporter_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "reports_resolved_by_users_id_fk": { - "name": "reports_resolved_by_users_id_fk", - "tableFrom": "reports", - "tableTo": "users", - "columnsFrom": [ - "resolved_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.sessions": { - "name": "sessions", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "sessions_token_idx": { - "name": "sessions_token_idx", - "columns": [ - { - "expression": "token", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "sessions_user_idx": { - "name": "sessions_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "sessions_user_id_users_id_fk": { - "name": "sessions_user_id_users_id_fk", - "tableFrom": "sessions", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "sessions_token_unique": { - "name": "sessions_token_unique", - "nullsNotDistinct": false, - "columns": [ - "token" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.signed_action_dedupe": { - "name": "signed_action_dedupe", - "schema": "", - "columns": { - "action_id": { - "name": "action_id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "did": { - "name": "did", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "nonce": { - "name": "nonce", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "ts": { - "name": "ts", - "type": "bigint", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "signed_action_dedupe_created_idx": { - "name": "signed_action_dedupe_created_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.swarm_nodes": { - "name": "swarm_nodes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "domain": { - "name": "domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "logo_url": { - "name": "logo_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "software_version": { - "name": "software_version", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "user_count": { - "name": "user_count", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "post_count": { - "name": "post_count", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "is_nsfw": { - "name": "is_nsfw", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "discovered_via": { - "name": "discovered_via", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "discovered_at": { - "name": "discovered_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "last_seen_at": { - "name": "last_seen_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "last_sync_at": { - "name": "last_sync_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "consecutive_failures": { - "name": "consecutive_failures", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "is_active": { - "name": "is_active", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "trust_score": { - "name": "trust_score", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 50 - }, - "capabilities": { - "name": "capabilities", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "swarm_nodes_domain_idx": { - "name": "swarm_nodes_domain_idx", - "columns": [ - { - "expression": "domain", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "swarm_nodes_active_idx": { - "name": "swarm_nodes_active_idx", - "columns": [ - { - "expression": "is_active", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "swarm_nodes_last_seen_idx": { - "name": "swarm_nodes_last_seen_idx", - "columns": [ - { - "expression": "last_seen_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "swarm_nodes_trust_idx": { - "name": "swarm_nodes_trust_idx", - "columns": [ - { - "expression": "trust_score", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "swarm_nodes_nsfw_idx": { - "name": "swarm_nodes_nsfw_idx", - "columns": [ - { - "expression": "is_nsfw", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "swarm_nodes_domain_unique": { - "name": "swarm_nodes_domain_unique", - "nullsNotDistinct": false, - "columns": [ - "domain" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.swarm_seeds": { - "name": "swarm_seeds", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "domain": { - "name": "domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "priority": { - "name": "priority", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 100 - }, - "is_enabled": { - "name": "is_enabled", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "last_contact_at": { - "name": "last_contact_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "consecutive_failures": { - "name": "consecutive_failures", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "swarm_seeds_enabled_idx": { - "name": "swarm_seeds_enabled_idx", - "columns": [ - { - "expression": "is_enabled", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "swarm_seeds_priority_idx": { - "name": "swarm_seeds_priority_idx", - "columns": [ - { - "expression": "priority", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "swarm_seeds_domain_unique": { - "name": "swarm_seeds_domain_unique", - "nullsNotDistinct": false, - "columns": [ - "domain" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.swarm_sync_log": { - "name": "swarm_sync_log", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "remote_domain": { - "name": "remote_domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "direction": { - "name": "direction", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "nodes_received": { - "name": "nodes_received", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "nodes_sent": { - "name": "nodes_sent", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "handles_received": { - "name": "handles_received", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "handles_sent": { - "name": "handles_sent", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "success": { - "name": "success", - "type": "boolean", - "primaryKey": false, - "notNull": true - }, - "error_message": { - "name": "error_message", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "duration_ms": { - "name": "duration_ms", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "swarm_sync_log_remote_idx": { - "name": "swarm_sync_log_remote_idx", - "columns": [ - { - "expression": "remote_domain", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "swarm_sync_log_created_idx": { - "name": "swarm_sync_log_created_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.users": { - "name": "users", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "did": { - "name": "did", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "handle": { - "name": "handle", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "password_hash": { - "name": "password_hash", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "display_name": { - "name": "display_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "bio": { - "name": "bio", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "avatar_url": { - "name": "avatar_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "header_url": { - "name": "header_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "private_key_encrypted": { - "name": "private_key_encrypted", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "chat_public_key": { - "name": "chat_public_key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "chat_private_key_encrypted": { - "name": "chat_private_key_encrypted", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "node_id": { - "name": "node_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "is_bot": { - "name": "is_bot", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "bot_owner_id": { - "name": "bot_owner_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "is_nsfw": { - "name": "is_nsfw", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "nsfw_enabled": { - "name": "nsfw_enabled", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "age_verified_at": { - "name": "age_verified_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "is_suspended": { - "name": "is_suspended", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "suspension_reason": { - "name": "suspension_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "suspended_at": { - "name": "suspended_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "is_silenced": { - "name": "is_silenced", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "silence_reason": { - "name": "silence_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "silenced_at": { - "name": "silenced_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "moved_to": { - "name": "moved_to", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "moved_from": { - "name": "moved_from", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "migrated_at": { - "name": "migrated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "followers_count": { - "name": "followers_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "following_count": { - "name": "following_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "posts_count": { - "name": "posts_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "website": { - "name": "website", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "users_handle_idx": { - "name": "users_handle_idx", - "columns": [ - { - "expression": "handle", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_did_idx": { - "name": "users_did_idx", - "columns": [ - { - "expression": "did", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_suspended_idx": { - "name": "users_suspended_idx", - "columns": [ - { - "expression": "is_suspended", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_silenced_idx": { - "name": "users_silenced_idx", - "columns": [ - { - "expression": "is_silenced", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_is_bot_idx": { - "name": "users_is_bot_idx", - "columns": [ - { - "expression": "is_bot", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_bot_owner_idx": { - "name": "users_bot_owner_idx", - "columns": [ - { - "expression": "bot_owner_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_nsfw_idx": { - "name": "users_nsfw_idx", - "columns": [ - { - "expression": "is_nsfw", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "users_node_id_nodes_id_fk": { - "name": "users_node_id_nodes_id_fk", - "tableFrom": "users", - "tableTo": "nodes", - "columnsFrom": [ - "node_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "users_bot_owner_id_users_id_fk": { - "name": "users_bot_owner_id_users_id_fk", - "tableFrom": "users", - "tableTo": "users", - "columnsFrom": [ - "bot_owner_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "users_did_unique": { - "name": "users_did_unique", - "nullsNotDistinct": false, - "columns": [ - "did" - ] - }, - "users_handle_unique": { - "name": "users_handle_unique", - "nullsNotDistinct": false, - "columns": [ - "handle" - ] - }, - "users_email_unique": { - "name": "users_email_unique", - "nullsNotDistinct": false, - "columns": [ - "email" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": {}, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/drizzle/meta/0012_snapshot.json b/drizzle/meta/0012_snapshot.json deleted file mode 100644 index 85d6a46..0000000 --- a/drizzle/meta/0012_snapshot.json +++ /dev/null @@ -1,4805 +0,0 @@ -{ - "id": "02a4734f-64b6-4c6e-bc9b-fced92eb2843", - "prevId": "9c5ad998-ee99-4677-894a-21969787a20c", - "version": "7", - "dialect": "postgresql", - "tables": { - "public.blocks": { - "name": "blocks", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "blocked_user_id": { - "name": "blocked_user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "blocks_user_idx": { - "name": "blocks_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "blocks_blocked_user_idx": { - "name": "blocks_blocked_user_idx", - "columns": [ - { - "expression": "blocked_user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "blocks_user_id_users_id_fk": { - "name": "blocks_user_id_users_id_fk", - "tableFrom": "blocks", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "blocks_blocked_user_id_users_id_fk": { - "name": "blocks_blocked_user_id_users_id_fk", - "tableFrom": "blocks", - "tableTo": "users", - "columnsFrom": [ - "blocked_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.bot_activity_logs": { - "name": "bot_activity_logs", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "bot_id": { - "name": "bot_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "details": { - "name": "details", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "success": { - "name": "success", - "type": "boolean", - "primaryKey": false, - "notNull": true - }, - "error_message": { - "name": "error_message", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "bot_activity_logs_bot_idx": { - "name": "bot_activity_logs_bot_idx", - "columns": [ - { - "expression": "bot_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_activity_logs_action_idx": { - "name": "bot_activity_logs_action_idx", - "columns": [ - { - "expression": "action", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_activity_logs_created_idx": { - "name": "bot_activity_logs_created_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "bot_activity_logs_bot_id_bots_id_fk": { - "name": "bot_activity_logs_bot_id_bots_id_fk", - "tableFrom": "bot_activity_logs", - "tableTo": "bots", - "columnsFrom": [ - "bot_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.bot_content_items": { - "name": "bot_content_items", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "source_id": { - "name": "source_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "external_id": { - "name": "external_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "title": { - "name": "title", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "url": { - "name": "url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "published_at": { - "name": "published_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "fetched_at": { - "name": "fetched_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "is_processed": { - "name": "is_processed", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "processed_at": { - "name": "processed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "post_id": { - "name": "post_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "interest_score": { - "name": "interest_score", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "interest_reason": { - "name": "interest_reason", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "bot_content_items_source_idx": { - "name": "bot_content_items_source_idx", - "columns": [ - { - "expression": "source_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_content_items_processed_idx": { - "name": "bot_content_items_processed_idx", - "columns": [ - { - "expression": "is_processed", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_content_items_external_idx": { - "name": "bot_content_items_external_idx", - "columns": [ - { - "expression": "external_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "bot_content_items_source_id_bot_content_sources_id_fk": { - "name": "bot_content_items_source_id_bot_content_sources_id_fk", - "tableFrom": "bot_content_items", - "tableTo": "bot_content_sources", - "columnsFrom": [ - "source_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "bot_content_items_post_id_posts_id_fk": { - "name": "bot_content_items_post_id_posts_id_fk", - "tableFrom": "bot_content_items", - "tableTo": "posts", - "columnsFrom": [ - "post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.bot_content_sources": { - "name": "bot_content_sources", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "bot_id": { - "name": "bot_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "url": { - "name": "url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "subreddit": { - "name": "subreddit", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "api_key_encrypted": { - "name": "api_key_encrypted", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "source_config": { - "name": "source_config", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "keywords": { - "name": "keywords", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "is_active": { - "name": "is_active", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "last_fetch_at": { - "name": "last_fetch_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "last_error": { - "name": "last_error", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "consecutive_errors": { - "name": "consecutive_errors", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "bot_content_sources_bot_idx": { - "name": "bot_content_sources_bot_idx", - "columns": [ - { - "expression": "bot_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_content_sources_type_idx": { - "name": "bot_content_sources_type_idx", - "columns": [ - { - "expression": "type", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "bot_content_sources_bot_id_bots_id_fk": { - "name": "bot_content_sources_bot_id_bots_id_fk", - "tableFrom": "bot_content_sources", - "tableTo": "bots", - "columnsFrom": [ - "bot_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.bot_mentions": { - "name": "bot_mentions", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "bot_id": { - "name": "bot_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "post_id": { - "name": "post_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "author_id": { - "name": "author_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "is_processed": { - "name": "is_processed", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "processed_at": { - "name": "processed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "response_post_id": { - "name": "response_post_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "is_remote": { - "name": "is_remote", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "remote_actor_url": { - "name": "remote_actor_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "bot_mentions_bot_idx": { - "name": "bot_mentions_bot_idx", - "columns": [ - { - "expression": "bot_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_mentions_processed_idx": { - "name": "bot_mentions_processed_idx", - "columns": [ - { - "expression": "is_processed", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bot_mentions_created_idx": { - "name": "bot_mentions_created_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "bot_mentions_bot_id_bots_id_fk": { - "name": "bot_mentions_bot_id_bots_id_fk", - "tableFrom": "bot_mentions", - "tableTo": "bots", - "columnsFrom": [ - "bot_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "bot_mentions_post_id_posts_id_fk": { - "name": "bot_mentions_post_id_posts_id_fk", - "tableFrom": "bot_mentions", - "tableTo": "posts", - "columnsFrom": [ - "post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "bot_mentions_author_id_users_id_fk": { - "name": "bot_mentions_author_id_users_id_fk", - "tableFrom": "bot_mentions", - "tableTo": "users", - "columnsFrom": [ - "author_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "bot_mentions_response_post_id_posts_id_fk": { - "name": "bot_mentions_response_post_id_posts_id_fk", - "tableFrom": "bot_mentions", - "tableTo": "posts", - "columnsFrom": [ - "response_post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.bot_rate_limits": { - "name": "bot_rate_limits", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "bot_id": { - "name": "bot_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "window_start": { - "name": "window_start", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "window_type": { - "name": "window_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "post_count": { - "name": "post_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "reply_count": { - "name": "reply_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "bot_rate_limits_bot_window_idx": { - "name": "bot_rate_limits_bot_window_idx", - "columns": [ - { - "expression": "bot_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "window_start", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "bot_rate_limits_bot_id_bots_id_fk": { - "name": "bot_rate_limits_bot_id_bots_id_fk", - "tableFrom": "bot_rate_limits", - "tableTo": "bots", - "columnsFrom": [ - "bot_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.bots": { - "name": "bots", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "owner_id": { - "name": "owner_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "personality_config": { - "name": "personality_config", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "llm_provider": { - "name": "llm_provider", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "llm_model": { - "name": "llm_model", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "llm_api_key_encrypted": { - "name": "llm_api_key_encrypted", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "schedule_config": { - "name": "schedule_config", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "autonomous_mode": { - "name": "autonomous_mode", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "is_active": { - "name": "is_active", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "is_suspended": { - "name": "is_suspended", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "suspension_reason": { - "name": "suspension_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "suspended_at": { - "name": "suspended_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "last_post_at": { - "name": "last_post_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "bots_user_id_idx": { - "name": "bots_user_id_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bots_owner_id_idx": { - "name": "bots_owner_id_idx", - "columns": [ - { - "expression": "owner_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "bots_active_idx": { - "name": "bots_active_idx", - "columns": [ - { - "expression": "is_active", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "bots_user_id_users_id_fk": { - "name": "bots_user_id_users_id_fk", - "tableFrom": "bots", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "bots_owner_id_users_id_fk": { - "name": "bots_owner_id_users_id_fk", - "tableFrom": "bots", - "tableTo": "users", - "columnsFrom": [ - "owner_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.chat_conversations": { - "name": "chat_conversations", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'direct'" - }, - "participant1_id": { - "name": "participant1_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "participant2_handle": { - "name": "participant2_handle", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "last_message_at": { - "name": "last_message_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "last_message_preview": { - "name": "last_message_preview", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "chat_conversations_participant1_idx": { - "name": "chat_conversations_participant1_idx", - "columns": [ - { - "expression": "participant1_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "chat_conversations_last_message_idx": { - "name": "chat_conversations_last_message_idx", - "columns": [ - { - "expression": "last_message_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "chat_conversations_unique": { - "name": "chat_conversations_unique", - "columns": [ - { - "expression": "participant1_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "participant2_handle", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "chat_conversations_participant1_id_users_id_fk": { - "name": "chat_conversations_participant1_id_users_id_fk", - "tableFrom": "chat_conversations", - "tableTo": "users", - "columnsFrom": [ - "participant1_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.chat_device_bundles": { - "name": "chat_device_bundles", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "did": { - "name": "did", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "device_id": { - "name": "device_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "registration_id": { - "name": "registration_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "identity_key": { - "name": "identity_key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "signed_pre_key": { - "name": "signed_pre_key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "kyber_pre_key": { - "name": "kyber_pre_key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "signature": { - "name": "signature", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "last_seen_at": { - "name": "last_seen_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "chat_bundles_user_idx": { - "name": "chat_bundles_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "chat_bundles_did_idx": { - "name": "chat_bundles_did_idx", - "columns": [ - { - "expression": "did", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "chat_bundles_device_unique": { - "name": "chat_bundles_device_unique", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "device_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "chat_device_bundles_user_id_users_id_fk": { - "name": "chat_device_bundles_user_id_users_id_fk", - "tableFrom": "chat_device_bundles", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.chat_inbox": { - "name": "chat_inbox", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "recipient_did": { - "name": "recipient_did", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "recipient_device_id": { - "name": "recipient_device_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "sender_did": { - "name": "sender_did", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "envelope_json": { - "name": "envelope_json", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "is_read": { - "name": "is_read", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "chat_inbox_recipient_idx": { - "name": "chat_inbox_recipient_idx", - "columns": [ - { - "expression": "recipient_did", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "recipient_device_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "chat_inbox_created_idx": { - "name": "chat_inbox_created_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.chat_messages": { - "name": "chat_messages", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "conversation_id": { - "name": "conversation_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "sender_handle": { - "name": "sender_handle", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "sender_display_name": { - "name": "sender_display_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "sender_avatar_url": { - "name": "sender_avatar_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "sender_node_domain": { - "name": "sender_node_domain", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "sender_did": { - "name": "sender_did", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "encrypted_content": { - "name": "encrypted_content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "sender_encrypted_content": { - "name": "sender_encrypted_content", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "sender_chat_public_key": { - "name": "sender_chat_public_key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "swarm_message_id": { - "name": "swarm_message_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "delivered_at": { - "name": "delivered_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "read_at": { - "name": "read_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "chat_messages_conversation_idx": { - "name": "chat_messages_conversation_idx", - "columns": [ - { - "expression": "conversation_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "chat_messages_created_idx": { - "name": "chat_messages_created_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "chat_messages_swarm_id_idx": { - "name": "chat_messages_swarm_id_idx", - "columns": [ - { - "expression": "swarm_message_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "chat_messages_conversation_id_chat_conversations_id_fk": { - "name": "chat_messages_conversation_id_chat_conversations_id_fk", - "tableFrom": "chat_messages", - "tableTo": "chat_conversations", - "columnsFrom": [ - "conversation_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "chat_messages_swarm_message_id_unique": { - "name": "chat_messages_swarm_message_id_unique", - "nullsNotDistinct": false, - "columns": [ - "swarm_message_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.chat_one_time_keys": { - "name": "chat_one_time_keys", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "bundle_id": { - "name": "bundle_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "key_id": { - "name": "key_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "chat_otk_bundle_idx": { - "name": "chat_otk_bundle_idx", - "columns": [ - { - "expression": "bundle_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "chat_otk_unique": { - "name": "chat_otk_unique", - "columns": [ - { - "expression": "bundle_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "key_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "chat_one_time_keys_user_id_users_id_fk": { - "name": "chat_one_time_keys_user_id_users_id_fk", - "tableFrom": "chat_one_time_keys", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "chat_one_time_keys_bundle_id_chat_device_bundles_id_fk": { - "name": "chat_one_time_keys_bundle_id_chat_device_bundles_id_fk", - "tableFrom": "chat_one_time_keys", - "tableTo": "chat_device_bundles", - "columnsFrom": [ - "bundle_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.chat_typing_indicators": { - "name": "chat_typing_indicators", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "conversation_id": { - "name": "conversation_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "user_handle": { - "name": "user_handle", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "chat_typing_conversation_idx": { - "name": "chat_typing_conversation_idx", - "columns": [ - { - "expression": "conversation_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "chat_typing_expires_idx": { - "name": "chat_typing_expires_idx", - "columns": [ - { - "expression": "expires_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "chat_typing_unique": { - "name": "chat_typing_unique", - "columns": [ - { - "expression": "conversation_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "user_handle", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "chat_typing_indicators_conversation_id_chat_conversations_id_fk": { - "name": "chat_typing_indicators_conversation_id_chat_conversations_id_fk", - "tableFrom": "chat_typing_indicators", - "tableTo": "chat_conversations", - "columnsFrom": [ - "conversation_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.follows": { - "name": "follows", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "follower_id": { - "name": "follower_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "following_id": { - "name": "following_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "ap_id": { - "name": "ap_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "pending": { - "name": "pending", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "follows_follower_idx": { - "name": "follows_follower_idx", - "columns": [ - { - "expression": "follower_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "follows_following_idx": { - "name": "follows_following_idx", - "columns": [ - { - "expression": "following_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "follows_follower_id_users_id_fk": { - "name": "follows_follower_id_users_id_fk", - "tableFrom": "follows", - "tableTo": "users", - "columnsFrom": [ - "follower_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "follows_following_id_users_id_fk": { - "name": "follows_following_id_users_id_fk", - "tableFrom": "follows", - "tableTo": "users", - "columnsFrom": [ - "following_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "follows_ap_id_unique": { - "name": "follows_ap_id_unique", - "nullsNotDistinct": false, - "columns": [ - "ap_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.handle_registry": { - "name": "handle_registry", - "schema": "", - "columns": { - "handle": { - "name": "handle", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "did": { - "name": "did", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "node_domain": { - "name": "node_domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "registered_at": { - "name": "registered_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "handle_registry_updated_idx": { - "name": "handle_registry_updated_idx", - "columns": [ - { - "expression": "updated_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.likes": { - "name": "likes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "post_id": { - "name": "post_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "ap_id": { - "name": "ap_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "likes_user_post_idx": { - "name": "likes_user_post_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "post_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "likes_user_id_users_id_fk": { - "name": "likes_user_id_users_id_fk", - "tableFrom": "likes", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "likes_post_id_posts_id_fk": { - "name": "likes_post_id_posts_id_fk", - "tableFrom": "likes", - "tableTo": "posts", - "columnsFrom": [ - "post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "likes_ap_id_unique": { - "name": "likes_ap_id_unique", - "nullsNotDistinct": false, - "columns": [ - "ap_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.media": { - "name": "media", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "post_id": { - "name": "post_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "url": { - "name": "url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "alt_text": { - "name": "alt_text", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "mime_type": { - "name": "mime_type", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "width": { - "name": "width", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "height": { - "name": "height", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "media_user_idx": { - "name": "media_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "media_post_idx": { - "name": "media_post_idx", - "columns": [ - { - "expression": "post_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "media_user_id_users_id_fk": { - "name": "media_user_id_users_id_fk", - "tableFrom": "media", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "media_post_id_posts_id_fk": { - "name": "media_post_id_posts_id_fk", - "tableFrom": "media", - "tableTo": "posts", - "columnsFrom": [ - "post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.muted_nodes": { - "name": "muted_nodes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "node_domain": { - "name": "node_domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "muted_nodes_user_idx": { - "name": "muted_nodes_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "muted_nodes_domain_idx": { - "name": "muted_nodes_domain_idx", - "columns": [ - { - "expression": "node_domain", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "muted_nodes_user_id_users_id_fk": { - "name": "muted_nodes_user_id_users_id_fk", - "tableFrom": "muted_nodes", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.mutes": { - "name": "mutes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "muted_user_id": { - "name": "muted_user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "mutes_user_idx": { - "name": "mutes_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "mutes_muted_user_idx": { - "name": "mutes_muted_user_idx", - "columns": [ - { - "expression": "muted_user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "mutes_user_id_users_id_fk": { - "name": "mutes_user_id_users_id_fk", - "tableFrom": "mutes", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "mutes_muted_user_id_users_id_fk": { - "name": "mutes_muted_user_id_users_id_fk", - "tableFrom": "mutes", - "tableTo": "users", - "columnsFrom": [ - "muted_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.nodes": { - "name": "nodes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "domain": { - "name": "domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "long_description": { - "name": "long_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "rules": { - "name": "rules", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "banner_url": { - "name": "banner_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "logo_url": { - "name": "logo_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "favicon_url": { - "name": "favicon_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "accent_color": { - "name": "accent_color", - "type": "text", - "primaryKey": false, - "notNull": false, - "default": "'#FFFFFF'" - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "private_key_encrypted": { - "name": "private_key_encrypted", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "is_nsfw": { - "name": "is_nsfw", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "turnstile_site_key": { - "name": "turnstile_site_key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "turnstile_secret_key": { - "name": "turnstile_secret_key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "nodes_domain_unique": { - "name": "nodes_domain_unique", - "nullsNotDistinct": false, - "columns": [ - "domain" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.notifications": { - "name": "notifications", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "actor_id": { - "name": "actor_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "actor_handle": { - "name": "actor_handle", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "actor_display_name": { - "name": "actor_display_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "actor_avatar_url": { - "name": "actor_avatar_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "actor_node_domain": { - "name": "actor_node_domain", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "post_id": { - "name": "post_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "post_content": { - "name": "post_content", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "read_at": { - "name": "read_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "notifications_user_idx": { - "name": "notifications_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "notifications_created_idx": { - "name": "notifications_created_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "notifications_user_id_users_id_fk": { - "name": "notifications_user_id_users_id_fk", - "tableFrom": "notifications", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "notifications_actor_id_users_id_fk": { - "name": "notifications_actor_id_users_id_fk", - "tableFrom": "notifications", - "tableTo": "users", - "columnsFrom": [ - "actor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "notifications_post_id_posts_id_fk": { - "name": "notifications_post_id_posts_id_fk", - "tableFrom": "notifications", - "tableTo": "posts", - "columnsFrom": [ - "post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.posts": { - "name": "posts", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "bot_id": { - "name": "bot_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "reply_to_id": { - "name": "reply_to_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "repost_of_id": { - "name": "repost_of_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "swarm_reply_to_id": { - "name": "swarm_reply_to_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "swarm_reply_to_content": { - "name": "swarm_reply_to_content", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "swarm_reply_to_author": { - "name": "swarm_reply_to_author", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "likes_count": { - "name": "likes_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "reposts_count": { - "name": "reposts_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "replies_count": { - "name": "replies_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "is_nsfw": { - "name": "is_nsfw", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "is_removed": { - "name": "is_removed", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "removed_at": { - "name": "removed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "removed_by": { - "name": "removed_by", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "removed_reason": { - "name": "removed_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "ap_id": { - "name": "ap_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "ap_url": { - "name": "ap_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_url": { - "name": "link_preview_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_title": { - "name": "link_preview_title", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_description": { - "name": "link_preview_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_image": { - "name": "link_preview_image", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "posts_user_id_idx": { - "name": "posts_user_id_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "posts_bot_id_idx": { - "name": "posts_bot_id_idx", - "columns": [ - { - "expression": "bot_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "posts_created_at_idx": { - "name": "posts_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "posts_reply_to_idx": { - "name": "posts_reply_to_idx", - "columns": [ - { - "expression": "reply_to_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "posts_removed_idx": { - "name": "posts_removed_idx", - "columns": [ - { - "expression": "is_removed", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "posts_nsfw_idx": { - "name": "posts_nsfw_idx", - "columns": [ - { - "expression": "is_nsfw", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "posts_user_id_users_id_fk": { - "name": "posts_user_id_users_id_fk", - "tableFrom": "posts", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "posts_bot_id_bots_id_fk": { - "name": "posts_bot_id_bots_id_fk", - "tableFrom": "posts", - "tableTo": "bots", - "columnsFrom": [ - "bot_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "posts_removed_by_users_id_fk": { - "name": "posts_removed_by_users_id_fk", - "tableFrom": "posts", - "tableTo": "users", - "columnsFrom": [ - "removed_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "posts_ap_id_unique": { - "name": "posts_ap_id_unique", - "nullsNotDistinct": false, - "columns": [ - "ap_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.remote_followers": { - "name": "remote_followers", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "actor_url": { - "name": "actor_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "inbox_url": { - "name": "inbox_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "shared_inbox_url": { - "name": "shared_inbox_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "handle": { - "name": "handle", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "activity_id": { - "name": "activity_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "remote_followers_user_idx": { - "name": "remote_followers_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_followers_actor_idx": { - "name": "remote_followers_actor_idx", - "columns": [ - { - "expression": "actor_url", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_followers_user_actor_unique": { - "name": "remote_followers_user_actor_unique", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "actor_url", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "remote_followers_user_id_users_id_fk": { - "name": "remote_followers_user_id_users_id_fk", - "tableFrom": "remote_followers", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.remote_follows": { - "name": "remote_follows", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "follower_id": { - "name": "follower_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "target_handle": { - "name": "target_handle", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "target_actor_url": { - "name": "target_actor_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "inbox_url": { - "name": "inbox_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "activity_id": { - "name": "activity_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "display_name": { - "name": "display_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "bio": { - "name": "bio", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "avatar_url": { - "name": "avatar_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "remote_follows_follower_idx": { - "name": "remote_follows_follower_idx", - "columns": [ - { - "expression": "follower_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_follows_target_idx": { - "name": "remote_follows_target_idx", - "columns": [ - { - "expression": "target_handle", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "remote_follows_follower_id_users_id_fk": { - "name": "remote_follows_follower_id_users_id_fk", - "tableFrom": "remote_follows", - "tableTo": "users", - "columnsFrom": [ - "follower_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.remote_identity_cache": { - "name": "remote_identity_cache", - "schema": "", - "columns": { - "did": { - "name": "did", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "fetched_at": { - "name": "fetched_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.remote_likes": { - "name": "remote_likes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "post_id": { - "name": "post_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "actor_handle": { - "name": "actor_handle", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "actor_node_domain": { - "name": "actor_node_domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "remote_likes_post_idx": { - "name": "remote_likes_post_idx", - "columns": [ - { - "expression": "post_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_likes_actor_idx": { - "name": "remote_likes_actor_idx", - "columns": [ - { - "expression": "actor_handle", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "actor_node_domain", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_likes_unique": { - "name": "remote_likes_unique", - "columns": [ - { - "expression": "post_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "actor_handle", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "actor_node_domain", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "remote_likes_post_id_posts_id_fk": { - "name": "remote_likes_post_id_posts_id_fk", - "tableFrom": "remote_likes", - "tableTo": "posts", - "columnsFrom": [ - "post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.remote_posts": { - "name": "remote_posts", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "ap_id": { - "name": "ap_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "author_handle": { - "name": "author_handle", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "author_actor_url": { - "name": "author_actor_url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "author_display_name": { - "name": "author_display_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "author_avatar_url": { - "name": "author_avatar_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "published_at": { - "name": "published_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "link_preview_url": { - "name": "link_preview_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_title": { - "name": "link_preview_title", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_description": { - "name": "link_preview_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "link_preview_image": { - "name": "link_preview_image", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "media_json": { - "name": "media_json", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "fetched_at": { - "name": "fetched_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "remote_posts_author_idx": { - "name": "remote_posts_author_idx", - "columns": [ - { - "expression": "author_handle", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_posts_published_idx": { - "name": "remote_posts_published_idx", - "columns": [ - { - "expression": "published_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_posts_ap_id_idx": { - "name": "remote_posts_ap_id_idx", - "columns": [ - { - "expression": "ap_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "remote_posts_ap_id_unique": { - "name": "remote_posts_ap_id_unique", - "nullsNotDistinct": false, - "columns": [ - "ap_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.remote_reposts": { - "name": "remote_reposts", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "post_id": { - "name": "post_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "actor_handle": { - "name": "actor_handle", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "actor_node_domain": { - "name": "actor_node_domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "remote_reposts_post_idx": { - "name": "remote_reposts_post_idx", - "columns": [ - { - "expression": "post_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_reposts_actor_idx": { - "name": "remote_reposts_actor_idx", - "columns": [ - { - "expression": "actor_handle", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "actor_node_domain", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "remote_reposts_unique": { - "name": "remote_reposts_unique", - "columns": [ - { - "expression": "post_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "actor_handle", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "actor_node_domain", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "remote_reposts_post_id_posts_id_fk": { - "name": "remote_reposts_post_id_posts_id_fk", - "tableFrom": "remote_reposts", - "tableTo": "posts", - "columnsFrom": [ - "post_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.reports": { - "name": "reports", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "reporter_id": { - "name": "reporter_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "target_type": { - "name": "target_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "target_id": { - "name": "target_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'open'" - }, - "resolved_at": { - "name": "resolved_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "resolved_by": { - "name": "resolved_by", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "resolution_note": { - "name": "resolution_note", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "reports_status_idx": { - "name": "reports_status_idx", - "columns": [ - { - "expression": "status", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "reports_target_idx": { - "name": "reports_target_idx", - "columns": [ - { - "expression": "target_type", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "target_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "reports_reporter_idx": { - "name": "reports_reporter_idx", - "columns": [ - { - "expression": "reporter_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "reports_reporter_id_users_id_fk": { - "name": "reports_reporter_id_users_id_fk", - "tableFrom": "reports", - "tableTo": "users", - "columnsFrom": [ - "reporter_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "reports_resolved_by_users_id_fk": { - "name": "reports_resolved_by_users_id_fk", - "tableFrom": "reports", - "tableTo": "users", - "columnsFrom": [ - "resolved_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.sessions": { - "name": "sessions", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "sessions_token_idx": { - "name": "sessions_token_idx", - "columns": [ - { - "expression": "token", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "sessions_user_idx": { - "name": "sessions_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "sessions_user_id_users_id_fk": { - "name": "sessions_user_id_users_id_fk", - "tableFrom": "sessions", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "sessions_token_unique": { - "name": "sessions_token_unique", - "nullsNotDistinct": false, - "columns": [ - "token" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.signed_action_dedupe": { - "name": "signed_action_dedupe", - "schema": "", - "columns": { - "action_id": { - "name": "action_id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "did": { - "name": "did", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "nonce": { - "name": "nonce", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "ts": { - "name": "ts", - "type": "bigint", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "signed_action_dedupe_created_idx": { - "name": "signed_action_dedupe_created_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.swarm_nodes": { - "name": "swarm_nodes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "domain": { - "name": "domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "logo_url": { - "name": "logo_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "software_version": { - "name": "software_version", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "user_count": { - "name": "user_count", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "post_count": { - "name": "post_count", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "is_nsfw": { - "name": "is_nsfw", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "discovered_via": { - "name": "discovered_via", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "discovered_at": { - "name": "discovered_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "last_seen_at": { - "name": "last_seen_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "last_sync_at": { - "name": "last_sync_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "consecutive_failures": { - "name": "consecutive_failures", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "is_active": { - "name": "is_active", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "trust_score": { - "name": "trust_score", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 50 - }, - "capabilities": { - "name": "capabilities", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "swarm_nodes_domain_idx": { - "name": "swarm_nodes_domain_idx", - "columns": [ - { - "expression": "domain", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "swarm_nodes_active_idx": { - "name": "swarm_nodes_active_idx", - "columns": [ - { - "expression": "is_active", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "swarm_nodes_last_seen_idx": { - "name": "swarm_nodes_last_seen_idx", - "columns": [ - { - "expression": "last_seen_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "swarm_nodes_trust_idx": { - "name": "swarm_nodes_trust_idx", - "columns": [ - { - "expression": "trust_score", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "swarm_nodes_nsfw_idx": { - "name": "swarm_nodes_nsfw_idx", - "columns": [ - { - "expression": "is_nsfw", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "swarm_nodes_domain_unique": { - "name": "swarm_nodes_domain_unique", - "nullsNotDistinct": false, - "columns": [ - "domain" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.swarm_seeds": { - "name": "swarm_seeds", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "domain": { - "name": "domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "priority": { - "name": "priority", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 100 - }, - "is_enabled": { - "name": "is_enabled", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "last_contact_at": { - "name": "last_contact_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "consecutive_failures": { - "name": "consecutive_failures", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "swarm_seeds_enabled_idx": { - "name": "swarm_seeds_enabled_idx", - "columns": [ - { - "expression": "is_enabled", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "swarm_seeds_priority_idx": { - "name": "swarm_seeds_priority_idx", - "columns": [ - { - "expression": "priority", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "swarm_seeds_domain_unique": { - "name": "swarm_seeds_domain_unique", - "nullsNotDistinct": false, - "columns": [ - "domain" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.swarm_sync_log": { - "name": "swarm_sync_log", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "remote_domain": { - "name": "remote_domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "direction": { - "name": "direction", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "nodes_received": { - "name": "nodes_received", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "nodes_sent": { - "name": "nodes_sent", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "handles_received": { - "name": "handles_received", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "handles_sent": { - "name": "handles_sent", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "success": { - "name": "success", - "type": "boolean", - "primaryKey": false, - "notNull": true - }, - "error_message": { - "name": "error_message", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "duration_ms": { - "name": "duration_ms", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "swarm_sync_log_remote_idx": { - "name": "swarm_sync_log_remote_idx", - "columns": [ - { - "expression": "remote_domain", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "swarm_sync_log_created_idx": { - "name": "swarm_sync_log_created_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.users": { - "name": "users", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "did": { - "name": "did", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "handle": { - "name": "handle", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "password_hash": { - "name": "password_hash", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "display_name": { - "name": "display_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "bio": { - "name": "bio", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "avatar_url": { - "name": "avatar_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "header_url": { - "name": "header_url", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "private_key_encrypted": { - "name": "private_key_encrypted", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "chat_public_key": { - "name": "chat_public_key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "chat_private_key_encrypted": { - "name": "chat_private_key_encrypted", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "node_id": { - "name": "node_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "is_bot": { - "name": "is_bot", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "bot_owner_id": { - "name": "bot_owner_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "is_nsfw": { - "name": "is_nsfw", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "nsfw_enabled": { - "name": "nsfw_enabled", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "age_verified_at": { - "name": "age_verified_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "is_suspended": { - "name": "is_suspended", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "suspension_reason": { - "name": "suspension_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "suspended_at": { - "name": "suspended_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "is_silenced": { - "name": "is_silenced", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "silence_reason": { - "name": "silence_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "silenced_at": { - "name": "silenced_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "moved_to": { - "name": "moved_to", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "moved_from": { - "name": "moved_from", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "migrated_at": { - "name": "migrated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "followers_count": { - "name": "followers_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "following_count": { - "name": "following_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "posts_count": { - "name": "posts_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "website": { - "name": "website", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "users_handle_idx": { - "name": "users_handle_idx", - "columns": [ - { - "expression": "handle", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_did_idx": { - "name": "users_did_idx", - "columns": [ - { - "expression": "did", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_suspended_idx": { - "name": "users_suspended_idx", - "columns": [ - { - "expression": "is_suspended", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_silenced_idx": { - "name": "users_silenced_idx", - "columns": [ - { - "expression": "is_silenced", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_is_bot_idx": { - "name": "users_is_bot_idx", - "columns": [ - { - "expression": "is_bot", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_bot_owner_idx": { - "name": "users_bot_owner_idx", - "columns": [ - { - "expression": "bot_owner_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_nsfw_idx": { - "name": "users_nsfw_idx", - "columns": [ - { - "expression": "is_nsfw", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "users_node_id_nodes_id_fk": { - "name": "users_node_id_nodes_id_fk", - "tableFrom": "users", - "tableTo": "nodes", - "columnsFrom": [ - "node_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "users_bot_owner_id_users_id_fk": { - "name": "users_bot_owner_id_users_id_fk", - "tableFrom": "users", - "tableTo": "users", - "columnsFrom": [ - "bot_owner_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "users_did_unique": { - "name": "users_did_unique", - "nullsNotDistinct": false, - "columns": [ - "did" - ] - }, - "users_handle_unique": { - "name": "users_handle_unique", - "nullsNotDistinct": false, - "columns": [ - "handle" - ] - }, - "users_email_unique": { - "name": "users_email_unique", - "nullsNotDistinct": false, - "columns": [ - "email" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": {}, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/drizzle/meta/_journal.json b/drizzle/meta/_journal.json deleted file mode 100644 index 166cea6..0000000 --- a/drizzle/meta/_journal.json +++ /dev/null @@ -1,104 +0,0 @@ -{ - "version": "7", - "dialect": "postgresql", - "entries": [ - { - "idx": 0, - "version": "7", - "when": 1769153858323, - "tag": "0000_clumsy_donald_blake", - "breakpoints": true - }, - { - "idx": 1, - "version": "7", - "when": 1769153858324, - "tag": "0004_add_source_config", - "breakpoints": true - }, - { - "idx": 2, - "version": "7", - "when": 1769367465905, - "tag": "0002_add_logo_url", - "breakpoints": true - }, - { - "idx": 3, - "version": "7", - "when": 1769370833410, - "tag": "0003_small_reavers", - "breakpoints": true - }, - { - "idx": 4, - "version": "7", - "when": 1769377790354, - "tag": "0004_luxuriant_lockheed", - "breakpoints": true - }, - { - "idx": 5, - "version": "7", - "when": 1769422771465, - "tag": "0005_yummy_millenium_guard", - "breakpoints": true - }, - { - "idx": 6, - "version": "7", - "when": 1769427398729, - "tag": "0006_loud_moonstone", - "breakpoints": true - }, - { - "idx": 7, - "version": "7", - "when": 1769446756226, - "tag": "0007_kind_agent_zero", - "breakpoints": true - }, - { - "idx": 8, - "version": "7", - "when": 1769453302714, - "tag": "0008_illegal_carlie_cooper", - "breakpoints": true - }, - { - "idx": 9, - "version": "7", - "when": 1769562092857, - "tag": "0009_sweet_chat", - "breakpoints": true - }, - { - "idx": 10, - "version": "7", - "when": 1769579537338, - "tag": "0010_add_sender_did_to_chat_messages", - "breakpoints": true - }, - { - "idx": 11, - "version": "7", - "when": 1769586658154, - "tag": "0011_elite_kat_farrell", - "breakpoints": true - }, - { - "idx": 12, - "version": "7", - "when": 1769586699065, - "tag": "0012_quick_mockingbird", - "breakpoints": true - }, - { - "idx": 13, - "version": "7", - "when": 1769638500000, - "tag": "0013_add_storage_public_base_url", - "breakpoints": true - } - ] -} \ No newline at end of file diff --git a/next.config.ts b/next.config.ts index f85eeaa..7c8ec18 100644 --- a/next.config.ts +++ b/next.config.ts @@ -1,12 +1,13 @@ import type { NextConfig } from "next"; const nextConfig: NextConfig = { - // Enable standalone output for Docker deployment - // This creates a minimal server.js that doesn't require full node_modules - output: 'standalone', + // Turso ships a platform-native Node module and must remain a runtime dependency. + serverExternalPackages: ['@tursodatabase/database'], // Turbopack configuration - turbopack: {}, + turbopack: { + root: process.cwd(), + }, }; export default nextConfig; diff --git a/package-lock.json b/package-lock.json index eb1d304..1e37dc2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,19 +10,18 @@ "license": "Apache-2.0", "dependencies": { "@aws-sdk/client-s3": "^3.972.0", + "@tursodatabase/database": "0.7.0", "@upstash/redis": "^1.34.3", "bcryptjs": "^2.4.3", "crypto-js": "^4.2.0", "dotenv": "^17.2.3", - "drizzle-kit": "^0.31.8", - "drizzle-orm": "^0.44.1", + "drizzle-orm": "1.0.0-rc.4", "jose": "^6.0.11", "libsodium-wrappers-sumo": "^0.8.2", "lucide-react": "^0.562.0", "multiformats": "^13.4.2", "next": "16.1.4", "next-auth": "^5.0.0-beta.25", - "pg": "^8.17.2", "react": "19.2.3", "react-dom": "19.2.3", "uuid": "^11.1.0", @@ -32,11 +31,11 @@ "@tailwindcss/postcss": "^4", "@types/bcryptjs": "^2.4.6", "@types/node": "^20.19.30", - "@types/pg": "^8.16.0", "@types/react": "^19", "@types/react-dom": "^19", "@types/uuid": "^10.0.0", "dotenv-cli": "^11.0.0", + "drizzle-kit": "1.0.0-rc.4", "eslint": "^9", "eslint-config-next": "16.1.4", "fast-check": "^4.5.3", @@ -1227,9 +1226,10 @@ } }, "node_modules/@drizzle-team/brocli": { - "version": "0.10.2", - "resolved": "https://registry.npmjs.org/@drizzle-team/brocli/-/brocli-0.10.2.tgz", - "integrity": "sha512-z33Il7l5dKjUgGULTqBsQBQwckHh5AbIuxhdsIxDDiZAzBOrZO6q9ogcWC65kU382AfynTfgNumVcNIjuIua6w==", + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/@drizzle-team/brocli/-/brocli-0.12.0.tgz", + "integrity": "sha512-mlUE+rZ8CatQekLhnaiN91Iemdd+e2gFKooGlnRB3oPTL3VghLfX24dx7HrzMNeC1JrIB/0kpsfyty3f5HNfxQ==", + "dev": true, "license": "Apache-2.0" }, "node_modules/@emnapi/core": { @@ -1265,417 +1265,6 @@ "tslib": "^2.4.0" } }, - "node_modules/@esbuild-kit/core-utils": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/@esbuild-kit/core-utils/-/core-utils-3.3.2.tgz", - "integrity": "sha512-sPRAnw9CdSsRmEtnsl2WXWdyquogVpB3yZ3dgwJfe8zrOzTsV7cJvmwrKVa+0ma5BoiGJ+BoqkMvawbayKUsqQ==", - "deprecated": "Merged into tsx: https://tsx.is", - "license": "MIT", - "dependencies": { - "esbuild": "~0.18.20", - "source-map-support": "^0.5.21" - } - }, - "node_modules/@esbuild-kit/core-utils/node_modules/@esbuild/android-arm": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.18.20.tgz", - "integrity": "sha512-fyi7TDI/ijKKNZTUJAQqiG5T7YjJXgnzkURqmGj13C6dCqckZBLdl4h7bkhHt/t0WP+zO9/zwroDvANaOqO5Sw==", - "cpu": [ - "arm" - ], - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild-kit/core-utils/node_modules/@esbuild/android-arm64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.18.20.tgz", - "integrity": "sha512-Nz4rJcchGDtENV0eMKUNa6L12zz2zBDXuhj/Vjh18zGqB44Bi7MBMSXjgunJgjRhCmKOjnPuZp4Mb6OKqtMHLQ==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild-kit/core-utils/node_modules/@esbuild/android-x64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.18.20.tgz", - "integrity": "sha512-8GDdlePJA8D6zlZYJV/jnrRAi6rOiNaCC/JclcXpB+KIuvfBN4owLtgzY2bsxnx666XjJx2kDPUmnTtR8qKQUg==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild-kit/core-utils/node_modules/@esbuild/darwin-arm64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.18.20.tgz", - "integrity": "sha512-bxRHW5kHU38zS2lPTPOyuyTm+S+eobPUnTNkdJEfAddYgEcll4xkT8DB9d2008DtTbl7uJag2HuE5NZAZgnNEA==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild-kit/core-utils/node_modules/@esbuild/darwin-x64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.18.20.tgz", - "integrity": "sha512-pc5gxlMDxzm513qPGbCbDukOdsGtKhfxD1zJKXjCCcU7ju50O7MeAZ8c4krSJcOIJGFR+qx21yMMVYwiQvyTyQ==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild-kit/core-utils/node_modules/@esbuild/freebsd-arm64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.18.20.tgz", - "integrity": "sha512-yqDQHy4QHevpMAaxhhIwYPMv1NECwOvIpGCZkECn8w2WFHXjEwrBn3CeNIYsibZ/iZEUemj++M26W3cNR5h+Tw==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild-kit/core-utils/node_modules/@esbuild/freebsd-x64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.18.20.tgz", - "integrity": "sha512-tgWRPPuQsd3RmBZwarGVHZQvtzfEBOreNuxEMKFcd5DaDn2PbBxfwLcj4+aenoh7ctXcbXmOQIn8HI6mCSw5MQ==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild-kit/core-utils/node_modules/@esbuild/linux-arm": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.18.20.tgz", - "integrity": "sha512-/5bHkMWnq1EgKr1V+Ybz3s1hWXok7mDFUMQ4cG10AfW3wL02PSZi5kFpYKrptDsgb2WAJIvRcDm+qIvXf/apvg==", - "cpu": [ - "arm" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild-kit/core-utils/node_modules/@esbuild/linux-arm64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.18.20.tgz", - "integrity": "sha512-2YbscF+UL7SQAVIpnWvYwM+3LskyDmPhe31pE7/aoTMFKKzIc9lLbyGUpmmb8a8AixOL61sQ/mFh3jEjHYFvdA==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild-kit/core-utils/node_modules/@esbuild/linux-ia32": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.18.20.tgz", - "integrity": "sha512-P4etWwq6IsReT0E1KHU40bOnzMHoH73aXp96Fs8TIT6z9Hu8G6+0SHSw9i2isWrD2nbx2qo5yUqACgdfVGx7TA==", - "cpu": [ - "ia32" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild-kit/core-utils/node_modules/@esbuild/linux-loong64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.18.20.tgz", - "integrity": "sha512-nXW8nqBTrOpDLPgPY9uV+/1DjxoQ7DoB2N8eocyq8I9XuqJ7BiAMDMf9n1xZM9TgW0J8zrquIb/A7s3BJv7rjg==", - "cpu": [ - "loong64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild-kit/core-utils/node_modules/@esbuild/linux-mips64el": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.18.20.tgz", - "integrity": "sha512-d5NeaXZcHp8PzYy5VnXV3VSd2D328Zb+9dEq5HE6bw6+N86JVPExrA6O68OPwobntbNJ0pzCpUFZTo3w0GyetQ==", - "cpu": [ - "mips64el" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild-kit/core-utils/node_modules/@esbuild/linux-ppc64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.18.20.tgz", - "integrity": "sha512-WHPyeScRNcmANnLQkq6AfyXRFr5D6N2sKgkFo2FqguP44Nw2eyDlbTdZwd9GYk98DZG9QItIiTlFLHJHjxP3FA==", - "cpu": [ - "ppc64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild-kit/core-utils/node_modules/@esbuild/linux-riscv64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.18.20.tgz", - "integrity": "sha512-WSxo6h5ecI5XH34KC7w5veNnKkju3zBRLEQNY7mv5mtBmrP/MjNBCAlsM2u5hDBlS3NGcTQpoBvRzqBcRtpq1A==", - "cpu": [ - "riscv64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild-kit/core-utils/node_modules/@esbuild/linux-s390x": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.18.20.tgz", - "integrity": "sha512-+8231GMs3mAEth6Ja1iK0a1sQ3ohfcpzpRLH8uuc5/KVDFneH6jtAJLFGafpzpMRO6DzJ6AvXKze9LfFMrIHVQ==", - "cpu": [ - "s390x" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild-kit/core-utils/node_modules/@esbuild/linux-x64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.18.20.tgz", - "integrity": "sha512-UYqiqemphJcNsFEskc73jQ7B9jgwjWrSayxawS6UVFZGWrAAtkzjxSqnoclCXxWtfwLdzU+vTpcNYhpn43uP1w==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild-kit/core-utils/node_modules/@esbuild/netbsd-x64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.18.20.tgz", - "integrity": "sha512-iO1c++VP6xUBUmltHZoMtCUdPlnPGdBom6IrO4gyKPFFVBKioIImVooR5I83nTew5UOYrk3gIJhbZh8X44y06A==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "netbsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild-kit/core-utils/node_modules/@esbuild/openbsd-x64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.18.20.tgz", - "integrity": "sha512-e5e4YSsuQfX4cxcygw/UCPIEP6wbIL+se3sxPdCiMbFLBWu0eiZOJ7WoD+ptCLrmjZBK1Wk7I6D/I3NglUGOxg==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild-kit/core-utils/node_modules/@esbuild/sunos-x64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.18.20.tgz", - "integrity": "sha512-kDbFRFp0YpTQVVrqUd5FTYmWo45zGaXe0X8E1G/LKFC0v8x0vWrhOWSLITcCn63lmZIxfOMXtCfti/RxN/0wnQ==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "sunos" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild-kit/core-utils/node_modules/@esbuild/win32-arm64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.18.20.tgz", - "integrity": "sha512-ddYFR6ItYgoaq4v4JmQQaAI5s7npztfV4Ag6NrhiaW0RrnOXqBkgwZLofVTlq1daVTQNhtI5oieTvkRPfZrePg==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild-kit/core-utils/node_modules/@esbuild/win32-ia32": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.18.20.tgz", - "integrity": "sha512-Wv7QBi3ID/rROT08SABTS7eV4hX26sVduqDOTe1MvGMjNd3EjOz4b7zeexIR62GTIEKrfJXKL9LFxTYgkyeu7g==", - "cpu": [ - "ia32" - ], - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild-kit/core-utils/node_modules/@esbuild/win32-x64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.18.20.tgz", - "integrity": "sha512-kTdfRcSiDfQca/y9QIkng02avJ+NCaQvrMejlsB3RRv5sE9rRoeBPISaZpKxHELzRxZyLvNts1P27W3wV+8geQ==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild-kit/core-utils/node_modules/esbuild": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.18.20.tgz", - "integrity": "sha512-ceqxoedUrcayh7Y7ZX6NdbbDzGROiyVBgC4PriJThBKSVPWnnFHZAkfI1lJT8QFkOwH4qOS2SJkS4wvpGl8BpA==", - "hasInstallScript": true, - "license": "MIT", - "bin": { - "esbuild": "bin/esbuild" - }, - "engines": { - "node": ">=12" - }, - "optionalDependencies": { - "@esbuild/android-arm": "0.18.20", - "@esbuild/android-arm64": "0.18.20", - "@esbuild/android-x64": "0.18.20", - "@esbuild/darwin-arm64": "0.18.20", - "@esbuild/darwin-x64": "0.18.20", - "@esbuild/freebsd-arm64": "0.18.20", - "@esbuild/freebsd-x64": "0.18.20", - "@esbuild/linux-arm": "0.18.20", - "@esbuild/linux-arm64": "0.18.20", - "@esbuild/linux-ia32": "0.18.20", - "@esbuild/linux-loong64": "0.18.20", - "@esbuild/linux-mips64el": "0.18.20", - "@esbuild/linux-ppc64": "0.18.20", - "@esbuild/linux-riscv64": "0.18.20", - "@esbuild/linux-s390x": "0.18.20", - "@esbuild/linux-x64": "0.18.20", - "@esbuild/netbsd-x64": "0.18.20", - "@esbuild/openbsd-x64": "0.18.20", - "@esbuild/sunos-x64": "0.18.20", - "@esbuild/win32-arm64": "0.18.20", - "@esbuild/win32-ia32": "0.18.20", - "@esbuild/win32-x64": "0.18.20" - } - }, - "node_modules/@esbuild-kit/esm-loader": { - "version": "2.6.5", - "resolved": "https://registry.npmjs.org/@esbuild-kit/esm-loader/-/esm-loader-2.6.5.tgz", - "integrity": "sha512-FxEMIkJKnodyA1OaCUoEvbYRkoZlLZ4d/eXFu9Fh8CbBBgP5EmZxrfTRyN0qpXZ4vOvqnE5YdRdcrmUUXuU+dA==", - "deprecated": "Merged into tsx: https://tsx.is", - "license": "MIT", - "dependencies": { - "@esbuild-kit/core-utils": "^3.3.2", - "get-tsconfig": "^4.7.0" - } - }, "node_modules/@esbuild/aix-ppc64": { "version": "0.25.12", "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.12.tgz", @@ -1683,6 +1272,7 @@ "cpu": [ "ppc64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1699,6 +1289,7 @@ "cpu": [ "arm" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1715,6 +1306,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1731,6 +1323,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1747,6 +1340,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1763,6 +1357,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1779,6 +1374,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1795,6 +1391,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1811,6 +1408,7 @@ "cpu": [ "arm" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1827,6 +1425,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1843,6 +1442,7 @@ "cpu": [ "ia32" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1859,6 +1459,7 @@ "cpu": [ "loong64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1875,6 +1476,7 @@ "cpu": [ "mips64el" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1891,6 +1493,7 @@ "cpu": [ "ppc64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1907,6 +1510,7 @@ "cpu": [ "riscv64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1923,6 +1527,7 @@ "cpu": [ "s390x" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1939,6 +1544,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1955,6 +1561,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1971,6 +1578,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -1987,6 +1595,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2003,6 +1612,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2019,6 +1629,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2035,6 +1646,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2051,6 +1663,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2067,6 +1680,7 @@ "cpu": [ "ia32" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2083,6 +1697,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2804,6 +2419,19 @@ "@jridgewell/sourcemap-codec": "^1.4.14" } }, + "node_modules/@js-temporal/polyfill": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/@js-temporal/polyfill/-/polyfill-0.5.1.tgz", + "integrity": "sha512-hloP58zRVCRSpgDxmqCWJNlizAlUgJFqG2ypq79DCvyv9tHjRYMDOcPFjzfl/A1/YxDvRCZz8wvZvmapQnKwFQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "jsbi": "^4.3.0" + }, + "engines": { + "node": ">=12" + } + }, "node_modules/@napi-rs/wasm-runtime": { "version": "0.2.12", "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-0.2.12.tgz", @@ -4394,6 +4022,79 @@ "tailwindcss": "4.1.18" } }, + "node_modules/@tursodatabase/database": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/@tursodatabase/database/-/database-0.7.0.tgz", + "integrity": "sha512-rp5qHS1/ToZP1E3feuh5P1bNgWIdiLXI4wMm8pEb8+uQTctskmH9NnroWGuiYjL59y40CHbN/oIPinZnMJDclw==", + "license": "MIT", + "dependencies": { + "@tursodatabase/database-common": "^0.7.0" + }, + "optionalDependencies": { + "@tursodatabase/database-darwin-arm64": "0.7.0", + "@tursodatabase/database-linux-arm64-gnu": "0.7.0", + "@tursodatabase/database-linux-x64-gnu": "0.7.0", + "@tursodatabase/database-win32-x64-msvc": "0.7.0" + } + }, + "node_modules/@tursodatabase/database-common": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/@tursodatabase/database-common/-/database-common-0.7.0.tgz", + "integrity": "sha512-7Www/wk04L558B3ioa6LnXMktd9+6BkMj7RnoveanyOCGKkJHRVlIUzAR9lblQH1AHIXG4VIpb0/tZ5IndRoxA==", + "license": "MIT" + }, + "node_modules/@tursodatabase/database-darwin-arm64": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/@tursodatabase/database-darwin-arm64/-/database-darwin-arm64-0.7.0.tgz", + "integrity": "sha512-QlK5WzEa5q0e3PjGS/jTCROAEOw0TZSey3++cJmJkmZL3nfv2O9yMurr6IHQYBSO5fLbXKsT9f0oPLVVdgv5vQ==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@tursodatabase/database-linux-arm64-gnu": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/@tursodatabase/database-linux-arm64-gnu/-/database-linux-arm64-gnu-0.7.0.tgz", + "integrity": "sha512-pk0Zd9WUyCmW4oEMull2MI42C6pnk/kU+fxGki4HAm2YrLAOHgHniDTpiZx3EMr2WJU5hbapIaXNvhH7Do7Jrg==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@tursodatabase/database-linux-x64-gnu": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/@tursodatabase/database-linux-x64-gnu/-/database-linux-x64-gnu-0.7.0.tgz", + "integrity": "sha512-6qH+f1dErF8GfLxTrKI6b30DDrsIb38n17j8ayiMqkW5CX9Z+1pCSghqFLTXhfIBvwThUbeS1F9Vthc468qXQA==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@tursodatabase/database-win32-x64-msvc": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/@tursodatabase/database-win32-x64-msvc/-/database-win32-x64-msvc-0.7.0.tgz", + "integrity": "sha512-+AECWhFs7/8P5nZiC+GcABfSrScVuTAAxa0WjbeJg+0ihZr3OPxOblda2FUIZ086sHbnKhRF152TFFv8Fl8gDw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, "node_modules/@tybys/wasm-util": { "version": "0.10.1", "resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.10.1.tgz", @@ -4465,8 +4166,9 @@ "version": "8.16.0", "resolved": "https://registry.npmjs.org/@types/pg/-/pg-8.16.0.tgz", "integrity": "sha512-RmhMd/wD+CF8Dfo+cVIy3RR5cl8CyfXQ0tGgW6XBL8L4LM/UTEbNXYRbLwU6w+CgrKBNbrQWt4FUtTfaU5jSYQ==", - "devOptional": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "@types/node": "*", "pg-protocol": "*", @@ -4477,8 +4179,9 @@ "version": "2.2.0", "resolved": "https://registry.npmjs.org/pg-types/-/pg-types-2.2.0.tgz", "integrity": "sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA==", - "devOptional": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "pg-int8": "1.0.1", "postgres-array": "~2.0.0", @@ -4494,8 +4197,9 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/postgres-array/-/postgres-array-2.0.0.tgz", "integrity": "sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA==", - "devOptional": true, "license": "MIT", + "optional": true, + "peer": true, "engines": { "node": ">=4" } @@ -4504,8 +4208,9 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/postgres-bytea/-/postgres-bytea-1.0.1.tgz", "integrity": "sha512-5+5HqXnsZPE65IJZSMkZtURARZelel2oXUEO8rH83VS/hxH5vv1uHquPg5wZs8yMAfdv971IU+kcPUczi7NVBQ==", - "devOptional": true, "license": "MIT", + "optional": true, + "peer": true, "engines": { "node": ">=0.10.0" } @@ -4514,8 +4219,9 @@ "version": "1.0.7", "resolved": "https://registry.npmjs.org/postgres-date/-/postgres-date-1.0.7.tgz", "integrity": "sha512-suDmjLVQg78nMK2UZ454hAG+OAW+HQPZ6n++TNDUX+L0+uUlLywnoxJKDou51Zm+zTCjrCl0Nq6J9C5hP9vK/Q==", - "devOptional": true, "license": "MIT", + "optional": true, + "peer": true, "engines": { "node": ">=0.10.0" } @@ -4524,8 +4230,9 @@ "version": "1.2.0", "resolved": "https://registry.npmjs.org/postgres-interval/-/postgres-interval-1.2.0.tgz", "integrity": "sha512-9ZhXKM/rw350N1ovuWHbGxnGh/SNJ4cnxHiM0rxE4VN41wsg8P8zWn9hv/buK00RP4WvlOyr/RBDiptyxVbkZQ==", - "devOptional": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "xtend": "^4.0.0" }, @@ -5600,12 +5307,6 @@ "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" } }, - "node_modules/buffer-from": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", - "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", - "license": "MIT" - }, "node_modules/call-bind": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.8.tgz", @@ -5846,6 +5547,7 @@ "version": "4.4.3", "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dev": true, "license": "MIT", "dependencies": { "ms": "^2.1.3" @@ -5983,28 +5685,39 @@ } }, "node_modules/drizzle-kit": { - "version": "0.31.8", - "resolved": "https://registry.npmjs.org/drizzle-kit/-/drizzle-kit-0.31.8.tgz", - "integrity": "sha512-O9EC/miwdnRDY10qRxM8P3Pg8hXe3LyU4ZipReKOgTwn4OqANmftj8XJz1UPUAS6NMHf0E2htjsbQujUTkncCg==", + "version": "1.0.0-rc.4", + "resolved": "https://registry.npmjs.org/drizzle-kit/-/drizzle-kit-1.0.0-rc.4.tgz", + "integrity": "sha512-KZCpjRyu+oYHLj/UJogfFlOkWhHVkaEI2EOT1U3NDVXUzLoTyPjqwFxwOrlQxsY6jzRyxcz4EacqboGfhEeYrA==", + "dev": true, "license": "MIT", "dependencies": { - "@drizzle-team/brocli": "^0.10.2", - "@esbuild-kit/esm-loader": "^2.5.5", - "esbuild": "^0.25.4", - "esbuild-register": "^3.5.0" + "@drizzle-team/brocli": "^0.12.0", + "@js-temporal/polyfill": "^0.5.1", + "esbuild": "^0.25.10", + "get-tsconfig": "^4.13.6", + "jiti": "^2.6.1" }, "bin": { "drizzle-kit": "bin.cjs" } }, "node_modules/drizzle-orm": { - "version": "0.44.7", - "resolved": "https://registry.npmjs.org/drizzle-orm/-/drizzle-orm-0.44.7.tgz", - "integrity": "sha512-quIpnYznjU9lHshEOAYLoZ9s3jweleHlZIAWR/jX9gAWNg/JhQ1wj0KGRf7/Zm+obRrYd9GjPVJg790QY9N5AQ==", + "version": "1.0.0-rc.4", + "resolved": "https://registry.npmjs.org/drizzle-orm/-/drizzle-orm-1.0.0-rc.4.tgz", + "integrity": "sha512-BT+pf+qoiYHqltoA88Jmf6ilGMXPlpfE0hEJKc2adRtMCAl25Swk/t5gXcWxZNAwdtf3F5gCd2FpeOyP/pT0Hw==", "license": "Apache-2.0", "peerDependencies": { "@aws-sdk/client-rds-data": ">=3", "@cloudflare/workers-types": ">=4", + "@effect/sql-d1": ">=4.0.0-beta.83 || >=4.0.0", + "@effect/sql-libsql": ">=4.0.0-beta.83 || >=4.0.0", + "@effect/sql-mysql2": ">=4.0.0-beta.83 || >=4.0.0", + "@effect/sql-pg": ">=4.0.0-beta.83 || >=4.0.0", + "@effect/sql-pglite": ">=4.0.0-beta.83 || >=4.0.0", + "@effect/sql-sqlite-bun": ">=4.0.0-beta.83 || >=4.0.0", + "@effect/sql-sqlite-do": ">=4.0.0-beta.83 || >=4.0.0", + "@effect/sql-sqlite-node": ">=4.0.0-beta.83 || >=4.0.0", + "@effect/sql-sqlite-wasm": ">=4.0.0-beta.83 || >=4.0.0", "@electric-sql/pglite": ">=0.2.0", "@libsql/client": ">=0.10.0", "@libsql/client-wasm": ">=0.10.0", @@ -6012,25 +5725,35 @@ "@op-engineering/op-sqlite": ">=2", "@opentelemetry/api": "^1.4.1", "@planetscale/database": ">=1.13", - "@prisma/client": "*", + "@sinclair/typebox": ">=0.34.8", + "@sqlitecloud/drivers": ">=1.0.653", "@tidbcloud/serverless": "*", + "@tursodatabase/database": ">=0.6.0-pre.28 || >=0.6.0", + "@tursodatabase/database-common": ">=0.6.0-pre.28 || >=0.6.0", + "@tursodatabase/database-wasm": ">=0.6.0-pre.28 || >=0.6.0", + "@tursodatabase/serverless": ">=1.1.3", + "@tursodatabase/sync": ">=0.6.0-pre.28 || >=0.6.0", "@types/better-sqlite3": "*", + "@types/mssql": "^9.1.4", "@types/pg": "*", "@types/sql.js": "*", "@upstash/redis": ">=1.34.7", "@vercel/postgres": ">=0.8.0", "@xata.io/client": "*", - "better-sqlite3": ">=7", + "arktype": ">=2.0.0", + "better-sqlite3": ">=9.3.0", "bun-types": "*", + "effect": ">=4.0.0-beta.83 || >=4.0.0", "expo-sqlite": ">=14.0.0", - "gel": ">=2", - "knex": "*", - "kysely": "*", + "mssql": "^11.0.1", "mysql2": ">=2", "pg": ">=8", "postgres": ">=3", "sql.js": ">=1", - "sqlite3": ">=5" + "sqlite3": ">=5", + "typebox": ">=1.0.0", + "valibot": ">=1.0.0-beta.7", + "zod": "^3.25.0 || ^4.0.0" }, "peerDependenciesMeta": { "@aws-sdk/client-rds-data": { @@ -6039,6 +5762,33 @@ "@cloudflare/workers-types": { "optional": true }, + "@effect/sql-d1": { + "optional": true + }, + "@effect/sql-libsql": { + "optional": true + }, + "@effect/sql-mysql2": { + "optional": true + }, + "@effect/sql-pg": { + "optional": true + }, + "@effect/sql-pglite": { + "optional": true + }, + "@effect/sql-sqlite-bun": { + "optional": true + }, + "@effect/sql-sqlite-do": { + "optional": true + }, + "@effect/sql-sqlite-node": { + "optional": true + }, + "@effect/sql-sqlite-wasm": { + "optional": true + }, "@electric-sql/pglite": { "optional": true }, @@ -6060,15 +5810,36 @@ "@planetscale/database": { "optional": true }, - "@prisma/client": { + "@sinclair/typebox": { + "optional": true + }, + "@sqlitecloud/drivers": { "optional": true }, "@tidbcloud/serverless": { "optional": true }, + "@tursodatabase/database": { + "optional": true + }, + "@tursodatabase/database-common": { + "optional": true + }, + "@tursodatabase/database-wasm": { + "optional": true + }, + "@tursodatabase/serverless": { + "optional": true + }, + "@tursodatabase/sync": { + "optional": true + }, "@types/better-sqlite3": { "optional": true }, + "@types/mssql": { + "optional": true + }, "@types/pg": { "optional": true }, @@ -6084,22 +5855,22 @@ "@xata.io/client": { "optional": true }, + "arktype": { + "optional": true + }, "better-sqlite3": { "optional": true }, "bun-types": { "optional": true }, + "effect": { + "optional": true + }, "expo-sqlite": { "optional": true }, - "gel": { - "optional": true - }, - "knex": { - "optional": true - }, - "kysely": { + "mssql": { "optional": true }, "mysql2": { @@ -6111,14 +5882,20 @@ "postgres": { "optional": true }, - "prisma": { - "optional": true - }, "sql.js": { "optional": true }, "sqlite3": { "optional": true + }, + "typebox": { + "optional": true + }, + "valibot": { + "optional": true + }, + "zod": { + "optional": true } } }, @@ -6353,6 +6130,7 @@ "version": "0.25.12", "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.12.tgz", "integrity": "sha512-bbPBYYrtZbkt6Os6FiTLCTFxvq4tt3JKall1vRwshA3fdVztsLAatFaZobhkBC8/BrPetoa0oksYoKXoG4ryJg==", + "dev": true, "hasInstallScript": true, "license": "MIT", "bin": { @@ -6390,18 +6168,6 @@ "@esbuild/win32-x64": "0.25.12" } }, - "node_modules/esbuild-register": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/esbuild-register/-/esbuild-register-3.6.0.tgz", - "integrity": "sha512-H2/S7Pm8a9CL1uhp9OvjwrBh5Pvx0H8qVOxNu8Wed9Y7qv56MPtq+GGM8RJpq6glYJn9Wspr8uw7l55uyinNeg==", - "license": "MIT", - "dependencies": { - "debug": "^4.3.4" - }, - "peerDependencies": { - "esbuild": ">=0.12 <1" - } - }, "node_modules/escalade": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", @@ -7185,9 +6951,10 @@ } }, "node_modules/get-tsconfig": { - "version": "4.13.0", - "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.13.0.tgz", - "integrity": "sha512-1VKTZJCwBrvbd+Wn3AOgQP/2Av+TfTCOlE4AcRJE72W1ksZXbAx8PPBR9RzgTeSPzlPMHrbANMH3LbltH73wxQ==", + "version": "4.14.0", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.14.0.tgz", + "integrity": "sha512-yTb+8DXzDREzgvYmh6s9vHsSVCHeC0G3PI5bEXNBHtmshPnO+S5O7qgLEOn0I5QvMy6kpZN8K1NKGyilLb93wA==", + "dev": true, "license": "MIT", "dependencies": { "resolve-pkg-maps": "^1.0.0" @@ -7908,6 +7675,13 @@ "js-yaml": "bin/js-yaml.js" } }, + "node_modules/jsbi": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/jsbi/-/jsbi-4.3.2.tgz", + "integrity": "sha512-9fqMSQbhJykSeii05nxKl4m6Eqn2P6rOlYiS+C5Dr/HPIU/7yZxu5qzbs40tgaFORiw2Amd0mirjxatXYMkIew==", + "dev": true, + "license": "Apache-2.0" + }, "node_modules/jsesc": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz", @@ -8417,6 +8191,7 @@ "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, "license": "MIT" }, "node_modules/multiformats": { @@ -8844,6 +8619,8 @@ "resolved": "https://registry.npmjs.org/pg/-/pg-8.17.2.tgz", "integrity": "sha512-vjbKdiBJRqzcYw1fNU5KuHyYvdJ1qpcQg1CeBrHFqV1pWgHeVR6j/+kX0E1AAXfyuLUGY1ICrN2ELKA/z2HWzw==", "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "pg-connection-string": "^2.10.1", "pg-pool": "^3.11.0", @@ -8871,19 +8648,24 @@ "resolved": "https://registry.npmjs.org/pg-cloudflare/-/pg-cloudflare-1.3.0.tgz", "integrity": "sha512-6lswVVSztmHiRtD6I8hw4qP/nDm1EJbKMRhf3HCYaqud7frGysPv7FYJ5noZQdhQtN2xJnimfMtvQq21pdbzyQ==", "license": "MIT", - "optional": true + "optional": true, + "peer": true }, "node_modules/pg-connection-string": { "version": "2.10.1", "resolved": "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-2.10.1.tgz", "integrity": "sha512-iNzslsoeSH2/gmDDKiyMqF64DATUCWj3YJ0wP14kqcsf2TUklwimd+66yYojKwZCA7h2yRNLGug71hCBA2a4sw==", - "license": "MIT" + "license": "MIT", + "optional": true, + "peer": true }, "node_modules/pg-int8": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/pg-int8/-/pg-int8-1.0.1.tgz", "integrity": "sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw==", "license": "ISC", + "optional": true, + "peer": true, "engines": { "node": ">=4.0.0" } @@ -8893,6 +8675,8 @@ "resolved": "https://registry.npmjs.org/pg-pool/-/pg-pool-3.11.0.tgz", "integrity": "sha512-MJYfvHwtGp870aeusDh+hg9apvOe2zmpZJpyt+BMtzUWlVqbhFmMK6bOBXLBUPd7iRtIF9fZplDc7KrPN3PN7w==", "license": "MIT", + "optional": true, + "peer": true, "peerDependencies": { "pg": ">=8.0" } @@ -8901,13 +8685,17 @@ "version": "1.11.0", "resolved": "https://registry.npmjs.org/pg-protocol/-/pg-protocol-1.11.0.tgz", "integrity": "sha512-pfsxk2M9M3BuGgDOfuy37VNRRX3jmKgMjcvAcWqNDpZSf4cUmv8HSOl5ViRQFsfARFn0KuUQTgLxVMbNq5NW3g==", - "license": "MIT" + "license": "MIT", + "optional": true, + "peer": true }, "node_modules/pg/node_modules/pg-types": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/pg-types/-/pg-types-2.2.0.tgz", "integrity": "sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA==", "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "pg-int8": "1.0.1", "postgres-array": "~2.0.0", @@ -8924,6 +8712,8 @@ "resolved": "https://registry.npmjs.org/postgres-array/-/postgres-array-2.0.0.tgz", "integrity": "sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA==", "license": "MIT", + "optional": true, + "peer": true, "engines": { "node": ">=4" } @@ -8933,6 +8723,8 @@ "resolved": "https://registry.npmjs.org/postgres-bytea/-/postgres-bytea-1.0.1.tgz", "integrity": "sha512-5+5HqXnsZPE65IJZSMkZtURARZelel2oXUEO8rH83VS/hxH5vv1uHquPg5wZs8yMAfdv971IU+kcPUczi7NVBQ==", "license": "MIT", + "optional": true, + "peer": true, "engines": { "node": ">=0.10.0" } @@ -8942,6 +8734,8 @@ "resolved": "https://registry.npmjs.org/postgres-date/-/postgres-date-1.0.7.tgz", "integrity": "sha512-suDmjLVQg78nMK2UZ454hAG+OAW+HQPZ6n++TNDUX+L0+uUlLywnoxJKDou51Zm+zTCjrCl0Nq6J9C5hP9vK/Q==", "license": "MIT", + "optional": true, + "peer": true, "engines": { "node": ">=0.10.0" } @@ -8951,6 +8745,8 @@ "resolved": "https://registry.npmjs.org/postgres-interval/-/postgres-interval-1.2.0.tgz", "integrity": "sha512-9ZhXKM/rw350N1ovuWHbGxnGh/SNJ4cnxHiM0rxE4VN41wsg8P8zWn9hv/buK00RP4WvlOyr/RBDiptyxVbkZQ==", "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "xtend": "^4.0.0" }, @@ -8963,6 +8759,8 @@ "resolved": "https://registry.npmjs.org/pgpass/-/pgpass-1.0.5.tgz", "integrity": "sha512-FdW9r/jQZhSeohs1Z3sI1yxFQNFvMcnmfuj4WBMUTxOrAyLMaTcE1aAMBiTlbMNaXvBCQuVi0R7hd8udDSP7ug==", "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "split2": "^4.1.0" } @@ -9221,6 +9019,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", + "dev": true, "license": "MIT", "funding": { "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" @@ -9590,15 +9389,6 @@ "dev": true, "license": "ISC" }, - "node_modules/source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/source-map-js": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", @@ -9608,21 +9398,13 @@ "node": ">=0.10.0" } }, - "node_modules/source-map-support": { - "version": "0.5.21", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", - "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", - "license": "MIT", - "dependencies": { - "buffer-from": "^1.0.0", - "source-map": "^0.6.0" - } - }, "node_modules/split2": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/split2/-/split2-4.2.0.tgz", "integrity": "sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==", "license": "ISC", + "optional": true, + "peer": true, "engines": { "node": ">= 10.x" } @@ -11585,6 +11367,8 @@ "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", "license": "MIT", + "optional": true, + "peer": true, "engines": { "node": ">=0.4" } diff --git a/package.json b/package.json index 1c761f3..d7550f0 100644 --- a/package.json +++ b/package.json @@ -7,9 +7,10 @@ "dev": "next dev --turbopack", "dev:dev": "dotenv -e .env.dev -- next dev --turbopack -p 3050", "build": "next build", - "start": "next start", + "start": "npm run db:migrate && next start --hostname 127.0.0.1", "lint": "eslint", "db:generate": "drizzle-kit generate", + "db:migrate": "tsx scripts/migrate.ts", "db:generate:dev": "dotenv -e .env.dev -- drizzle-kit generate", "db:push": "drizzle-kit push", "db:push:dev": "dotenv -e .env.dev -- drizzle-kit push", @@ -21,19 +22,18 @@ }, "dependencies": { "@aws-sdk/client-s3": "^3.972.0", + "@tursodatabase/database": "0.7.0", "@upstash/redis": "^1.34.3", "bcryptjs": "^2.4.3", "crypto-js": "^4.2.0", "dotenv": "^17.2.3", - "drizzle-kit": "^0.31.8", - "drizzle-orm": "^0.44.1", + "drizzle-orm": "1.0.0-rc.4", "jose": "^6.0.11", "libsodium-wrappers-sumo": "^0.8.2", "lucide-react": "^0.562.0", "multiformats": "^13.4.2", "next": "16.1.4", "next-auth": "^5.0.0-beta.25", - "pg": "^8.17.2", "react": "19.2.3", "react-dom": "19.2.3", "uuid": "^11.1.0", @@ -43,11 +43,11 @@ "@tailwindcss/postcss": "^4", "@types/bcryptjs": "^2.4.6", "@types/node": "^20.19.30", - "@types/pg": "^8.16.0", "@types/react": "^19", "@types/react-dom": "^19", "@types/uuid": "^10.0.0", "dotenv-cli": "^11.0.0", + "drizzle-kit": "1.0.0-rc.4", "eslint": "^9", "eslint-config-next": "16.1.4", "fast-check": "^4.5.3", diff --git a/scripts/add-sender-did.ts b/scripts/add-sender-did.ts deleted file mode 100644 index 3d5a22a..0000000 --- a/scripts/add-sender-did.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { db } from '../src/db'; - -async function main() { - await db.execute(`ALTER TABLE chat_messages ADD COLUMN IF NOT EXISTS sender_did text;`); - console.log('Added sender_did column to chat_messages'); - process.exit(0); -} - -main(); diff --git a/scripts/caddy-entrypoint.sh b/scripts/caddy-entrypoint.sh deleted file mode 100755 index dc99f1b..0000000 --- a/scripts/caddy-entrypoint.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/sh -# Caddy Entrypoint Script for Synapsis -# Reads the dynamic port from the shared file and starts Caddy - -set -e - -SHARED_PORT_FILE="/var/run/synapsis/port" -DEFAULT_PORT=3000 - -# Wait for the port file to exist (with timeout) -echo "⏳ Waiting for Synapsis app to announce its port..." -TIMEOUT=60 -ELAPSED=0 - -while [ ! -f "$SHARED_PORT_FILE" ] && [ $ELAPSED -lt $TIMEOUT ]; do - sleep 1 - ELAPSED=$((ELAPSED + 1)) -done - -if [ -f "$SHARED_PORT_FILE" ]; then - APP_PORT=$(cat "$SHARED_PORT_FILE") - echo "βœ… Found Synapsis app on port: $APP_PORT" -else - echo "⚠️ Port file not found after ${TIMEOUT}s, using default port: $DEFAULT_PORT" - APP_PORT=$DEFAULT_PORT -fi - -export APP_PORT - -# Validate that APP_PORT is a number -if ! echo "$APP_PORT" | grep -qE '^[0-9]+$'; then - echo "❌ Invalid port number: $APP_PORT" - exit 1 -fi - -echo "🌐 Starting Caddy reverse proxy to app:$APP_PORT..." -echo "" - -# Start Caddy with the environment variable set -exec caddy run --config /etc/caddy/Caddyfile --adapter caddyfile diff --git a/scripts/docker-entrypoint.sh b/scripts/docker-entrypoint.sh deleted file mode 100755 index 0d9122d..0000000 --- a/scripts/docker-entrypoint.sh +++ /dev/null @@ -1,203 +0,0 @@ -#!/bin/sh -# Synapsis Docker Entrypoint Script -# Handles database migrations, port detection, and application startup - -set -e - -# Default port range for auto-detection -PORT_START=${PORT_START:-3000} -PORT_END=${PORT_END:-3020} - -# Function to check if a port is available -check_port_available() { - local port=$1 - if ! nc -z localhost "$port" 2>/dev/null; then - return 0 # Port is available - else - return 1 # Port is in use - fi -} - -# Function to find first available port in range -find_available_port() { - local start=$1 - local end=$2 - - for port in $(seq "$start" "$end"); do - if check_port_available "$port"; then - echo "$port" - return 0 - fi - done - - echo "ERROR: No available ports found in range $start-$end" >&2 - return 1 -} - -# Handle PORT=auto -if [ "${PORT}" = "auto" ]; then - echo "πŸ” PORT=auto detected, scanning for available port in range ${PORT_START}-${PORT_END}..." - - DETECTED_PORT=$(find_available_port "$PORT_START" "$PORT_END") - - if [ $? -ne 0 ]; then - echo "❌ Failed to find an available port. Exiting." - exit 1 - fi - - export PORT="$DETECTED_PORT" - echo "βœ… Using automatically detected port: $PORT" -else - echo "πŸ“‘ Using configured port: $PORT" -fi - -# Ensure PORT is set -if [ -z "$PORT" ]; then - echo "⚠️ PORT not set, defaulting to 3000" - export PORT=3000 -fi - -# Write port to shared file for Caddy to read -SHARED_PORT_FILE="/var/run/synapsis/port" -mkdir -p "$(dirname "$SHARED_PORT_FILE")" -echo "$PORT" > "$SHARED_PORT_FILE" -echo "πŸ“ Port $PORT written to $SHARED_PORT_FILE" - -# Export HOSTNAME for Next.js -export HOSTNAME="0.0.0.0" - -# ============================================ -# Database Migrations -# ============================================ - -echo "" -echo "========================================" -echo " Synapsis - Starting Application" -echo "========================================" -echo " Time: $(date)" -echo " Working Dir: $(pwd)" -echo " Database URL: ${DATABASE_URL%%:*}://***@***" -echo " Port: $PORT" -echo "========================================" - -# Ensure DATABASE_URL is set -if [ -z "$DATABASE_URL" ]; then - echo "❌ DATABASE_URL is not set. Exiting." - exit 1 -fi - -# Normalize domain inputs (strip scheme/path) to avoid localhost/protocol issues -sanitize_domain() { - echo "$1" | sed -E 's#^[a-zA-Z]+://##; s#/.*$##' -} - -# Normalize DOMAIN if provided -if [ -n "$DOMAIN" ]; then - CLEAN_DOMAIN=$(sanitize_domain "$DOMAIN") - if [ "$CLEAN_DOMAIN" != "$DOMAIN" ]; then - export DOMAIN="$CLEAN_DOMAIN" - echo "🌐 DOMAIN normalized to $DOMAIN" - fi -fi - -# Normalize NEXT_PUBLIC_NODE_DOMAIN if provided -if [ -n "$NEXT_PUBLIC_NODE_DOMAIN" ]; then - CLEAN_NODE_DOMAIN=$(sanitize_domain "$NEXT_PUBLIC_NODE_DOMAIN") - if [ "$CLEAN_NODE_DOMAIN" != "$NEXT_PUBLIC_NODE_DOMAIN" ]; then - export NEXT_PUBLIC_NODE_DOMAIN="$CLEAN_NODE_DOMAIN" - echo "🌐 NEXT_PUBLIC_NODE_DOMAIN normalized to $NEXT_PUBLIC_NODE_DOMAIN" - fi -fi - -# Ensure NEXT_PUBLIC_NODE_DOMAIN is set (fallback to DOMAIN) -if [ -z "$NEXT_PUBLIC_NODE_DOMAIN" ] && [ -n "$DOMAIN" ]; then - export NEXT_PUBLIC_NODE_DOMAIN="$DOMAIN" - echo "🌐 NEXT_PUBLIC_NODE_DOMAIN set to $NEXT_PUBLIC_NODE_DOMAIN" -fi - -# Fail fast if running in production with localhost domain -if [ "$NODE_ENV" = "production" ]; then - case "$NEXT_PUBLIC_NODE_DOMAIN" in - ""|localhost|localhost:*|127.0.0.1|127.0.0.1:*) - if [ -z "$ALLOW_LOCALHOST" ]; then - echo "❌ NEXT_PUBLIC_NODE_DOMAIN is set to localhost in production." - echo " Set DOMAIN to your public domain in .env, or set ALLOW_LOCALHOST=1 to bypass." - exit 1 - fi - ;; - esac -fi - -# Ensure NEXT_PUBLIC_APP_URL is set for background jobs -if [ -z "$NEXT_PUBLIC_APP_URL" ] && [ -n "$NEXT_PUBLIC_NODE_DOMAIN" ]; then - case "$NEXT_PUBLIC_NODE_DOMAIN" in - http://*|https://*) - NEXT_PUBLIC_APP_URL="$NEXT_PUBLIC_NODE_DOMAIN" - ;; - localhost*|127.0.0.1*) - NEXT_PUBLIC_APP_URL="http://$NEXT_PUBLIC_NODE_DOMAIN" - ;; - *) - NEXT_PUBLIC_APP_URL="https://$NEXT_PUBLIC_NODE_DOMAIN" - ;; - esac - export NEXT_PUBLIC_APP_URL - echo "🌐 NEXT_PUBLIC_APP_URL set to $NEXT_PUBLIC_APP_URL" -fi - -# Function to wait for database -wait_for_db() { - echo "" - echo "⏳ Waiting for PostgreSQL..." - - # Extract host and port from DATABASE_URL - DB_HOST=$(echo "$DATABASE_URL" | sed -n 's#.*@\([^/:]*\).*#\1#p') - DB_PORT=$(echo "$DATABASE_URL" | sed -n 's#.*:\([0-9][0-9]*\)/.*#\1#p') - DB_HOST=${DB_HOST:-postgres} - DB_PORT=${DB_PORT:-5432} - - max_retries=30 - retry_count=0 - - while ! nc -z "$DB_HOST" "$DB_PORT" 2>/dev/null; do - retry_count=$((retry_count + 1)) - if [ $retry_count -ge $max_retries ]; then - echo "❌ Failed to connect to database after $max_retries attempts" - exit 1 - fi - echo " Attempt $retry_count/$max_retries - waiting for $DB_HOST:$DB_PORT..." - sleep 2 - done - - echo "βœ… Database is ready!" -} - -# Function to run database migrations -run_migrations() { - echo "" - echo "πŸ”„ Running database migrations..." - echo " Current directory: $(pwd)" - echo " Drizzle directory contents:" - ls -la drizzle/ 2>/dev/null || echo " (drizzle dir not found or empty)" - - # Run migrations using npm script - echo " Executing: npm run db:push" - if npm run db:push 2>&1; then - echo "βœ… Migration step complete" - else - echo "❌ Migration failed" - exit 1 - fi -} - -# Wait for database -wait_for_db - -# Run migrations -run_migrations - -echo "πŸš€ Starting Synapsis on port $PORT..." -echo "" - -# Start the Next.js application -exec node server.js diff --git a/scripts/docker-publish.sh b/scripts/docker-publish.sh deleted file mode 100755 index 7b234ef..0000000 --- a/scripts/docker-publish.sh +++ /dev/null @@ -1,120 +0,0 @@ -#!/bin/sh - -set -eu - -IMAGE_REPO="${IMAGE_REPO:-ghcr.io/gnosyslabs/synapsis}" -PACKAGE_API="${PACKAGE_API:-/orgs/GnosysLabs/packages/container/synapsis/versions?per_page=100}" -BUILDER="${BUILDER:-}" -PLATFORMS="${PLATFORMS:-linux/amd64,linux/arm64}" -DATE_PREFIX="${DATE_PREFIX:-$(date -u +%Y.%m.%d)}" -SOURCE_REPO="${SOURCE_REPO:-https://github.com/GnosysLabs/Synapsis}" -PRUNE_BUILD_CACHE="${PRUNE_BUILD_CACHE:-1}" -APP_VERSION="${APP_VERSION:-}" -EXTRA_TAGS="${EXTRA_TAGS:-}" - -require_command() { - if ! command -v "$1" >/dev/null 2>&1; then - echo "❌ Required command not found: $1" >&2 - exit 1 - fi -} - -require_command docker -require_command gh -require_command git - -CURRENT_SHA="$(git rev-parse --short HEAD)" -CURRENT_FULL_SHA="$(git rev-parse HEAD)" -BUILD_DATE="$(date -u +%Y-%m-%dT%H:%M:%SZ)" -GITHUB_URL="${SOURCE_REPO}/commit/${CURRENT_FULL_SHA}" - -if [ -z "${APP_VERSION}" ]; then - existing_tags="$( - gh api "${PACKAGE_API}" --paginate --jq '.[].metadata.container.tags[]?' 2>/dev/null || true - )" - - max_build=0 - for tag in ${existing_tags}; do - case "${tag}" in - "${DATE_PREFIX}".*) - build_number="${tag##${DATE_PREFIX}.}" - case "${build_number}" in - ''|*[!0-9]*) - ;; - *) - if [ "${build_number}" -gt "${max_build}" ]; then - max_build="${build_number}" - fi - ;; - esac - ;; - esac - done - - next_build=$((max_build + 1)) - APP_VERSION="${DATE_PREFIX}.${next_build}" -fi - -BUILD_ARGS=" - --platform ${PLATFORMS} - --build-arg APP_VERSION=${APP_VERSION} - --build-arg APP_COMMIT=${CURRENT_FULL_SHA} - --build-arg APP_BUILD_DATE=${BUILD_DATE} - --build-arg APP_GITHUB_URL=${GITHUB_URL} - --build-arg APP_IMAGE_REPO=${IMAGE_REPO} - --build-arg APP_SOURCE_REPO=${SOURCE_REPO} -" - -TAG_ARGS=" - -t ${IMAGE_REPO}:latest - -t ${IMAGE_REPO}:${APP_VERSION} - -t ${IMAGE_REPO}:${CURRENT_SHA} -" - -for extra_tag in ${EXTRA_TAGS}; do - TAG_ARGS="${TAG_ARGS} - -t ${IMAGE_REPO}:${extra_tag}" -done - -echo "========================================" -echo " Synapsis Docker Publish" -echo "========================================" -echo " Version: ${APP_VERSION}" -echo " Commit: ${CURRENT_SHA}" -echo " Build Date: ${BUILD_DATE}" -echo " Image: ${IMAGE_REPO}" -echo " Platforms: ${PLATFORMS}" -echo "========================================" - -set -- docker buildx build - -if [ -n "${BUILDER}" ]; then - set -- "$@" --builder "${BUILDER}" -fi - -# shellcheck disable=SC2086 -set -- "$@" $BUILD_ARGS -f docker/Dockerfile -# shellcheck disable=SC2086 -set -- "$@" $TAG_ARGS --push . - -"$@" - -echo "" -echo "βœ… Published:" -echo " ${IMAGE_REPO}:latest" -echo " ${IMAGE_REPO}:${APP_VERSION}" -echo " ${IMAGE_REPO}:${CURRENT_SHA}" - -for extra_tag in ${EXTRA_TAGS}; do - echo " ${IMAGE_REPO}:${extra_tag}" -done - -if [ "${PRUNE_BUILD_CACHE}" = "1" ]; then - echo "" - echo "🧹 Pruning BuildKit cache" - if [ -n "${BUILDER}" ]; then - docker buildx prune --builder "${BUILDER}" -af >/dev/null - else - docker buildx prune -af >/dev/null - fi -fi diff --git a/scripts/inspect-key.ts b/scripts/inspect-key.ts index 4bfc9ed..081a3d4 100644 --- a/scripts/inspect-key.ts +++ b/scripts/inspect-key.ts @@ -10,7 +10,7 @@ async function main() { console.log('--- Inspecting Remote Key ---'); const entry = await db.query.handleRegistry.findFirst({ - where: eq(handleRegistry.did, TARGET_DID), + where: { did: TARGET_DID }, }); if (!entry) { diff --git a/scripts/migrate-dids.ts b/scripts/migrate-dids.ts index 032c0bc..62ca878 100644 --- a/scripts/migrate-dids.ts +++ b/scripts/migrate-dids.ts @@ -47,7 +47,7 @@ async function migrateDIDs() { // Find all users with legacy did:synapsis: format const legacyUsers = await db.query.users.findMany({ - where: (users, { like }) => like(users.did, 'did:synapsis:%'), + where: { did: { like: 'did:synapsis:%' } }, }); console.log(`Found ${legacyUsers.length} users with legacy DID format\n`); diff --git a/scripts/migrate.ts b/scripts/migrate.ts new file mode 100644 index 0000000..15d5f6d --- /dev/null +++ b/scripts/migrate.ts @@ -0,0 +1,17 @@ +import { migrate } from 'drizzle-orm/tursodatabase/migrator'; +import { db } from '../src/db'; + +async function main() { + const result = await migrate(db, { migrationsFolder: './drizzle' }); + + if (result) { + throw new Error(`Database migration failed: ${JSON.stringify(result)}`); + } + + console.log('Database migrations are up to date.'); +} + +main().catch((error) => { + console.error(error); + process.exit(1); +}); diff --git a/src/app/.well-known/synapsis-handles/route.ts b/src/app/.well-known/synapsis-handles/route.ts index 1e3a355..c15cd70 100644 --- a/src/app/.well-known/synapsis-handles/route.ts +++ b/src/app/.well-known/synapsis-handles/route.ts @@ -1,6 +1,6 @@ import { NextResponse } from 'next/server'; import { db, handleRegistry } from '@/db'; -import { desc, eq, gt } from 'drizzle-orm'; +import { desc } from 'drizzle-orm'; import { normalizeHandle } from '@/lib/federation/handles'; export async function GET(request: Request) { @@ -17,7 +17,7 @@ export async function GET(request: Request) { if (handleParam) { const cleanHandle = normalizeHandle(handleParam); const entry = await db.query.handleRegistry.findFirst({ - where: eq(handleRegistry.handle, cleanHandle), + where: { handle: cleanHandle }, }); if (!entry) { @@ -36,8 +36,8 @@ export async function GET(request: Request) { const sinceDate = sinceParam ? new Date(sinceParam) : null; const entries = await db.query.handleRegistry.findMany({ - where: sinceDate ? gt(handleRegistry.updatedAt, sinceDate) : undefined, - orderBy: [desc(handleRegistry.updatedAt)], + where: sinceDate ? { updatedAt: { gt: sinceDate } } : undefined, + orderBy: () => [desc(handleRegistry.updatedAt)], limit, }); diff --git a/src/app/admin/page.tsx b/src/app/admin/page.tsx index 4d25ce8..981ca21 100644 --- a/src/app/admin/page.tsx +++ b/src/app/admin/page.tsx @@ -38,29 +38,6 @@ export default function AdminPage() { const [logoUploadError, setLogoUploadError] = useState(null); const [isUploadingFavicon, setIsUploadingFavicon] = useState(false); const [faviconUploadError, setFaviconUploadError] = useState(null); - const [updateStatus, setUpdateStatus] = useState<{ - current: { version: string; commit: string | null; buildDate: string | null }; - latest: { version: string; commit: string | null; buildDate: string | null } | null; - updateAvailable: boolean; - updater: { - available: boolean; - status: string; - message?: string; - lastStartedAt?: string | null; - lastFinishedAt?: string | null; - lastExitCode?: number | null; - lastError?: string | null; - trigger?: 'manual' | 'auto' | null; - config?: { - autoUpdateEnabled: boolean; - intervalMinutes: number; - }; - }; - } | null>(null); - const [loadingUpdateStatus, setLoadingUpdateStatus] = useState(false); - const [triggeringUpdate, setTriggeringUpdate] = useState(false); - const [savingAutoUpdate, setSavingAutoUpdate] = useState(false); - useEffect(() => { fetch('/api/admin/me') .then((res) => res.json()) @@ -93,42 +70,12 @@ export default function AdminPage() { } }; - const loadUpdateStatus = async () => { - setLoadingUpdateStatus(true); - try { - const res = await fetch('/api/admin/update', { cache: 'no-store' }); - if (!res.ok) { - throw new Error('Failed to load update status'); - } - - const data = await res.json(); - setUpdateStatus(data); - } catch { - setUpdateStatus(null); - } finally { - setLoadingUpdateStatus(false); - } - }; - useEffect(() => { if (isAdmin) { loadNodeSettings(); - loadUpdateStatus(); } }, [isAdmin]); - useEffect(() => { - if (!isAdmin) { - return; - } - - const interval = window.setInterval(() => { - loadUpdateStatus(); - }, 30000); - - return () => window.clearInterval(interval); - }, [isAdmin]); - const handleSaveSettings = async (override?: typeof nodeSettings) => { const payload = override ?? nodeSettings; setSavingSettings(true); @@ -234,33 +181,6 @@ export default function AdminPage() { setBannerPromptError(''); }; - const handleTriggerUpdate = async () => { - setTriggeringUpdate(true); - try { - const res = await fetch('/api/admin/update', { method: 'POST', keepalive: true }); - const data = await res.json().catch(() => ({})); - - if (!res.ok) { - throw new Error(data.error || 'Failed to start update'); - } - - showToast(data.message || 'Update started. Synapsis will restart shortly.', 'success'); - await loadUpdateStatus(); - } catch (error) { - const message = error instanceof Error ? error.message : 'Failed to start update'; - if (message.toLowerCase().includes('fetch') || message.toLowerCase().includes('network')) { - showToast('Update likely started. The node is restarting, so this page may disconnect briefly.', 'success'); - window.setTimeout(() => { - window.location.reload(); - }, 5000); - } else { - showToast(message, 'error'); - } - } finally { - setTriggeringUpdate(false); - } - }; - const handleLogoUpload = async (event: React.ChangeEvent) => { const file = event.target.files?.[0]; event.target.value = ''; @@ -297,38 +217,6 @@ export default function AdminPage() { } }; - const handleToggleAutoUpdate = async () => { - if (!updateStatus?.updater.available || !updateStatus.updater.config) return; - - const nextValue = !updateStatus.updater.config.autoUpdateEnabled; - setSavingAutoUpdate(true); - try { - const res = await fetch('/api/admin/update', { - method: 'PATCH', - headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ autoUpdateEnabled: nextValue }), - }); - const data = await res.json().catch(() => ({})); - - if (!res.ok) { - throw new Error(data.error || 'Failed to update auto-update setting'); - } - - setUpdateStatus((prev) => prev ? { - ...prev, - updater: { - ...prev.updater, - config: data.config, - }, - } : prev); - showToast(nextValue ? 'Automatic updates enabled' : 'Automatic updates disabled', 'success'); - } catch (error) { - showToast(error instanceof Error ? error.message : 'Failed to update auto-update setting', 'error'); - } finally { - setSavingAutoUpdate(false); - } - }; - const handleFaviconUpload = async (event: React.ChangeEvent) => { const file = event.target.files?.[0]; event.target.value = ''; @@ -703,86 +591,7 @@ export default function AdminPage() { -
-
-
-

System Update

-

- Keep this node on the latest published Synapsis build. -

-
- -
- - {updateStatus?.updater.available && updateStatus?.updater.config && ( -
-
-
- Automatic updates -
-
- Enabled by default. This node checks for updates every {updateStatus.updater.config.intervalMinutes} minutes and installs them automatically. -
-
- -
- )} - - {!updateStatus?.updater.available && ( -
- One-click updates are unavailable on this host. Use: -
- curl -fsSL https://synapsis.social/update.sh | bash -
-
- )} -
+ )} diff --git a/src/app/api/account/delete/route.ts b/src/app/api/account/delete/route.ts index e78e774..d142198 100644 --- a/src/app/api/account/delete/route.ts +++ b/src/app/api/account/delete/route.ts @@ -51,10 +51,7 @@ export async function POST(request: Request) { // First get conversation IDs where user is participant1 (local user) // For participant2, we need to check by handle since it's stored as text (can be remote) const conversations = await db.query.chatConversations.findMany({ - where: or( - eq(chatConversations.participant1Id, userId), - eq(chatConversations.participant2Handle, user.handle) - ), + where: { OR: [{ participant1Id: userId }, { participant2Handle: user.handle }] }, }); const conversationIds = conversations.map(c => c.id); diff --git a/src/app/api/account/email/route.ts b/src/app/api/account/email/route.ts index 0f1e7c2..19676aa 100644 --- a/src/app/api/account/email/route.ts +++ b/src/app/api/account/email/route.ts @@ -48,7 +48,7 @@ export async function POST(request: Request) { // Check if email is already taken by another user const existingUser = await db.query.users.findFirst({ - where: eq(users.email, newEmail.toLowerCase()), + where: { email: newEmail.toLowerCase() }, }); if (existingUser && existingUser.id !== user.id) { diff --git a/src/app/api/account/export/route.ts b/src/app/api/account/export/route.ts index 98785c9..e8ff53b 100644 --- a/src/app/api/account/export/route.ts +++ b/src/app/api/account/export/route.ts @@ -156,11 +156,11 @@ export async function POST(req: NextRequest) { return NextResponse.json({ error: 'This account has already been migrated' }, { status: 400 }); } - const nodeDomain = process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:3000'; + const nodeDomain = process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:43821'; // Fetch user's posts const userPosts = await db.query.posts.findMany({ - where: eq(posts.userId, user.id), + where: { userId: user.id }, with: { media: true, }, @@ -169,19 +169,19 @@ export async function POST(req: NextRequest) { // Fetch user's following list (local and remote) const userFollowing = await db.query.follows.findMany({ - where: eq(follows.followerId, user.id), + where: { followerId: user.id }, with: { following: true, }, }); const userRemoteFollowing = await db.query.remoteFollows.findMany({ - where: eq(remoteFollows.followerId, user.id), + where: { followerId: user.id }, }); // Fetch DMs const userConversations = await db.query.chatConversations.findMany({ - where: eq(chatConversations.participant1Id, user.id), + where: { participant1Id: user.id }, with: { messages: true } @@ -189,7 +189,7 @@ export async function POST(req: NextRequest) { // Fetch Bots const userBots = await db.query.bots.findMany({ - where: eq(bots.ownerId, user.id), + where: { ownerId: user.id }, with: { user: true, contentSources: true, diff --git a/src/app/api/account/import/route.ts b/src/app/api/account/import/route.ts index 8554d8d..76df398 100644 --- a/src/app/api/account/import/route.ts +++ b/src/app/api/account/import/route.ts @@ -203,7 +203,7 @@ export async function POST(req: NextRequest) { // Check if DID already exists on this node const existingDid = await db.query.users.findFirst({ - where: eq(users.did, manifest.did), + where: { did: manifest.did }, }); if (existingDid) { @@ -222,7 +222,7 @@ export async function POST(req: NextRequest) { // Check if handle is available const existingHandle = await db.query.users.findFirst({ - where: eq(users.handle, handleClean), + where: { handle: handleClean }, }); if (existingHandle) { @@ -232,7 +232,7 @@ export async function POST(req: NextRequest) { }, { status: 409 }); } - const nodeDomain = process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:3000'; + const nodeDomain = process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:43821'; const oldActorUrl = `https://${manifest.sourceNode}/users/${manifest.handle}`; const newActorUrl = `https://${nodeDomain}/users/${handleClean}`; @@ -253,7 +253,7 @@ export async function POST(req: NextRequest) { // Check if this is an NSFW node and auto-enable NSFW settings const node = await db.query.nodes.findFirst({ - where: eq(nodes.domain, nodeDomain), + where: { domain: nodeDomain }, }); if (node?.isNsfw) { @@ -319,7 +319,7 @@ export async function POST(req: NextRequest) { } else { // Local follow - look up user and add to follows table const targetUser = await db.query.users.findFirst({ - where: eq(users.handle, follow.handle.toLowerCase()), + where: { handle: follow.handle.toLowerCase() }, }); if (targetUser) { await db.insert(follows).values({ diff --git a/src/app/api/account/moved/route.ts b/src/app/api/account/moved/route.ts index 811d361..ccbae5d 100644 --- a/src/app/api/account/moved/route.ts +++ b/src/app/api/account/moved/route.ts @@ -29,7 +29,7 @@ export async function POST(req: NextRequest) { // Find the user on this node const user = await db.query.users.findFirst({ - where: eq(users.handle, oldHandle.toLowerCase()), + where: { handle: oldHandle.toLowerCase() }, }); if (!user) { @@ -67,7 +67,7 @@ export async function POST(req: NextRequest) { // Get all followers to notify const userFollowers = await db.query.follows.findMany({ - where: eq(follows.followingId, user.id), + where: { followingId: user.id }, with: { follower: true, }, diff --git a/src/app/api/admin/node/route.ts b/src/app/api/admin/node/route.ts index 3bde1fc..69490b5 100644 --- a/src/app/api/admin/node/route.ts +++ b/src/app/api/admin/node/route.ts @@ -9,10 +9,10 @@ export async function PATCH(req: NextRequest) { await requireAdmin(); const data = await req.json(); - const domain = process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:3000'; + const domain = process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:43821'; let node = await db.query.nodes.findFirst({ - where: eq(nodes.domain, domain), + where: { domain: domain }, }); // 2. Fallback: If not found, check if there is exactly ONE node in the system. diff --git a/src/app/api/admin/node/upload/route.ts b/src/app/api/admin/node/upload/route.ts index 4a171f2..359a11d 100644 --- a/src/app/api/admin/node/upload/route.ts +++ b/src/app/api/admin/node/upload/route.ts @@ -95,9 +95,9 @@ export async function POST(req: NextRequest) { const dataUrl = `data:${mimeType};base64,${base64Data}`; // Get current node - const domain = process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:3000'; + const domain = process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:43821'; let node = await db.query.nodes.findFirst({ - where: eq(nodes.domain, domain), + where: { domain: domain }, }); // Fallback: If not found, check if there is exactly ONE node in the system diff --git a/src/app/api/admin/nodes/route.ts b/src/app/api/admin/nodes/route.ts index 620a8ea..3c1c2e8 100644 --- a/src/app/api/admin/nodes/route.ts +++ b/src/app/api/admin/nodes/route.ts @@ -16,7 +16,7 @@ export async function GET() { await requireAdmin(); const nodes = await db.query.swarmNodes.findMany({ - orderBy: [desc(swarmNodes.isBlocked), desc(swarmNodes.blockedAt), desc(swarmNodes.lastSeenAt)], + orderBy: () => [desc(swarmNodes.isBlocked), desc(swarmNodes.blockedAt), desc(swarmNodes.lastSeenAt)], }); return NextResponse.json({ @@ -47,7 +47,7 @@ export async function PATCH(request: NextRequest) { const body = await request.json(); const data = mutateNodeSchema.parse(body); const domain = normalizeNodeDomain(data.domain); - const localDomain = normalizeNodeDomain(process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:3000'); + const localDomain = normalizeNodeDomain(process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:43821'); if (domain === localDomain) { return NextResponse.json({ error: 'Cannot block this node itself' }, { status: 400 }); diff --git a/src/app/api/admin/posts/[id]/route.ts b/src/app/api/admin/posts/[id]/route.ts index 5fb7567..79d39f1 100644 --- a/src/app/api/admin/posts/[id]/route.ts +++ b/src/app/api/admin/posts/[id]/route.ts @@ -24,7 +24,7 @@ export async function PATCH(request: Request, context: RouteContext) { const data = moderationSchema.parse(body); const post = await db.query.posts.findFirst({ - where: eq(posts.id, id), + where: { id: id }, }); if (!post) { diff --git a/src/app/api/admin/posts/route.ts b/src/app/api/admin/posts/route.ts index 033e21d..53f1bb6 100644 --- a/src/app/api/admin/posts/route.ts +++ b/src/app/api/admin/posts/route.ts @@ -15,19 +15,16 @@ export async function GET(request: Request) { const status = searchParams.get('status') || 'active'; // active | removed | all const limit = Math.min(parseInt(searchParams.get('limit') || '25'), 50); - const where = - status === 'active' - ? eq(posts.isRemoved, false) - : status === 'removed' - ? eq(posts.isRemoved, true) - : undefined; + const where = status === 'all' + ? undefined + : { isRemoved: status === 'removed' }; const results = await db.query.posts.findMany({ where, with: { author: true, }, - orderBy: [desc(posts.createdAt)], + orderBy: () => [desc(posts.createdAt)], limit, }); diff --git a/src/app/api/admin/reports/[id]/route.ts b/src/app/api/admin/reports/[id]/route.ts index 992e2d3..9cf5a0b 100644 --- a/src/app/api/admin/reports/[id]/route.ts +++ b/src/app/api/admin/reports/[id]/route.ts @@ -24,7 +24,7 @@ export async function PATCH(request: Request, context: RouteContext) { const data = updateSchema.parse(body); const report = await db.query.reports.findFirst({ - where: eq(reports.id, id), + where: { id: id }, }); if (!report) { diff --git a/src/app/api/admin/reports/route.ts b/src/app/api/admin/reports/route.ts index 79daa4d..352eec0 100644 --- a/src/app/api/admin/reports/route.ts +++ b/src/app/api/admin/reports/route.ts @@ -16,8 +16,8 @@ export async function GET(request: Request) { const limit = Math.min(parseInt(searchParams.get('limit') || '25'), 50); const reportRows = await db.query.reports.findMany({ - where: status === 'all' ? undefined : eq(reports.status, status), - orderBy: [desc(reports.createdAt)], + where: status === 'all' ? undefined : { status: status }, + orderBy: () => [desc(reports.createdAt)], limit, with: { reporter: true, @@ -34,13 +34,13 @@ export async function GET(request: Request) { const postTargetsRaw = postIds.length ? await db.query.posts.findMany({ - where: inArray(posts.id, postIds), + where: { id: { in: postIds } }, with: { author: true }, }) : []; const userTargetsRaw = userIds.length ? await db.query.users.findMany({ - where: inArray(users.id, userIds), + where: { id: { in: userIds } }, }) : []; diff --git a/src/app/api/admin/update/route.ts b/src/app/api/admin/update/route.ts deleted file mode 100644 index 0fa06e3..0000000 --- a/src/app/api/admin/update/route.ts +++ /dev/null @@ -1,82 +0,0 @@ -import { NextResponse } from 'next/server'; -import { requireAdmin } from '@/lib/auth/admin'; -import { getCurrentBuildInfo, getLatestPublishedBuild, compareBuildVersions } from '@/lib/version'; -import { getHostUpdaterStatus, triggerHostUpdate, updateHostUpdaterConfig } from '@/lib/host-updater'; - -function isUpdateAvailable(currentVersion: string, latestVersion: string | null | undefined) { - if (!latestVersion) { - return false; - } - - return compareBuildVersions(currentVersion, latestVersion) < 0; -} - -export async function GET() { - try { - await requireAdmin(); - - const [latest, updater] = await Promise.all([ - getLatestPublishedBuild(), - getHostUpdaterStatus(), - ]); - - const current = getCurrentBuildInfo(); - - return NextResponse.json({ - current, - latest, - updateAvailable: isUpdateAvailable(current.version, latest?.version), - updater, - }); - } catch (error) { - if (error instanceof Error && error.message === 'Admin required') { - return NextResponse.json({ error: 'Admin required' }, { status: 403 }); - } - - console.error('[Admin Update] Status error:', error); - return NextResponse.json({ error: 'Failed to get update status' }, { status: 500 }); - } -} - -export async function POST() { - try { - await requireAdmin(); - - const result = await triggerHostUpdate(); - return NextResponse.json(result, { status: 202 }); - } catch (error) { - if (error instanceof Error && error.message === 'Admin required') { - return NextResponse.json({ error: 'Admin required' }, { status: 403 }); - } - - console.error('[Admin Update] Trigger error:', error); - return NextResponse.json( - { error: error instanceof Error ? error.message : 'Failed to trigger update' }, - { status: 500 } - ); - } -} - -export async function PATCH(request: Request) { - try { - await requireAdmin(); - - const body = await request.json(); - if (typeof body.autoUpdateEnabled !== 'boolean') { - return NextResponse.json({ error: 'autoUpdateEnabled must be a boolean' }, { status: 400 }); - } - - const result = await updateHostUpdaterConfig(body.autoUpdateEnabled); - return NextResponse.json(result); - } catch (error) { - if (error instanceof Error && error.message === 'Admin required') { - return NextResponse.json({ error: 'Admin required' }, { status: 403 }); - } - - console.error('[Admin Update] Config error:', error); - return NextResponse.json( - { error: error instanceof Error ? error.message : 'Failed to update auto-update settings' }, - { status: 500 } - ); - } -} diff --git a/src/app/api/admin/users/[id]/route.ts b/src/app/api/admin/users/[id]/route.ts index 02aa4be..6fcf9ee 100644 --- a/src/app/api/admin/users/[id]/route.ts +++ b/src/app/api/admin/users/[id]/route.ts @@ -24,7 +24,7 @@ export async function PATCH(request: Request, context: RouteContext) { const data = moderationSchema.parse(body); const user = await db.query.users.findFirst({ - where: eq(users.id, id), + where: { id: id }, }); if (!user) { diff --git a/src/app/api/auth/check-handle/route.ts b/src/app/api/auth/check-handle/route.ts index 1166d44..b865058 100644 --- a/src/app/api/auth/check-handle/route.ts +++ b/src/app/api/auth/check-handle/route.ts @@ -25,7 +25,7 @@ export async function GET(req: NextRequest) { let existingUser = null; try { existingUser = await db.query.users.findFirst({ - where: eq(users.handle, handle), + where: { handle: handle }, }); } catch (err: any) { // Handle fresh installs where the users table isn't created yet. diff --git a/src/app/api/auth/register/route.ts b/src/app/api/auth/register/route.ts index 16e3ae1..a0d96b9 100644 --- a/src/app/api/auth/register/route.ts +++ b/src/app/api/auth/register/route.ts @@ -81,9 +81,9 @@ export async function POST(request: Request) { ); // Check if this is an NSFW node and auto-enable NSFW settings - const nodeDomain = process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:3000'; + const nodeDomain = process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:43821'; const node = await db.query.nodes.findFirst({ - where: eq(nodes.domain, nodeDomain), + where: { domain: nodeDomain }, }); if (node?.isNsfw) { diff --git a/src/app/api/bots/[id]/logs/errors/route.ts b/src/app/api/bots/[id]/logs/errors/route.ts index d33e4db..2e1d580 100644 --- a/src/app/api/bots/[id]/logs/errors/route.ts +++ b/src/app/api/bots/[id]/logs/errors/route.ts @@ -29,7 +29,7 @@ export async function GET( // Verify bot exists and user owns it const bot = await db.query.bots.findFirst({ - where: eq(bots.id, botId), + where: { id: botId }, columns: { id: true, userId: true }, }); diff --git a/src/app/api/bots/[id]/logs/route.ts b/src/app/api/bots/[id]/logs/route.ts index 03ae609..d20ffd6 100644 --- a/src/app/api/bots/[id]/logs/route.ts +++ b/src/app/api/bots/[id]/logs/route.ts @@ -29,7 +29,7 @@ export async function GET( // Verify bot exists and user owns it const bot = await db.query.bots.findFirst({ - where: eq(bots.id, botId), + where: { id: botId }, columns: { id: true, userId: true }, }); diff --git a/src/app/api/bots/[id]/mentions/[mid]/respond/route.ts b/src/app/api/bots/[id]/mentions/[mid]/respond/route.ts index 794f2bc..fb17f4c 100644 --- a/src/app/api/bots/[id]/mentions/[mid]/respond/route.ts +++ b/src/app/api/bots/[id]/mentions/[mid]/respond/route.ts @@ -38,7 +38,7 @@ export async function POST( // Verify bot exists and user owns it const bot = await db.query.bots.findFirst({ - where: eq(bots.id, botId), + where: { id: botId }, columns: { id: true, userId: true, diff --git a/src/app/api/bots/[id]/mentions/route.ts b/src/app/api/bots/[id]/mentions/route.ts index a5a11df..18e5ddf 100644 --- a/src/app/api/bots/[id]/mentions/route.ts +++ b/src/app/api/bots/[id]/mentions/route.ts @@ -41,7 +41,7 @@ export async function GET( // Verify bot exists and user owns it const bot = await db.query.bots.findFirst({ - where: eq(bots.id, botId), + where: { id: botId }, columns: { id: true, userId: true, diff --git a/src/app/api/bots/[id]/reinstate/route.ts b/src/app/api/bots/[id]/reinstate/route.ts index 2f42df4..67ad80e 100644 --- a/src/app/api/bots/[id]/reinstate/route.ts +++ b/src/app/api/bots/[id]/reinstate/route.ts @@ -31,7 +31,7 @@ export async function POST( // Verify bot exists const bot = await db.query.bots.findFirst({ - where: eq(bots.id, botId), + where: { id: botId }, columns: { id: true, userId: true }, }); diff --git a/src/app/api/bots/[id]/suspend/route.ts b/src/app/api/bots/[id]/suspend/route.ts index 3ac5e3c..2fa073c 100644 --- a/src/app/api/bots/[id]/suspend/route.ts +++ b/src/app/api/bots/[id]/suspend/route.ts @@ -41,7 +41,7 @@ export async function POST( // Verify bot exists const bot = await db.query.bots.findFirst({ - where: eq(bots.id, botId), + where: { id: botId }, columns: { id: true, userId: true }, }); diff --git a/src/app/api/bots/route.ts b/src/app/api/bots/route.ts index 1fdbf5c..5a4ac48 100644 --- a/src/app/api/bots/route.ts +++ b/src/app/api/bots/route.ts @@ -70,7 +70,7 @@ export async function POST(request: Request) { let botAvatarUrl: string | null | undefined = data.avatarUrl; if (!botAvatarUrl && storageSession) { try { - const nodeDomain = process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:3000'; + const nodeDomain = process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:43821'; const botHandle = `${data.handle.toLowerCase()}@${nodeDomain}`; botAvatarUrl = await generateAndUploadAvatarToUserStorage( diff --git a/src/app/api/chat/receive/route.ts b/src/app/api/chat/receive/route.ts index 3843bba..aac7f34 100644 --- a/src/app/api/chat/receive/route.ts +++ b/src/app/api/chat/receive/route.ts @@ -133,7 +133,7 @@ export async function POST(request: NextRequest) { // 1. Resolve Sender Public Key let senderUser = await db.query.users.findFirst({ - where: eq(users.did, did) + where: { did: did } }); let publicKey = senderUser?.publicKey; @@ -155,7 +155,7 @@ export async function POST(request: NextRequest) { } else { // Try handle registry (though we likely don't have it if we don't have the user) const registryEntry = await db.query.handleRegistry.findFirst({ - where: eq(handleRegistry.did, did) + where: { did: did } }); if (registryEntry) senderNodeDomain = normalizeNodeDomain(registryEntry.nodeDomain); } @@ -234,7 +234,7 @@ export async function POST(request: NextRequest) { // 3. Find Local Recipient const recipientUser = await db.query.users.findFirst({ - where: eq(users.did, recipientDid) + where: { did: recipientDid } }); if (!recipientUser) { @@ -247,10 +247,7 @@ export async function POST(request: NextRequest) { const computedFullSenderHandle = senderHandle.includes('@') ? senderHandle : (senderNodeDomain ? `${senderHandle}@${senderNodeDomain}` : senderHandle); let conversation = await db.query.chatConversations.findFirst({ - where: and( - eq(chatConversations.participant1Id, recipientUser.id), - eq(chatConversations.participant2Handle, computedFullSenderHandle) - ) + where: { AND: [{ participant1Id: recipientUser.id }, { participant2Handle: computedFullSenderHandle }] } }); if (!conversation) { diff --git a/src/app/api/chat/send/route.ts b/src/app/api/chat/send/route.ts index 0fc2c0e..077fdf4 100644 --- a/src/app/api/chat/send/route.ts +++ b/src/app/api/chat/send/route.ts @@ -33,7 +33,7 @@ export async function POST(request: NextRequest) { // Check if recipient is local const recipientUser = await db.query.users.findFirst({ - where: eq(users.did, recipientDid) + where: { did: recipientDid } }); // Check if recipient is a local user (not remote/swarm cached) @@ -55,10 +55,7 @@ export async function POST(request: NextRequest) { } else if (recipientUser.dmPrivacy === 'following') { // Check if recipient follows the sender const isFollowingSender = await db.query.follows.findFirst({ - where: and( - eq(follows.followerId, recipientUser.id), - eq(follows.followingId, user.id) - ) + where: { AND: [{ followerId: recipientUser.id }, { followingId: user.id }] } }); if (!isFollowingSender) { return NextResponse.json({ error: 'This user only accepts messages from accounts they follow' }, { status: 403 }); @@ -69,10 +66,7 @@ export async function POST(request: NextRequest) { // Ensure conversations exist for both sides // 1. Recipient's Inbox (Recipient -> User) let recipientConv = await db.query.chatConversations.findFirst({ - where: and( - eq(chatConversations.participant1Id, recipientUser.id), - eq(chatConversations.participant2Handle, user.handle) - ) + where: { AND: [{ participant1Id: recipientUser.id }, { participant2Handle: user.handle }] } }); if (!recipientConv) { @@ -96,10 +90,7 @@ export async function POST(request: NextRequest) { // 2. Sender's Sent Box (User -> Recipient) let senderConv = await db.query.chatConversations.findFirst({ - where: and( - eq(chatConversations.participant1Id, user.id), - eq(chatConversations.participant2Handle, recipientUser.handle) - ) + where: { AND: [{ participant1Id: user.id }, { participant2Handle: recipientUser.handle }] } }); if (!senderConv) { @@ -151,7 +142,7 @@ export async function POST(request: NextRequest) { // 1. Resolve recipient node const registryEntry = await db.query.handleRegistry.findFirst({ - where: eq(handleRegistry.did, recipientDid) + where: { did: recipientDid } }); // If not in registry, try to parse from handle if it has domain @@ -224,10 +215,7 @@ export async function POST(request: NextRequest) { // 3. Store "Sent" copy locally // Ensure conversation exists locally let senderConv = await db.query.chatConversations.findFirst({ - where: and( - eq(chatConversations.participant1Id, user.id), - eq(chatConversations.participant2Handle, recipientHandle) - ) + where: { AND: [{ participant1Id: user.id }, { participant2Handle: recipientHandle }] } }); if (!senderConv) { diff --git a/src/app/api/chat/unread/route.ts b/src/app/api/chat/unread/route.ts index 844755b..97bc49e 100644 --- a/src/app/api/chat/unread/route.ts +++ b/src/app/api/chat/unread/route.ts @@ -12,7 +12,7 @@ export async function GET() { // Get user's conversations const conversations = await db.query.chatConversations.findMany({ - where: eq(chatConversations.participant1Id, session.user.id), + where: { participant1Id: session.user.id }, }); if (conversations.length === 0) { @@ -23,10 +23,7 @@ export async function GET() { const conversationIds = conversations.map(c => c.id); const unreadMessages = await db.query.chatMessages.findMany({ - where: and( - inArray(chatMessages.conversationId, conversationIds), - isNull(chatMessages.readAt) - ), + where: { AND: [{ conversationId: { in: conversationIds } }, { readAt: { isNull: true } }] }, }); // Filter out messages sent by the current user diff --git a/src/app/api/config/route.ts b/src/app/api/config/route.ts index 3fa48ad..de46421 100644 --- a/src/app/api/config/route.ts +++ b/src/app/api/config/route.ts @@ -2,6 +2,6 @@ import { NextResponse } from 'next/server'; export async function GET() { return NextResponse.json({ - domain: process.env.NEXT_PUBLIC_NODE_DOMAIN || process.env.NODE_DOMAIN || 'localhost:3000', + domain: process.env.NEXT_PUBLIC_NODE_DOMAIN || process.env.NODE_DOMAIN || 'localhost:43821', }); } diff --git a/src/app/api/favicon/route.ts b/src/app/api/favicon/route.ts index 82c64d1..f387189 100644 --- a/src/app/api/favicon/route.ts +++ b/src/app/api/favicon/route.ts @@ -21,14 +21,14 @@ export async function GET(req: NextRequest) { try { if (!db) { // Redirect to default favicon - const domain = process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:3000'; + const domain = process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:43821'; const baseUrl = getRequestBaseUrl(req, domain); return NextResponse.redirect(new URL('/favicon.png', baseUrl)); } - const domain = process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:3000'; + const domain = process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:43821'; const node = await db.query.nodes.findFirst({ - where: eq(nodes.domain, domain), + where: { domain: domain }, columns: { faviconUrl: true }, }); @@ -46,7 +46,7 @@ export async function GET(req: NextRequest) { return NextResponse.redirect(new URL('/favicon.png', baseUrl)); } catch (error) { console.error('Favicon error:', error); - const domain = process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:3000'; + const domain = process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:43821'; const baseUrl = getRequestBaseUrl(req, domain); return NextResponse.redirect(new URL('/favicon.png', baseUrl)); } diff --git a/src/app/api/handles/resolve/route.ts b/src/app/api/handles/resolve/route.ts index b2025cd..02ad65e 100644 --- a/src/app/api/handles/resolve/route.ts +++ b/src/app/api/handles/resolve/route.ts @@ -41,7 +41,7 @@ export async function GET(request: Request) { const parsed = parseHandleWithDomain(handleParam); const lookupHandle = parsed ? parsed.handle : normalizeHandle(handleParam); const localEntry = await db.query.handleRegistry.findFirst({ - where: eq(handleRegistry.handle, lookupHandle), + where: { handle: lookupHandle }, }); if (localEntry) { diff --git a/src/app/api/health/route.ts b/src/app/api/health/route.ts index 88cf603..7c65978 100644 --- a/src/app/api/health/route.ts +++ b/src/app/api/health/route.ts @@ -1,7 +1,7 @@ import { NextResponse } from 'next/server'; /** - * Health check endpoint for Docker and monitoring + * Health check endpoint for systemd and external monitoring * Returns 200 OK when the application is running properly */ export async function GET() { diff --git a/src/app/api/node/favicon/route.ts b/src/app/api/node/favicon/route.ts index 4945290..9e998e1 100644 --- a/src/app/api/node/favicon/route.ts +++ b/src/app/api/node/favicon/route.ts @@ -10,11 +10,11 @@ export async function GET() { return NextResponse.json({ error: 'Database not available' }, { status: 500 }); } - const domain = process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:3000'; + const domain = process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:43821'; // 1. Try exact match let node = await db.query.nodes.findFirst({ - where: eq(nodes.domain, domain), + where: { domain: domain }, }); // 2. Fallback: If not found, check if there is exactly ONE node in the system diff --git a/src/app/api/node/logo/route.ts b/src/app/api/node/logo/route.ts index 1ed17c0..2b0fb1c 100644 --- a/src/app/api/node/logo/route.ts +++ b/src/app/api/node/logo/route.ts @@ -10,11 +10,11 @@ export async function GET() { return NextResponse.json({ error: 'Database not available' }, { status: 500 }); } - const domain = process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:3000'; + const domain = process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:43821'; // 1. Try exact match let node = await db.query.nodes.findFirst({ - where: eq(nodes.domain, domain), + where: { domain: domain }, }); // 2. Fallback: If not found, check if there is exactly ONE node in the system diff --git a/src/app/api/node/route.ts b/src/app/api/node/route.ts index a6f87aa..5b528f9 100644 --- a/src/app/api/node/route.ts +++ b/src/app/api/node/route.ts @@ -9,11 +9,11 @@ export async function GET() { try { if (!db) return NextResponse.json({}); - const domain = process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:3000'; + const domain = process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:43821'; // 1. Try exact match let node = await db.query.nodes.findFirst({ - where: eq(nodes.domain, domain), + where: { domain: domain }, }); // 2. Fallback: If not found, check if there is exactly ONE node in the system. diff --git a/src/app/api/notifications/route.ts b/src/app/api/notifications/route.ts index b31e26a..041614f 100644 --- a/src/app/api/notifications/route.ts +++ b/src/app/api/notifications/route.ts @@ -45,14 +45,12 @@ export async function GET(request: Request) { const limit = Math.min(parseInt(searchParams.get('limit') || '30'), 50); const unreadOnly = searchParams.get('unread') === 'true'; - const conditions = [eq(notifications.userId, user.id)]; - if (unreadOnly) { - conditions.push(isNull(notifications.readAt)); - } - const rows = await db.query.notifications.findMany({ - where: and(...conditions), - orderBy: [desc(notifications.createdAt)], + where: { + userId: user.id, + ...(unreadOnly ? { readAt: { isNull: true as const } } : {}), + }, + orderBy: () => [desc(notifications.createdAt)], limit, }); diff --git a/src/app/api/posts/[id]/like/route.ts b/src/app/api/posts/[id]/like/route.ts index f49210f..79bab79 100644 --- a/src/app/api/posts/[id]/like/route.ts +++ b/src/app/api/posts/[id]/like/route.ts @@ -120,7 +120,7 @@ export async function POST(request: Request, context: RouteContext) { const decodedId = decodedParamId; const postId = postIdSchema.parse(decodedId); - const nodeDomain = process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:3000'; + const nodeDomain = process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:43821'; if (user.isSuspended || user.isSilenced) { return NextResponse.json({ error: 'Account restricted' }, { status: 403 }); @@ -178,7 +178,7 @@ export async function POST(request: Request, context: RouteContext) { // Local post - check if it exists const post = await db.query.posts.findFirst({ - where: eq(posts.id, postId), + where: { id: postId }, }); if (!post) { @@ -190,10 +190,7 @@ export async function POST(request: Request, context: RouteContext) { // Check if already liked const existingLike = await db.query.likes.findFirst({ - where: and( - eq(likes.userId, user.id), - eq(likes.postId, postId) - ), + where: { AND: [{ userId: user.id }, { postId: postId }] }, }); if (existingLike) { @@ -213,7 +210,7 @@ export async function POST(request: Request, context: RouteContext) { if (post.userId !== user.id) { const postAuthor = await db.query.users.findFirst({ - where: eq(users.id, post.userId), + where: { id: post.userId }, }); // Create notification with actor info stored directly @@ -323,7 +320,7 @@ export async function DELETE(request: Request, context: RouteContext) { const decodedId = decodedParamId; const postId = postIdSchema.parse(decodedId); - const nodeDomain = process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:3000'; + const nodeDomain = process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:43821'; if (user.isSuspended || user.isSilenced) { return NextResponse.json({ error: 'Account restricted' }, { status: 403 }); @@ -368,7 +365,7 @@ export async function DELETE(request: Request, context: RouteContext) { // Local post - check if it exists const post = await db.query.posts.findFirst({ - where: eq(posts.id, postId), + where: { id: postId }, }); if (!post) { @@ -380,10 +377,7 @@ export async function DELETE(request: Request, context: RouteContext) { // Find the like const existingLike = await db.query.likes.findFirst({ - where: and( - eq(likes.userId, user.id), - eq(likes.postId, postId) - ), + where: { AND: [{ userId: user.id }, { postId: postId }] }, }); if (!existingLike) { @@ -395,7 +389,7 @@ export async function DELETE(request: Request, context: RouteContext) { // Update post's like count (atomic decrement, clamped to 0) await db.update(posts) - .set({ likesCount: sql`GREATEST(0, ${posts.likesCount} - 1)` }) + .set({ likesCount: sql`max(0, ${posts.likesCount} - 1)` }) .where(eq(posts.id, postId)); // SWARM-FIRST: Deliver unlike to swarm node diff --git a/src/app/api/posts/[id]/repost/route.ts b/src/app/api/posts/[id]/repost/route.ts index fd358ce..bc230cd 100644 --- a/src/app/api/posts/[id]/repost/route.ts +++ b/src/app/api/posts/[id]/repost/route.ts @@ -90,7 +90,7 @@ export async function POST(request: Request, context: RouteContext) { const { id: rawId } = await context.params; const decodedId = decodeURIComponent(rawId); const postId = postIdSchema.parse(decodedId); - const nodeDomain = process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:3000'; + const nodeDomain = process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:43821'; if (user.isSuspended || user.isSilenced) { return NextResponse.json({ error: 'Account restricted' }, { status: 403 }); @@ -106,11 +106,7 @@ export async function POST(request: Request, context: RouteContext) { } const existingRepost = await db.query.userSwarmReposts.findFirst({ - where: and( - eq(userSwarmReposts.userId, user.id), - eq(userSwarmReposts.nodeDomain, targetDomain), - eq(userSwarmReposts.originalPostId, originalPostId), - ), + where: { AND: [{ userId: user.id }, { nodeDomain: targetDomain }, { originalPostId: originalPostId }] }, }); if (existingRepost) { @@ -165,7 +161,7 @@ export async function POST(request: Request, context: RouteContext) { // Local post - check if it exists const originalPost = await db.query.posts.findFirst({ - where: eq(posts.id, postId), + where: { id: postId }, }); if (!originalPost) { @@ -177,11 +173,7 @@ export async function POST(request: Request, context: RouteContext) { // Check if already reposted by this user const existingRepost = await db.query.posts.findFirst({ - where: and( - eq(posts.userId, user.id), - eq(posts.repostOfId, postId), - eq(posts.isRemoved, false) - ), + where: { AND: [{ userId: user.id }, { repostOfId: postId }, { isRemoved: false }] }, }); if (existingRepost) { @@ -210,7 +202,7 @@ export async function POST(request: Request, context: RouteContext) { if (originalPost.userId !== user.id) { const postAuthor = await db.query.users.findFirst({ - where: eq(users.id, originalPost.userId), + where: { id: originalPost.userId }, }); // Create notification with actor info stored directly @@ -300,7 +292,7 @@ export async function DELETE(request: Request, context: RouteContext) { const { id: rawId } = await context.params; const decodedId = decodeURIComponent(rawId); const postId = postIdSchema.parse(decodedId); - const nodeDomain = process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:3000'; + const nodeDomain = process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:43821'; if (user.isSuspended || user.isSilenced) { return NextResponse.json({ error: 'Account restricted' }, { status: 403 }); @@ -316,11 +308,7 @@ export async function DELETE(request: Request, context: RouteContext) { } const existingRepost = await db.query.userSwarmReposts.findFirst({ - where: and( - eq(userSwarmReposts.userId, user.id), - eq(userSwarmReposts.nodeDomain, targetDomain), - eq(userSwarmReposts.originalPostId, originalPostId), - ), + where: { AND: [{ userId: user.id }, { nodeDomain: targetDomain }, { originalPostId: originalPostId }] }, }); if (!existingRepost) { @@ -352,7 +340,7 @@ export async function DELETE(request: Request, context: RouteContext) { )); await db.update(users) - .set({ postsCount: sql`GREATEST(0, ${users.postsCount} - 1)` }) + .set({ postsCount: sql`max(0, ${users.postsCount} - 1)` }) .where(eq(users.id, user.id)); console.log(`[Swarm] Unrepost delivered to ${targetDomain} for post ${originalPostId}`); @@ -361,16 +349,12 @@ export async function DELETE(request: Request, context: RouteContext) { // Local post - check if original post exists const originalPost = await db.query.posts.findFirst({ - where: eq(posts.id, postId), + where: { id: postId }, }); // Find the repost by this user const repost = await db.query.posts.findFirst({ - where: and( - eq(posts.userId, user.id), - eq(posts.repostOfId, postId), - eq(posts.isRemoved, false) - ), + where: { AND: [{ userId: user.id }, { repostOfId: postId }, { isRemoved: false }] }, }); if (!repost) { @@ -385,13 +369,13 @@ export async function DELETE(request: Request, context: RouteContext) { // Update original post's repost count if (originalPost) { await db.update(posts) - .set({ repostsCount: sql`GREATEST(0, ${posts.repostsCount} - 1)` }) + .set({ repostsCount: sql`max(0, ${posts.repostsCount} - 1)` }) .where(eq(posts.id, postId)); } // Update user's post count await db.update(users) - .set({ postsCount: sql`GREATEST(0, ${users.postsCount} - 1)` }) + .set({ postsCount: sql`max(0, ${users.postsCount} - 1)` }) .where(eq(users.id, user.id)); return NextResponse.json({ success: true, reposted: false }); diff --git a/src/app/api/posts/[id]/route.ts b/src/app/api/posts/[id]/route.ts index 4da2e65..43b9b83 100644 --- a/src/app/api/posts/[id]/route.ts +++ b/src/app/api/posts/[id]/route.ts @@ -88,7 +88,7 @@ export async function GET( // Decode URL-encoded characters (e.g., %3A -> :) const id = decodeURIComponent(rawId); - const nodeDomain = process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:3000'; + const nodeDomain = process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:43821'; let mainPost: any = null; let replyPosts: any[] = []; @@ -168,7 +168,7 @@ export async function GET( } const post = await db.query.posts.findFirst({ - where: eq(posts.id, id), + where: { id: id }, with: postDetailRelations, }); @@ -176,12 +176,9 @@ export async function GET( mainPost = post; const replies = await db.query.posts.findMany({ - where: and( - eq(posts.replyToId, id), - eq(posts.isRemoved, false) - ), + where: { AND: [{ replyToId: id }, { isRemoved: false }] }, with: postDetailRelations, - orderBy: [desc(posts.createdAt)], + orderBy: () => [desc(posts.createdAt)], }); mainPost = { @@ -201,19 +198,12 @@ export async function GET( if (allPostIds.length > 0) { const viewerLikes = await db.query.likes.findMany({ - where: and( - eq(likes.userId, viewer.id), - inArray(likes.postId, allPostIds) - ), + where: { AND: [{ userId: viewer.id }, { postId: { in: allPostIds } }] }, }); const likedPostIds = new Set(viewerLikes.map(l => l.postId)); const viewerReposts = await db.query.posts.findMany({ - where: and( - eq(posts.userId, viewer.id), - inArray(posts.repostOfId, allPostIds), - eq(posts.isRemoved, false) - ), + where: { AND: [{ userId: viewer.id }, { repostOfId: { in: allPostIds } }, { isRemoved: false }] }, }); const repostedPostIds = new Set(viewerReposts.map(r => r.repostOfId)); @@ -233,7 +223,7 @@ export async function GET( } } else { const cached = await db.query.remotePosts.findFirst({ - where: eq(remotePosts.apId, id), + where: { apId: id }, }); if (cached) { @@ -296,7 +286,7 @@ export async function DELETE( const user = await requireAuth(); const { id } = await params; - const nodeDomain = process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:3000'; + const nodeDomain = process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:43821'; // Handle swarm post IDs (format: swarm:domain:uuid) if (id.startsWith('swarm:')) { @@ -393,7 +383,7 @@ export async function DELETE( } const post = await db.query.posts.findFirst({ - where: eq(posts.id, id), + where: { id: id }, with: { bot: true, }, @@ -412,7 +402,7 @@ export async function DELETE( let isParentPostOwner = false; if (post.replyToId) { const parentPost = await db.query.posts.findFirst({ - where: eq(posts.id, post.replyToId), + where: { id: post.replyToId }, }); if (parentPost && parentPost.userId === user.id) { isParentPostOwner = true; @@ -426,7 +416,7 @@ export async function DELETE( // 1. If it's a reply, decrement parent's repliesCount if (post.replyToId) { const parentPost = await db.query.posts.findFirst({ - where: eq(posts.id, post.replyToId), + where: { id: post.replyToId }, }); if (parentPost && parentPost.repliesCount > 0) { await db.update(posts) @@ -472,7 +462,7 @@ export async function DELETE( // 4. Decrement the post author's postsCount (atomic decrement, clamped to 0) await db.update(users) - .set({ postsCount: sql`GREATEST(0, ${users.postsCount} - 1)` }) + .set({ postsCount: sql`max(0, ${users.postsCount} - 1)` }) .where(eq(users.id, post.userId)); return NextResponse.json({ success: true }); diff --git a/src/app/api/posts/route.test.ts b/src/app/api/posts/route.test.ts index 5a0463a..043bf7b 100644 --- a/src/app/api/posts/route.test.ts +++ b/src/app/api/posts/route.test.ts @@ -85,7 +85,7 @@ describe('POST /api/posts', () => { }; // Create a mock request - const request = new Request('http://localhost:3000/api/posts', { + const request = new Request('http://localhost:43821/api/posts', { method: 'POST', headers: { 'Content-Type': 'application/json', @@ -122,7 +122,7 @@ describe('POST /api/posts', () => { signature: 'invalid-signature', }; - const request = new Request('http://localhost:3000/api/posts', { + const request = new Request('http://localhost:43821/api/posts', { method: 'POST', headers: { 'Content-Type': 'application/json', @@ -152,7 +152,7 @@ describe('POST /api/posts', () => { signature: 'test-signature', }; - const request = new Request('http://localhost:3000/api/posts', { + const request = new Request('http://localhost:43821/api/posts', { method: 'POST', headers: { 'Content-Type': 'application/json', @@ -182,7 +182,7 @@ describe('POST /api/posts', () => { signature: 'test-signature', }; - const request = new Request('http://localhost:3000/api/posts', { + const request = new Request('http://localhost:43821/api/posts', { method: 'POST', headers: { 'Content-Type': 'application/json', @@ -212,7 +212,7 @@ describe('POST /api/posts', () => { signature: 'test-signature', }; - const request = new Request('http://localhost:3000/api/posts', { + const request = new Request('http://localhost:43821/api/posts', { method: 'POST', headers: { 'Content-Type': 'application/json', @@ -253,7 +253,7 @@ describe('POST /api/posts', () => { signature: 'test-signature', }; - const request = new Request('http://localhost:3000/api/posts', { + const request = new Request('http://localhost:43821/api/posts', { method: 'POST', headers: { 'Content-Type': 'application/json', @@ -293,7 +293,7 @@ describe('POST /api/posts', () => { signature: 'test-signature', }; - const request = new Request('http://localhost:3000/api/posts', { + const request = new Request('http://localhost:43821/api/posts', { method: 'POST', headers: { 'Content-Type': 'application/json', diff --git a/src/app/api/posts/route.ts b/src/app/api/posts/route.ts index a9a6a4e..056bc62 100644 --- a/src/app/api/posts/route.ts +++ b/src/app/api/posts/route.ts @@ -3,7 +3,6 @@ import { db, posts, users, media, follows, mutes, blocks, likes, remoteFollows, import { requireAuth } from '@/lib/auth'; import { requireSignedAction, type SignedAction } from '@/lib/auth/verify-signature'; import { eq, desc, and, inArray, isNull, isNotNull, or, lt, sql } from 'drizzle-orm'; -import type { SQL } from 'drizzle-orm'; import { z } from 'zod'; import { buildNotificationTarget } from '@/lib/notifications'; import { serializeLinkPreviewMedia, parseLinkPreviewMediaJson } from '@/lib/media/linkPreview'; @@ -13,12 +12,6 @@ const CURATION_WINDOW_HOURS = 72; const CURATION_SEED_MULTIPLIER = 5; const CURATION_SEED_CAP = 200; -const buildWhere = (...conditions: Array) => { - const filtered = conditions.filter(Boolean) as SQL[]; - if (filtered.length === 0) return undefined; - return and(...filtered); -}; - type FeedPostWithChildren = { id: string; repostOf?: FeedPostWithChildren | null; @@ -90,13 +83,13 @@ async function getMixedFeedCursorDate(cursor: string | null) { if (cursor.startsWith('swarm-repost:')) { const repostRow = await db.query.userSwarmReposts.findFirst({ - where: eq(userSwarmReposts.id, cursor.replace('swarm-repost:', '')), + where: { id: cursor.replace('swarm-repost:', '') }, }); return repostRow?.repostedAt ?? null; } const cursorPost = await db.query.posts.findFirst({ - where: eq(posts.id, cursor), + where: { id: cursor }, }); return cursorPost?.createdAt ?? null; } @@ -211,7 +204,7 @@ export async function POST(request: Request) { return NextResponse.json({ error: 'Account restricted' }, { status: 403 }); } - const nodeDomain = process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:3000'; + const nodeDomain = process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:43821'; // Build swarm reply fields if replying to a swarm post const swarmReplyFields = data.swarmReplyTo ? { @@ -245,11 +238,7 @@ export async function POST(request: Request) { let unattachedMedia: typeof media.$inferSelect[] = []; if (data.mediaIds?.length) { unattachedMedia = await db.query.media.findMany({ - where: and( - inArray(media.id, data.mediaIds), - eq(media.userId, user.id), - isNull(media.postId), - ), + where: { AND: [{ id: { in: data.mediaIds } }, { userId: user.id }, { postId: { isNull: true } }] }, }); } @@ -329,18 +318,14 @@ export async function POST(request: Request) { let attachedMedia: typeof media.$inferSelect[] = []; if (data.mediaIds?.length) { attachedMedia = await db.query.media.findMany({ - where: and( - inArray(media.id, data.mediaIds), - eq(media.userId, user.id), - eq(media.postId, post.id), - ), + where: { AND: [{ id: { in: data.mediaIds } }, { userId: user.id }, { postId: post.id }] }, }); } if (data.replyToId) { try { const parentPost = await db.query.posts.findFirst({ - where: eq(posts.id, data.replyToId), + where: { id: data.replyToId }, with: { author: true, }, @@ -395,7 +380,7 @@ export async function POST(request: Request) { // Find the mentioned user const mentionedUser = await db.query.users.findFirst({ - where: eq(users.handle, mention.handle.toLowerCase()), + where: { handle: mention.handle.toLowerCase() }, }); if (mentionedUser && mentionedUser.id !== user.id && !mentionedUser.isSuspended) { @@ -612,38 +597,41 @@ export async function GET(request: Request) { let feedPosts; // Base filter excludes removed posts and replies (replies only show on detail/profile) - const baseFilter = buildWhere( - eq(posts.isRemoved, false), - isNull(posts.replyToId), - isNull(posts.swarmReplyToId) - ); + const baseFilter = { + isRemoved: false, + replyToId: { isNull: true as const }, + swarmReplyToId: { isNull: true as const }, + }; // Filter for replies only - const repliesFilter = buildWhere( - eq(posts.isRemoved, false), - or( - isNotNull(posts.replyToId), - isNotNull(posts.swarmReplyToId) - ) - ); + const repliesFilter = { + isRemoved: false, + OR: [ + { replyToId: { isNotNull: true as const } }, + { swarmReplyToId: { isNotNull: true as const } }, + ], + }; if (type === 'local') { // Local node posts only - let whereCondition = baseFilter; + let whereCondition = { + ...baseFilter, + createdAt: undefined as { lt: Date } | undefined, + }; // Apply cursor-based pagination if (cursor) { const cursorPost = await db.query.posts.findFirst({ - where: eq(posts.id, cursor), + where: { id: cursor }, }); if (cursorPost) { - whereCondition = buildWhere(baseFilter, lt(posts.createdAt, cursorPost.createdAt)); + whereCondition = { ...baseFilter, createdAt: { lt: cursorPost.createdAt } }; } } feedPosts = await db.query.posts.findMany({ where: whereCondition, with: feedPostRelations, - orderBy: [desc(posts.createdAt)], + orderBy: () => [desc(posts.createdAt)], limit, }); } else if (type === 'public') { @@ -651,13 +639,13 @@ export async function GET(request: Request) { const localPosts = await db.query.posts.findMany({ where: baseFilter, with: feedPostRelations, - orderBy: [desc(posts.createdAt)], + orderBy: () => [desc(posts.createdAt)], limit: limit * 2, }); // Get all cached remote posts const remotePostsData = await db.query.remotePosts.findMany({ - orderBy: [desc(remotePosts.publishedAt)], + orderBy: () => [desc(remotePosts.publishedAt)], limit: limit, }); @@ -669,42 +657,50 @@ export async function GET(request: Request) { .slice(0, limit) as any; } else if (type === 'user' && userId) { // User's posts (excluding replies) - let whereCondition = buildWhere(baseFilter, eq(posts.userId, userId)); + let whereCondition = { + ...baseFilter, + userId, + createdAt: undefined as { lt: Date } | undefined, + }; // Apply cursor-based pagination if (cursor) { const cursorPost = await db.query.posts.findFirst({ - where: eq(posts.id, cursor), + where: { id: cursor }, }); if (cursorPost) { - whereCondition = buildWhere(baseFilter, eq(posts.userId, userId), lt(posts.createdAt, cursorPost.createdAt)); + whereCondition = { ...baseFilter, userId, createdAt: { lt: cursorPost.createdAt } }; } } feedPosts = await db.query.posts.findMany({ where: whereCondition, with: feedPostRelations, - orderBy: [desc(posts.createdAt)], + orderBy: () => [desc(posts.createdAt)], limit, }); } else if (type === 'replies' && userId) { // User's replies only - let whereCondition = buildWhere(repliesFilter, eq(posts.userId, userId)); + let whereCondition = { + ...repliesFilter, + userId, + createdAt: undefined as { lt: Date } | undefined, + }; // Apply cursor-based pagination if (cursor) { const cursorPost = await db.query.posts.findFirst({ - where: eq(posts.id, cursor), + where: { id: cursor }, }); if (cursorPost) { - whereCondition = buildWhere(repliesFilter, eq(posts.userId, userId), lt(posts.createdAt, cursorPost.createdAt)); + whereCondition = { ...repliesFilter, userId, createdAt: { lt: cursorPost.createdAt } }; } } feedPosts = await db.query.posts.findMany({ where: whereCondition, with: feedPostRelations, - orderBy: [desc(posts.createdAt)], + orderBy: () => [desc(posts.createdAt)], limit, }); } else if (type === 'curated') { @@ -857,36 +853,38 @@ export async function GET(request: Request) { const allowedUserIds = [user.id, ...followingIds]; // Build where condition with cursor support - let whereCondition = buildWhere(baseFilter, inArray(posts.userId, allowedUserIds)); + let whereCondition = { + ...baseFilter, + userId: { in: allowedUserIds }, + createdAt: undefined as { lt: Date } | undefined, + }; const cursorDate = await getMixedFeedCursorDate(cursor); if (cursorDate) { - whereCondition = buildWhere(baseFilter, inArray(posts.userId, allowedUserIds), lt(posts.createdAt, cursorDate)); + whereCondition = { ...baseFilter, userId: { in: allowedUserIds }, createdAt: { lt: cursorDate } }; } // Get local posts from people the user follows + their own posts const localPosts = await db.query.posts.findMany({ where: whereCondition, with: feedPostRelations, - orderBy: [desc(posts.createdAt)], + orderBy: () => [desc(posts.createdAt)], limit: cursor ? limit : limit * 2, // Get more on first load to account for mixing with remote }); - const swarmRepostWhere = cursorDate - ? and( - inArray(userSwarmReposts.userId, allowedUserIds), - lt(userSwarmReposts.repostedAt, cursorDate) - ) - : inArray(userSwarmReposts.userId, allowedUserIds); + const swarmRepostWhere = { + userId: { in: allowedUserIds }, + ...(cursorDate ? { repostedAt: { lt: cursorDate } } : {}), + }; const swarmRepostRows = await db.query.userSwarmReposts.findMany({ where: swarmRepostWhere, - orderBy: [desc(userSwarmReposts.repostedAt)], + orderBy: () => [desc(userSwarmReposts.repostedAt)], limit: cursor ? limit : limit * 2, }); const swarmRepostAuthors = swarmRepostRows.length > 0 ? await db.query.users.findMany({ - where: inArray(users.id, Array.from(new Set(swarmRepostRows.map((row) => row.userId)))), + where: { id: { in: Array.from(new Set(swarmRepostRows.map((row) => row.userId))) } }, }) : []; const swarmRepostAuthorMap = new Map(swarmRepostAuthors.map((author) => [author.id, author])); @@ -902,7 +900,7 @@ export async function GET(request: Request) { // Get handles of remote users we follow const followedRemoteUsers = await db.query.remoteFollows.findMany({ - where: eq(remoteFollows.followerId, user.id), + where: { followerId: user.id }, }); // Fetch posts LIVE from followed remote users (in parallel, with timeout) @@ -969,7 +967,7 @@ export async function GET(request: Request) { feedPosts = await db.query.posts.findMany({ where: baseFilter, with: feedPostRelations, - orderBy: [desc(posts.createdAt)], + orderBy: () => [desc(posts.createdAt)], limit, }); } @@ -982,7 +980,7 @@ export async function GET(request: Request) { if (session?.user && feedPosts && feedPosts.length > 0) { const viewer = session.user; - const nodeDomain = process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:3000'; + const nodeDomain = process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:43821'; const allFeedPosts = collectNestedPosts(feedPosts as FeedPostWithChildren[]); // Separate local and swarm posts @@ -1010,19 +1008,12 @@ export async function GET(request: Request) { if (localPostIds.length > 0) { const viewerLikes = await db.query.likes.findMany({ - where: and( - eq(likes.userId, viewer.id), - inArray(likes.postId, localPostIds) - ), + where: { AND: [{ userId: viewer.id }, { postId: { in: localPostIds } }] }, }); viewerLikes.forEach(l => likedPostIds.add(l.postId)); const viewerReposts = await db.query.posts.findMany({ - where: and( - eq(posts.userId, viewer.id), - inArray(posts.repostOfId, localPostIds), - eq(posts.isRemoved, false) - ), + where: { AND: [{ userId: viewer.id }, { repostOfId: { in: localPostIds } }, { isRemoved: false }] }, }); viewerReposts.forEach(r => { if (r.repostOfId) repostedPostIds.add(r.repostOfId); }); } diff --git a/src/app/api/posts/swarm/route.ts b/src/app/api/posts/swarm/route.ts index 1bb9fff..f0a381a 100644 --- a/src/app/api/posts/swarm/route.ts +++ b/src/app/api/posts/swarm/route.ts @@ -79,7 +79,7 @@ export async function GET(request: NextRequest) { const session = await getSession().catch(() => null); const viewer = session?.user; - const nodeDomain = process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:3000'; + const nodeDomain = process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:43821'; const allTimelinePosts = collectNestedSwarmPosts(timeline.posts as SwarmFeedPost[]); const likedPostIds = viewer ? await getViewerSwarmLikedPostIds( diff --git a/src/app/api/reports/route.ts b/src/app/api/reports/route.ts index 02608a9..15ce534 100644 --- a/src/app/api/reports/route.ts +++ b/src/app/api/reports/route.ts @@ -21,7 +21,7 @@ export async function POST(request: Request) { if (data.targetType === 'post') { const targetPost = await db.query.posts.findFirst({ - where: eq(posts.id, data.targetId), + where: { id: data.targetId }, }); if (!targetPost || targetPost.isRemoved) { return NextResponse.json({ error: 'Post not found' }, { status: 404 }); @@ -30,7 +30,7 @@ export async function POST(request: Request) { if (data.targetType === 'user') { const targetUser = await db.query.users.findFirst({ - where: eq(users.id, data.targetId), + where: { id: data.targetId }, }); if (!targetUser) { return NextResponse.json({ error: 'User not found' }, { status: 404 }); diff --git a/src/app/api/search/route.ts b/src/app/api/search/route.ts index 34ebbcb..1d09d3a 100644 --- a/src/app/api/search/route.ts +++ b/src/app/api/search/route.ts @@ -1,6 +1,6 @@ import { NextResponse } from 'next/server'; import { db, users, posts, likes } from '@/db'; -import { ilike, or, desc, and, notInArray, eq, inArray } from 'drizzle-orm'; +import { like, or, desc, and, eq, inArray } from 'drizzle-orm'; import { fetchSwarmUserProfile, isSwarmNode } from '@/lib/swarm/interactions'; import { discoverNode } from '@/lib/swarm/discovery'; @@ -119,9 +119,9 @@ export async function GET(request: Request) { if (searchUsers.length === 0) { const userConditions = and( or( - ilike(users.handle, searchPattern), - ilike(users.displayName, searchPattern), - ilike(users.bio, searchPattern) + like(users.handle, searchPattern), + like(users.displayName, searchPattern), + like(users.bio, searchPattern) ), eq(users.isSuspended, false), eq(users.isSilenced, false) @@ -187,17 +187,14 @@ export async function GET(request: Request) { // Search posts if (type === 'all' || type === 'posts') { - const postConditions = [ - ilike(posts.content, searchPattern), - eq(posts.isRemoved, false), - ]; - if (moderatedIds.length) { - postConditions.push(notInArray(posts.userId, moderatedIds)); - } const postResults = await db.query.posts.findMany({ - where: and(...postConditions), + where: { + content: { like: searchPattern }, + isRemoved: false, + ...(moderatedIds.length ? { userId: { notIn: moderatedIds } } : {}), + }, with: searchPostRelations, - orderBy: [desc(posts.createdAt)], + orderBy: () => [desc(posts.createdAt)], limit, }); searchPosts = postResults; @@ -213,19 +210,12 @@ export async function GET(request: Request) { if (postIds.length > 0) { const viewerLikes = await db.query.likes.findMany({ - where: and( - eq(likes.userId, viewer.id), - inArray(likes.postId, postIds) - ), + where: { AND: [{ userId: viewer.id }, { postId: { in: postIds } }] }, }); const likedPostIds = new Set(viewerLikes.map(l => l.postId)); const viewerReposts = await db.query.posts.findMany({ - where: and( - eq(posts.userId, viewer.id), - inArray(posts.repostOfId, postIds), - eq(posts.isRemoved, false) - ), + where: { AND: [{ userId: viewer.id }, { repostOfId: { in: postIds } }, { isRemoved: false }] }, }); const repostedPostIds = new Set(viewerReposts.map(r => r.repostOfId)); diff --git a/src/app/api/settings/blocked-users/route.ts b/src/app/api/settings/blocked-users/route.ts index 669c3eb..ac09acb 100644 --- a/src/app/api/settings/blocked-users/route.ts +++ b/src/app/api/settings/blocked-users/route.ts @@ -10,7 +10,7 @@ export async function GET() { const currentUser = await requireAuth(); const blocked = await db.query.blocks.findMany({ - where: eq(blocks.userId, currentUser.id), + where: { userId: currentUser.id }, with: { blockedUser: true, }, diff --git a/src/app/api/settings/muted-nodes/route.ts b/src/app/api/settings/muted-nodes/route.ts index 00e2a91..73723e5 100644 --- a/src/app/api/settings/muted-nodes/route.ts +++ b/src/app/api/settings/muted-nodes/route.ts @@ -10,7 +10,7 @@ export async function GET() { const currentUser = await requireAuth(); const muted = await db.query.mutedNodes.findMany({ - where: eq(mutedNodes.userId, currentUser.id), + where: { userId: currentUser.id }, orderBy: (t, { desc }) => [desc(t.createdAt)], }); @@ -43,10 +43,7 @@ export async function POST(req: NextRequest) { // Check if already muted const existing = await db.query.mutedNodes.findFirst({ - where: and( - eq(mutedNodes.userId, currentUser.id), - eq(mutedNodes.nodeDomain, normalizedDomain) - ), + where: { AND: [{ userId: currentUser.id }, { nodeDomain: normalizedDomain }] }, }); if (existing) { diff --git a/src/app/api/swarm/chat/conversations/[id]/route.ts b/src/app/api/swarm/chat/conversations/[id]/route.ts index d8ba110..47fd09a 100644 --- a/src/app/api/swarm/chat/conversations/[id]/route.ts +++ b/src/app/api/swarm/chat/conversations/[id]/route.ts @@ -54,10 +54,7 @@ export async function DELETE( // Verify the conversation belongs to this user const conversation = await db.query.chatConversations.findFirst({ - where: and( - eq(chatConversations.id, id), - eq(chatConversations.participant1Id, session.user.id) - ), + where: { AND: [{ id: id }, { participant1Id: session.user.id }] }, }); if (!conversation) { @@ -113,16 +110,13 @@ export async function DELETE( } else { // Local user - find and delete their conversation too const recipientUser = await db.query.users.findFirst({ - where: eq(users.handle, participant2Handle), + where: { handle: participant2Handle }, }); if (recipientUser) { // Find their conversation with us const recipientConversation = await db.query.chatConversations.findFirst({ - where: and( - eq(chatConversations.participant1Id, recipientUser.id), - eq(chatConversations.participant2Handle, session.user.handle) - ), + where: { AND: [{ participant1Id: recipientUser.id }, { participant2Handle: session.user.handle }] }, }); if (recipientConversation) { diff --git a/src/app/api/swarm/chat/conversations/route.ts b/src/app/api/swarm/chat/conversations/route.ts index 222c1fa..896551a 100644 --- a/src/app/api/swarm/chat/conversations/route.ts +++ b/src/app/api/swarm/chat/conversations/route.ts @@ -22,11 +22,11 @@ export async function GET(request: NextRequest) { // Get all conversations for this user const conversations = await db.query.chatConversations.findMany({ - where: eq(chatConversations.participant1Id, session.user.id), - orderBy: [desc(chatConversations.lastMessageAt)], + where: { participant1Id: session.user.id }, + orderBy: () => [desc(chatConversations.lastMessageAt)], with: { messages: { - orderBy: [desc(chatMessages.createdAt)], + orderBy: () => [desc(chatMessages.createdAt)], limit: 1, }, }, @@ -59,7 +59,7 @@ export async function GET(request: NextRequest) { // Try to get cached user info let cachedUser = await db.query.users.findFirst({ - where: eq(users.handle, participant2Handle), + where: { handle: participant2Handle }, }); // If not found, check if it's a local user with a domain suffix @@ -67,7 +67,7 @@ export async function GET(request: NextRequest) { const [handlePart, domainPart] = participant2Handle.split('@'); if (!domainPart || domainPart === process.env.NEXT_PUBLIC_NODE_DOMAIN) { cachedUser = await db.query.users.findFirst({ - where: eq(users.handle, handlePart), + where: { handle: handlePart }, }); } } @@ -91,7 +91,7 @@ export async function GET(request: NextRequest) { // Re-query to get the new cached user cachedUser = await db.query.users.findFirst({ - where: eq(users.handle, participant2Handle), + where: { handle: participant2Handle }, }) as any; } } catch (e) { diff --git a/src/app/api/swarm/chat/delete/route.ts b/src/app/api/swarm/chat/delete/route.ts index be3c2ce..15e8775 100644 --- a/src/app/api/swarm/chat/delete/route.ts +++ b/src/app/api/swarm/chat/delete/route.ts @@ -53,7 +53,7 @@ export async function POST(request: NextRequest) { // Find the recipient (local user) const recipient = await db.query.users.findFirst({ - where: eq(users.handle, data.recipientHandle.toLowerCase()), + where: { handle: data.recipientHandle.toLowerCase() }, }); if (!recipient) { @@ -63,10 +63,7 @@ export async function POST(request: NextRequest) { // Find the conversation with the sender const senderFullHandle = `${data.senderHandle}@${senderNodeDomain}`; const conversation = await db.query.chatConversations.findFirst({ - where: and( - eq(chatConversations.participant1Id, recipient.id), - eq(chatConversations.participant2Handle, senderFullHandle) - ), + where: { AND: [{ participant1Id: recipient.id }, { participant2Handle: senderFullHandle }] }, }); if (!conversation) { diff --git a/src/app/api/swarm/chat/messages/route.ts b/src/app/api/swarm/chat/messages/route.ts index 15baaba..4fadd9a 100644 --- a/src/app/api/swarm/chat/messages/route.ts +++ b/src/app/api/swarm/chat/messages/route.ts @@ -52,10 +52,7 @@ export async function GET(request: NextRequest) { // Verify user has access to this conversation const conversation = await db.query.chatConversations.findFirst({ - where: and( - eq(chatConversations.id, conversationId), - eq(chatConversations.participant1Id, session.user.id) - ), + where: { AND: [{ id: conversationId }, { participant1Id: session.user.id }] }, }); if (!conversation) { @@ -63,15 +60,14 @@ export async function GET(request: NextRequest) { } // Build query with cursor-based pagination - const baseCondition = eq(chatMessages.conversationId, conversationId); const whereCondition = cursor - ? and(baseCondition, lt(chatMessages.createdAt, new Date(cursor)))! - : baseCondition; + ? { conversationId, createdAt: { lt: new Date(cursor) } } + : { conversationId }; // Get messages const messages = await db.query.chatMessages.findMany({ where: whereCondition, - orderBy: [desc(chatMessages.createdAt)], + orderBy: () => [desc(chatMessages.createdAt)], limit, }); @@ -92,7 +88,7 @@ export async function GET(request: NextRequest) { if (senderDids.size > 0) { const found = await db.query.users.findMany({ - where: inArray(users.did, Array.from(senderDids)) + where: { did: { in: Array.from(senderDids) } } }); found.forEach(u => usersByDid[u.did] = u); } @@ -100,7 +96,7 @@ export async function GET(request: NextRequest) { // Also fetch local users by handle if needed if (senderHandles.size > 0) { const found = await db.query.users.findMany({ - where: inArray(users.handle, Array.from(senderHandles)) + where: { handle: { in: Array.from(senderHandles) } } }); found.forEach(u => usersByHandle[u.handle] = u); } @@ -164,10 +160,7 @@ export async function PATCH(request: NextRequest) { // Verify user has access to this conversation const conversation = await db.query.chatConversations.findFirst({ - where: and( - eq(chatConversations.id, conversationId), - eq(chatConversations.participant1Id, session.user.id) - ), + where: { AND: [{ id: conversationId }, { participant1Id: session.user.id }] }, }); if (!conversation) { diff --git a/src/app/api/swarm/interactions/follow/route.ts b/src/app/api/swarm/interactions/follow/route.ts index 903c761..717e5c6 100644 --- a/src/app/api/swarm/interactions/follow/route.ts +++ b/src/app/api/swarm/interactions/follow/route.ts @@ -56,7 +56,7 @@ export async function POST(request: NextRequest) { // Find the target user (local user being followed) const targetUser = await db.query.users.findFirst({ - where: eq(users.handle, data.targetHandle.toLowerCase()), + where: { handle: data.targetHandle.toLowerCase() }, }); if (!targetUser) { @@ -73,10 +73,7 @@ export async function POST(request: NextRequest) { // Check if this follow already exists const existingFollow = await db.query.remoteFollowers.findFirst({ - where: and( - eq(remoteFollowers.userId, targetUser.id), - eq(remoteFollowers.actorUrl, actorUrl) - ), + where: { AND: [{ userId: targetUser.id }, { actorUrl: actorUrl }] }, }); if (existingFollow) { diff --git a/src/app/api/swarm/interactions/like/route.ts b/src/app/api/swarm/interactions/like/route.ts index 221f8bd..54252da 100644 --- a/src/app/api/swarm/interactions/like/route.ts +++ b/src/app/api/swarm/interactions/like/route.ts @@ -52,7 +52,7 @@ export async function POST(request: NextRequest) { // Find the target post const post = await db.query.posts.findFirst({ - where: eq(posts.id, data.postId), + where: { id: data.postId }, with: { author: true }, }); @@ -66,11 +66,7 @@ export async function POST(request: NextRequest) { // Check if already liked by this remote user const existingLike = await db.query.remoteLikes.findFirst({ - where: and( - eq(remoteLikes.postId, data.postId), - eq(remoteLikes.actorHandle, data.like.actorHandle), - eq(remoteLikes.actorNodeDomain, data.like.actorNodeDomain) - ), + where: { AND: [{ postId: data.postId }, { actorHandle: data.like.actorHandle }, { actorNodeDomain: data.like.actorNodeDomain }] }, }); if (existingLike) { diff --git a/src/app/api/swarm/interactions/mention/route.ts b/src/app/api/swarm/interactions/mention/route.ts index 1f1e68e..6c06aea 100644 --- a/src/app/api/swarm/interactions/mention/route.ts +++ b/src/app/api/swarm/interactions/mention/route.ts @@ -54,7 +54,7 @@ export async function POST(request: NextRequest) { // Find the mentioned user (local user) const mentionedUser = await db.query.users.findFirst({ - where: eq(users.handle, data.mentionedHandle.toLowerCase()), + where: { handle: data.mentionedHandle.toLowerCase() }, }); if (!mentionedUser) { diff --git a/src/app/api/swarm/interactions/repost/route.ts b/src/app/api/swarm/interactions/repost/route.ts index e3f4fcd..c315873 100644 --- a/src/app/api/swarm/interactions/repost/route.ts +++ b/src/app/api/swarm/interactions/repost/route.ts @@ -53,7 +53,7 @@ export async function POST(request: NextRequest) { // Find the target post const post = await db.query.posts.findFirst({ - where: eq(posts.id, data.postId), + where: { id: data.postId }, with: { author: true }, }); @@ -66,11 +66,7 @@ export async function POST(request: NextRequest) { } const existingRepost = await db.query.remoteReposts.findFirst({ - where: and( - eq(remoteReposts.postId, data.postId), - eq(remoteReposts.actorHandle, data.repost.actorHandle), - eq(remoteReposts.actorNodeDomain, data.repost.actorNodeDomain), - ), + where: { AND: [{ postId: data.postId }, { actorHandle: data.repost.actorHandle }, { actorNodeDomain: data.repost.actorNodeDomain }] }, }); if (existingRepost) { diff --git a/src/app/api/swarm/interactions/unfollow/route.ts b/src/app/api/swarm/interactions/unfollow/route.ts index cc11e39..fe9d8c9 100644 --- a/src/app/api/swarm/interactions/unfollow/route.ts +++ b/src/app/api/swarm/interactions/unfollow/route.ts @@ -49,7 +49,7 @@ export async function POST(request: NextRequest) { // Find the target user const targetUser = await db.query.users.findFirst({ - where: eq(users.handle, data.targetHandle.toLowerCase()), + where: { handle: data.targetHandle.toLowerCase() }, }); if (!targetUser) { @@ -60,10 +60,7 @@ export async function POST(request: NextRequest) { const actorUrl = `swarm://${data.unfollow.followerNodeDomain}/${data.unfollow.followerHandle}`; const existingFollow = await db.query.remoteFollowers.findFirst({ - where: and( - eq(remoteFollowers.userId, targetUser.id), - eq(remoteFollowers.actorUrl, actorUrl) - ), + where: { AND: [{ userId: targetUser.id }, { actorUrl: actorUrl }] }, }); if (!existingFollow) { @@ -78,7 +75,7 @@ export async function POST(request: NextRequest) { // Update follower count await db.update(users) - .set({ followersCount: sql`GREATEST(0, ${users.followersCount} - 1)` }) + .set({ followersCount: sql`max(0, ${users.followersCount} - 1)` }) .where(eq(users.id, targetUser.id)); console.log(`[Swarm] Received unfollow from ${data.unfollow.followerHandle}@${data.unfollow.followerNodeDomain} for @${data.targetHandle}`); diff --git a/src/app/api/swarm/interactions/unlike/route.ts b/src/app/api/swarm/interactions/unlike/route.ts index 241674d..98d01d9 100644 --- a/src/app/api/swarm/interactions/unlike/route.ts +++ b/src/app/api/swarm/interactions/unlike/route.ts @@ -49,7 +49,7 @@ export async function POST(request: NextRequest) { // Find the target post const post = await db.query.posts.findFirst({ - where: eq(posts.id, data.postId), + where: { id: data.postId }, }); if (!post) { diff --git a/src/app/api/swarm/interactions/unrepost/route.ts b/src/app/api/swarm/interactions/unrepost/route.ts index 5e199eb..f974d9f 100644 --- a/src/app/api/swarm/interactions/unrepost/route.ts +++ b/src/app/api/swarm/interactions/unrepost/route.ts @@ -49,7 +49,7 @@ export async function POST(request: NextRequest) { // Find the target post const post = await db.query.posts.findFirst({ - where: eq(posts.id, data.postId), + where: { id: data.postId }, }); if (!post) { @@ -61,11 +61,7 @@ export async function POST(request: NextRequest) { } const existingRepost = await db.query.remoteReposts.findFirst({ - where: and( - eq(remoteReposts.postId, data.postId), - eq(remoteReposts.actorHandle, data.unrepost.actorHandle), - eq(remoteReposts.actorNodeDomain, data.unrepost.actorNodeDomain), - ), + where: { AND: [{ postId: data.postId }, { actorHandle: data.unrepost.actorHandle }, { actorNodeDomain: data.unrepost.actorNodeDomain }] }, }); if (!existingRepost) { @@ -77,7 +73,7 @@ export async function POST(request: NextRequest) { // Decrement repost count await db.update(posts) - .set({ repostsCount: sql`GREATEST(0, ${posts.repostsCount} - 1)` }) + .set({ repostsCount: sql`max(0, ${posts.repostsCount} - 1)` }) .where(eq(posts.id, data.postId)); await db.delete(remoteReposts).where(eq(remoteReposts.id, existingRepost.id)); diff --git a/src/app/api/swarm/posts/[id]/likes/route.ts b/src/app/api/swarm/posts/[id]/likes/route.ts index 3f8d8a4..5f4f917 100644 --- a/src/app/api/swarm/posts/[id]/likes/route.ts +++ b/src/app/api/swarm/posts/[id]/likes/route.ts @@ -59,7 +59,7 @@ export async function GET(request: NextRequest, context: RouteContext) { // Find the post const post = await db.query.posts.findFirst({ - where: eq(posts.id, postId), + where: { id: postId }, }); if (!post || post.isRemoved) { @@ -71,11 +71,7 @@ export async function GET(request: NextRequest, context: RouteContext) { // If domain is provided, check remote likes if (checkDomain) { const remoteLike = await db.query.remoteLikes.findFirst({ - where: and( - eq(remoteLikes.postId, postId), - eq(remoteLikes.actorHandle, checkHandle), - eq(remoteLikes.actorNodeDomain, checkDomain) - ), + where: { AND: [{ postId: postId }, { actorHandle: checkHandle }, { actorNodeDomain: checkDomain }] }, }); return NextResponse.json({ @@ -89,15 +85,12 @@ export async function GET(request: NextRequest, context: RouteContext) { // No domain = local user const localUser = await db.query.users.findFirst({ - where: eq(users.handle, checkHandle), + where: { handle: checkHandle }, }); if (localUser) { const liked = await db.query.likes.findFirst({ - where: and( - eq(likes.postId, postId), - eq(likes.userId, localUser.id) - ), + where: { AND: [{ postId: postId }, { userId: localUser.id }] }, }); return NextResponse.json({ diff --git a/src/app/api/swarm/posts/[id]/route.ts b/src/app/api/swarm/posts/[id]/route.ts index 9795e54..c326ba1 100644 --- a/src/app/api/swarm/posts/[id]/route.ts +++ b/src/app/api/swarm/posts/[id]/route.ts @@ -36,7 +36,7 @@ export async function GET(request: NextRequest, context: RouteContext) { // Find the post const post = await db.query.posts.findFirst({ - where: eq(posts.id, postId), + where: { id: postId }, with: { author: true, media: true, @@ -45,7 +45,7 @@ export async function GET(request: NextRequest, context: RouteContext) { if (!post || post.isRemoved) { const remoteRepost = await db.query.userSwarmReposts.findFirst({ - where: eq(userSwarmReposts.id, postId), + where: { id: postId }, }); if (!remoteRepost) { @@ -53,7 +53,7 @@ export async function GET(request: NextRequest, context: RouteContext) { } const repostAuthor = await db.query.users.findFirst({ - where: eq(users.id, remoteRepost.userId), + where: { id: remoteRepost.userId }, }); return NextResponse.json({ @@ -104,15 +104,12 @@ export async function GET(request: NextRequest, context: RouteContext) { // Get replies const replies = await db.query.posts.findMany({ - where: and( - eq(posts.replyToId, postId), - eq(posts.isRemoved, false) - ), + where: { AND: [{ replyToId: postId }, { isRemoved: false }] }, with: { author: true, media: true, }, - orderBy: [desc(posts.createdAt)], + orderBy: () => [desc(posts.createdAt)], limit: 50, }); diff --git a/src/app/api/swarm/replies/route.ts b/src/app/api/swarm/replies/route.ts index 1c4a5ba..fef6903 100644 --- a/src/app/api/swarm/replies/route.ts +++ b/src/app/api/swarm/replies/route.ts @@ -34,7 +34,7 @@ const swarmReplySchema = z.object({ async function syncParentReplyCount(postId: string) { const [{ count }] = await db - .select({ count: sql`count(*)::int` }) + .select({ count: sql`count(*)` }) .from(posts) .where(and( eq(posts.replyToId, postId), @@ -82,10 +82,7 @@ export async function POST(request: NextRequest) { } const parentPost = await db.query.posts.findFirst({ - where: and( - eq(posts.id, data.postId), - eq(posts.isRemoved, false) - ), + where: { AND: [{ id: data.postId }, { isRemoved: false }] }, with: { author: true, }, @@ -107,7 +104,7 @@ export async function POST(request: NextRequest) { }); const remoteUser = await db.query.users.findFirst({ - where: eq(users.handle, remoteHandle), + where: { handle: remoteHandle }, }); if (!remoteUser) { @@ -116,7 +113,7 @@ export async function POST(request: NextRequest) { const replyApId = `swarm:${sourceDomain}:${data.reply.id}`; const existingReply = await db.query.posts.findFirst({ - where: eq(posts.apId, replyApId), + where: { apId: replyApId }, }); if (existingReply) { @@ -205,7 +202,7 @@ export async function DELETE(request: NextRequest) { // Find the reply by its swarm ID const swarmReplyId = `swarm:${nodeDomain}:${replyId}`; const existingReply = await db.query.posts.findFirst({ - where: eq(posts.apId, swarmReplyId), + where: { apId: swarmReplyId }, }); if (!existingReply) { diff --git a/src/app/api/swarm/timeline/route.ts b/src/app/api/swarm/timeline/route.ts index b071a71..096b545 100644 --- a/src/app/api/swarm/timeline/route.ts +++ b/src/app/api/swarm/timeline/route.ts @@ -128,7 +128,7 @@ export async function GET(request: NextRequest) { // Get node NSFW status const node = await db.query.nodes.findFirst({ - where: eq(nodes.domain, nodeDomain), + where: { domain: nodeDomain }, }); const nodeIsNsfw = node?.isNsfw ?? false; diff --git a/src/app/api/swarm/users/[handle]/followers/route.ts b/src/app/api/swarm/users/[handle]/followers/route.ts index f3364fb..08dc82c 100644 --- a/src/app/api/swarm/users/[handle]/followers/route.ts +++ b/src/app/api/swarm/users/[handle]/followers/route.ts @@ -41,7 +41,7 @@ export async function GET(request: NextRequest, context: RouteContext) { // Find the user const user = await db.query.users.findFirst({ - where: eq(users.handle, cleanHandle), + where: { handle: cleanHandle }, }); if (!user) { @@ -74,7 +74,7 @@ export async function GET(request: NextRequest, context: RouteContext) { // Get remote followers const userRemoteFollowers = await db.query.remoteFollowers.findMany({ - where: eq(remoteFollowers.userId, user.id), + where: { userId: user.id }, limit, }); diff --git a/src/app/api/swarm/users/[handle]/following/route.ts b/src/app/api/swarm/users/[handle]/following/route.ts index 74def1b..6f0b3b9 100644 --- a/src/app/api/swarm/users/[handle]/following/route.ts +++ b/src/app/api/swarm/users/[handle]/following/route.ts @@ -40,7 +40,7 @@ export async function GET(request: NextRequest, context: RouteContext) { // Find the user const user = await db.query.users.findFirst({ - where: eq(users.handle, cleanHandle), + where: { handle: cleanHandle }, }); if (!user) { @@ -73,7 +73,7 @@ export async function GET(request: NextRequest, context: RouteContext) { // Get remote following const userRemoteFollowing = await db.query.remoteFollows.findMany({ - where: eq(remoteFollows.followerId, user.id), + where: { followerId: user.id }, limit, }); diff --git a/src/app/api/swarm/users/[handle]/route.ts b/src/app/api/swarm/users/[handle]/route.ts index a516c6e..0ad4b76 100644 --- a/src/app/api/swarm/users/[handle]/route.ts +++ b/src/app/api/swarm/users/[handle]/route.ts @@ -188,7 +188,7 @@ export async function GET(request: NextRequest, context: RouteContext) { // Find the user const user = await db.query.users.findFirst({ - where: eq(users.handle, cleanHandle), + where: { handle: cleanHandle }, with: { botOwner: true, // Include bot owner if this is a bot }, @@ -222,20 +222,15 @@ export async function GET(request: NextRequest, context: RouteContext) { }; const localPosts = await db.query.posts.findMany({ - where: and( - eq(posts.userId, user.id), - eq(posts.isRemoved, false), - isNull(posts.replyToId), - isNull(posts.swarmReplyToId) - ), + where: { AND: [{ userId: user.id }, { isRemoved: false }, { replyToId: { isNull: true } }, { swarmReplyToId: { isNull: true } }] }, with: profilePostRelations, - orderBy: [desc(posts.createdAt)], + orderBy: () => [desc(posts.createdAt)], limit: limit * 2, }); const remoteRepostRows = await db.query.userSwarmReposts.findMany({ - where: eq(userSwarmReposts.userId, user.id), - orderBy: [desc(userSwarmReposts.repostedAt)], + where: { userId: user.id }, + orderBy: () => [desc(userSwarmReposts.repostedAt)], limit: limit * 2, }); diff --git a/src/app/api/users/[handle]/block/route.ts b/src/app/api/users/[handle]/block/route.ts index 3b8bda6..c61f5ad 100644 --- a/src/app/api/users/[handle]/block/route.ts +++ b/src/app/api/users/[handle]/block/route.ts @@ -13,7 +13,7 @@ export async function GET(req: NextRequest, context: RouteContext) { const { handle } = await context.params; const targetUser = await db.query.users.findFirst({ - where: eq(users.handle, handle), + where: { handle: handle }, }); if (!targetUser) { @@ -21,10 +21,7 @@ export async function GET(req: NextRequest, context: RouteContext) { } const block = await db.query.blocks.findFirst({ - where: and( - eq(blocks.userId, currentUser.id), - eq(blocks.blockedUserId, targetUser.id) - ), + where: { AND: [{ userId: currentUser.id }, { blockedUserId: targetUser.id }] }, }); return NextResponse.json({ blocked: !!block }); @@ -44,7 +41,7 @@ export async function POST(req: NextRequest, context: RouteContext) { const { handle } = await context.params; const targetUser = await db.query.users.findFirst({ - where: eq(users.handle, handle), + where: { handle: handle }, }); if (!targetUser) { @@ -57,10 +54,7 @@ export async function POST(req: NextRequest, context: RouteContext) { // Check if already blocked const existing = await db.query.blocks.findFirst({ - where: and( - eq(blocks.userId, currentUser.id), - eq(blocks.blockedUserId, targetUser.id) - ), + where: { AND: [{ userId: currentUser.id }, { blockedUserId: targetUser.id }] }, }); if (existing) { @@ -104,7 +98,7 @@ export async function DELETE(req: NextRequest, context: RouteContext) { const { handle } = await context.params; const targetUser = await db.query.users.findFirst({ - where: eq(users.handle, handle), + where: { handle: handle }, }); if (!targetUser) { diff --git a/src/app/api/users/[handle]/follow/route.ts b/src/app/api/users/[handle]/follow/route.ts index 7d38a1d..6aa832d 100644 --- a/src/app/api/users/[handle]/follow/route.ts +++ b/src/app/api/users/[handle]/follow/route.ts @@ -37,10 +37,7 @@ export async function GET(request: Request, context: RouteContext) { } const targetHandle = `${remote.handle}@${remote.domain}`; const existingRemoteFollow = await db.query.remoteFollows.findFirst({ - where: and( - eq(remoteFollows.followerId, currentUser.id), - eq(remoteFollows.targetHandle, targetHandle) - ), + where: { AND: [{ followerId: currentUser.id }, { targetHandle: targetHandle }] }, }); return NextResponse.json({ following: !!existingRemoteFollow, remote: true }); } @@ -50,7 +47,7 @@ export async function GET(request: Request, context: RouteContext) { } const targetUser = await db.query.users.findFirst({ - where: eq(users.handle, cleanHandle), + where: { handle: cleanHandle }, }); if (!targetUser) { @@ -65,10 +62,7 @@ export async function GET(request: Request, context: RouteContext) { } const existingFollow = await db.query.follows.findFirst({ - where: and( - eq(follows.followerId, currentUser.id), - eq(follows.followingId, targetUser.id) - ), + where: { AND: [{ followerId: currentUser.id }, { followingId: targetUser.id }] }, }); return NextResponse.json({ following: !!existingFollow }); @@ -96,7 +90,7 @@ export async function POST(request: Request, context: RouteContext) { const { handle } = await context.params; const cleanHandle = handle.toLowerCase().replace(/^@/, ''); const remote = parseRemoteHandle(handle); - const nodeDomain = process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:3000'; + const nodeDomain = process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:43821'; if (currentUser.isSuspended || currentUser.isSilenced) { return NextResponse.json({ error: 'Account restricted' }, { status: 403 }); @@ -107,10 +101,7 @@ export async function POST(request: Request, context: RouteContext) { // Check if already following const existingRemoteFollow = await db.query.remoteFollows.findFirst({ - where: and( - eq(remoteFollows.followerId, currentUser.id), - eq(remoteFollows.targetHandle, targetHandle) - ), + where: { AND: [{ followerId: currentUser.id }, { targetHandle: targetHandle }] }, }); if (existingRemoteFollow) { return NextResponse.json({ error: 'Already following' }, { status: 400 }); @@ -179,7 +170,7 @@ export async function POST(request: Request, context: RouteContext) { // Find target user const targetUser = await db.query.users.findFirst({ - where: eq(users.handle, cleanHandle), + where: { handle: cleanHandle }, }); if (!targetUser) { @@ -196,10 +187,7 @@ export async function POST(request: Request, context: RouteContext) { // Check if already following const existingFollow = await db.query.follows.findFirst({ - where: and( - eq(follows.followerId, currentUser.id), - eq(follows.followingId, targetUser.id) - ), + where: { AND: [{ followerId: currentUser.id }, { followingId: targetUser.id }] }, }); if (existingFollow) { @@ -268,7 +256,7 @@ export async function DELETE(request: Request, context: RouteContext) { const { handle } = await context.params; const cleanHandle = handle.toLowerCase().replace(/^@/, ''); const remote = parseRemoteHandle(handle); - const nodeDomain = process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:3000'; + const nodeDomain = process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:43821'; if (remote) { if (!db) { @@ -276,10 +264,7 @@ export async function DELETE(request: Request, context: RouteContext) { } const targetHandle = `${remote.handle}@${remote.domain}`; const existingRemoteFollow = await db.query.remoteFollows.findFirst({ - where: and( - eq(remoteFollows.followerId, currentUser.id), - eq(remoteFollows.targetHandle, targetHandle) - ), + where: { AND: [{ followerId: currentUser.id }, { targetHandle: targetHandle }] }, }); if (!existingRemoteFollow) { return NextResponse.json({ error: 'Not following' }, { status: 400 }); @@ -306,7 +291,7 @@ export async function DELETE(request: Request, context: RouteContext) { // Update the user's following count (atomic decrement, clamped to 0) await db.update(users) - .set({ followingCount: sql`GREATEST(0, ${users.followingCount} - 1)` }) + .set({ followingCount: sql`max(0, ${users.followingCount} - 1)` }) .where(eq(users.id, currentUser.id)); console.log(`[Swarm] Unfollow delivered to ${remote.domain}`); @@ -319,7 +304,7 @@ export async function DELETE(request: Request, context: RouteContext) { // Find target user const targetUser = await db.query.users.findFirst({ - where: eq(users.handle, cleanHandle), + where: { handle: cleanHandle }, }); if (!targetUser) { @@ -331,10 +316,7 @@ export async function DELETE(request: Request, context: RouteContext) { // Find existing follow const existingFollow = await db.query.follows.findFirst({ - where: and( - eq(follows.followerId, currentUser.id), - eq(follows.followingId, targetUser.id) - ), + where: { AND: [{ followerId: currentUser.id }, { followingId: targetUser.id }] }, }); if (!existingFollow) { @@ -346,11 +328,11 @@ export async function DELETE(request: Request, context: RouteContext) { // Update counts (atomic decrements, clamped to 0) await db.update(users) - .set({ followingCount: sql`GREATEST(0, ${users.followingCount} - 1)` }) + .set({ followingCount: sql`max(0, ${users.followingCount} - 1)` }) .where(eq(users.id, currentUser.id)); await db.update(users) - .set({ followersCount: sql`GREATEST(0, ${users.followersCount} - 1)` }) + .set({ followersCount: sql`max(0, ${users.followersCount} - 1)` }) .where(eq(users.id, targetUser.id)); return NextResponse.json({ success: true, following: false }); diff --git a/src/app/api/users/[handle]/followers/route.ts b/src/app/api/users/[handle]/followers/route.ts index f4f9996..4d16325 100644 --- a/src/app/api/users/[handle]/followers/route.ts +++ b/src/app/api/users/[handle]/followers/route.ts @@ -61,7 +61,7 @@ export async function GET(request: Request, context: RouteContext) { // Find the user const user = await db.query.users.findFirst({ - where: eq(users.handle, cleanHandle), + where: { handle: cleanHandle }, }); if (!user) { @@ -94,7 +94,7 @@ export async function GET(request: Request, context: RouteContext) { // Get remote followers const userRemoteFollowers = await db.query.remoteFollowers.findMany({ - where: eq(remoteFollowers.userId, user.id), + where: { userId: user.id }, limit, }); diff --git a/src/app/api/users/[handle]/following/route.ts b/src/app/api/users/[handle]/following/route.ts index 9dc0f04..d5a22db 100644 --- a/src/app/api/users/[handle]/following/route.ts +++ b/src/app/api/users/[handle]/following/route.ts @@ -61,7 +61,7 @@ export async function GET(request: Request, context: RouteContext) { // Find the user const user = await db.query.users.findFirst({ - where: eq(users.handle, cleanHandle), + where: { handle: cleanHandle }, }); if (!user) { @@ -94,7 +94,7 @@ export async function GET(request: Request, context: RouteContext) { // Get remote following const userRemoteFollowing = await db.query.remoteFollows.findMany({ - where: eq(remoteFollows.followerId, user.id), + where: { followerId: user.id }, limit, }); diff --git a/src/app/api/users/[handle]/likes/route.ts b/src/app/api/users/[handle]/likes/route.ts index 762ee87..ab4d1a6 100644 --- a/src/app/api/users/[handle]/likes/route.ts +++ b/src/app/api/users/[handle]/likes/route.ts @@ -108,7 +108,7 @@ export async function GET(request: Request, context: RouteContext) { // Find the user const user = await db.query.users.findFirst({ - where: eq(users.handle, cleanHandle), + where: { handle: cleanHandle }, }); const isRemotePlaceholder = user && cleanHandle.includes('@'); @@ -141,13 +141,13 @@ export async function GET(request: Request, context: RouteContext) { // Get user's liked posts const userLikes = await db.query.likes.findMany({ - where: eq(likes.userId, user.id), + where: { userId: user.id }, with: { post: { with: likedPostRelations, }, }, - orderBy: [desc(likes.createdAt)], + orderBy: () => [desc(likes.createdAt)], limit, }); @@ -156,8 +156,8 @@ export async function GET(request: Request, context: RouteContext) { .map(like => like.post); const swarmLikedRows = await db.query.userSwarmLikes.findMany({ - where: eq(userSwarmLikes.userId, user.id), - orderBy: [desc(userSwarmLikes.likedAt)], + where: { userId: user.id }, + orderBy: () => [desc(userSwarmLikes.likedAt)], limit, }); @@ -225,19 +225,12 @@ export async function GET(request: Request, context: RouteContext) { if (localPostIds.length > 0) { const viewerLikes = await db.query.likes.findMany({ - where: and( - eq(likes.userId, viewer.id), - inArray(likes.postId, localPostIds) - ), + where: { AND: [{ userId: viewer.id }, { postId: { in: localPostIds } }] }, }); const likedPostIds = new Set(viewerLikes.map(l => l.postId)); const viewerReposts = await db.query.posts.findMany({ - where: and( - eq(posts.userId, viewer.id), - inArray(posts.repostOfId, localPostIds), - eq(posts.isRemoved, false) - ), + where: { AND: [{ userId: viewer.id }, { repostOfId: { in: localPostIds } }, { isRemoved: false }] }, }); const repostedPostIds = new Set(viewerReposts.map(r => r.repostOfId)); diff --git a/src/app/api/users/[handle]/posts/route.ts b/src/app/api/users/[handle]/posts/route.ts index ea0a6f0..823d3df 100644 --- a/src/app/api/users/[handle]/posts/route.ts +++ b/src/app/api/users/[handle]/posts/route.ts @@ -151,13 +151,13 @@ async function getMixedProfileCursorDate(cursor: string | null) { if (cursor.startsWith('swarm-repost:')) { const repostRow = await db.query.userSwarmReposts.findFirst({ - where: eq(userSwarmReposts.id, cursor.replace('swarm-repost:', '')), + where: { id: cursor.replace('swarm-repost:', '') }, }); return repostRow?.repostedAt ?? null; } const cursorPost = await db.query.posts.findFirst({ - where: eq(posts.id, cursor), + where: { id: cursor }, }); return cursorPost?.createdAt ?? null; } @@ -173,7 +173,7 @@ async function populateViewerLikeState( const { getSession } = await import('@/lib/auth'); const session = await getSession(); const viewer = session?.user; - const nodeDomain = process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:3000'; + const nodeDomain = process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:43821'; if (!viewer) { return remotePosts; @@ -301,7 +301,7 @@ export async function GET(request: Request, context: RouteContext) { // Find the user const user = await db.query.users.findFirst({ - where: eq(users.handle, cleanHandle), + where: { handle: cleanHandle }, }); const isRemotePlaceholder = user && cleanHandle.includes('@'); @@ -330,39 +330,28 @@ export async function GET(request: Request, context: RouteContext) { // Get user's posts with cursor-based pagination const cursorDate = await getMixedProfileCursorDate(cursor); - let whereConditions = and( - eq(posts.userId, user.id), - eq(posts.isRemoved, false), - isNull(posts.replyToId), - isNull(posts.swarmReplyToId) - ); - - if (cursorDate) { - whereConditions = and( - eq(posts.userId, user.id), - eq(posts.isRemoved, false), - isNull(posts.replyToId), - isNull(posts.swarmReplyToId), - lt(posts.createdAt, cursorDate) - ); - } + const whereConditions = { + userId: user.id, + isRemoved: false, + replyToId: { isNull: true as const }, + swarmReplyToId: { isNull: true as const }, + ...(cursorDate ? { createdAt: { lt: cursorDate } } : {}), + }; const localPosts = await db.query.posts.findMany({ where: whereConditions, with: userPostRelations, - orderBy: [desc(posts.createdAt)], + orderBy: () => [desc(posts.createdAt)], limit: cursor ? limit : limit * 2, }); - const swarmRepostWhere = cursorDate - ? and( - eq(userSwarmReposts.userId, user.id), - lt(userSwarmReposts.repostedAt, cursorDate) - ) - : eq(userSwarmReposts.userId, user.id); + const swarmRepostWhere = { + userId: user.id, + ...(cursorDate ? { repostedAt: { lt: cursorDate } } : {}), + }; const swarmRepostRows = await db.query.userSwarmReposts.findMany({ where: swarmRepostWhere, - orderBy: [desc(userSwarmReposts.repostedAt)], + orderBy: () => [desc(userSwarmReposts.repostedAt)], limit: cursor ? limit : limit * 2, }); let userPosts: any[] = [ @@ -400,19 +389,12 @@ export async function GET(request: Request, context: RouteContext) { if (localPostIds.length > 0) { const viewerLikes = await db.query.likes.findMany({ - where: and( - eq(likes.userId, viewer.id), - inArray(likes.postId, localPostIds) - ), + where: { AND: [{ userId: viewer.id }, { postId: { in: localPostIds } }] }, }); viewerLikes.forEach((like) => likedPostIds.add(like.postId)); const viewerReposts = await db.query.posts.findMany({ - where: and( - eq(posts.userId, viewer.id), - inArray(posts.repostOfId, localPostIds), - eq(posts.isRemoved, false) - ), + where: { AND: [{ userId: viewer.id }, { repostOfId: { in: localPostIds } }, { isRemoved: false }] }, }); viewerReposts.forEach((repost) => { if (repost.repostOfId) { @@ -422,7 +404,7 @@ export async function GET(request: Request, context: RouteContext) { } if (swarmTargets.length > 0) { - const nodeDomain = process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:3000'; + const nodeDomain = process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:43821'; const likedIds = await getViewerSwarmLikedPostIds( swarmTargets.map((post) => ({ id: post.id, diff --git a/src/app/api/users/[handle]/replies/route.ts b/src/app/api/users/[handle]/replies/route.ts index 65e8c19..19bd57c 100644 --- a/src/app/api/users/[handle]/replies/route.ts +++ b/src/app/api/users/[handle]/replies/route.ts @@ -95,7 +95,7 @@ export async function GET(request: Request, context: RouteContext) { } const user = await db.query.users.findFirst({ - where: eq(users.handle, cleanHandle), + where: { handle: cleanHandle }, }); const isRemotePlaceholder = user && cleanHandle.includes('@'); @@ -121,30 +121,29 @@ export async function GET(request: Request, context: RouteContext) { return NextResponse.json({ error: 'User not found' }, { status: 404 }); } - let whereConditions = and( - eq(posts.userId, user.id), - eq(posts.isRemoved, false), - or(isNotNull(posts.replyToId), isNotNull(posts.swarmReplyToId)), - ); + let cursorDate: Date | undefined; if (cursor) { const cursorPost = await db.query.posts.findFirst({ - where: eq(posts.id, cursor), + where: { id: cursor }, }); if (cursorPost) { - whereConditions = and( - eq(posts.userId, user.id), - eq(posts.isRemoved, false), - or(isNotNull(posts.replyToId), isNotNull(posts.swarmReplyToId)), - lt(posts.createdAt, cursorPost.createdAt), - ); + cursorDate = cursorPost.createdAt; } } let replyPosts: any[] = await db.query.posts.findMany({ - where: whereConditions, + where: { + userId: user.id, + isRemoved: false, + OR: [ + { replyToId: { isNotNull: true } }, + { swarmReplyToId: { isNotNull: true } }, + ], + ...(cursorDate ? { createdAt: { lt: cursorDate } } : {}), + }, with: replyRelations, - orderBy: [desc(posts.createdAt)], + orderBy: () => [desc(posts.createdAt)], limit, }); @@ -158,21 +157,14 @@ export async function GET(request: Request, context: RouteContext) { const viewerLikes = postIds.length > 0 ? await db.query.likes.findMany({ - where: and( - eq(likes.userId, viewer.id), - inArray(likes.postId, postIds), - ), + where: { AND: [{ userId: viewer.id }, { postId: { in: postIds } }] }, }) : []; const likedPostIds = new Set(viewerLikes.map((like) => like.postId)); const viewerReposts = postIds.length > 0 ? await db.query.posts.findMany({ - where: and( - eq(posts.userId, viewer.id), - inArray(posts.repostOfId, postIds), - eq(posts.isRemoved, false), - ), + where: { AND: [{ userId: viewer.id }, { repostOfId: { in: postIds } }, { isRemoved: false }] }, }) : []; const repostedPostIds = new Set(viewerReposts.map((post) => post.repostOfId)); diff --git a/src/app/api/users/[handle]/route.ts b/src/app/api/users/[handle]/route.ts index f62ad55..d5edcb0 100644 --- a/src/app/api/users/[handle]/route.ts +++ b/src/app/api/users/[handle]/route.ts @@ -32,7 +32,7 @@ export async function GET(request: Request, context: RouteContext) { } const user = await db.query.users.findFirst({ - where: eq(users.handle, cleanHandle), + where: { handle: cleanHandle }, }); // If user exists but is a remote placeholder (handle contains @), fetch fresh data from remote @@ -147,10 +147,7 @@ export async function GET(request: Request, context: RouteContext) { canReceiveDms = true; // Can DM yourself } else { const isFollowingViewer = await db.query.follows.findFirst({ - where: and( - eq(follows.followerId, user.id), - eq(follows.followingId, session.user.id) - ) + where: { AND: [{ followerId: user.id }, { followingId: session.user.id }] } }); if (isFollowingViewer) { canReceiveDms = true; @@ -163,7 +160,7 @@ export async function GET(request: Request, context: RouteContext) { // If this is a bot, include owner info if (user.isBot && user.botOwnerId) { const owner = await db.query.users.findFirst({ - where: eq(users.id, user.botOwnerId), + where: { id: user.botOwnerId }, }); if (owner) { userResponse.botOwner = { diff --git a/src/db/index.ts b/src/db/index.ts index 7a7e7df..fbf5112 100644 --- a/src/db/index.ts +++ b/src/db/index.ts @@ -1,26 +1,19 @@ -import { drizzle } from 'drizzle-orm/node-postgres'; -import { Pool } from 'pg'; -import * as schema from './schema'; +import { mkdirSync } from 'node:fs'; +import { dirname, resolve } from 'node:path'; +import { drizzle } from 'drizzle-orm/tursodatabase/database'; +import { relations } from './relations'; -// Best Practice for VPS/Self-Hosting: -// We use 'pg' (node-postgres) which connects via standard TCP. -// This works for local Postgres, Docker, VPS, and managed clouds (AWS RDS, Neon, etc.). +const configuredPath = process.env.DATABASE_PATH || './data/synapsis.db'; +const databasePath = configuredPath === ':memory:' ? configuredPath : resolve(configuredPath); -const connectionString = process.env.DATABASE_URL || 'postgres://placeholder:placeholder@localhost:5432/placeholder'; +if (databasePath !== ':memory:') { + mkdirSync(dirname(databasePath), { recursive: true }); +} -// Create a connection pool -const pool = new Pool({ - connectionString, - max: 20, // Adjust based on your server capacity - idleTimeoutMillis: 30000, - connectionTimeoutMillis: 2000, -}); +export const db = drizzle(databasePath, { relations }); -// Create the Drizzle client -export const db = drizzle(pool, { schema }); - -// Helper to check if DB is configured -export const isDbAvailable = () => !!process.env.DATABASE_URL; +// Embedded Turso is always available; DATABASE_PATH only changes its location. +export const isDbAvailable = () => true; // Export schema for use elsewhere export * from './schema'; diff --git a/src/db/relations.ts b/src/db/relations.ts new file mode 100644 index 0000000..c6cabfb --- /dev/null +++ b/src/db/relations.ts @@ -0,0 +1,177 @@ +import { defineRelations } from 'drizzle-orm'; +import * as schema from './schema'; + +export const relations = defineRelations(schema, (r) => ({ + users: { + node: r.one.nodes({ from: r.users.nodeId, to: r.nodes.id }), + botOwner: r.one.users({ + from: r.users.botOwnerId, + to: r.users.id, + alias: 'ownedBots', + }), + ownedBotUsers: r.many.users({ + from: r.users.id, + to: r.users.botOwnerId, + alias: 'ownedBots', + }), + posts: r.many.posts({ from: r.users.id, to: r.posts.userId }), + followersRelation: r.many.follows({ + from: r.users.id, + to: r.follows.followingId, + alias: 'following', + }), + followingRelation: r.many.follows({ + from: r.users.id, + to: r.follows.followerId, + alias: 'follower', + }), + }, + posts: { + author: r.one.users({ from: r.posts.userId, to: r.users.id, optional: false }), + bot: r.one.bots({ from: r.posts.botId, to: r.bots.id }), + removedByUser: r.one.users({ from: r.posts.removedBy, to: r.users.id }), + replyTo: r.one.posts({ + from: r.posts.replyToId, + to: r.posts.id, + alias: 'replies', + }), + replies: r.many.posts({ + from: r.posts.id, + to: r.posts.replyToId, + alias: 'replies', + }), + repostOf: r.one.posts({ + from: r.posts.repostOfId, + to: r.posts.id, + alias: 'reposts', + }), + reposts: r.many.posts({ + from: r.posts.id, + to: r.posts.repostOfId, + alias: 'reposts', + }), + likes: r.many.likes({ from: r.posts.id, to: r.likes.postId }), + media: r.many.media({ from: r.posts.id, to: r.media.postId }), + }, + media: { + user: r.one.users({ from: r.media.userId, to: r.users.id, optional: false }), + post: r.one.posts({ from: r.media.postId, to: r.posts.id }), + }, + follows: { + follower: r.one.users({ + from: r.follows.followerId, + to: r.users.id, + alias: 'follower', + optional: false, + }), + following: r.one.users({ + from: r.follows.followingId, + to: r.users.id, + alias: 'following', + optional: false, + }), + }, + likes: { + user: r.one.users({ from: r.likes.userId, to: r.users.id, optional: false }), + post: r.one.posts({ from: r.likes.postId, to: r.posts.id, optional: false }), + }, + notifications: { + recipient: r.one.users({ + from: r.notifications.userId, + to: r.users.id, + alias: 'recipient', + optional: false, + }), + actor: r.one.users({ + from: r.notifications.actorId, + to: r.users.id, + alias: 'actor', + optional: false, + }), + post: r.one.posts({ from: r.notifications.postId, to: r.posts.id }), + }, + sessions: { + user: r.one.users({ from: r.sessions.userId, to: r.users.id, optional: false }), + }, + blocks: { + user: r.one.users({ from: r.blocks.userId, to: r.users.id, optional: false }), + blockedUser: r.one.users({ from: r.blocks.blockedUserId, to: r.users.id, optional: false }), + }, + mutes: { + user: r.one.users({ from: r.mutes.userId, to: r.users.id, optional: false }), + mutedUser: r.one.users({ from: r.mutes.mutedUserId, to: r.users.id, optional: false }), + }, + mutedNodes: { + user: r.one.users({ from: r.mutedNodes.userId, to: r.users.id, optional: false }), + }, + reports: { + reporter: r.one.users({ from: r.reports.reporterId, to: r.users.id }), + resolver: r.one.users({ from: r.reports.resolvedBy, to: r.users.id }), + }, + bots: { + user: r.one.users({ + from: r.bots.userId, + to: r.users.id, + alias: 'botUser', + optional: false, + }), + owner: r.one.users({ + from: r.bots.ownerId, + to: r.users.id, + alias: 'botOwner', + optional: false, + }), + contentSources: r.many.botContentSources({ from: r.bots.id, to: r.botContentSources.botId }), + mentions: r.many.botMentions({ from: r.bots.id, to: r.botMentions.botId }), + activityLogs: r.many.botActivityLogs({ from: r.bots.id, to: r.botActivityLogs.botId }), + rateLimits: r.many.botRateLimits({ from: r.bots.id, to: r.botRateLimits.botId }), + }, + botContentSources: { + bot: r.one.bots({ from: r.botContentSources.botId, to: r.bots.id, optional: false }), + contentItems: r.many.botContentItems({ + from: r.botContentSources.id, + to: r.botContentItems.sourceId, + }), + }, + botContentItems: { + source: r.one.botContentSources({ + from: r.botContentItems.sourceId, + to: r.botContentSources.id, + optional: false, + }), + post: r.one.posts({ from: r.botContentItems.postId, to: r.posts.id }), + }, + botMentions: { + bot: r.one.bots({ from: r.botMentions.botId, to: r.bots.id, optional: false }), + post: r.one.posts({ from: r.botMentions.postId, to: r.posts.id, optional: false }), + author: r.one.users({ from: r.botMentions.authorId, to: r.users.id, optional: false }), + responsePost: r.one.posts({ + from: r.botMentions.responsePostId, + to: r.posts.id, + }), + }, + botActivityLogs: { + bot: r.one.bots({ from: r.botActivityLogs.botId, to: r.bots.id, optional: false }), + }, + botRateLimits: { + bot: r.one.bots({ from: r.botRateLimits.botId, to: r.bots.id, optional: false }), + }, + chatConversations: { + participant1: r.one.users({ + from: r.chatConversations.participant1Id, + to: r.users.id, + optional: false, + }), + messages: r.many.chatMessages({ + from: r.chatConversations.id, + to: r.chatMessages.conversationId, + }), + }, + chatMessages: { + conversation: r.one.chatConversations({ + from: r.chatMessages.conversationId, + to: r.chatConversations.id, + optional: false, + }), + }, +})); diff --git a/src/db/schema.ts b/src/db/schema.ts index 01dd357..ee30b16 100644 --- a/src/db/schema.ts +++ b/src/db/schema.ts @@ -1,12 +1,15 @@ -import { pgTable, text, timestamp, uuid, integer, bigint, boolean, index, foreignKey, uniqueIndex } from 'drizzle-orm/pg-core'; -import { relations } from 'drizzle-orm'; +import { sqliteTable, text, integer, index, foreignKey, uniqueIndex } from 'drizzle-orm/sqlite-core'; +import { sql } from 'drizzle-orm'; +import { randomUUID } from 'node:crypto'; + +const currentTimestamp = sql`(unixepoch())`; // ============================================ // NODES // ============================================ -export const nodes = pgTable('nodes', { - id: uuid('id').primaryKey().defaultRandom(), +export const nodes = sqliteTable('nodes', { + id: text('id').primaryKey().$defaultFn(() => randomUUID()), domain: text('domain').notNull().unique(), name: text('name').notNull(), description: text('description'), @@ -21,20 +24,20 @@ export const nodes = pgTable('nodes', { publicKey: text('public_key'), privateKeyEncrypted: text('private_key_encrypted'), // Encrypted with AUTH_SECRET // NSFW settings - isNsfw: boolean('is_nsfw').default(false).notNull(), // Entire node is NSFW + isNsfw: integer('is_nsfw', { mode: 'boolean' }).default(false).notNull(), // Entire node is NSFW // Cloudflare Turnstile settings turnstileSiteKey: text('turnstile_site_key'), turnstileSecretKey: text('turnstile_secret_key'), - createdAt: timestamp('created_at').defaultNow().notNull(), - updatedAt: timestamp('updated_at').defaultNow().notNull(), + createdAt: integer('created_at', { mode: 'timestamp' }).default(currentTimestamp).notNull(), + updatedAt: integer('updated_at', { mode: 'timestamp' }).default(currentTimestamp).notNull(), }); // ============================================ // USERS // ============================================ -export const users = pgTable('users', { - id: uuid('id').primaryKey().defaultRandom(), +export const users = sqliteTable('users', { + id: text('id').primaryKey().$defaultFn(() => randomUUID()), did: text('did').notNull().unique(), // Decentralized Identifier handle: text('handle').notNull().unique(), // @username (globally unique) email: text('email').unique(), @@ -45,25 +48,25 @@ export const users = pgTable('users', { headerUrl: text('header_url'), privateKeyEncrypted: text('private_key_encrypted'), // For cryptographic signing publicKey: text('public_key').notNull(), - nodeId: uuid('node_id').references(() => nodes.id), + nodeId: text('node_id').references(() => nodes.id), // Bot-related fields - isBot: boolean('is_bot').default(false).notNull(), - botOwnerId: uuid('bot_owner_id'), + isBot: integer('is_bot', { mode: 'boolean' }).default(false).notNull(), + botOwnerId: text('bot_owner_id'), // NSFW settings - isNsfw: boolean('is_nsfw').default(false).notNull(), // Account produces NSFW content - nsfwEnabled: boolean('nsfw_enabled').default(false).notNull(), // User wants to see NSFW content - ageVerifiedAt: timestamp('age_verified_at'), // When user confirmed 18+ + isNsfw: integer('is_nsfw', { mode: 'boolean' }).default(false).notNull(), // Account produces NSFW content + nsfwEnabled: integer('nsfw_enabled', { mode: 'boolean' }).default(false).notNull(), // User wants to see NSFW content + ageVerifiedAt: integer('age_verified_at', { mode: 'timestamp' }), // When user confirmed 18+ // Moderation fields - isSuspended: boolean('is_suspended').default(false).notNull(), + isSuspended: integer('is_suspended', { mode: 'boolean' }).default(false).notNull(), suspensionReason: text('suspension_reason'), - suspendedAt: timestamp('suspended_at'), - isSilenced: boolean('is_silenced').default(false).notNull(), + suspendedAt: integer('suspended_at', { mode: 'timestamp' }), + isSilenced: integer('is_silenced', { mode: 'boolean' }).default(false).notNull(), silenceReason: text('silence_reason'), - silencedAt: timestamp('silenced_at'), + silencedAt: integer('silenced_at', { mode: 'timestamp' }), // Account migration fields movedTo: text('moved_to'), // New actor URL if this account migrated away movedFrom: text('moved_from'), // Old actor URL if this account migrated here - migratedAt: timestamp('migrated_at'), // When the migration occurred + migratedAt: integer('migrated_at', { mode: 'timestamp' }), // When the migration occurred // User-owned S3-compatible storage - required for new users storageProvider: text('storage_provider'), // 's3', 'r2', 'b2', 'wasabi', 'contabo' storageEndpoint: text('storage_endpoint'), // S3 endpoint URL (optional for AWS) @@ -77,8 +80,8 @@ export const users = pgTable('users', { postsCount: integer('posts_count').default(0).notNull(), website: text('website'), dmPrivacy: text('dm_privacy').default('everyone').notNull(), - createdAt: timestamp('created_at').defaultNow().notNull(), - updatedAt: timestamp('updated_at').defaultNow().notNull(), + createdAt: integer('created_at', { mode: 'timestamp' }).default(currentTimestamp).notNull(), + updatedAt: integer('updated_at', { mode: 'timestamp' }).default(currentTimestamp).notNull(), }, (table) => [ index('users_handle_idx').on(table.handle), index('users_did_idx').on(table.did), @@ -94,33 +97,18 @@ export const users = pgTable('users', { }).onDelete('cascade'), ]); -export const usersRelations = relations(users, ({ one, many }) => ({ - node: one(nodes, { - fields: [users.nodeId], - references: [nodes.id], - }), - botOwner: one(users, { - fields: [users.botOwnerId], - references: [users.id], - relationName: 'ownedBots', - }), - ownedBotUsers: many(users, { relationName: 'ownedBots' }), - posts: many(posts), - followersRelation: many(follows, { relationName: 'following' }), - followingRelation: many(follows, { relationName: 'follower' }), -})); // ============================================ // POSTS // ============================================ -export const posts = pgTable('posts', { - id: uuid('id').primaryKey().defaultRandom(), - userId: uuid('user_id').notNull().references(() => users.id, { onDelete: 'cascade' }), - botId: uuid('bot_id').references(() => bots.id, { onDelete: 'set null' }), // If posted by a bot +export const posts = sqliteTable('posts', { + id: text('id').primaryKey().$defaultFn(() => randomUUID()), + userId: text('user_id').notNull().references(() => users.id, { onDelete: 'cascade' }), + botId: text('bot_id').references(() => bots.id, { onDelete: 'set null' }), // If posted by a bot content: text('content').notNull(), - replyToId: uuid('reply_to_id'), - repostOfId: uuid('repost_of_id'), + replyToId: text('reply_to_id'), + repostOfId: text('repost_of_id'), // Swarm reply reference (when replying to a post on another node) swarmReplyToId: text('swarm_reply_to_id'), // Format: "swarm:domain:postId" swarmReplyToContent: text('swarm_reply_to_content'), // Cached content for display @@ -129,11 +117,11 @@ export const posts = pgTable('posts', { repostsCount: integer('reposts_count').default(0).notNull(), repliesCount: integer('replies_count').default(0).notNull(), // NSFW - isNsfw: boolean('is_nsfw').default(false).notNull(), // This specific post is NSFW + isNsfw: integer('is_nsfw', { mode: 'boolean' }).default(false).notNull(), // This specific post is NSFW // Moderation - isRemoved: boolean('is_removed').default(false).notNull(), - removedAt: timestamp('removed_at'), - removedBy: uuid('removed_by').references(() => users.id), + isRemoved: integer('is_removed', { mode: 'boolean' }).default(false).notNull(), + removedAt: integer('removed_at', { mode: 'timestamp' }), + removedBy: text('removed_by').references(() => users.id), removedReason: text('removed_reason'), // Post identifiers apId: text('ap_id').unique(), // Unique post ID (legacy field, used for swarm posts too) @@ -146,8 +134,8 @@ export const posts = pgTable('posts', { linkPreviewType: text('link_preview_type'), linkPreviewVideoUrl: text('link_preview_video_url'), linkPreviewMediaJson: text('link_preview_media_json'), - createdAt: timestamp('created_at').defaultNow().notNull(), - updatedAt: timestamp('updated_at').defaultNow().notNull(), + createdAt: integer('created_at', { mode: 'timestamp' }).default(currentTimestamp).notNull(), + updatedAt: integer('updated_at', { mode: 'timestamp' }).default(currentTimestamp).notNull(), }, (table) => [ index('posts_user_id_idx').on(table.userId), index('posts_bot_id_idx').on(table.botId), @@ -157,102 +145,52 @@ export const posts = pgTable('posts', { index('posts_nsfw_idx').on(table.isNsfw), ]); -export const postsRelations = relations(posts, ({ one, many }) => ({ - author: one(users, { - fields: [posts.userId], - references: [users.id], - }), - bot: one(bots, { - fields: [posts.botId], - references: [bots.id], - }), - removedByUser: one(users, { - fields: [posts.removedBy], - references: [users.id], - }), - replyTo: one(posts, { - fields: [posts.replyToId], - references: [posts.id], - relationName: 'replies', - }), - replies: many(posts, { relationName: 'replies' }), - repostOf: one(posts, { - fields: [posts.repostOfId], - references: [posts.id], - relationName: 'reposts', - }), - reposts: many(posts, { relationName: 'reposts' }), - likes: many(likes), - media: many(media), -})); // ============================================ // MEDIA // ============================================ -export const media = pgTable('media', { - id: uuid('id').primaryKey().defaultRandom(), - userId: uuid('user_id').notNull().references(() => users.id, { onDelete: 'cascade' }), - postId: uuid('post_id').references(() => posts.id, { onDelete: 'cascade' }), +export const media = sqliteTable('media', { + id: text('id').primaryKey().$defaultFn(() => randomUUID()), + userId: text('user_id').notNull().references(() => users.id, { onDelete: 'cascade' }), + postId: text('post_id').references(() => posts.id, { onDelete: 'cascade' }), url: text('url').notNull(), altText: text('alt_text'), mimeType: text('mime_type'), width: integer('width'), height: integer('height'), - createdAt: timestamp('created_at').defaultNow().notNull(), + createdAt: integer('created_at', { mode: 'timestamp' }).default(currentTimestamp).notNull(), }, (table) => [ index('media_user_idx').on(table.userId), index('media_post_idx').on(table.postId), ]); -export const mediaRelations = relations(media, ({ one }) => ({ - user: one(users, { - fields: [media.userId], - references: [users.id], - }), - post: one(posts, { - fields: [media.postId], - references: [posts.id], - }), -})); // ============================================ // FOLLOWS // ============================================ -export const follows = pgTable('follows', { - id: uuid('id').primaryKey().defaultRandom(), - followerId: uuid('follower_id').notNull().references(() => users.id, { onDelete: 'cascade' }), - followingId: uuid('following_id').notNull().references(() => users.id, { onDelete: 'cascade' }), +export const follows = sqliteTable('follows', { + id: text('id').primaryKey().$defaultFn(() => randomUUID()), + followerId: text('follower_id').notNull().references(() => users.id, { onDelete: 'cascade' }), + followingId: text('following_id').notNull().references(() => users.id, { onDelete: 'cascade' }), // Follow identifiers apId: text('ap_id').unique(), // Activity ID (legacy field) - pending: boolean('pending').default(false), // For follow requests - createdAt: timestamp('created_at').defaultNow().notNull(), + pending: integer('pending', { mode: 'boolean' }).default(false), // For follow requests + createdAt: integer('created_at', { mode: 'timestamp' }).default(currentTimestamp).notNull(), }, (table) => [ index('follows_follower_idx').on(table.followerId), index('follows_following_idx').on(table.followingId), ]); -export const followsRelations = relations(follows, ({ one }) => ({ - follower: one(users, { - fields: [follows.followerId], - references: [users.id], - relationName: 'follower', - }), - following: one(users, { - fields: [follows.followingId], - references: [users.id], - relationName: 'following', - }), -})); // ============================================ // REMOTE FOLLOWS (for federated follows) // ============================================ -export const remoteFollows = pgTable('remote_follows', { - id: uuid('id').primaryKey().defaultRandom(), - followerId: uuid('follower_id').notNull().references(() => users.id, { onDelete: 'cascade' }), +export const remoteFollows = sqliteTable('remote_follows', { + id: text('id').primaryKey().$defaultFn(() => randomUUID()), + followerId: text('follower_id').notNull().references(() => users.id, { onDelete: 'cascade' }), targetHandle: text('target_handle').notNull(), // username@domain targetActorUrl: text('target_actor_url').notNull(), inboxUrl: text('inbox_url').notNull(), @@ -261,7 +199,7 @@ export const remoteFollows = pgTable('remote_follows', { displayName: text('display_name'), bio: text('bio'), avatarUrl: text('avatar_url'), - createdAt: timestamp('created_at').defaultNow().notNull(), + createdAt: integer('created_at', { mode: 'timestamp' }).default(currentTimestamp).notNull(), }, (table) => [ index('remote_follows_follower_idx').on(table.followerId), index('remote_follows_target_idx').on(table.targetHandle), @@ -271,15 +209,15 @@ export const remoteFollows = pgTable('remote_follows', { // REMOTE FOLLOWERS (followers from federated instances) // ============================================ -export const remoteFollowers = pgTable('remote_followers', { - id: uuid('id').primaryKey().defaultRandom(), - userId: uuid('user_id').notNull().references(() => users.id, { onDelete: 'cascade' }), // Local user being followed +export const remoteFollowers = sqliteTable('remote_followers', { + id: text('id').primaryKey().$defaultFn(() => randomUUID()), + userId: text('user_id').notNull().references(() => users.id, { onDelete: 'cascade' }), // Local user being followed actorUrl: text('actor_url').notNull(), // Remote actor URL inboxUrl: text('inbox_url').notNull(), // Remote user's inbox sharedInboxUrl: text('shared_inbox_url'), // Optional shared inbox handle: text('handle'), // Remote user's handle (e.g., user@other-node.com) activityId: text('activity_id'), // The Follow activity ID - createdAt: timestamp('created_at').defaultNow().notNull(), + createdAt: integer('created_at', { mode: 'timestamp' }).default(currentTimestamp).notNull(), }, (table) => [ index('remote_followers_user_idx').on(table.userId), index('remote_followers_actor_idx').on(table.actorUrl), @@ -290,15 +228,15 @@ export const remoteFollowers = pgTable('remote_followers', { // REMOTE POSTS (cached posts from federated users) // ============================================ -export const remotePosts = pgTable('remote_posts', { - id: uuid('id').primaryKey().defaultRandom(), +export const remotePosts = sqliteTable('remote_posts', { + id: text('id').primaryKey().$defaultFn(() => randomUUID()), apId: text('ap_id').notNull().unique(), // Unique post ID (swarm:// or https://) authorHandle: text('author_handle').notNull(), // e.g., user@other-node.com authorActorUrl: text('author_actor_url').notNull(), // Remote actor URL authorDisplayName: text('author_display_name'), authorAvatarUrl: text('author_avatar_url'), content: text('content').notNull(), - publishedAt: timestamp('published_at').notNull(), // Original publish time + publishedAt: integer('published_at', { mode: 'timestamp' }).notNull(), // Original publish time // Link preview linkPreviewUrl: text('link_preview_url'), linkPreviewTitle: text('link_preview_title'), @@ -310,8 +248,8 @@ export const remotePosts = pgTable('remote_posts', { // Media attachments stored as JSON mediaJson: text('media_json'), // JSON array of {url, altText} // Metadata - fetchedAt: timestamp('fetched_at').defaultNow().notNull(), - createdAt: timestamp('created_at').defaultNow().notNull(), + fetchedAt: integer('fetched_at', { mode: 'timestamp' }).default(currentTimestamp).notNull(), + createdAt: integer('created_at', { mode: 'timestamp' }).default(currentTimestamp).notNull(), }, (table) => [ index('remote_posts_author_idx').on(table.authorHandle), index('remote_posts_published_idx').on(table.publishedAt), @@ -322,37 +260,27 @@ export const remotePosts = pgTable('remote_posts', { // LIKES // ============================================ -export const likes = pgTable('likes', { - id: uuid('id').primaryKey().defaultRandom(), - userId: uuid('user_id').notNull().references(() => users.id, { onDelete: 'cascade' }), - postId: uuid('post_id').notNull().references(() => posts.id, { onDelete: 'cascade' }), +export const likes = sqliteTable('likes', { + id: text('id').primaryKey().$defaultFn(() => randomUUID()), + userId: text('user_id').notNull().references(() => users.id, { onDelete: 'cascade' }), + postId: text('post_id').notNull().references(() => posts.id, { onDelete: 'cascade' }), apId: text('ap_id').unique(), // Activity ID - createdAt: timestamp('created_at').defaultNow().notNull(), + createdAt: integer('created_at', { mode: 'timestamp' }).default(currentTimestamp).notNull(), }, (table) => [ index('likes_user_post_idx').on(table.userId, table.postId), ]); -export const likesRelations = relations(likes, ({ one }) => ({ - user: one(users, { - fields: [likes.userId], - references: [users.id], - }), - post: one(posts, { - fields: [likes.postId], - references: [posts.id], - }), -})); // ============================================ // REMOTE LIKES (likes from federated users on local posts) // ============================================ -export const remoteLikes = pgTable('remote_likes', { - id: uuid('id').primaryKey().defaultRandom(), - postId: uuid('post_id').notNull().references(() => posts.id, { onDelete: 'cascade' }), +export const remoteLikes = sqliteTable('remote_likes', { + id: text('id').primaryKey().$defaultFn(() => randomUUID()), + postId: text('post_id').notNull().references(() => posts.id, { onDelete: 'cascade' }), actorHandle: text('actor_handle').notNull(), // e.g., "user" actorNodeDomain: text('actor_node_domain').notNull(), // e.g., "other.node" - createdAt: timestamp('created_at').defaultNow().notNull(), + createdAt: integer('created_at', { mode: 'timestamp' }).default(currentTimestamp).notNull(), }, (table) => [ index('remote_likes_post_idx').on(table.postId), index('remote_likes_actor_idx').on(table.actorHandle, table.actorNodeDomain), @@ -363,16 +291,16 @@ export const remoteLikes = pgTable('remote_likes', { // USER SWARM LIKES (local users liking remote swarm posts) // ============================================ -export const userSwarmLikes = pgTable('user_swarm_likes', { - id: uuid('id').primaryKey().defaultRandom(), - userId: uuid('user_id').notNull().references(() => users.id, { onDelete: 'cascade' }), +export const userSwarmLikes = sqliteTable('user_swarm_likes', { + id: text('id').primaryKey().$defaultFn(() => randomUUID()), + userId: text('user_id').notNull().references(() => users.id, { onDelete: 'cascade' }), nodeDomain: text('node_domain').notNull(), originalPostId: text('original_post_id').notNull(), authorHandle: text('author_handle').notNull(), authorDisplayName: text('author_display_name'), authorAvatarUrl: text('author_avatar_url'), content: text('content').notNull(), - postCreatedAt: timestamp('post_created_at').notNull(), + postCreatedAt: integer('post_created_at', { mode: 'timestamp' }).notNull(), likesCount: integer('likes_count').default(0).notNull(), repostsCount: integer('reposts_count').default(0).notNull(), repliesCount: integer('replies_count').default(0).notNull(), @@ -384,7 +312,7 @@ export const userSwarmLikes = pgTable('user_swarm_likes', { linkPreviewVideoUrl: text('link_preview_video_url'), linkPreviewMediaJson: text('link_preview_media_json'), mediaJson: text('media_json'), - likedAt: timestamp('liked_at').defaultNow().notNull(), + likedAt: integer('liked_at', { mode: 'timestamp' }).default(currentTimestamp).notNull(), }, (table) => [ index('user_swarm_likes_user_idx').on(table.userId, table.likedAt), index('user_swarm_likes_post_idx').on(table.nodeDomain, table.originalPostId), @@ -395,16 +323,16 @@ export const userSwarmLikes = pgTable('user_swarm_likes', { // USER SWARM REPOSTS (local users reposting remote swarm posts) // ============================================ -export const userSwarmReposts = pgTable('user_swarm_reposts', { - id: uuid('id').primaryKey().defaultRandom(), - userId: uuid('user_id').notNull().references(() => users.id, { onDelete: 'cascade' }), +export const userSwarmReposts = sqliteTable('user_swarm_reposts', { + id: text('id').primaryKey().$defaultFn(() => randomUUID()), + userId: text('user_id').notNull().references(() => users.id, { onDelete: 'cascade' }), nodeDomain: text('node_domain').notNull(), originalPostId: text('original_post_id').notNull(), authorHandle: text('author_handle').notNull(), authorDisplayName: text('author_display_name'), authorAvatarUrl: text('author_avatar_url'), content: text('content').notNull(), - postCreatedAt: timestamp('post_created_at').notNull(), + postCreatedAt: integer('post_created_at', { mode: 'timestamp' }).notNull(), likesCount: integer('likes_count').default(0).notNull(), repostsCount: integer('reposts_count').default(0).notNull(), repliesCount: integer('replies_count').default(0).notNull(), @@ -416,7 +344,7 @@ export const userSwarmReposts = pgTable('user_swarm_reposts', { linkPreviewVideoUrl: text('link_preview_video_url'), linkPreviewMediaJson: text('link_preview_media_json'), mediaJson: text('media_json'), - repostedAt: timestamp('reposted_at').defaultNow().notNull(), + repostedAt: integer('reposted_at', { mode: 'timestamp' }).default(currentTimestamp).notNull(), }, (table) => [ index('user_swarm_reposts_user_idx').on(table.userId, table.repostedAt), index('user_swarm_reposts_post_idx').on(table.nodeDomain, table.originalPostId), @@ -427,12 +355,12 @@ export const userSwarmReposts = pgTable('user_swarm_reposts', { // REMOTE REPOSTS (reposts from federated users on local posts) // ============================================ -export const remoteReposts = pgTable('remote_reposts', { - id: uuid('id').primaryKey().defaultRandom(), - postId: uuid('post_id').notNull().references(() => posts.id, { onDelete: 'cascade' }), +export const remoteReposts = sqliteTable('remote_reposts', { + id: text('id').primaryKey().$defaultFn(() => randomUUID()), + postId: text('post_id').notNull().references(() => posts.id, { onDelete: 'cascade' }), actorHandle: text('actor_handle').notNull(), actorNodeDomain: text('actor_node_domain').notNull(), - createdAt: timestamp('created_at').defaultNow().notNull(), + createdAt: integer('created_at', { mode: 'timestamp' }).default(currentTimestamp).notNull(), }, (table) => [ index('remote_reposts_post_idx').on(table.postId), index('remote_reposts_actor_idx').on(table.actorHandle, table.actorNodeDomain), @@ -443,11 +371,11 @@ export const remoteReposts = pgTable('remote_reposts', { // NOTIFICATIONS // ============================================ -export const notifications = pgTable('notifications', { - id: uuid('id').primaryKey().defaultRandom(), - userId: uuid('user_id').notNull().references(() => users.id, { onDelete: 'cascade' }), +export const notifications = sqliteTable('notifications', { + id: text('id').primaryKey().$defaultFn(() => randomUUID()), + userId: text('user_id').notNull().references(() => users.id, { onDelete: 'cascade' }), // Actor info - stored directly instead of referencing placeholder users - actorId: uuid('actor_id').references(() => users.id, { onDelete: 'cascade' }), // Optional - only for local actors + actorId: text('actor_id').references(() => users.id, { onDelete: 'cascade' }), // Optional - only for local actors actorHandle: text('actor_handle').notNull(), // e.g., "user" or "user@remote.node" actorDisplayName: text('actor_display_name'), actorAvatarUrl: text('actor_avatar_url'), @@ -457,45 +385,29 @@ export const notifications = pgTable('notifications', { targetDisplayName: text('target_display_name'), targetAvatarUrl: text('target_avatar_url'), targetNodeDomain: text('target_node_domain'), - targetIsBot: boolean('target_is_bot'), + targetIsBot: integer('target_is_bot', { mode: 'boolean' }), // Post reference - postId: uuid('post_id').references(() => posts.id, { onDelete: 'cascade' }), + postId: text('post_id').references(() => posts.id, { onDelete: 'cascade' }), postContent: text('post_content'), // Cached content for display type: text('type').notNull(), // follow | like | repost | mention - readAt: timestamp('read_at'), - createdAt: timestamp('created_at').defaultNow().notNull(), + readAt: integer('read_at', { mode: 'timestamp' }), + createdAt: integer('created_at', { mode: 'timestamp' }).default(currentTimestamp).notNull(), }, (table) => [ index('notifications_user_idx').on(table.userId), index('notifications_created_idx').on(table.createdAt), ]); -export const notificationsRelations = relations(notifications, ({ one }) => ({ - recipient: one(users, { - fields: [notifications.userId], - references: [users.id], - relationName: 'recipient', - }), - actor: one(users, { - fields: [notifications.actorId], - references: [users.id], - relationName: 'actor', - }), - post: one(posts, { - fields: [notifications.postId], - references: [posts.id], - }), -})); // ============================================ // HANDLE REGISTRY (for federated handle resolution) // ============================================ -export const handleRegistry = pgTable('handle_registry', { +export const handleRegistry = sqliteTable('handle_registry', { handle: text('handle').primaryKey(), // @username did: text('did').notNull(), nodeDomain: text('node_domain').notNull(), - registeredAt: timestamp('registered_at').defaultNow().notNull(), - updatedAt: timestamp('updated_at').defaultNow().notNull(), + registeredAt: integer('registered_at', { mode: 'timestamp' }).default(currentTimestamp).notNull(), + updatedAt: integer('updated_at', { mode: 'timestamp' }).default(currentTimestamp).notNull(), }, (table) => [ index('handle_registry_updated_idx').on(table.updatedAt), ]); @@ -504,129 +416,87 @@ export const handleRegistry = pgTable('handle_registry', { // SESSIONS (for auth) // ============================================ -export const sessions = pgTable('sessions', { - id: uuid('id').primaryKey().defaultRandom(), - userId: uuid('user_id').notNull().references(() => users.id, { onDelete: 'cascade' }), +export const sessions = sqliteTable('sessions', { + id: text('id').primaryKey().$defaultFn(() => randomUUID()), + userId: text('user_id').notNull().references(() => users.id, { onDelete: 'cascade' }), token: text('token').notNull().unique(), - expiresAt: timestamp('expires_at').notNull(), - createdAt: timestamp('created_at').defaultNow().notNull(), + expiresAt: integer('expires_at', { mode: 'timestamp' }).notNull(), + createdAt: integer('created_at', { mode: 'timestamp' }).default(currentTimestamp).notNull(), }, (table) => [ index('sessions_token_idx').on(table.token), index('sessions_user_idx').on(table.userId), ]); -export const sessionsRelations = relations(sessions, ({ one }) => ({ - user: one(users, { - fields: [sessions.userId], - references: [users.id], - }), -})); // ============================================ // BLOCKS & MUTES (user-level moderation) // ============================================ -export const blocks = pgTable('blocks', { - id: uuid('id').primaryKey().defaultRandom(), - userId: uuid('user_id').notNull().references(() => users.id, { onDelete: 'cascade' }), - blockedUserId: uuid('blocked_user_id').notNull().references(() => users.id, { onDelete: 'cascade' }), - createdAt: timestamp('created_at').defaultNow().notNull(), +export const blocks = sqliteTable('blocks', { + id: text('id').primaryKey().$defaultFn(() => randomUUID()), + userId: text('user_id').notNull().references(() => users.id, { onDelete: 'cascade' }), + blockedUserId: text('blocked_user_id').notNull().references(() => users.id, { onDelete: 'cascade' }), + createdAt: integer('created_at', { mode: 'timestamp' }).default(currentTimestamp).notNull(), }, (table) => [ index('blocks_user_idx').on(table.userId), index('blocks_blocked_user_idx').on(table.blockedUserId), ]); -export const blocksRelations = relations(blocks, ({ one }) => ({ - user: one(users, { - fields: [blocks.userId], - references: [users.id], - }), - blockedUser: one(users, { - fields: [blocks.blockedUserId], - references: [users.id], - }), -})); -export const mutes = pgTable('mutes', { - id: uuid('id').primaryKey().defaultRandom(), - userId: uuid('user_id').notNull().references(() => users.id, { onDelete: 'cascade' }), - mutedUserId: uuid('muted_user_id').notNull().references(() => users.id, { onDelete: 'cascade' }), - createdAt: timestamp('created_at').defaultNow().notNull(), +export const mutes = sqliteTable('mutes', { + id: text('id').primaryKey().$defaultFn(() => randomUUID()), + userId: text('user_id').notNull().references(() => users.id, { onDelete: 'cascade' }), + mutedUserId: text('muted_user_id').notNull().references(() => users.id, { onDelete: 'cascade' }), + createdAt: integer('created_at', { mode: 'timestamp' }).default(currentTimestamp).notNull(), }, (table) => [ index('mutes_user_idx').on(table.userId), index('mutes_muted_user_idx').on(table.mutedUserId), ]); -export const mutesRelations = relations(mutes, ({ one }) => ({ - user: one(users, { - fields: [mutes.userId], - references: [users.id], - }), - mutedUser: one(users, { - fields: [mutes.mutedUserId], - references: [users.id], - }), -})); // Muted nodes - hide all content from specific swarm nodes -export const mutedNodes = pgTable('muted_nodes', { - id: uuid('id').primaryKey().defaultRandom(), - userId: uuid('user_id').notNull().references(() => users.id, { onDelete: 'cascade' }), +export const mutedNodes = sqliteTable('muted_nodes', { + id: text('id').primaryKey().$defaultFn(() => randomUUID()), + userId: text('user_id').notNull().references(() => users.id, { onDelete: 'cascade' }), nodeDomain: text('node_domain').notNull(), // Domain of the muted node - createdAt: timestamp('created_at').defaultNow().notNull(), + createdAt: integer('created_at', { mode: 'timestamp' }).default(currentTimestamp).notNull(), }, (table) => [ index('muted_nodes_user_idx').on(table.userId), index('muted_nodes_domain_idx').on(table.nodeDomain), ]); -export const mutedNodesRelations = relations(mutedNodes, ({ one }) => ({ - user: one(users, { - fields: [mutedNodes.userId], - references: [users.id], - }), -})); // ============================================ // REPORTS (moderation) // ============================================ -export const reports = pgTable('reports', { - id: uuid('id').primaryKey().defaultRandom(), - reporterId: uuid('reporter_id').references(() => users.id, { onDelete: 'set null' }), +export const reports = sqliteTable('reports', { + id: text('id').primaryKey().$defaultFn(() => randomUUID()), + reporterId: text('reporter_id').references(() => users.id, { onDelete: 'set null' }), targetType: text('target_type').notNull(), // 'post' | 'user' - targetId: uuid('target_id').notNull(), + targetId: text('target_id').notNull(), reason: text('reason').notNull(), status: text('status').default('open').notNull(), // open | resolved - resolvedAt: timestamp('resolved_at'), - resolvedBy: uuid('resolved_by').references(() => users.id), + resolvedAt: integer('resolved_at', { mode: 'timestamp' }), + resolvedBy: text('resolved_by').references(() => users.id), resolutionNote: text('resolution_note'), - createdAt: timestamp('created_at').defaultNow().notNull(), + createdAt: integer('created_at', { mode: 'timestamp' }).default(currentTimestamp).notNull(), }, (table) => [ index('reports_status_idx').on(table.status), index('reports_target_idx').on(table.targetType, table.targetId), index('reports_reporter_idx').on(table.reporterId), ]); -export const reportsRelations = relations(reports, ({ one }) => ({ - reporter: one(users, { - fields: [reports.reporterId], - references: [users.id], - }), - resolver: one(users, { - fields: [reports.resolvedBy], - references: [users.id], - }), -})); // ============================================ // BOTS // ============================================ -export const bots = pgTable('bots', { - id: uuid('id').primaryKey().defaultRandom(), - userId: uuid('user_id').notNull().references(() => users.id, { onDelete: 'cascade' }), // The bot's own user account - ownerId: uuid('owner_id').notNull().references(() => users.id, { onDelete: 'cascade' }), // The human who manages this bot +export const bots = sqliteTable('bots', { + id: text('id').primaryKey().$defaultFn(() => randomUUID()), + userId: text('user_id').notNull().references(() => users.id, { onDelete: 'cascade' }), // The bot's own user account + ownerId: text('owner_id').notNull().references(() => users.id, { onDelete: 'cascade' }), // The human who manages this bot name: text('name').notNull(), // Personality configuration (JSON) @@ -640,48 +510,32 @@ export const bots = pgTable('bots', { // Scheduling scheduleConfig: text('schedule_config'), // JSON - autonomousMode: boolean('autonomous_mode').default(false).notNull(), + autonomousMode: integer('autonomous_mode', { mode: 'boolean' }).default(false).notNull(), // Status - isActive: boolean('is_active').default(true).notNull(), - isSuspended: boolean('is_suspended').default(false).notNull(), + isActive: integer('is_active', { mode: 'boolean' }).default(true).notNull(), + isSuspended: integer('is_suspended', { mode: 'boolean' }).default(false).notNull(), suspensionReason: text('suspension_reason'), - suspendedAt: timestamp('suspended_at'), + suspendedAt: integer('suspended_at', { mode: 'timestamp' }), // Timestamps - lastPostAt: timestamp('last_post_at'), - createdAt: timestamp('created_at').defaultNow().notNull(), - updatedAt: timestamp('updated_at').defaultNow().notNull(), + lastPostAt: integer('last_post_at', { mode: 'timestamp' }), + createdAt: integer('created_at', { mode: 'timestamp' }).default(currentTimestamp).notNull(), + updatedAt: integer('updated_at', { mode: 'timestamp' }).default(currentTimestamp).notNull(), }, (table) => [ index('bots_user_id_idx').on(table.userId), index('bots_owner_id_idx').on(table.ownerId), index('bots_active_idx').on(table.isActive), ]); -export const botsRelations = relations(bots, ({ one, many }) => ({ - user: one(users, { - fields: [bots.userId], - references: [users.id], - relationName: 'botUser', - }), - owner: one(users, { - fields: [bots.ownerId], - references: [users.id], - relationName: 'botOwner', - }), - contentSources: many(botContentSources), - mentions: many(botMentions), - activityLogs: many(botActivityLogs), - rateLimits: many(botRateLimits), -})); // ============================================ // BOT CONTENT SOURCES // ============================================ -export const botContentSources = pgTable('bot_content_sources', { - id: uuid('id').primaryKey().defaultRandom(), - botId: uuid('bot_id').notNull().references(() => bots.id, { onDelete: 'cascade' }), +export const botContentSources = sqliteTable('bot_content_sources', { + id: text('id').primaryKey().$defaultFn(() => randomUUID()), + botId: text('bot_id').notNull().references(() => bots.id, { onDelete: 'cascade' }), type: text('type').notNull(), // rss, reddit, news_api, brave_news url: text('url').notNull(), @@ -691,45 +545,38 @@ export const botContentSources = pgTable('bot_content_sources', { keywords: text('keywords'), // JSON array for filtering - isActive: boolean('is_active').default(true).notNull(), - lastFetchAt: timestamp('last_fetch_at'), + isActive: integer('is_active', { mode: 'boolean' }).default(true).notNull(), + lastFetchAt: integer('last_fetch_at', { mode: 'timestamp' }), lastError: text('last_error'), consecutiveErrors: integer('consecutive_errors').default(0).notNull(), - createdAt: timestamp('created_at').defaultNow().notNull(), - updatedAt: timestamp('updated_at').defaultNow().notNull(), + createdAt: integer('created_at', { mode: 'timestamp' }).default(currentTimestamp).notNull(), + updatedAt: integer('updated_at', { mode: 'timestamp' }).default(currentTimestamp).notNull(), }, (table) => [ index('bot_content_sources_bot_idx').on(table.botId), index('bot_content_sources_type_idx').on(table.type), ]); -export const botContentSourcesRelations = relations(botContentSources, ({ one, many }) => ({ - bot: one(bots, { - fields: [botContentSources.botId], - references: [bots.id], - }), - contentItems: many(botContentItems), -})); // ============================================ // BOT CONTENT ITEMS // ============================================ -export const botContentItems = pgTable('bot_content_items', { - id: uuid('id').primaryKey().defaultRandom(), - sourceId: uuid('source_id').notNull().references(() => botContentSources.id, { onDelete: 'cascade' }), +export const botContentItems = sqliteTable('bot_content_items', { + id: text('id').primaryKey().$defaultFn(() => randomUUID()), + sourceId: text('source_id').notNull().references(() => botContentSources.id, { onDelete: 'cascade' }), externalId: text('external_id').notNull(), // Unique ID from source title: text('title').notNull(), content: text('content'), url: text('url').notNull(), - publishedAt: timestamp('published_at').notNull(), - fetchedAt: timestamp('fetched_at').defaultNow().notNull(), + publishedAt: integer('published_at', { mode: 'timestamp' }).notNull(), + fetchedAt: integer('fetched_at', { mode: 'timestamp' }).default(currentTimestamp).notNull(), - isProcessed: boolean('is_processed').default(false).notNull(), - processedAt: timestamp('processed_at'), - postId: uuid('post_id').references(() => posts.id, { onDelete: 'set null' }), // If a post was created + isProcessed: integer('is_processed', { mode: 'boolean' }).default(false).notNull(), + processedAt: integer('processed_at', { mode: 'timestamp' }), + postId: text('post_id').references(() => posts.id, { onDelete: 'set null' }), // If a post was created interestScore: integer('interest_score'), // LLM evaluation score interestReason: text('interest_reason'), @@ -739,115 +586,75 @@ export const botContentItems = pgTable('bot_content_items', { index('bot_content_items_external_idx').on(table.externalId), ]); -export const botContentItemsRelations = relations(botContentItems, ({ one }) => ({ - source: one(botContentSources, { - fields: [botContentItems.sourceId], - references: [botContentSources.id], - }), - post: one(posts, { - fields: [botContentItems.postId], - references: [posts.id], - }), -})); // ============================================ // BOT MENTIONS // ============================================ -export const botMentions = pgTable('bot_mentions', { - id: uuid('id').primaryKey().defaultRandom(), - botId: uuid('bot_id').notNull().references(() => bots.id, { onDelete: 'cascade' }), - postId: uuid('post_id').notNull().references(() => posts.id, { onDelete: 'cascade' }), +export const botMentions = sqliteTable('bot_mentions', { + id: text('id').primaryKey().$defaultFn(() => randomUUID()), + botId: text('bot_id').notNull().references(() => bots.id, { onDelete: 'cascade' }), + postId: text('post_id').notNull().references(() => posts.id, { onDelete: 'cascade' }), - authorId: uuid('author_id').notNull().references(() => users.id), + authorId: text('author_id').notNull().references(() => users.id), content: text('content').notNull(), - isProcessed: boolean('is_processed').default(false).notNull(), - processedAt: timestamp('processed_at'), - responsePostId: uuid('response_post_id').references(() => posts.id), + isProcessed: integer('is_processed', { mode: 'boolean' }).default(false).notNull(), + processedAt: integer('processed_at', { mode: 'timestamp' }), + responsePostId: text('response_post_id').references(() => posts.id), // For federated mentions - isRemote: boolean('is_remote').default(false).notNull(), + isRemote: integer('is_remote', { mode: 'boolean' }).default(false).notNull(), remoteActorUrl: text('remote_actor_url'), - createdAt: timestamp('created_at').defaultNow().notNull(), + createdAt: integer('created_at', { mode: 'timestamp' }).default(currentTimestamp).notNull(), }, (table) => [ index('bot_mentions_bot_idx').on(table.botId), index('bot_mentions_processed_idx').on(table.isProcessed), index('bot_mentions_created_idx').on(table.createdAt), ]); -export const botMentionsRelations = relations(botMentions, ({ one }) => ({ - bot: one(bots, { - fields: [botMentions.botId], - references: [bots.id], - }), - post: one(posts, { - fields: [botMentions.postId], - references: [posts.id], - }), - author: one(users, { - fields: [botMentions.authorId], - references: [users.id], - }), - responsePost: one(posts, { - fields: [botMentions.responsePostId], - references: [posts.id], - }), -})); // ============================================ // BOT ACTIVITY LOGS // ============================================ -export const botActivityLogs = pgTable('bot_activity_logs', { - id: uuid('id').primaryKey().defaultRandom(), - botId: uuid('bot_id').notNull().references(() => bots.id, { onDelete: 'cascade' }), +export const botActivityLogs = sqliteTable('bot_activity_logs', { + id: text('id').primaryKey().$defaultFn(() => randomUUID()), + botId: text('bot_id').notNull().references(() => bots.id, { onDelete: 'cascade' }), action: text('action').notNull(), // post_created, mention_response, etc. details: text('details').notNull(), // JSON - success: boolean('success').notNull(), + success: integer('success', { mode: 'boolean' }).notNull(), errorMessage: text('error_message'), - createdAt: timestamp('created_at').defaultNow().notNull(), + createdAt: integer('created_at', { mode: 'timestamp' }).default(currentTimestamp).notNull(), }, (table) => [ index('bot_activity_logs_bot_idx').on(table.botId), index('bot_activity_logs_action_idx').on(table.action), index('bot_activity_logs_created_idx').on(table.createdAt), ]); -export const botActivityLogsRelations = relations(botActivityLogs, ({ one }) => ({ - bot: one(bots, { - fields: [botActivityLogs.botId], - references: [bots.id], - }), -})); // ============================================ // BOT RATE LIMITS // ============================================ -export const botRateLimits = pgTable('bot_rate_limits', { - id: uuid('id').primaryKey().defaultRandom(), - botId: uuid('bot_id').notNull().references(() => bots.id, { onDelete: 'cascade' }), +export const botRateLimits = sqliteTable('bot_rate_limits', { + id: text('id').primaryKey().$defaultFn(() => randomUUID()), + botId: text('bot_id').notNull().references(() => bots.id, { onDelete: 'cascade' }), - windowStart: timestamp('window_start').notNull(), + windowStart: integer('window_start', { mode: 'timestamp' }).notNull(), windowType: text('window_type').notNull(), // daily, hourly postCount: integer('post_count').default(0).notNull(), replyCount: integer('reply_count').default(0).notNull(), - createdAt: timestamp('created_at').defaultNow().notNull(), + createdAt: integer('created_at', { mode: 'timestamp' }).default(currentTimestamp).notNull(), }, (table) => [ index('bot_rate_limits_bot_window_idx').on(table.botId, table.windowStart), ]); -export const botRateLimitsRelations = relations(botRateLimits, ({ one }) => ({ - bot: one(bots, { - fields: [botRateLimits.botId], - references: [bots.id], - }), -})); // ============================================ // SWARM - Node Discovery Network @@ -857,8 +664,8 @@ export const botRateLimitsRelations = relations(botRateLimits, ({ one }) => ({ * Discovered nodes in the swarm network. * Tracks all known Synapsis nodes discovered through gossip or seed nodes. */ -export const swarmNodes = pgTable('swarm_nodes', { - id: uuid('id').primaryKey().defaultRandom(), +export const swarmNodes = sqliteTable('swarm_nodes', { + id: text('id').primaryKey().$defaultFn(() => randomUUID()), domain: text('domain').notNull().unique(), // Node metadata (fetched from remote) @@ -873,31 +680,31 @@ export const swarmNodes = pgTable('swarm_nodes', { postCount: integer('post_count'), // NSFW flag (synced from remote node) - isNsfw: boolean('is_nsfw').default(false).notNull(), + isNsfw: integer('is_nsfw', { mode: 'boolean' }).default(false).notNull(), // Discovery metadata discoveredVia: text('discovered_via'), // Domain of node that told us about this one - discoveredAt: timestamp('discovered_at').defaultNow().notNull(), + discoveredAt: integer('discovered_at', { mode: 'timestamp' }).default(currentTimestamp).notNull(), // Health tracking - lastSeenAt: timestamp('last_seen_at').defaultNow().notNull(), - lastSyncAt: timestamp('last_sync_at'), + lastSeenAt: integer('last_seen_at', { mode: 'timestamp' }).default(currentTimestamp).notNull(), + lastSyncAt: integer('last_sync_at', { mode: 'timestamp' }), consecutiveFailures: integer('consecutive_failures').default(0).notNull(), - isActive: boolean('is_active').default(true).notNull(), + isActive: integer('is_active', { mode: 'boolean' }).default(true).notNull(), // Trust/reputation (for future spam prevention) trustScore: integer('trust_score').default(50).notNull(), // 0-100 // Admin moderation - isBlocked: boolean('is_blocked').default(false).notNull(), + isBlocked: integer('is_blocked', { mode: 'boolean' }).default(false).notNull(), blockReason: text('block_reason'), - blockedAt: timestamp('blocked_at'), + blockedAt: integer('blocked_at', { mode: 'timestamp' }), // Capabilities capabilities: text('capabilities'), // JSON array: ["handles", "gossip", "relay"] - createdAt: timestamp('created_at').defaultNow().notNull(), - updatedAt: timestamp('updated_at').defaultNow().notNull(), + createdAt: integer('created_at', { mode: 'timestamp' }).default(currentTimestamp).notNull(), + updatedAt: integer('updated_at', { mode: 'timestamp' }).default(currentTimestamp).notNull(), }, (table) => [ index('swarm_nodes_domain_idx').on(table.domain), index('swarm_nodes_active_idx').on(table.isActive), @@ -911,21 +718,21 @@ export const swarmNodes = pgTable('swarm_nodes', { * Seed nodes - well-known entry points to the swarm. * These are the bootstrap nodes that new nodes contact first. */ -export const swarmSeeds = pgTable('swarm_seeds', { - id: uuid('id').primaryKey().defaultRandom(), +export const swarmSeeds = sqliteTable('swarm_seeds', { + id: text('id').primaryKey().$defaultFn(() => randomUUID()), domain: text('domain').notNull().unique(), // Priority for connection order (lower = higher priority) priority: integer('priority').default(100).notNull(), // Whether this seed is enabled - isEnabled: boolean('is_enabled').default(true).notNull(), + isEnabled: integer('is_enabled', { mode: 'boolean' }).default(true).notNull(), // Health tracking - lastContactAt: timestamp('last_contact_at'), + lastContactAt: integer('last_contact_at', { mode: 'timestamp' }), consecutiveFailures: integer('consecutive_failures').default(0).notNull(), - createdAt: timestamp('created_at').defaultNow().notNull(), + createdAt: integer('created_at', { mode: 'timestamp' }).default(currentTimestamp).notNull(), }, (table) => [ index('swarm_seeds_enabled_idx').on(table.isEnabled), index('swarm_seeds_priority_idx').on(table.priority), @@ -934,8 +741,8 @@ export const swarmSeeds = pgTable('swarm_seeds', { /** * Swarm sync log - tracks gossip exchanges between nodes. */ -export const swarmSyncLog = pgTable('swarm_sync_log', { - id: uuid('id').primaryKey().defaultRandom(), +export const swarmSyncLog = sqliteTable('swarm_sync_log', { + id: text('id').primaryKey().$defaultFn(() => randomUUID()), // Which node we synced with remoteDomain: text('remote_domain').notNull(), @@ -950,11 +757,11 @@ export const swarmSyncLog = pgTable('swarm_sync_log', { handlesSent: integer('handles_sent').default(0).notNull(), // Result - success: boolean('success').notNull(), + success: integer('success', { mode: 'boolean' }).notNull(), errorMessage: text('error_message'), durationMs: integer('duration_ms'), - createdAt: timestamp('created_at').defaultNow().notNull(), + createdAt: integer('created_at', { mode: 'timestamp' }).default(currentTimestamp).notNull(), }, (table) => [ index('swarm_sync_log_remote_idx').on(table.remoteDomain), index('swarm_sync_log_created_idx').on(table.createdAt), @@ -968,23 +775,23 @@ export const swarmSyncLog = pgTable('swarm_sync_log', { * Chat conversations between users across the swarm. * Each conversation has a unique ID and tracks participants. */ -export const chatConversations = pgTable('chat_conversations', { - id: uuid('id').primaryKey().defaultRandom(), +export const chatConversations = sqliteTable('chat_conversations', { + id: text('id').primaryKey().$defaultFn(() => randomUUID()), // Conversation type: 'direct' (1-on-1) or 'group' (future) type: text('type').default('direct').notNull(), // For direct chats, store both participants - participant1Id: uuid('participant1_id').notNull().references(() => users.id, { onDelete: 'cascade' }), + participant1Id: text('participant1_id').notNull().references(() => users.id, { onDelete: 'cascade' }), participant2Handle: text('participant2_handle').notNull(), // Can be local or remote (user@domain) // Last message info for sorting - lastMessageAt: timestamp('last_message_at'), + lastMessageAt: integer('last_message_at', { mode: 'timestamp' }), lastMessagePreview: text('last_message_preview'), // Metadata - createdAt: timestamp('created_at').defaultNow().notNull(), - updatedAt: timestamp('updated_at').defaultNow().notNull(), + createdAt: integer('created_at', { mode: 'timestamp' }).default(currentTimestamp).notNull(), + updatedAt: integer('updated_at', { mode: 'timestamp' }).default(currentTimestamp).notNull(), }, (table) => [ index('chat_conversations_participant1_idx').on(table.participant1Id), index('chat_conversations_last_message_idx').on(table.lastMessageAt), @@ -992,24 +799,17 @@ export const chatConversations = pgTable('chat_conversations', { uniqueIndex('chat_conversations_unique').on(table.participant1Id, table.participant2Handle), ]); -export const chatConversationsRelations = relations(chatConversations, ({ one, many }) => ({ - participant1: one(users, { - fields: [chatConversations.participant1Id], - references: [users.id], - }), - messages: many(chatMessages), -})); /** * Individual chat messages within conversations. * Messages are stored as plain text on the server. * Both sender and recipient can view the message content. */ -export const chatMessages = pgTable('chat_messages', { - id: uuid('id').primaryKey().defaultRandom(), +export const chatMessages = sqliteTable('chat_messages', { + id: text('id').primaryKey().$defaultFn(() => randomUUID()), // Which conversation this belongs to - conversationId: uuid('conversation_id').notNull().references(() => chatConversations.id, { onDelete: 'cascade' }), + conversationId: text('conversation_id').notNull().references(() => chatConversations.id, { onDelete: 'cascade' }), // Sender info senderHandle: text('sender_handle').notNull(), // Can be local or remote @@ -1025,23 +825,17 @@ export const chatMessages = pgTable('chat_messages', { swarmMessageId: text('swarm_message_id').unique(), // Format: swarm:domain:uuid // Status tracking - deliveredAt: timestamp('delivered_at'), - readAt: timestamp('read_at'), + deliveredAt: integer('delivered_at', { mode: 'timestamp' }), + readAt: integer('read_at', { mode: 'timestamp' }), // Metadata - createdAt: timestamp('created_at').defaultNow().notNull(), + createdAt: integer('created_at', { mode: 'timestamp' }).default(currentTimestamp).notNull(), }, (table) => [ index('chat_messages_conversation_idx').on(table.conversationId), index('chat_messages_created_idx').on(table.createdAt), index('chat_messages_swarm_id_idx').on(table.swarmMessageId), ]); -export const chatMessagesRelations = relations(chatMessages, ({ one }) => ({ - conversation: one(chatConversations, { - fields: [chatMessages.conversationId], - references: [chatConversations.id], - }), -})); @@ -1049,14 +843,14 @@ export const chatMessagesRelations = relations(chatMessages, ({ one }) => ({ * Typing indicators for real-time chat UX. * Short-lived records that expire after 10 seconds. */ -export const chatTypingIndicators = pgTable('chat_typing_indicators', { - id: uuid('id').primaryKey().defaultRandom(), +export const chatTypingIndicators = sqliteTable('chat_typing_indicators', { + id: text('id').primaryKey().$defaultFn(() => randomUUID()), - conversationId: uuid('conversation_id').notNull().references(() => chatConversations.id, { onDelete: 'cascade' }), + conversationId: text('conversation_id').notNull().references(() => chatConversations.id, { onDelete: 'cascade' }), userHandle: text('user_handle').notNull(), - expiresAt: timestamp('expires_at').notNull(), - createdAt: timestamp('created_at').defaultNow().notNull(), + expiresAt: integer('expires_at', { mode: 'timestamp' }).notNull(), + createdAt: integer('created_at', { mode: 'timestamp' }).default(currentTimestamp).notNull(), }, (table) => [ index('chat_typing_conversation_idx').on(table.conversationId), index('chat_typing_expires_idx').on(table.expiresAt), @@ -1071,15 +865,15 @@ export const chatTypingIndicators = pgTable('chat_typing_indicators', { * Replay protection for signed user actions. * Enforces uniqueness of (did, nonce) within the valid timeframe. */ -export const signedActionDedupe = pgTable('signed_action_dedupe', { +export const signedActionDedupe = sqliteTable('signed_action_dedupe', { // SHA-256 of canonical signed payload (without signature) actionId: text('action_id').primaryKey(), did: text('did').notNull(), nonce: text('nonce').notNull(), - ts: bigint('ts', { mode: 'number' }).notNull(), + ts: integer('ts').notNull(), - createdAt: timestamp('created_at').defaultNow().notNull(), + createdAt: integer('created_at', { mode: 'timestamp' }).default(currentTimestamp).notNull(), }, (table) => [ index('signed_action_dedupe_created_idx').on(table.createdAt), // For cleanup ]); @@ -1088,10 +882,10 @@ export const signedActionDedupe = pgTable('signed_action_dedupe', { * Cache for remote public keys to enforce key continuity. * Prevents TOFU (Trust On First Use) attacks after initial trust. */ -export const remoteIdentityCache = pgTable('remote_identity_cache', { +export const remoteIdentityCache = sqliteTable('remote_identity_cache', { did: text('did').primaryKey(), // The DID is the key publicKey: text('public_key').notNull(), - fetchedAt: timestamp('fetched_at').notNull(), - expiresAt: timestamp('expires_at').notNull(), + fetchedAt: integer('fetched_at', { mode: 'timestamp' }).notNull(), + expiresAt: integer('expires_at', { mode: 'timestamp' }).notNull(), }); diff --git a/src/lib/auth/index.ts b/src/lib/auth/index.ts index 4fb9cfb..2b2b109 100644 --- a/src/lib/auth/index.ts +++ b/src/lib/auth/index.ts @@ -89,7 +89,7 @@ async function loadSessionsByTokens(tokens: string[]): Promise } const sessionRecords = await db.query.sessions.findMany({ - where: inArray(sessions.token, uniqueTokens), + where: { token: { in: uniqueTokens } }, with: { user: true, }, @@ -296,7 +296,7 @@ export async function registerUser( // Check if handle is taken const existingHandle = await db.query.users.findFirst({ - where: eq(users.handle, handle.toLowerCase()), + where: { handle: handle.toLowerCase() }, }); if (existingHandle) { @@ -305,7 +305,7 @@ export async function registerUser( // Check if email is taken const existingEmail = await db.query.users.findFirst({ - where: eq(users.email, email.toLowerCase()), + where: { email: email.toLowerCase() }, }); if (existingEmail) { @@ -339,7 +339,7 @@ export async function registerUser( const did = generateDID(publicKey); const passwordHash = await hashPassword(password); - const nodeDomain = process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:3000'; + const nodeDomain = process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:43821'; // Generate avatar and upload to user's S3 storage const fullHandle = `${handle.toLowerCase()}@${nodeDomain}`; @@ -393,7 +393,7 @@ export async function authenticateUser( password: string ): Promise { const user = await db.query.users.findFirst({ - where: eq(users.email, email.toLowerCase()), + where: { email: email.toLowerCase() }, }); if (!user || !user.passwordHash) { diff --git a/src/lib/auth/key-registry.ts b/src/lib/auth/key-registry.ts index d2bd967..399b170 100644 --- a/src/lib/auth/key-registry.ts +++ b/src/lib/auth/key-registry.ts @@ -26,7 +26,7 @@ interface RemoteIdentity { export async function lookupRemoteKey(did: string): Promise { // 1. Check Cache const cached = await db.query.remoteIdentityCache.findFirst({ - where: eq(remoteIdentityCache.did, did), + where: { did: did }, }); const now = new Date(); diff --git a/src/lib/auth/verify-signature.ts b/src/lib/auth/verify-signature.ts index 0f6cc51..b9ffbbd 100644 --- a/src/lib/auth/verify-signature.ts +++ b/src/lib/auth/verify-signature.ts @@ -96,7 +96,7 @@ export async function verifyUserAction(signedAction: SignedAction): Promise<{ // 3. FETCH USER & KEY const user = await db.query.users.findFirst({ - where: eq(users.did, payload.did), + where: { did: payload.did }, }); if (!user) { diff --git a/src/lib/background/scheduler.ts b/src/lib/background/scheduler.ts index 154883e..30b1efb 100644 --- a/src/lib/background/scheduler.ts +++ b/src/lib/background/scheduler.ts @@ -120,7 +120,7 @@ export function startBackgroundTasks(origin?: string) { isStarted = true; // Default origin for remote sync (can be overridden) - const syncOrigin = origin || process.env.NEXT_PUBLIC_APP_URL || 'http://localhost:3000'; + const syncOrigin = origin || process.env.NEXT_PUBLIC_APP_URL || 'http://localhost:43821'; log('STARTUP', 'Background task scheduler starting...'); log('STARTUP', `Bot interval: ${BOT_INTERVAL_MS / 1000}s, Gossip interval: ${GOSSIP_INTERVAL_MS / 1000}s, Remote sync interval: ${REMOTE_SYNC_INTERVAL_MS / 1000}s`); diff --git a/src/lib/bots/activityLogger.ts b/src/lib/bots/activityLogger.ts index 5da0867..a6147e7 100644 --- a/src/lib/bots/activityLogger.ts +++ b/src/lib/bots/activityLogger.ts @@ -95,26 +95,19 @@ export async function getLogsForBot( botId: string, options: LogQueryOptions = {} ): Promise { - const conditions = [eq(botActivityLogs.botId, botId)]; - - // Filter by action types - if (options.actionTypes && options.actionTypes.length > 0) { - conditions.push(inArray(botActivityLogs.action, options.actionTypes)); - } - - // Filter by date range - if (options.startDate) { - conditions.push(gte(botActivityLogs.createdAt, options.startDate)); - } - - if (options.endDate) { - conditions.push(lte(botActivityLogs.createdAt, options.endDate)); - } - // Build query let query = db.query.botActivityLogs.findMany({ - where: and(...conditions), - orderBy: [desc(botActivityLogs.createdAt)], // Reverse chronological + where: { + botId, + ...(options.actionTypes?.length ? { action: { in: options.actionTypes } } : {}), + ...(options.startDate || options.endDate ? { + createdAt: { + ...(options.startDate ? { gte: options.startDate } : {}), + ...(options.endDate ? { lte: options.endDate } : {}), + }, + } : {}), + }, + orderBy: () => [desc(botActivityLogs.createdAt)], // Reverse chronological limit: options.limit || 100, offset: options.offset || 0, }); @@ -146,11 +139,8 @@ export async function getErrorLogs( limit: number = 50 ): Promise { const logs = await db.query.botActivityLogs.findMany({ - where: and( - eq(botActivityLogs.botId, botId), - eq(botActivityLogs.success, false) - ), - orderBy: [desc(botActivityLogs.createdAt)], + where: { AND: [{ botId: botId }, { success: false }] }, + orderBy: () => [desc(botActivityLogs.createdAt)], limit, }); diff --git a/src/lib/bots/autonomous.ts b/src/lib/bots/autonomous.ts index 1c7da20..49ef6c0 100644 --- a/src/lib/bots/autonomous.ts +++ b/src/lib/bots/autonomous.ts @@ -114,10 +114,10 @@ export const MIN_INTEREST_SCORE = 60; */ async function hasContentSources(botId: string): Promise { const bot = await db.query.bots.findFirst({ - where: eq(bots.id, botId), + where: { id: botId }, with: { contentSources: { - where: (sources, { eq }) => eq(sources.isActive, true), + where: { isActive: true }, }, }, }); @@ -139,10 +139,10 @@ async function getUnprocessedContentItems( ): Promise { // Get bot's content sources const bot = await db.query.bots.findFirst({ - where: eq(bots.id, botId), + where: { id: botId }, with: { contentSources: { - where: (sources, { eq }) => eq(sources.isActive, true), + where: { isActive: true }, }, }, }); @@ -155,9 +155,7 @@ async function getUnprocessedContentItems( // Get unprocessed content items from these sources const items = await db.query.botContentItems.findMany({ - where: and( - eq(botContentItems.isProcessed, false) - ), + where: { AND: [{ isProcessed: false }] }, orderBy: (items, { desc }) => [desc(items.publishedAt)], limit, }); @@ -284,7 +282,7 @@ export async function evaluateContentForPosting( ): Promise { // Get bot with user relation const dbBot = await db.query.bots.findFirst({ - where: eq(bots.id, botId), + where: { id: botId }, with: { user: true }, }); @@ -373,7 +371,7 @@ export async function attemptAutonomousPost( // Get bot with schedule config const dbBot = await db.query.bots.findFirst({ - where: eq(bots.id, botId), + where: { id: botId }, with: { user: true }, }); @@ -541,11 +539,7 @@ export async function processAllAutonomousBots(): Promise> { // Get all active bots with autonomous mode enabled const autonomousBots = await db.query.bots.findMany({ - where: and( - eq(bots.isActive, true), - eq(bots.isSuspended, false), - eq(bots.autonomousMode, true) - ), + where: { AND: [{ isActive: true }, { isSuspended: false }, { autonomousMode: true }] }, with: { user: true }, }); @@ -590,7 +584,7 @@ export async function canPostAutonomously(botId: string): Promise<{ }> { // Get bot const bot = await db.query.bots.findFirst({ - where: eq(bots.id, botId), + where: { id: botId }, }); if (!bot) { @@ -686,7 +680,7 @@ export async function getAutonomousPostingStats(botId: string): Promise<{ }> { // Get bot's content sources const bot = await db.query.bots.findFirst({ - where: eq(bots.id, botId), + where: { id: botId }, with: { contentSources: true, }, @@ -706,7 +700,7 @@ export async function getAutonomousPostingStats(botId: string): Promise<{ // Get all content items for this bot's sources const allItems = await db.query.botContentItems.findMany({ - where: (items, { inArray }) => inArray(items.sourceId, sourceIds), + where: { sourceId: { in: sourceIds } }, }); const processedItems = allItems.filter(item => item.isProcessed); diff --git a/src/lib/bots/botManager.ts b/src/lib/bots/botManager.ts index 365ade6..83fcbb3 100644 --- a/src/lib/bots/botManager.ts +++ b/src/lib/bots/botManager.ts @@ -396,7 +396,7 @@ export async function createBot(ownerId: string, config: BotCreateInput): Promis // Check if handle is taken (in users table now) const existingUser = await db.query.users.findFirst({ - where: eq(users.handle, config.handle.toLowerCase()), + where: { handle: config.handle.toLowerCase() }, }); if (existingUser) { @@ -405,7 +405,7 @@ export async function createBot(ownerId: string, config: BotCreateInput): Promis // Get owner to access their S3 storage for bot avatar const owner = await db.query.users.findFirst({ - where: eq(users.id, ownerId), + where: { id: ownerId }, }); if (!owner) { @@ -420,7 +420,7 @@ export async function createBot(ownerId: string, config: BotCreateInput): Promis const encryptedPrivateKey = encryptApiKey(privateKey); // Generate a DID for the bot - const nodeDomain = process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:3000'; + const nodeDomain = process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:43821'; const botDid = `did:web:${nodeDomain}:users:${config.handle.toLowerCase()}`; // Generate bot avatar using owner's S3 storage if no avatar provided @@ -515,7 +515,7 @@ export async function updateBot(botId: string, config: BotUpdateInput): Promise< // Check if bot exists and get its user account const existingBot = await db.query.bots.findFirst({ - where: eq(bots.id, botId), + where: { id: botId }, }); if (!existingBot) { @@ -524,7 +524,7 @@ export async function updateBot(botId: string, config: BotUpdateInput): Promise< // Get the bot's user account const botUser = await db.query.users.findFirst({ - where: eq(users.id, existingBot.userId), + where: { id: existingBot.userId }, }); if (!botUser) { @@ -629,7 +629,7 @@ export async function updateBot(botId: string, config: BotUpdateInput): Promise< // Get updated user const updatedUser = await db.query.users.findFirst({ - where: eq(users.id, existingBot.userId), + where: { id: existingBot.userId }, }); return dbBotToBot(updatedBot, updatedUser!); @@ -647,7 +647,7 @@ export async function updateBot(botId: string, config: BotUpdateInput): Promise< export async function deleteBot(botId: string): Promise { // Check if bot exists const existingBot = await db.query.bots.findFirst({ - where: eq(bots.id, botId), + where: { id: botId }, }); if (!existingBot) { @@ -671,14 +671,14 @@ export async function deleteBot(botId: string): Promise { */ export async function getBotsByUser(ownerId: string): Promise { const userBots = await db.query.bots.findMany({ - where: eq(bots.ownerId, ownerId), + where: { ownerId: ownerId }, orderBy: (bots, { desc }) => [desc(bots.createdAt)], }); // Get all bot user accounts const botUserIds = userBots.map(b => b.userId); const botUsers = await db.query.users.findMany({ - where: (users, { inArray }) => inArray(users.id, botUserIds), + where: { id: { in: botUserIds } }, }); const userMap = new Map(botUsers.map(u => [u.id, u])); @@ -702,7 +702,7 @@ export async function getBotsByUser(ownerId: string): Promise { */ export async function getBotById(botId: string): Promise { const bot = await db.query.bots.findFirst({ - where: eq(bots.id, botId), + where: { id: botId }, }); if (!bot) { @@ -711,7 +711,7 @@ export async function getBotById(botId: string): Promise { // Get the bot's user account const botUser = await db.query.users.findFirst({ - where: eq(users.id, bot.userId), + where: { id: bot.userId }, }); if (!botUser) { @@ -730,10 +730,7 @@ export async function getBotById(botId: string): Promise { export async function getBotByHandle(handle: string): Promise { // Find the user with this handle that is a bot const botUser = await db.query.users.findFirst({ - where: and( - eq(users.handle, handle.toLowerCase()), - eq(users.isBot, true) - ), + where: { AND: [{ handle: handle.toLowerCase() }, { isBot: true }] }, }); if (!botUser) { @@ -742,7 +739,7 @@ export async function getBotByHandle(handle: string): Promise { // Find the bot config for this user const bot = await db.query.bots.findFirst({ - where: eq(bots.userId, botUser.id), + where: { userId: botUser.id }, }); if (!bot) { @@ -789,7 +786,7 @@ export async function canUserCreateBot(ownerId: string): Promise { */ export async function userOwnsBot(ownerId: string, botId: string): Promise { const bot = await db.query.bots.findFirst({ - where: and(eq(bots.id, botId), eq(bots.ownerId, ownerId)), + where: { AND: [{ id: botId }, { ownerId: ownerId }] }, }); return bot !== undefined; @@ -836,7 +833,7 @@ export async function setApiKey( ): Promise { // Check if bot exists const existingBot = await db.query.bots.findFirst({ - where: eq(bots.id, botId), + where: { id: botId }, }); if (!existingBot) { @@ -885,7 +882,7 @@ export async function setApiKey( export async function removeApiKey(botId: string): Promise { // Check if bot exists const existingBot = await db.query.bots.findFirst({ - where: eq(bots.id, botId), + where: { id: botId }, }); if (!existingBot) { @@ -930,7 +927,7 @@ export interface ApiKeyStatus { export async function getApiKeyStatus(botId: string): Promise { // Get the bot with encrypted API key const bot = await db.query.bots.findFirst({ - where: eq(bots.id, botId), + where: { id: botId }, }); if (!bot) { @@ -984,7 +981,7 @@ export async function botHasApiKey(botId: string): Promise { export async function getDecryptedApiKey(botId: string): Promise { // Get the bot with encrypted API key const bot = await db.query.bots.findFirst({ - where: eq(bots.id, botId), + where: { id: botId }, }); if (!bot) { diff --git a/src/lib/bots/contentFetcher.ts b/src/lib/bots/contentFetcher.ts index f8595e6..197e616 100644 --- a/src/lib/bots/contentFetcher.ts +++ b/src/lib/bots/contentFetcher.ts @@ -562,10 +562,7 @@ export async function contentItemExists( externalId: string ): Promise { const existing = await db.query.botContentItems.findFirst({ - where: and( - eq(botContentItems.sourceId, sourceId), - eq(botContentItems.externalId, externalId) - ), + where: { AND: [{ sourceId: sourceId }, { externalId: externalId }] }, columns: { id: true }, }); @@ -684,7 +681,7 @@ export async function recordFetchError( ): Promise { // Get current consecutive errors const source = await db.query.botContentSources.findFirst({ - where: eq(botContentSources.id, sourceId), + where: { id: sourceId }, columns: { consecutiveErrors: true }, }); @@ -768,7 +765,7 @@ export async function fetchContent( case 'news_api': // Decrypt API key const dbSource = await db.query.botContentSources.findFirst({ - where: eq(botContentSources.id, sourceId), + where: { id: sourceId }, columns: { apiKeyEncrypted: true }, }); @@ -785,7 +782,7 @@ export async function fetchContent( case 'brave_news': // Decrypt API key const braveDbSource = await db.query.botContentSources.findFirst({ - where: eq(botContentSources.id, sourceId), + where: { id: sourceId }, columns: { apiKeyEncrypted: true, sourceConfig: true }, }); @@ -945,10 +942,7 @@ export async function fetchAllSourcesForBot( options: FetchOptions = {} ): Promise { const sources = await db.query.botContentSources.findMany({ - where: and( - eq(botContentSources.botId, botId), - eq(botContentSources.isActive, true) - ), + where: { AND: [{ botId: botId }, { isActive: true }] }, }); const results: FetchResult[] = []; @@ -994,10 +988,7 @@ export async function getUnprocessedItems( limit: number = 10 ): Promise { const items = await db.query.botContentItems.findMany({ - where: and( - eq(botContentItems.sourceId, sourceId), - eq(botContentItems.isProcessed, false) - ), + where: { AND: [{ sourceId: sourceId }, { isProcessed: false }] }, orderBy: (items, { asc }) => [asc(items.publishedAt)], limit, }); diff --git a/src/lib/bots/contentSource.ts b/src/lib/bots/contentSource.ts index 85f4820..414b3f8 100644 --- a/src/lib/bots/contentSource.ts +++ b/src/lib/bots/contentSource.ts @@ -592,7 +592,7 @@ export async function addSource( // Check if bot exists const bot = await db.query.bots.findFirst({ - where: eq(bots.id, botId), + where: { id: botId }, columns: { id: true }, }); @@ -646,7 +646,7 @@ export async function addSource( export async function removeSource(sourceId: string): Promise { // Check if source exists const existingSource = await db.query.botContentSources.findFirst({ - where: eq(botContentSources.id, sourceId), + where: { id: sourceId }, columns: { id: true }, }); @@ -666,7 +666,7 @@ export async function removeSource(sourceId: string): Promise { */ export async function getSourceById(sourceId: string): Promise { const source = await db.query.botContentSources.findFirst({ - where: eq(botContentSources.id, sourceId), + where: { id: sourceId }, }); if (!source) { @@ -686,7 +686,7 @@ export async function getSourceById(sourceId: string): Promise { const sources = await db.query.botContentSources.findMany({ - where: eq(botContentSources.botId, botId), + where: { botId: botId }, orderBy: (sources, { desc }) => [desc(sources.createdAt)], }); @@ -701,10 +701,7 @@ export async function getSourcesByBot(botId: string): Promise { */ export async function getActiveSourcesByBot(botId: string): Promise { const sources = await db.query.botContentSources.findMany({ - where: and( - eq(botContentSources.botId, botId), - eq(botContentSources.isActive, true) - ), + where: { AND: [{ botId: botId }, { isActive: true }] }, orderBy: (sources, { desc }) => [desc(sources.createdAt)], }); @@ -728,7 +725,7 @@ export async function updateSource( ): Promise { // Check if source exists const existingSource = await db.query.botContentSources.findFirst({ - where: eq(botContentSources.id, sourceId), + where: { id: sourceId }, }); if (!existingSource) { @@ -811,10 +808,7 @@ export async function deactivateSource(sourceId: string): Promise { */ export async function botOwnsSource(botId: string, sourceId: string): Promise { const source = await db.query.botContentSources.findFirst({ - where: and( - eq(botContentSources.id, sourceId), - eq(botContentSources.botId, botId) - ), + where: { AND: [{ id: sourceId }, { botId: botId }] }, columns: { id: true }, }); @@ -829,7 +823,7 @@ export async function botOwnsSource(botId: string, sourceId: string): Promise { const sources = await db.query.botContentSources.findMany({ - where: eq(botContentSources.botId, botId), + where: { botId: botId }, columns: { id: true }, }); @@ -850,10 +844,7 @@ export async function getSourcesByType( type: ContentSourceType ): Promise { const sources = await db.query.botContentSources.findMany({ - where: and( - eq(botContentSources.botId, botId), - eq(botContentSources.type, type) - ), + where: { AND: [{ botId: botId }, { type: type }] }, orderBy: (sources, { desc }) => [desc(sources.createdAt)], }); diff --git a/src/lib/bots/mentionHandler.ts b/src/lib/bots/mentionHandler.ts index 28b466e..df6c0b1 100644 --- a/src/lib/bots/mentionHandler.ts +++ b/src/lib/bots/mentionHandler.ts @@ -106,7 +106,7 @@ export async function detectMentions(botId: string): Promise [desc(posts.createdAt)], limit: 1000, // Reasonable limit for scanning }); @@ -218,11 +216,8 @@ export async function detectMentions(botId: string): Promise { try { const mentions = await db.query.botMentions.findMany({ - where: and( - eq(botMentions.botId, botId), - eq(botMentions.isProcessed, false) - ), - orderBy: [asc(botMentions.createdAt)], // Chronological order (oldest first) + where: { AND: [{ botId: botId }, { isProcessed: false }] }, + orderBy: () => [asc(botMentions.createdAt)], // Chronological order (oldest first) }); return mentions.map(m => ({ @@ -256,8 +251,8 @@ export async function getUnprocessedMentions(botId: string): Promise export async function getAllMentions(botId: string): Promise { try { const mentions = await db.query.botMentions.findMany({ - where: eq(botMentions.botId, botId), - orderBy: [desc(botMentions.createdAt)], + where: { botId: botId }, + orderBy: () => [desc(botMentions.createdAt)], }); return mentions.map(m => ({ @@ -307,7 +302,7 @@ export async function getConversationContext( while (currentPostId && depth < maxDepth) { const post: any = await db.query.posts.findFirst({ - where: eq(posts.id, currentPostId), + where: { id: currentPostId }, with: { author: { columns: { @@ -365,7 +360,7 @@ export async function processMention(mentionId: string): Promise { try { const mention = await db.query.botMentions.findFirst({ - where: eq(botMentions.id, mentionId), + where: { id: mentionId }, }); if (!mention) { diff --git a/src/lib/bots/personality.ts b/src/lib/bots/personality.ts index ffc6e84..4193b9c 100644 --- a/src/lib/bots/personality.ts +++ b/src/lib/bots/personality.ts @@ -335,7 +335,7 @@ export function deserializePersonalityConfig(json: string): PersonalityConfig { */ export async function getPersonalityConfig(botId: string): Promise { const bot = await db.query.bots.findFirst({ - where: eq(bots.id, botId), + where: { id: botId }, columns: { personalityConfig: true, }, @@ -372,7 +372,7 @@ export async function updatePersonalityConfig( // Check if bot exists const existingBot = await db.query.bots.findFirst({ - where: eq(bots.id, botId), + where: { id: botId }, columns: { id: true }, }); diff --git a/src/lib/bots/posting.ts b/src/lib/bots/posting.ts index b54598b..024011f 100644 --- a/src/lib/bots/posting.ts +++ b/src/lib/bots/posting.ts @@ -169,7 +169,7 @@ function getDecryptedApiKeyForBot(bot: typeof bots.$inferSelect): string { */ async function getContentItemById(contentItemId: string): Promise { const item = await db.query.botContentItems.findFirst({ - where: eq(botContentItems.id, contentItemId), + where: { id: contentItemId }, }); if (!item) { @@ -197,10 +197,10 @@ async function getContentItemById(contentItemId: string): Promise { // Get bot's content sources const bot = await db.query.bots.findFirst({ - where: eq(bots.id, botId), + where: { id: botId }, with: { contentSources: { - where: (sources, { eq }) => eq(sources.isActive, true), + where: { isActive: true }, }, user: true, }, @@ -214,7 +214,7 @@ async function getNextUnprocessedContentItem(botId: string): Promise [asc(items.publishedAt)], limit: 100, // Get more items to have options after filtering }); @@ -278,7 +275,7 @@ async function getNextUnprocessedContentItem(botId: string): Promise { // Get bot to find its user ID const bot = await db.query.bots.findFirst({ - where: eq(bots.id, botId), + where: { id: botId }, }); if (!bot) { @@ -287,7 +284,7 @@ async function getBotPreviousPosts(botId: string, limit: number = 40): Promise [desc(posts.createdAt)], limit, columns: { @@ -512,7 +509,7 @@ export async function selectContentForPosting( // Verify the content belongs to this bot's sources const bot = await db.query.bots.findFirst({ - where: eq(bots.id, botId), + where: { id: botId }, with: { contentSources: true, user: true, @@ -691,7 +688,7 @@ async function resolveContentItemSourceUrl(contentItem?: ContentItem | null): Pr } const source = await db.query.botContentSources.findFirst({ - where: eq(botContentSources.id, contentItem.sourceId), + where: { id: contentItem.sourceId }, columns: { type: true, subreddit: true, @@ -726,7 +723,7 @@ async function createPostInDatabase( ): Promise { // Get bot config const bot = await db.query.bots.findFirst({ - where: eq(bots.id, botId), + where: { id: botId }, }); if (!bot) { @@ -738,7 +735,7 @@ async function createPostInDatabase( // Get the bot's own user account (not the owner) const botUser = await db.query.users.findFirst({ - where: eq(users.id, bot.userId), + where: { id: bot.userId }, }); if (!botUser) { @@ -755,7 +752,7 @@ async function createPostInDatabase( linkPreview = await fetchLinkPreview(sourceUrl); } - const nodeDomain = process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:3000'; + const nodeDomain = process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:43821'; const postUuid = crypto.randomUUID(); try { @@ -807,7 +804,7 @@ async function federatePost( try { // Get bot config const bot = await db.query.bots.findFirst({ - where: eq(bots.id, botId), + where: { id: botId }, }); if (!bot) { @@ -817,7 +814,7 @@ async function federatePost( // Get the bot's own user account const botUser = await db.query.users.findFirst({ - where: eq(users.id, bot.userId), + where: { id: bot.userId }, }); if (!botUser) { @@ -825,7 +822,7 @@ async function federatePost( return; } - const nodeDomain = process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:3000'; + const nodeDomain = process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:43821'; // Use swarm delivery for bot posts const { deliverPostToSwarmFollowers } = await import('@/lib/swarm/interactions'); @@ -993,7 +990,7 @@ export async function triggerPost( // Get bot from database for generation const dbBot = await db.query.bots.findFirst({ - where: eq(bots.id, botId), + where: { id: botId }, with: { user: true }, // Required for generatePostContent }); @@ -1142,7 +1139,7 @@ export async function getPostingStats(botId: string): Promise<{ }> { // Get bot const bot = await db.query.bots.findFirst({ - where: eq(bots.id, botId), + where: { id: botId }, with: { contentSources: true, }, @@ -1160,7 +1157,7 @@ export async function getPostingStats(botId: string): Promise<{ // Get user's post count const user = await db.query.users.findFirst({ - where: eq(users.id, bot.userId), + where: { id: bot.userId }, }); const totalPosts = user?.postsCount || 0; @@ -1170,10 +1167,7 @@ export async function getPostingStats(botId: string): Promise<{ today.setUTCHours(0, 0, 0, 0); const postsToday = await db.query.posts.findMany({ - where: and( - eq(posts.userId, bot.userId), - // Note: This is a simplified query. In production, you'd want to use a proper date comparison - ), + where: { AND: [{ userId: bot.userId }] }, }); // Get content item stats @@ -1184,7 +1178,7 @@ export async function getPostingStats(botId: string): Promise<{ if (sourceIds.length > 0) { const allItems = await db.query.botContentItems.findMany({ - where: (items, { inArray }) => inArray(items.sourceId, sourceIds), + where: { sourceId: { in: sourceIds } }, }); contentItemsProcessed = allItems.filter(item => item.isProcessed).length; diff --git a/src/lib/bots/rateLimiter.ts b/src/lib/bots/rateLimiter.ts index 2578f25..551832c 100644 --- a/src/lib/bots/rateLimiter.ts +++ b/src/lib/bots/rateLimiter.ts @@ -129,11 +129,7 @@ async function getOrCreateWindow( ): Promise { // Try to find existing window const existing = await db.query.botRateLimits.findFirst({ - where: and( - eq(botRateLimits.botId, botId), - eq(botRateLimits.windowType, windowType), - eq(botRateLimits.windowStart, windowStart) - ), + where: { AND: [{ botId }, { windowType }, { windowStart: { eq: windowStart } }] }, }); if (existing) { @@ -158,11 +154,7 @@ async function getOrCreateWindow( async function getDailyPostCount(botId: string): Promise { const windowStart = getDailyWindowStart(); const window = await db.query.botRateLimits.findFirst({ - where: and( - eq(botRateLimits.botId, botId), - eq(botRateLimits.windowType, 'daily'), - eq(botRateLimits.windowStart, windowStart) - ), + where: { AND: [{ botId }, { windowType: 'daily' }, { windowStart: { eq: windowStart } }] }, }); return window?.postCount ?? 0; @@ -174,11 +166,7 @@ async function getDailyPostCount(botId: string): Promise { async function getHourlyReplyCount(botId: string): Promise { const windowStart = getHourlyWindowStart(); const window = await db.query.botRateLimits.findFirst({ - where: and( - eq(botRateLimits.botId, botId), - eq(botRateLimits.windowType, 'hourly'), - eq(botRateLimits.windowStart, windowStart) - ), + where: { AND: [{ botId }, { windowType: 'hourly' }, { windowStart: { eq: windowStart } }] }, }); return window?.replyCount ?? 0; @@ -189,7 +177,7 @@ async function getHourlyReplyCount(botId: string): Promise { */ async function getLastPostAt(botId: string): Promise { const bot = await db.query.bots.findFirst({ - where: eq(bots.id, botId), + where: { id: botId }, columns: { lastPostAt: true }, }); @@ -368,11 +356,7 @@ export async function getPostCount(botId: string, windowHours: number): Promise< // Get all daily windows that overlap with the requested time range const windows = await db.query.botRateLimits.findMany({ - where: and( - eq(botRateLimits.botId, botId), - eq(botRateLimits.windowType, 'daily'), - gte(botRateLimits.windowStart, getDailyWindowStart(windowStart)) - ), + where: { AND: [{ botId: botId }, { windowType: 'daily' }, { windowStart: { gte: getDailyWindowStart(windowStart) } }] }, }); return windows.reduce((sum, w) => sum + w.postCount, 0); diff --git a/src/lib/bots/scheduler.ts b/src/lib/bots/scheduler.ts index 4c674e9..345f98e 100644 --- a/src/lib/bots/scheduler.ts +++ b/src/lib/bots/scheduler.ts @@ -679,10 +679,7 @@ export function isDue( export async function hasUnprocessedContent(botId: string): Promise { // Get all content sources for the bot const sources = await db.query.botContentSources.findMany({ - where: and( - eq(botContentSources.botId, botId), - eq(botContentSources.isActive, true) - ), + where: { AND: [{ botId: botId }, { isActive: true }] }, columns: { id: true }, }); @@ -693,10 +690,7 @@ export async function hasUnprocessedContent(botId: string): Promise { // Check if any source has unprocessed content for (const source of sources) { const unprocessedItem = await db.query.botContentItems.findFirst({ - where: and( - eq(botContentItems.sourceId, source.id), - eq(botContentItems.isProcessed, false) - ), + where: { AND: [{ sourceId: source.id }, { isProcessed: false }] }, columns: { id: true }, }); @@ -724,10 +718,7 @@ export async function getNextUnprocessedContent(botId: string): Promise<{ } | null> { // Get all content sources for the bot const sources = await db.query.botContentSources.findMany({ - where: and( - eq(botContentSources.botId, botId), - eq(botContentSources.isActive, true) - ), + where: { AND: [{ botId: botId }, { isActive: true }] }, columns: { id: true }, }); @@ -740,10 +731,7 @@ export async function getNextUnprocessedContent(botId: string): Promise<{ for (const source of sources) { const item = await db.query.botContentItems.findFirst({ - where: and( - eq(botContentItems.sourceId, source.id), - eq(botContentItems.isProcessed, false) - ), + where: { AND: [{ sourceId: source.id }, { isProcessed: false }] }, orderBy: (items, { asc }) => [asc(items.publishedAt)], }); @@ -789,10 +777,7 @@ export async function processScheduledPosts(): Promise { const sources = await db.query.botContentSources.findMany({ - where: and( - eq(botContentSources.botId, botId), - eq(botContentSources.isActive, true) - ), + where: { AND: [{ botId: botId }, { isActive: true }] }, columns: { id: true }, }); @@ -951,7 +933,7 @@ async function botHasActiveSources(botId: string): Promise { */ export async function getBotSchedule(botId: string): Promise { const bot = await db.query.bots.findFirst({ - where: eq(bots.id, botId), + where: { id: botId }, columns: { scheduleConfig: true }, }); diff --git a/src/lib/bots/suspension.ts b/src/lib/bots/suspension.ts index 40d3e9d..60b73c0 100644 --- a/src/lib/bots/suspension.ts +++ b/src/lib/bots/suspension.ts @@ -69,7 +69,7 @@ export async function reinstateBot(botId: string) { */ export async function isBotSuspended(botId: string): Promise { const bot = await db.query.bots.findFirst({ - where: eq(bots.id, botId), + where: { id: botId }, columns: { isSuspended: true }, }); @@ -86,7 +86,7 @@ export async function isBotSuspended(botId: string): Promise { */ export async function ensureBotNotSuspended(botId: string): Promise { const bot = await db.query.bots.findFirst({ - where: eq(bots.id, botId), + where: { id: botId }, columns: { isSuspended: true, suspensionReason: true }, }); diff --git a/src/lib/config.ts b/src/lib/config.ts index 77289a9..1846cb7 100644 --- a/src/lib/config.ts +++ b/src/lib/config.ts @@ -9,13 +9,13 @@ export async function getRuntimeConfig() { .then((res) => res.json()) .then((data) => { cachedConfig = { - domain: data.domain || 'localhost:3000', + domain: data.domain || 'localhost:43821', }; return cachedConfig; }) .catch(() => { cachedConfig = { - domain: process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:3000', + domain: process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:43821', }; return cachedConfig; }); @@ -24,7 +24,7 @@ export async function getRuntimeConfig() { } export function getDomain(): string { - return cachedConfig?.domain || process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:3000'; + return cachedConfig?.domain || process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:43821'; } export function clearCachedConfig() { diff --git a/src/lib/contexts/ConfigContext.tsx b/src/lib/contexts/ConfigContext.tsx index 5e66fce..381c10d 100644 --- a/src/lib/contexts/ConfigContext.tsx +++ b/src/lib/contexts/ConfigContext.tsx @@ -26,13 +26,13 @@ export function ConfigProvider({ children }: { children: ReactNode }) { .then((res) => res.json()) .then((data) => { setConfig({ - domain: data.domain || 'localhost:3000', + domain: data.domain || 'localhost:43821', }); }) .catch(() => { // Fallback to build-time value if fetch fails setConfig({ - domain: process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:3000', + domain: process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:43821', }); }) .finally(() => { @@ -59,7 +59,7 @@ export function useDomain(): string { const { config, isLoading } = useRuntimeConfig(); // Return runtime domain if loaded, otherwise fall back to build-time value if (isLoading || !config) { - return process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:3000'; + return process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:43821'; } return config.domain; } diff --git a/src/lib/federation/handles.ts b/src/lib/federation/handles.ts index 0628064..b68d473 100644 --- a/src/lib/federation/handles.ts +++ b/src/lib/federation/handles.ts @@ -26,7 +26,7 @@ export async function upsertHandleEntries(entries: HandleEntry[]) { } const existing = await db.query.handleRegistry.findFirst({ - where: eq(handleRegistry.handle, cleanHandle), + where: { handle: cleanHandle }, }); // If no timestamp provided, treat it as "now" but be careful diff --git a/src/lib/host-updater.ts b/src/lib/host-updater.ts deleted file mode 100644 index 8d99bd5..0000000 --- a/src/lib/host-updater.ts +++ /dev/null @@ -1,129 +0,0 @@ -import http from 'http'; - -const DEFAULT_SOCKET_PATH = '/var/run/synapsis-updater/updater.sock'; -const REQUEST_TIMEOUT_MS = 4000; - -export interface HostUpdaterStatus { - available: boolean; - status: 'unavailable' | 'idle' | 'updating' | 'success' | 'error'; - message?: string; - lastStartedAt?: string | null; - lastFinishedAt?: string | null; - lastExitCode?: number | null; - lastError?: string | null; - pid?: number | null; - trigger?: 'manual' | 'auto' | null; - config?: { - autoUpdateEnabled: boolean; - intervalMinutes: number; - }; -} - -function getUpdaterConfig() { - const socketPath = process.env.HOST_UPDATER_SOCKET || DEFAULT_SOCKET_PATH; - const token = process.env.HOST_UPDATER_TOKEN || ''; - - return { - socketPath, - token, - enabled: Boolean(socketPath && token), - }; -} - -function requestUpdater(method: 'GET' | 'POST' | 'PATCH', path: string, body?: unknown): Promise { - const { socketPath, token, enabled } = getUpdaterConfig(); - - if (!enabled) { - return Promise.reject(new Error('Host updater is not configured')); - } - - const payload = body ? JSON.stringify(body) : undefined; - - return new Promise((resolve, reject) => { - const request = http.request( - { - method, - socketPath, - path, - headers: { - Authorization: `Bearer ${token}`, - Accept: 'application/json', - ...(payload - ? { - 'Content-Type': 'application/json', - 'Content-Length': Buffer.byteLength(payload), - } - : {}), - }, - }, - (response) => { - const chunks: Buffer[] = []; - - response.on('data', (chunk) => chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk))); - response.on('end', () => { - const text = Buffer.concat(chunks).toString('utf8'); - const data = text ? JSON.parse(text) : {}; - - if ((response.statusCode || 500) >= 400) { - const message = data.error || `Updater request failed with ${response.statusCode}`; - reject(new Error(message)); - return; - } - - resolve(data as T); - }); - } - ); - - request.setTimeout(REQUEST_TIMEOUT_MS, () => { - request.destroy(new Error('Host updater request timed out')); - }); - - request.on('error', (error) => { - reject(error); - }); - - if (payload) { - request.write(payload); - } - - request.end(); - }); -} - -export async function getHostUpdaterStatus(): Promise { - const config = getUpdaterConfig(); - if (!config.enabled) { - return { - available: false, - status: 'unavailable', - message: 'Host updater is not configured for this install.', - }; - } - - try { - const status = await requestUpdater('GET', '/status'); - return { - ...status, - available: true, - }; - } catch (error) { - return { - available: false, - status: 'unavailable', - message: error instanceof Error ? error.message : 'Host updater is unavailable.', - }; - } -} - -export async function triggerHostUpdate() { - return requestUpdater<{ ok: boolean; status: string; message?: string }>('POST', '/update'); -} - -export async function updateHostUpdaterConfig(autoUpdateEnabled: boolean) { - return requestUpdater<{ ok: boolean; config: { autoUpdateEnabled: boolean; intervalMinutes: number } }>( - 'PATCH', - '/config', - { autoUpdateEnabled } - ); -} diff --git a/src/lib/swarm/discovery.ts b/src/lib/swarm/discovery.ts index 726bb32..53a8fec 100644 --- a/src/lib/swarm/discovery.ts +++ b/src/lib/swarm/discovery.ts @@ -22,7 +22,7 @@ function normalizeOptionalUrl(value: string | null | undefined): string | undefi * Build this node's announcement payload */ export async function buildAnnouncement(): Promise { - const domain = process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:3000'; + const domain = process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:43821'; let name = 'Synapsis Node'; let description: string | undefined; @@ -35,7 +35,7 @@ export async function buildAnnouncement(): Promise { if (db) { // Get node info const node = await db.query.nodes.findFirst({ - where: eq(nodes.domain, domain), + where: { domain: domain }, }); if (node) { diff --git a/src/lib/swarm/gossip.ts b/src/lib/swarm/gossip.ts index 6b9db31..e6b95c8 100644 --- a/src/lib/swarm/gossip.ts +++ b/src/lib/swarm/gossip.ts @@ -25,7 +25,7 @@ import { buildAnnouncement } from './discovery'; * Build a gossip payload to send to another node */ export async function buildGossipPayload(since?: string): Promise { - const ourDomain = process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:3000'; + const ourDomain = process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:43821'; // Get nodes to share let nodes: SwarmNodeInfo[]; @@ -56,8 +56,8 @@ export async function buildGossipPayload(since?: string): Promise [desc(handleRegistry.updatedAt)], limit: SWARM_CONFIG.maxHandlesPerGossip, }); diff --git a/src/lib/swarm/identity-cache.ts b/src/lib/swarm/identity-cache.ts index 6a14770..70194c0 100644 --- a/src/lib/swarm/identity-cache.ts +++ b/src/lib/swarm/identity-cache.ts @@ -20,7 +20,7 @@ interface IdentityCacheEntry { */ export async function getCachedIdentity(did: string): Promise { const cached = await db.query.remoteIdentityCache.findFirst({ - where: eq(remoteIdentityCache.did, did), + where: { did: did }, }); return cached || null; diff --git a/src/lib/swarm/interactions.ts b/src/lib/swarm/interactions.ts index 48f7a7c..36fb6ec 100644 --- a/src/lib/swarm/interactions.ts +++ b/src/lib/swarm/interactions.ts @@ -465,7 +465,7 @@ export async function cacheSwarmUserPosts( // Check if we already have this post const existing = await db.query.remotePosts.findFirst({ - where: eq(remotePosts.apId, apId), + where: { apId: apId }, }); if (existing) { @@ -673,7 +673,7 @@ export async function getSwarmFollowerDomains(userId: string): Promise if (!db) return []; const followers = await db.query.remoteFollowers.findMany({ - where: eq(remoteFollowers.userId, userId), + where: { userId: userId }, }); // Filter for swarm followers (actorUrl starts with swarm://) diff --git a/src/lib/swarm/node-blocklist.ts b/src/lib/swarm/node-blocklist.ts index 20183ff..4acdf96 100644 --- a/src/lib/swarm/node-blocklist.ts +++ b/src/lib/swarm/node-blocklist.ts @@ -17,7 +17,7 @@ export async function isNodeBlocked(domain: string | null | undefined): Promise< if (!normalized) return false; const node = await db.query.swarmNodes.findFirst({ - where: eq(swarmNodes.domain, normalized), + where: { domain: normalized }, columns: { isBlocked: true, }, @@ -30,7 +30,7 @@ export async function getBlockedNodeDomains(): Promise> { if (!db) return new Set(); const rows = await db.query.swarmNodes.findMany({ - where: eq(swarmNodes.isBlocked, true), + where: { isBlocked: true }, columns: { domain: true, }, @@ -46,10 +46,7 @@ export async function filterBlockedDomains(domains: string[]): Promise if (normalized.length === 0) return []; const blocked = await db.query.swarmNodes.findMany({ - where: and( - inArray(swarmNodes.domain, normalized), - eq(swarmNodes.isBlocked, true), - ), + where: { AND: [{ domain: { in: normalized } }, { isBlocked: true }] }, columns: { domain: true, }, @@ -66,7 +63,7 @@ export async function upsertBlockedNode(domain: string, reason?: string | null) if (!normalized) return null; const existing = await db.query.swarmNodes.findFirst({ - where: eq(swarmNodes.domain, normalized), + where: { domain: normalized }, }); if (existing) { @@ -105,7 +102,7 @@ export async function unblockNode(domain: string) { if (!normalized) return null; const existing = await db.query.swarmNodes.findFirst({ - where: eq(swarmNodes.domain, normalized), + where: { domain: normalized }, }); if (!existing) return null; diff --git a/src/lib/swarm/node-keys.ts b/src/lib/swarm/node-keys.ts index eff9017..9e4a8c2 100644 --- a/src/lib/swarm/node-keys.ts +++ b/src/lib/swarm/node-keys.ts @@ -68,11 +68,11 @@ export async function getNodeKeypair(): Promise<{ privateKey: string; publicKey: throw new Error('Database not available'); } - const domain = process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:3000'; + const domain = process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:43821'; // Try to get existing node let node = await db.query.nodes.findFirst({ - where: eq(nodes.domain, domain), + where: { domain: domain }, }); // If node doesn't exist, create it @@ -118,9 +118,9 @@ export async function getNodeKeypair(): Promise<{ privateKey: string; publicKey: export async function getNodePublicKey(): Promise { if (!db) return null; - const domain = process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:3000'; + const domain = process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:43821'; const node = await db.query.nodes.findFirst({ - where: eq(nodes.domain, domain), + where: { domain: domain }, }); if (!node?.publicKey) { diff --git a/src/lib/swarm/registry.ts b/src/lib/swarm/registry.ts index 1b93fd7..921d720 100644 --- a/src/lib/swarm/registry.ts +++ b/src/lib/swarm/registry.ts @@ -22,7 +22,7 @@ export async function upsertSwarmNode( } const existing = await db.query.swarmNodes.findFirst({ - where: eq(swarmNodes.domain, normalizeNodeDomain(node.domain)), + where: { domain: normalizeNodeDomain(node.domain) }, }); const normalizedDomain = normalizeNodeDomain(node.domain); @@ -110,11 +110,8 @@ export async function getActiveSwarmNodes(limit = 100): Promise } const nodes = await db.query.swarmNodes.findMany({ - where: and( - eq(swarmNodes.isActive, true), - eq(swarmNodes.isBlocked, false), - ), - orderBy: [desc(swarmNodes.lastSeenAt)], + where: { AND: [{ isActive: true }, { isBlocked: false }] }, + orderBy: () => [desc(swarmNodes.lastSeenAt)], limit, }); @@ -131,12 +128,8 @@ export async function getNodesForGossip(count: number): Promise // Get active nodes with decent trust scores, ordered randomly const nodes = await db.query.swarmNodes.findMany({ - where: and( - eq(swarmNodes.isActive, true), - eq(swarmNodes.isBlocked, false), - gt(swarmNodes.trustScore, 20) - ), - orderBy: sql`RANDOM()`, + where: { AND: [{ isActive: true }, { isBlocked: false }, { trustScore: { gt: 20 } }] }, + orderBy: () => sql`RANDOM()`, limit: count, }); @@ -152,11 +145,8 @@ export async function getNodesSince(since: Date, limit = 100): Promise [desc(swarmNodes.updatedAt)], limit, }); @@ -173,7 +163,7 @@ export async function markNodeFailure(domain: string): Promise { try { const node = await db.query.swarmNodes.findFirst({ - where: eq(swarmNodes.domain, domain), + where: { domain: domain }, }); if (!node) return; @@ -209,7 +199,7 @@ export async function markNodeSuccess(domain: string): Promise { try { const node = await db.query.swarmNodes.findFirst({ - where: eq(swarmNodes.domain, domain), + where: { domain: domain }, }); if (!node) return; @@ -274,8 +264,8 @@ export async function getSeedNodes(): Promise { } const seeds = await db.query.swarmSeeds.findMany({ - where: eq(swarmSeeds.isEnabled, true), - orderBy: [swarmSeeds.priority], + where: { isEnabled: true }, + orderBy: () => [swarmSeeds.priority], }); if (seeds.length === 0) { diff --git a/src/lib/swarm/reposts.ts b/src/lib/swarm/reposts.ts index 837d56f..7ac74cc 100644 --- a/src/lib/swarm/reposts.ts +++ b/src/lib/swarm/reposts.ts @@ -21,11 +21,7 @@ export async function getViewerSwarmRepostedPostIds( const originalPostIds = Array.from(new Set(targets.map((target) => target.originalPostId))); const rows = await db.query.userSwarmReposts.findMany({ - where: and( - eq(userSwarmReposts.userId, viewerId), - inArray(userSwarmReposts.nodeDomain, domains), - inArray(userSwarmReposts.originalPostId, originalPostIds), - ), + where: { AND: [{ userId: viewerId }, { nodeDomain: { in: domains } }, { originalPostId: { in: originalPostIds } }] }, }); const rowKeys = new Set(rows.map((row) => `${row.nodeDomain}:${row.originalPostId}`)); diff --git a/src/lib/swarm/signature.ts b/src/lib/swarm/signature.ts index 0a218c4..9f85adb 100644 --- a/src/lib/swarm/signature.ts +++ b/src/lib/swarm/signature.ts @@ -141,7 +141,7 @@ export async function verifyUserInteraction( // Try to get cached user const fullHandle = `${userHandle}@${normalizedDomain}`; let user = await db?.query.users.findFirst({ - where: eq(users.handle, fullHandle), + where: { handle: fullHandle }, }); let publicKey: string | null = null; diff --git a/src/lib/swarm/user-cache.ts b/src/lib/swarm/user-cache.ts index 4fecef2..7a9d9b7 100644 --- a/src/lib/swarm/user-cache.ts +++ b/src/lib/swarm/user-cache.ts @@ -21,10 +21,7 @@ export async function upsertRemoteUser(profile: RemoteProfile): Promise { try { // Check if user already exists const existing = await db.query.users.findFirst({ - where: or( - eq(users.did, profile.did), - eq(users.handle, profile.handle), - ), + where: { OR: [{ did: profile.did }, { handle: profile.handle }] }, }); if (existing) { diff --git a/src/lib/turnstile.ts b/src/lib/turnstile.ts index 2f17160..8d05902 100644 --- a/src/lib/turnstile.ts +++ b/src/lib/turnstile.ts @@ -4,9 +4,9 @@ import { eq } from 'drizzle-orm'; export async function verifyTurnstileToken(token: string, ip?: string): Promise { try { // Get node settings to check if Turnstile is enabled - const domain = process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:3000'; + const domain = process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:43821'; const node = await db.query.nodes.findFirst({ - where: eq(nodes.domain, domain), + where: { domain: domain }, }); // If no secret key is configured, skip verification (Turnstile is disabled) @@ -38,9 +38,9 @@ export async function verifyTurnstileToken(token: string, ip?: string): Promise< export async function getTurnstileSiteKey(): Promise { try { - const domain = process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:3000'; + const domain = process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:43821'; const node = await db.query.nodes.findFirst({ - where: eq(nodes.domain, domain), + where: { domain: domain }, }); return node?.turnstileSiteKey || null; diff --git a/src/lib/utils/handle.ts b/src/lib/utils/handle.ts index 0555829..d638c83 100644 --- a/src/lib/utils/handle.ts +++ b/src/lib/utils/handle.ts @@ -1,7 +1,7 @@ import { useDomain } from '@/lib/contexts/ConfigContext'; // Build-time domain fallback (for SSR/non-React contexts) -export const NODE_DOMAIN = process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:3000'; +export const NODE_DOMAIN = process.env.NEXT_PUBLIC_NODE_DOMAIN || 'localhost:43821'; /** * Formats a handle into its full federated form: @user@domain diff --git a/src/lib/version.ts b/src/lib/version.ts index 0a2417e..ec9a3cf 100644 --- a/src/lib/version.ts +++ b/src/lib/version.ts @@ -1,241 +1,15 @@ import packageJson from '../../package.json'; -const DEFAULT_IMAGE_REPO = 'ghcr.io/gnosyslabs/synapsis'; -const VERSION_CACHE_TTL_MS = 5 * 60 * 1000; - export interface BuildInfo { version: string; commit: string | null; buildDate: string | null; - githubUrl: string | null; - imageDigest: string | null; - imageRepo: string; - sourceRepo: string; -} - -type CachedLatest = { - expiresAt: number; - value: PublishedBuildInfo | null; -}; - -export interface PublishedBuildInfo extends BuildInfo { - tag: string; -} - -let latestVersionCache: CachedLatest | null = null; - -function normalizeImageRepo(value: string): string { - if (!value) { - return DEFAULT_IMAGE_REPO; - } - - return value.startsWith('ghcr.io/') ? value : `ghcr.io/${value}`; -} - -function imageRepoPath(value: string): string { - return normalizeImageRepo(value).replace(/^ghcr\.io\//, ''); -} - -function buildGithubUrl(sourceRepo: string, commit: string | null): string | null { - if (!commit || !sourceRepo) { - return null; - } - - return `${sourceRepo.replace(/\/$/, '')}/commit/${commit}`; } export function getCurrentBuildInfo(): BuildInfo { - const sourceRepo = process.env.APP_SOURCE_REPO || 'https://github.com/GnosysLabs/Synapsis'; - const version = process.env.APP_VERSION || packageJson.version || 'dev'; - const commit = process.env.APP_COMMIT || null; - const buildDate = process.env.APP_BUILD_DATE || null; - const imageDigest = process.env.APP_IMAGE_DIGEST || null; - const imageRepo = normalizeImageRepo(process.env.APP_IMAGE_REPO || DEFAULT_IMAGE_REPO); - const githubUrl = process.env.APP_GITHUB_URL || buildGithubUrl(sourceRepo, commit); - return { - version, - commit, - buildDate, - githubUrl, - imageDigest, - imageRepo, - sourceRepo, + version: process.env.APP_VERSION || packageJson.version || 'dev', + commit: process.env.APP_COMMIT || null, + buildDate: process.env.APP_BUILD_DATE || null, }; } - -export function parseVersionTuple(version: string): [number, number, number, number] | null { - const match = /^(\d{4})\.(\d{2})\.(\d{2})\.(\d+)$/.exec(version); - if (!match) { - return null; - } - - return [ - Number(match[1]), - Number(match[2]), - Number(match[3]), - Number(match[4]), - ]; -} - -export function compareBuildVersions(a: string, b: string): number { - const aTuple = parseVersionTuple(a); - const bTuple = parseVersionTuple(b); - - if (!aTuple && !bTuple) { - return a.localeCompare(b); - } - if (!aTuple) { - return -1; - } - if (!bTuple) { - return 1; - } - - for (let i = 0; i < aTuple.length; i += 1) { - if (aTuple[i] !== bTuple[i]) { - return aTuple[i] - bTuple[i]; - } - } - - return 0; -} - -async function fetchGhcrToken(repoPath: string): Promise { - const tokenResponse = await fetch(`https://ghcr.io/token?scope=repository:${repoPath}:pull`, { - cache: 'no-store', - }); - - if (!tokenResponse.ok) { - return null; - } - - const tokenData = await tokenResponse.json(); - return tokenData.token || null; -} - -async function fetchRegistryJson( - repoPath: string, - reference: string, - accept: string, - token: string -) { - const response = await fetch(`https://ghcr.io/v2/${repoPath}/manifests/${reference}`, { - headers: { - Accept: accept, - Authorization: `Bearer ${token}`, - }, - cache: 'no-store', - }); - - if (!response.ok) { - throw new Error(`Registry request failed with ${response.status}`); - } - - return { - digest: response.headers.get('docker-content-digest'), - body: await response.json(), - }; -} - -async function fetchRegistryBlob(repoPath: string, digest: string, token: string) { - const response = await fetch(`https://ghcr.io/v2/${repoPath}/blobs/${digest}`, { - headers: { - Authorization: `Bearer ${token}`, - }, - cache: 'no-store', - }); - - if (!response.ok) { - throw new Error(`Registry blob request failed with ${response.status}`); - } - - return response.json(); -} - -async function loadLatestPublishedBuild(): Promise { - const current = getCurrentBuildInfo(); - const repoPath = imageRepoPath(current.imageRepo); - const token = await fetchGhcrToken(repoPath); - - if (!token) { - return null; - } - - const manifestAccept = [ - 'application/vnd.oci.image.index.v1+json', - 'application/vnd.docker.distribution.manifest.list.v2+json', - 'application/vnd.oci.image.manifest.v1+json', - 'application/vnd.docker.distribution.manifest.v2+json', - ].join(', '); - - const latestManifest = await fetchRegistryJson(repoPath, 'latest', manifestAccept, token); - const latestBody = latestManifest.body; - - let configDigest: string | undefined; - - if (Array.isArray(latestBody.manifests)) { - const platformManifest = - latestBody.manifests.find( - (manifest: any) => - manifest.platform?.os === 'linux' && manifest.platform?.architecture === 'amd64' - ) || - latestBody.manifests.find((manifest: any) => manifest.platform?.os && manifest.platform?.architecture); - - if (!platformManifest?.digest) { - return null; - } - - const platformManifestResponse = await fetchRegistryJson(repoPath, platformManifest.digest, manifestAccept, token); - configDigest = platformManifestResponse.body?.config?.digest; - } else { - configDigest = latestBody?.config?.digest; - } - - if (!configDigest) { - return null; - } - - const configBlob = await fetchRegistryBlob(repoPath, configDigest, token); - const labels = configBlob?.config?.Labels || {}; - const sourceRepo = labels['org.opencontainers.image.source'] || current.sourceRepo; - const commit = labels['org.opencontainers.image.revision'] || null; - const version = labels['org.opencontainers.image.version'] || null; - - if (!version) { - return null; - } - - return { - tag: 'latest', - version, - commit, - buildDate: labels['org.opencontainers.image.created'] || null, - githubUrl: buildGithubUrl(sourceRepo, commit), - imageDigest: latestManifest.digest || null, - imageRepo: current.imageRepo, - sourceRepo, - }; -} - -export async function getLatestPublishedBuild(): Promise { - if (latestVersionCache && latestVersionCache.expiresAt > Date.now()) { - return latestVersionCache.value; - } - - try { - const latest = await loadLatestPublishedBuild(); - latestVersionCache = { - expiresAt: Date.now() + VERSION_CACHE_TTL_MS, - value: latest, - }; - return latest; - } catch (error) { - console.error('[Version] Failed to fetch latest published build:', error); - latestVersionCache = { - expiresAt: Date.now() + VERSION_CACHE_TTL_MS, - value: null, - }; - return null; - } -}