[
  {
    "path": ".dockerignore",
    "content": "# Ignore Docker-related configs\n.dockerignore\ndocker-compose.yml\ndocker-compose*.yml\n\n# Development/Editor config\n.idea\n.vscode\n\n# Node-related\nnode_modules\nnpm-debug.log\nyarn-debug.log\nyarn-error.log\npnpm-debug.log\n\n# Next.js build output\n.next\nout\n\n\n\n# Docs and markdowns\nREADME.md\n*.md\n"
  },
  {
    "path": ".eslintrc.json",
    "content": "{\n  \"extends\": [\n    \"next/core-web-vitals\",\n    \"plugin:tailwindcss/recommended\"\n  ],\n  \"rules\": {\n    \"react/no-unescaped-entities\": \"off\",\n    \"react-hooks/rules-of-hooks\": \"off\"\n\n  }\n}\n"
  },
  {
    "path": ".github/CODE_OF_CONDUCT.md",
    "content": "# Contributor Covenant Code of Conduct\n\n## Our Pledge\n\nWe as members, contributors, and leaders pledge to make participation in our\ncommunity a harassment-free experience for everyone, regardless of age, body\nsize, visible or invisible disability, ethnicity, sex characteristics, gender\nidentity and expression, level of experience, education, socio-economic status,\nnationality, personal appearance, race, religion, or sexual identity\nand orientation.\n\nWe pledge to act and interact in ways that contribute to an open, welcoming,\ndiverse, inclusive, and healthy community.\n\n## Our Standards\n\nExamples of behavior that contributes to a positive environment for our\ncommunity include:\n\n* Demonstrating empathy and kindness toward other people\n* Being respectful of differing opinions, viewpoints, and experiences\n* Giving and gracefully accepting constructive feedback\n* Accepting responsibility and apologizing to those affected by our mistakes,\n  and learning from the experience\n* Focusing on what is best not just for us as individuals, but for the\n  overall community\n\nExamples of unacceptable behavior include:\n\n* The use of sexualized language or imagery, and sexual attention or\n  advances of any kind\n* Trolling, insulting or derogatory comments, and personal or political attacks\n* Public or private harassment\n* Publishing others' private information, such as a physical or email\n  address, without their explicit permission\n* Other conduct which could reasonably be considered inappropriate in a\n  professional setting\n\n## Enforcement Responsibilities\n\nCommunity leaders are responsible for clarifying and enforcing our standards of\nacceptable behavior and will take appropriate and fair corrective action in\nresponse to any behavior that they deem inappropriate, threatening, offensive,\nor harmful.\n\nCommunity leaders have the right and responsibility to remove, edit, or reject\ncomments, commits, code, wiki edits, issues, and other contributions that are\nnot aligned to this Code of Conduct, and will communicate reasons for moderation\ndecisions when appropriate.\n\n## Scope\n\nThis Code of Conduct applies within all community spaces, and also applies when\nan individual is officially representing the community in public spaces.\nExamples of representing our community include using an official e-mail address,\nposting via an official social media account, or acting as an appointed\nrepresentative at an online or offline event.\n\n## Enforcement\n\nInstances of abusive, harassing, or otherwise unacceptable behavior may be\nreported to the community leaders responsible for enforcement at\ncontact@portabase.io.\nAll complaints will be reviewed and investigated promptly and fairly.\n\nAll community leaders are obligated to respect the privacy and security of the\nreporter of any incident.\n\n## Enforcement Guidelines\n\nCommunity leaders will follow these Community Impact Guidelines in determining\nthe consequences for any action they deem in violation of this Code of Conduct:\n\n### 1. Correction\n\n**Community Impact**: Use of inappropriate language or other behavior deemed\nunprofessional or unwelcome in the community.\n\n**Consequence**: A private, written warning from community leaders, providing\nclarity around the nature of the violation and an explanation of why the\nbehavior was inappropriate. A public apology may be requested.\n\n### 2. Warning\n\n**Community Impact**: A violation through a single incident or series\nof actions.\n\n**Consequence**: A warning with consequences for continued behavior. No\ninteraction with the people involved, including unsolicited interaction with\nthose enforcing the Code of Conduct, for a specified period of time. This\nincludes avoiding interactions in community spaces as well as external channels\nlike social media. Violating these terms may lead to a temporary or\npermanent ban.\n\n### 3. Temporary Ban\n\n**Community Impact**: A serious violation of community standards, including\nsustained inappropriate behavior.\n\n**Consequence**: A temporary ban from any sort of interaction or public\ncommunication with the community for a specified period of time. No public or\nprivate interaction with the people involved, including unsolicited interaction\nwith those enforcing the Code of Conduct, is allowed during this period.\nViolating these terms may lead to a permanent ban.\n\n### 4. Permanent Ban\n\n**Community Impact**: Demonstrating a pattern of violation of community\nstandards, including sustained inappropriate behavior,  harassment of an\nindividual, or aggression toward or disparagement of classes of individuals.\n\n**Consequence**: A permanent ban from any sort of public interaction within\nthe community.\n\n## Attribution\n\nThis Code of Conduct is adapted from the [Contributor Covenant][homepage],\nversion 2.0, available at\nhttps://www.contributor-covenant.org/version/2/0/code_of_conduct.html.\n\nCommunity Impact Guidelines were inspired by [Mozilla's code of conduct\nenforcement ladder](https://github.com/mozilla/diversity).\n\n[homepage]: https://www.contributor-covenant.org\n\nFor answers to common questions about this code of conduct, see the FAQ at\nhttps://www.contributor-covenant.org/faq. Translations are available at\nhttps://www.contributor-covenant.org/translations."
  },
  {
    "path": ".github/CONTRIBUTING.md",
    "content": "---\n\n# Contributing to Portabase\n\nThank you for considering contributing to **Portabase!** 🎉 Contributions help make this project better for everyone.\n\nPlease take a moment to review this guide. It will help you understand how to contribute effectively.\n\n---\n\n## Table of Contents\n\n1. [How to Get Started](#how-to-get-started)\n2. [Reporting Issues](#reporting-issues)\n3. [Submitting Changes](#submitting-changes)\n4. [Code Style Guidelines](#code-style-guidelines)\n5. [Pull Request Process](#pull-request-process)\n6. [Community Guidelines](#community-guidelines)\n\n---\n\n## How to Get Started\n\n1. **Fork the repository**  \n   Click the \"Fork\" button at the top-right corner of this repository.\n\n2. **Clone the repository**\n   ```bash\n   git clone https://github.com/Portabase/portabase\n   ```\n\n3. **Set up the development environment**  \n   Follow the steps in the `README.md` to install dependencies and configure the project.\n\n4. **Create a branch**  \n   Use the feature branch to work on changes.\n   ```bash\n   git checkout -b feature/<feature-name>\n   ```\n\n---\n\n## Reporting Issues\n\nIf you encounter a bug or have a suggestion for improvement, follow these steps:\n\n1. **Check existing issues** to avoid duplicates.\n2. **Open a new issue** if needed:\n    - Provide a clear and descriptive title.\n    - Describe the issue with steps to reproduce it (if applicable).\n    - Include relevant logs, screenshots, or code snippets.\n\n---\n\n## Submitting Changes\n\n1. **Ensure your branch is up to date**\n   ```bash\n   git pull origin main\n   ```\n\n2. **Write meaningful commit messages**  \n   Follow this format:\n   ```\n   [type] Summary of changes\n   ```\n   Example:\n   ```\n   feat: add user authentication\n   fix: resolve crash on login page\n   ```\n\n3. **Push your branch**\n   ```bash\n   git push origin feat/<feature-name>\n   ```\n\n4. **Open a Pull Request (PR)**  \n   Go to the repository on GitHub and click \"New Pull Request.\"\n\n---\n\n## Code Style Guidelines\n\n- Follow the [specific coding style guide] (e.g., Prettier, ESLint, PEP8,Biome).\n- Use meaningful variable names and include comments where necessary.\n- Tests before submitting your changes.\n\n---\n\n## Pull Request Process\n\n1. Ensure your code passes all tests and linters.\n2. Provide a clear description of what your PR does.\n3. Reference any related issues (e.g., `Closes #123`).\n4. Wait for a review from a maintainer.\n\n---\n\n## Community Guidelines\n\n- Be respectful and inclusive to all contributors.\n- Follow the [Code of Conduct](CODE_OF_CONDUCT.md).\n- Feel free to ask questions if you’re unsure about something.\n\n---\n\nThank you for contributing! 🙌\n\n---\n"
  },
  {
    "path": ".github/FUNDING.yml",
    "content": "# These are supported funding model platforms\n\ngithub: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]\npatreon: # Replace with a single Patreon username\nopen_collective: # Replace with a single Open Collective username\nko_fi: # Replace with a single Ko-fi username\ntidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel\ncommunity_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry\nliberapay: # Replace with a single Liberapay username\nissuehunt: # Replace with a single IssueHunt username\nlfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry\npolar: # Replace with a single Polar username\nbuy_me_a_coffee: portabase\nthanks_dev: # Replace with a single thanks.dev username\ncustom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/bug_report.md",
    "content": "---\nname: Bug report\nabout: Create a report to help us improve\ntitle: ''\nlabels: ''\nassignees: ''\n\n---\n\n**Describe the bug**\nA clear and concise description of what the bug is.\n\n**To Reproduce**\nSteps to reproduce the behavior:\n1. Go to '...'\n2. Click on '....'\n3. Scroll down to '....'\n4. See error\n\n**Expected behavior**\nA clear and concise description of what you expected to happen.\n\n**Screenshots**\nIf applicable, add screenshots to help explain your problem.\n\n**Desktop (please complete the following information):**\n - OS: [e.g. iOS]\n - Browser [e.g. chrome, safari]\n - Version [e.g. 22]\n\n**Smartphone (please complete the following information):**\n - Device: [e.g. iPhone6]\n - OS: [e.g. iOS8.1]\n - Browser [e.g. stock browser, safari]\n - Version [e.g. 22]\n\n**Additional context**\nAdd any other context about the problem here.\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/feature_request.md",
    "content": "---\nname: Feature request\nabout: Suggest an idea for this project\ntitle: ''\nlabels: ''\nassignees: ''\n\n---\n\n**Is your feature request related to a problem? Please describe.**\nA clear and concise description of what the problem is. Ex. I'm always frustrated when [...]\n\n**Describe the solution you'd like**\nA clear and concise description of what you want to happen.\n\n**Describe alternatives you've considered**\nA clear and concise description of any alternative solutions or features you've considered.\n\n**Additional context**\nAdd any other context or screenshots about the feature request here.\n"
  },
  {
    "path": ".github/SECURITY.md",
    "content": "\n---\n\n# Security Policy\n\n## Supported Versions\n\nWe take security seriously and aim to support the following versions of the project with security updates:\n\n| Version | Supported          |  \n|---------|--------------------|  \n| Latest  | ✅ Fully Supported |  \n\n---\n\n## Reporting a Vulnerability\n\nIf you discover a security vulnerability in this project, we appreciate your help in disclosing it responsibly.\n\n1. **Contact Us**  \n   Please report the vulnerability by emailing **[contact@portabase.io](mailto:contact@portabase.io)**. Include the following details:\n    - A detailed description of the issue.\n    - Steps to reproduce the vulnerability (if applicable).\n    - Any potential impacts or risks.\n\n2. **Response Time**  \n   We aim to respond to security reports within **72 hours**. Once the issue is verified, we will:\n    - Acknowledge receipt of your report.\n    - Provide a timeline for addressing the issue.\n    - Keep you informed throughout the process.\n\n3. **Public Disclosure**  \n   We will coordinate with you before publicly disclosing the vulnerability. Credit will be given to the reporter unless otherwise requested.\n\n---\n\n## Security Best Practices\n\nWe encourage all users to:\n- Use the latest stable version of the project.\n- Review the project’s dependencies and update them regularly.\n- Follow secure coding practices when using this project.\n\n---\n\n## Thanks\n\nWe thank the security community for their vigilance and help in keeping this project secure!\n\n---"
  },
  {
    "path": ".github/workflows/discord.yml",
    "content": "name: Discord Notification\n\non:\n  workflow_call:\n    inputs:\n      release_tag:\n        required: true\n        type: string\n      discord_title:\n        required: true\n        type: string\n      discord_color:\n        required: true\n        type: number\n      discord_footer:\n        required: true\n        type: string\n    secrets:\n      DISCORD_WEBHOOK:\n        required: true\n      GH_TOKEN:\n        required: true\n\njobs:\n  notify-discord:\n    runs-on: ubuntu-latest\n    steps:\n      - name: Send Discord Notification\n        env:\n          DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}\n          GH_TOKEN: ${{ secrets.GH_TOKEN }}\n        run: |\n          RELEASE_INFO=$(gh release view \"${{ inputs.release_tag }}\" -R ${{ github.repository }} --json name,url,body,author)\n\n          RELEASE_TITLE=$(echo \"$RELEASE_INFO\" | jq -r .name)\n          if [ -z \"$RELEASE_TITLE\" ] || [ \"$RELEASE_TITLE\" = \"null\" ]; then RELEASE_TITLE=\"${{ inputs.release_tag }}\"; fi\n\n          RELEASE_URL=$(echo \"$RELEASE_INFO\" | jq -r .url)\n          RELEASE_BODY=$(echo \"$RELEASE_INFO\" | jq -r .body)\n\n          AUTHOR_NAME=\"Portabase\"\n          AUTHOR_ICON=\"https://github.com/Portabase.png\"\n\n          PAYLOAD=$(jq -n \\\n            --arg title \"$RELEASE_TITLE\" \\\n            --arg description \"$RELEASE_BODY\" \\\n            --arg url \"$RELEASE_URL\" \\\n            --arg author \"$AUTHOR_NAME\" \\\n            --arg icon \"$AUTHOR_ICON\" \\\n            --arg discord_title \"${{ inputs.discord_title }}\" \\\n            --arg discord_footer \"${{ inputs.discord_footer }}\" \\\n            --argjson discord_color ${{ inputs.discord_color }} \\\n            '{\n              content: $discord_title,\n              embeds: [{\n                title: $title,\n                url: $url,\n                description: $description,\n                color: $discord_color,\n                author: {\n                  name: $author,\n                  icon_url: $icon\n                },\n                footer: {\n                  text: $discord_footer\n                }\n              }]\n            }'\n          )\n\n          curl -H \"Content-Type: application/json\" \\\n               -d \"$PAYLOAD\" \\\n               \"$DISCORD_WEBHOOK\"\n"
  },
  {
    "path": ".github/workflows/docker.yml",
    "content": "name: Docker Publish\n\non:\n  workflow_call:\n    inputs:\n      version:\n        required: true\n        type: string\n      ref:\n        required: true\n        type: string\n      image_name:\n        required: false\n        type: string\n        default: \"portabase/portabase\"\n      add_latest:\n        required: false\n        type: boolean\n        default: false\n      target:\n        required: false\n        type: string\n        default: \"prod\"\n      dockerfile:\n        required: false\n        type: string\n        default: \"./docker/dockerfile/Dockerfile\"\n    secrets:\n      DOCKER_USERNAME:\n        required: true\n      DOCKER_PASSWORD:\n        required: true\n\njobs:\n  build:\n    name: Build architectures\n    runs-on: ${{ matrix.platform == 'linux/amd64' && 'ubuntu-latest' || 'ubuntu-24.04-arm' }}\n    strategy:\n      fail-fast: false\n      matrix:\n        platform: [ linux/amd64, linux/arm64 ]\n    steps:\n      - name: Checkout\n        uses: actions/checkout@v4\n        with:\n          ref: ${{ inputs.ref }}\n          fetch-depth: 0\n\n      - name: Set up Docker Buildx\n        uses: docker/setup-buildx-action@v3\n\n      - name: Login to Docker\n        uses: docker/login-action@v3\n        with:\n          username: ${{ secrets.DOCKER_USERNAME }}\n          password: ${{ secrets.DOCKER_PASSWORD }}\n\n      - name: Prepare Image Tags\n        id: prep\n        run: |\n          ARCH=${{ matrix.platform == 'linux/amd64' && 'amd64' || 'arm64' }}\n          echo \"image=${{ inputs.image_name }}:${{inputs.version}}-$ARCH\" >> $GITHUB_OUTPUT\n          echo \"safe_platform=${{ matrix.platform == 'linux/amd64' && 'linux-amd64' || 'linux-arm64' }}\" >> $GITHUB_OUTPUT\n\n\n      - name: Build and push image\n        uses: docker/build-push-action@v6\n        with:\n          context: .\n          file: ${{ inputs.dockerfile }}\n          platforms: ${{ matrix.platform }}\n          push: true\n          tags: ${{ steps.prep.outputs.image }}\n          target: ${{ inputs.target }}\n          cache-from: type=gha,scope=build-${{ matrix.platform }}\n          cache-to: type=gha,mode=max,scope=build-${{ matrix.platform }}\n\n      - name: Save image name for manifest\n        run: echo \"${{ steps.prep.outputs.image }}\" > image.txt\n\n      - uses: actions/upload-artifact@v4\n        with:\n          name: image-${{ steps.prep.outputs.safe_platform }}\n          path: image.txt\n          retention-days: 1\n\n  create-manifest:\n    name: Create multi-arch manifest\n    runs-on: ubuntu-latest\n    needs: build\n    steps:\n      - uses: actions/download-artifact@v4\n        with:\n          name: image-linux-amd64\n          path: /tmp/digests/amd64\n\n      - uses: actions/download-artifact@v4\n        with:\n          name: image-linux-arm64\n          path: /tmp/digests/arm64\n\n      - name: Login to Docker\n        uses: docker/login-action@v3\n        with:\n          username: ${{ secrets.DOCKER_USERNAME }}\n          password: ${{ secrets.DOCKER_PASSWORD }}\n\n      - name: Generate semantic tags\n        id: tags\n        run: |\n          VERSION=\"${{ inputs.version }}\"\n          IFS='.' read -r MAJOR MINOR PATCH <<< \"$VERSION\"\n          \n          echo \"VERSION_TAG=$VERSION\" >> $GITHUB_OUTPUT\n          if [ -n \"$MINOR\" ]; then\n            echo \"MINOR_TAG=$MAJOR.$MINOR\" >> $GITHUB_OUTPUT\n          fi\n          if [ -n \"$MAJOR\" ]; then\n            echo \"MAJOR_TAG=$MAJOR\" >> $GITHUB_OUTPUT\n          fi\n          if [ \"${{ inputs.add_latest }}\" = \"true\" ]; then\n            echo \"LATEST_TAG=latest\" >> $GITHUB_OUTPUT\n          fi\n\n      - name: Extract Docker metadata\n        id: meta\n        uses: docker/metadata-action@v5\n        with:\n          images: ${{ inputs.image_name }}\n          tags: |\n            type=raw,value=${{ steps.tags.outputs.VERSION_TAG }}\n            type=raw,value=${{ steps.tags.outputs.MINOR_TAG }}\n            type=raw,value=${{ steps.tags.outputs.MAJOR_TAG }}\n            type=raw,value=${{ steps.tags.outputs.LATEST_TAG }}\n\n      - name: Create and push manifest list\n        working-directory: /tmp/digests\n        run: |\n          DOCKER_IMAGES=\"$(cat amd64/image.txt) $(cat arm64/image.txt)\"\n          TAG_ARGS=$(jq -cr '.tags | map(\"-t \" + .) | join(\" \")' <<< \"$DOCKER_METADATA_OUTPUT_JSON\")\n          echo $TAG_ARGS\n          docker buildx imagetools create $TAG_ARGS $DOCKER_IMAGES\n"
  },
  {
    "path": ".github/workflows/e2e.yml",
    "content": "name: End-to-end testing\n\non:\n  pull_request:\n    branches: [main]\n\njobs:\n  build-and-test:\n    runs-on: ubuntu-latest\n    if: github.event.pull_request.head.repo.full_name == github.repository\n\n    steps:\n      - uses: actions/checkout@v4\n\n      - name: Setup pnpm\n        uses: pnpm/action-setup@v4\n\n      - name: Setup Node.js\n        uses: actions/setup-node@v4\n        with:\n          node-version: 22\n          cache: 'pnpm'\n\n      - name: Install dependencies\n        run: pnpm install --frozen-lockfile\n\n      - name: Build Docker image\n        uses: docker/build-push-action@v6\n        with:\n          context: .\n          file: ./docker/dockerfile/Dockerfile\n          push: false\n          load: true\n          tags: portabase/portabase:test\n\n      - name: Run app container\n        run: |\n          docker run -d --name myapp \\\n            -p 8887:80 \\\n            -e NODE_ENV=production \\\n            -e PROJECT_URL=http://localhost:8887 \\\n            -e PROJECT_SECRET=80af5e4c875dfded3a6ba511c6ed8b0160cad723f848ee0851403ed6141f6ba1 \\\n            portabase/portabase:test\n\n      - name: Wait for app port to be listening\n        run: |\n          for i in {1..40}; do\n          \n            if curl -fsS http://localhost:8887/ >/dev/null; then\n              echo \"App is responding on port 8887\"\n              exit 0\n            fi\n            echo \"Waiting for app readiness... ($i/40)\"\n            sleep 2\n          done\n          echo \"Timeout: app never became ready\"\n          docker logs myapp\n          exit 1\n\n      - name: Install Playwright browsers\n        run: pnpm exec playwright install --with-deps chromium\n\n      - name: Run Playwright tests\n        run: pnpm exec playwright test\n        env:\n          PROJECT_URL: http://localhost:8887\n          # E2E Notification\n          E2E_NOTIFICATION_SMTP_HOST: ${{ secrets.E2E_NOTIFICATION_SMTP_HOST }}\n          E2E_NOTIFICATION_SMTP_PORT: ${{ secrets.E2E_NOTIFICATION_SMTP_PORT }}\n          E2E_NOTIFICATION_SMTP_USER: ${{ secrets.E2E_NOTIFICATION_SMTP_USER }}\n          E2E_NOTIFICATION_SMTP_PASSWORD: ${{ secrets.E2E_NOTIFICATION_SMTP_PASSWORD }}\n          E2E_NOTIFICATION_SMTP_FROM: ${{ secrets.E2E_NOTIFICATION_SMTP_FROM }}\n          E2E_NOTIFICATION_SMTP_TO: ${{ secrets.E2E_NOTIFICATION_SMTP_TO }}\n          E2E_NOTIFICATION_SLACK_WEBHOOK: ${{ secrets.E2E_NOTIFICATION_SLACK_WEBHOOK }}\n          E2E_NOTIFICATION_DISCORD_WEBHOOK: ${{ secrets.E2E_NOTIFICATION_DISCORD_WEBHOOK }}\n          E2E_NOTIFICATION_TELEGRAM_BOT_TOKEN: ${{ secrets.E2E_NOTIFICATION_TELEGRAM_BOT_TOKEN }}\n          E2E_NOTIFICATION_TELEGRAM_CHAT_ID: ${{ secrets.E2E_NOTIFICATION_TELEGRAM_CHAT_ID }}\n          E2E_NOTIFICATION_TELEGRAM_TOPIC_ID: ${{ secrets.E2E_NOTIFICATION_TELEGRAM_TOPIC_ID }}\n          E2E_NOTIFICATION_GOTIFY_SERVER_URL: ${{ secrets.E2E_NOTIFICATION_GOTIFY_SERVER_URL }}\n          E2E_NOTIFICATION_GOTIFY_APP_TOKEN: ${{ secrets.E2E_NOTIFICATION_GOTIFY_APP_TOKEN }}\n          E2E_NOTIFICATION_NTFY_TOPIC: ${{ secrets.E2E_NOTIFICATION_NTFY_TOPIC }}\n          E2E_NOTIFICATION_NTFY_SERVER_URL: ${{ secrets.E2E_NOTIFICATION_NTFY_SERVER_URL }}\n          E2E_NOTIFICATION_NTFY_TOKEN: ${{ secrets.E2E_NOTIFICATION_NTFY_TOKEN }}\n          E2E_NOTIFICATION_NTFY_USERNAME: ${{ secrets.E2E_NOTIFICATION_NTFY_USERNAME }}\n          E2E_NOTIFICATION_NTFY_PASSWORD: ${{ secrets.E2E_NOTIFICATION_NTFY_PASSWORD }}\n          E2E_NOTIFICATION_WEBHOOK_URL: ${{ secrets.E2E_NOTIFICATION_WEBHOOK_URL }}\n          E2E_NOTIFICATION_WEBHOOK_SECRET_HEADER: ${{ secrets.E2E_NOTIFICATION_WEBHOOK_SECRET_HEADER }}\n          E2E_NOTIFICATION_WEBHOOK_SECRET: ${{ secrets.E2E_NOTIFICATION_WEBHOOK_SECRET }}\n\n          # E2E Storage\n          E2E_STORAGE_AWS_S3_ENDPOINT_URL: ${{ secrets.E2E_STORAGE_AWS_S3_ENDPOINT_URL }}\n          E2E_STORAGE_AWS_S3_REGION: ${{ secrets.E2E_STORAGE_AWS_S3_REGION }}\n          E2E_STORAGE_AWS_S3_ACCESS_KEY: ${{ secrets.E2E_STORAGE_AWS_S3_ACCESS_KEY }}\n          E2E_STORAGE_AWS_S3_SECRET_KEY: ${{ secrets.E2E_STORAGE_AWS_S3_SECRET_KEY }}\n          E2E_STORAGE_AWS_S3_BUCKET_NAME: ${{ secrets.E2E_STORAGE_AWS_S3_BUCKET_NAME }}\n          E2E_STORAGE_AWS_S3_PORT: ${{ secrets.E2E_STORAGE_AWS_S3_PORT }}\n          E2E_STORAGE_R2_ENDPOINT_URL: ${{ secrets.E2E_STORAGE_R2_ENDPOINT_URL }}\n          E2E_STORAGE_R2_REGION: ${{ secrets.E2E_STORAGE_R2_REGION }}\n          E2E_STORAGE_R2_ACCESS_KEY: ${{ secrets.E2E_STORAGE_R2_ACCESS_KEY }}\n          E2E_STORAGE_R2_SECRET_KEY: ${{ secrets.E2E_STORAGE_R2_SECRET_KEY }}\n          E2E_STORAGE_R2_BUCKET_NAME: ${{ secrets.E2E_STORAGE_R2_BUCKET_NAME }}\n          E2E_STORAGE_R2_PORT: ${{ secrets.E2E_STORAGE_R2_PORT }}\n          E2E_STORAGE_GOOGLE_DRIVE_CLIENT_ID: ${{ secrets.E2E_STORAGE_GOOGLE_DRIVE_CLIENT_ID }}\n          E2E_STORAGE_GOOGLE_DRIVE_CLIENT_SECRET: ${{ secrets.E2E_STORAGE_GOOGLE_DRIVE_CLIENT_SECRET }}\n          E2E_STORAGE_GOOGLE_DRIVE_FOLDER_ID: ${{ secrets.E2E_STORAGE_GOOGLE_DRIVE_FOLDER_ID }}\n\n      - name: Upload report if failed\n        if: failure()\n        uses: actions/upload-artifact@v4\n        with:\n          name: playwright-report\n          path: playwright-report/\n          retention-days: 7\n\n      - name: Cleanup\n        if: always()\n        run: docker stop myapp && docker rm myapp || true"
  },
  {
    "path": ".github/workflows/helm.yml",
    "content": "name: Publish Helm Chart\non:\n  workflow_call:\n    inputs:\n      version:\n        required: true\n        type: string\n    secrets:\n      GH_TOKEN:\n        required: true\n\njobs:\n  publish-helm:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v4\n        with:\n          fetch-depth: 0\n\n      - name: Set up Helm\n        uses: azure/setup-helm@v4\n\n      - name: Package Helm chart\n        run: |\n          mkdir -p ./helm-packages\n          helm package helm \\\n            --version ${{ inputs.version }} \\\n            --app-version ${{ inputs.version }} \\\n            --destination ./helm-packages\n\n      - name: Authenticate to GitHub Packages\n        run: |\n          echo \"${{ secrets.GH_TOKEN }}\" | helm registry login ghcr.io -u ${{ github.actor }} --password-stdin\n\n      - name: Push Helm chart to GitHub Packages (OCI)\n        run: |\n          helm push ./helm-packages/portabase-${{ inputs.version }}.tgz oci://ghcr.io/portabase/charts"
  },
  {
    "path": ".github/workflows/release-candidate.yml",
    "content": "name: Publish Docker image for release candidate\n\non:\n  push:\n    tags:\n      - \"*.*.*-rc*\"\n      - \"!*-*-rc*\"\n\npermissions:\n  contents: read\n  packages: write\n\njobs:\n  docker_publish:\n    uses: ./.github/workflows/docker.yml\n    with:\n      add_latest: true\n    secrets:\n      DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME_2 }}\n      DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD_2 }}\n\n  discord_notification:\n    needs: docker_publish\n    uses: ./.github/workflows/discord.yml\n    with:\n      discord_title: \"New Release Candidate: ${{ github.ref_name }}\"\n      discord_color: 2044800\n      discord_footer: \"Portabase\"\n    secrets:\n      DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}\n      GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n"
  },
  {
    "path": ".github/workflows/release.yml",
    "content": "name: Auto Release & Publish\n\non:\n  pull_request_target:\n    types: [ closed ]\n    branches:\n      - main\n\npermissions:\n  contents: write\n  packages: write\n\njobs:\n\n  check-skip:\n    runs-on: ubuntu-latest\n    outputs:\n      skip: ${{ steps.set-skip.outputs.skip }}\n    steps:\n      - name: Determine if release should be skipped\n        id: set-skip\n        run: |\n          TITLE=\"${{ github.event.pull_request.title }}\"\n          echo \"PR title: $TITLE\"\n\n          if [[ \"$TITLE\" == *\"[skip-release]\"* ]]; then\n            echo \"PR title contains [skip-release], skipping release jobs.\"\n            echo \"skip=true\" >> $GITHUB_OUTPUT\n          else\n            echo \"skip=false\" >> $GITHUB_OUTPUT\n          fi\n\n  create-release:\n    needs: check-skip\n    if: ${{ needs.check-skip.outputs.skip == 'false' }}\n    runs-on: ubuntu-latest\n    outputs:\n      draft_tag: ${{ steps.release_step.outputs.draft_tag }}\n      version: ${{ steps.release_step.outputs.version }}\n    steps:\n      - uses: actions/create-github-app-token@v1\n        id: app-token\n        with:\n          app-id: ${{ vars.APP_ID }}\n          private-key: ${{ secrets.APP_PRIVATE_KEY }}\n\n      - uses: actions/checkout@v4\n        with:\n          fetch-depth: 0\n          token: ${{ steps.app-token.outputs.token }}\n          ref: main\n\n      - uses: pnpm/action-setup@v4\n      - uses: actions/setup-node@v4\n        with:\n          node-version: \"lts/*\"\n          cache: \"pnpm\"\n\n      - run: pnpm install --frozen-lockfile\n\n      - run: |\n          git config --global user.name 'github-actions[bot]'\n          git config --global user.email 'github-actions[bot]@users.noreply.github.com'\n\n\n      - name: Run release-it\n        id: release_step\n        run: |\n          git pull origin main\n          \n          VERSION=$(pnpm exec release-it --ci --release-version)\n          echo $VERSION\n          echo \"version=$VERSION\" >> $GITHUB_OUTPUT\n          \n          OUTPUT=$(pnpm exec release-it --ci)\n          echo \"$OUTPUT\"\n          \n          DRAFT_TAG=$(echo \"$OUTPUT\" | grep -oE 'untagged-[a-z0-9]+')\n          echo $DRAFT_TAG\n          echo \"draft_tag=$DRAFT_TAG\" >> $GITHUB_OUTPUT\n        env:\n          GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}\n\n\n  publish-docker:\n    needs: create-release\n    if: ${{ needs.create-release.result == 'success' }}\n    uses: ./.github/workflows/docker.yml\n    with:\n      version: ${{ needs.create-release.outputs.version }}\n      ref: ${{ needs.create-release.outputs.version }}\n      add_latest: true\n    secrets:\n      DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME_2 }}\n      DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD_2 }}\n\n  publish-helm:\n    needs: create-release\n    if: ${{ needs.create-release.result == 'success' }}\n    uses: ./.github/workflows/helm.yml\n    with:\n      version: ${{ needs.create-release.outputs.version }}\n    secrets:\n      GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n\n  finalize-release:\n    needs:\n      - create-release\n      - publish-docker\n      - publish-helm\n    runs-on: ubuntu-latest\n    outputs:\n      release_tag: ${{ steps.publish_release_step.outputs.release_tag }}\n    steps:\n      - uses: actions/checkout@v4\n        with:\n          fetch-depth: 0\n\n      - name: Publish GitHub Release\n        id: publish_release_step\n        env:\n          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n        run: |\n          OUTPUT=$(gh release edit ${{ needs.create-release.outputs.draft_tag }} --draft=false)\n          echo \"$OUTPUT\"\n          RELEASE_TAG=$(echo \"$OUTPUT\" | sed -E 's|.*/releases/tag/||')\n          echo \"release_tag=$RELEASE_TAG\" >> $GITHUB_OUTPUT\n\n  notify-discord:\n    needs:\n      - publish-docker\n      - publish-helm\n      - create-release\n      - finalize-release\n    uses: ./.github/workflows/discord.yml\n    with:\n      release_tag: ${{ needs.create-release.outputs.version }}\n      discord_title: \"New Release\"\n      discord_color: 3066993\n      discord_footer: \"Portabase\"\n    secrets:\n      DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}\n      GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}"
  },
  {
    "path": ".github/workflows/security.yml",
    "content": "name: Security Checks\non:\n  pull_request:\n  push:\n    branches: [ main ]\n\njobs:\n  sca-deps:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v4\n      - uses: aquasecurity/trivy-action@v0.35.0\n        with:\n          scan-type: 'fs'\n          format: 'table'\n          severity: 'CRITICAL,HIGH'\n          ignore-unfixed: true\n\n  secrets-gitleaks:\n    if: github.event.pull_request.head.repo.fork == false\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v4\n        with:\n          fetch-depth: 0\n      - uses: gitleaks/gitleaks-action@v2\n        env:\n          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n          GITLEAKS_LICENSE: ${{ secrets.GITLEAKS_LICENSE }}\n        with:\n          config-path: .gitleaks.toml"
  },
  {
    "path": ".gitignore",
    "content": "# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.\n.idea\n.vscode\n# dependencies\n/node_modules\n/.pnp\n.pnp.js\n#.yarn/install-state.gz\n\n# testing\n/coverage\n\n# next.js\n/.next/\n/out/\n\n# production\n/build\n\n# misc\n.DS_Store\n*.pem\n\n# debug\nnpm-debug.log*\nyarn-debug.log*\nyarn-error.log*\n\n# local env files\n.env*.local\n\n# vercel\n.vercel\n\n# typescript\n*.tsbuildinfo\nnext-env.d.ts\n\npublic/uploads/*\n!public/uploads/\n\nprivate/uploads/*\nprivate/keys/*\n\n/.env\n\nseeds/pocket-id/*.db\n\ncertificates\n\n# Playwright\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n/playwright/.auth/\n/e2e/local-storage.json\n"
  },
  {
    "path": ".gitleaks.toml",
    "content": "title = \"Custom gitleaks config\"\n\n[allowlist]\n# Global allowlist patterns (won’t be flagged)\nregexes = []\npaths = [\n    \"src/utils/init.ts\"\n]\n"
  },
  {
    "path": ".pre-commit-config.yaml",
    "content": "repos:\n  - repo: https://github.com/gitleaks/gitleaks\n    rev: v8.24.2\n    hooks:\n      - id: gitleaks"
  },
  {
    "path": ".release-it.json",
    "content": "{\n  \"github\": {\n    \"release\": true,\n    \"draft\": true,\n    \"tokenRef\": \"GITHUB_TOKEN\"\n  },\n  \"git\": {\n    \"commit\": true,\n    \"commitMessage\": \"chore: release ${version}\",\n    \"requireCleanWorkingDir\": true,\n    \"tag\": true,\n    \"tagName\": \"${version}\",\n    \"push\": true\n  },\n  \"plugins\": {\n    \"@release-it/conventional-changelog\": {\n      \"preset\": {\n        \"name\": \"conventionalcommits\",\n        \"types\": [\n          {\n            \"type\": \"feat\",\n            \"section\": \"✨ Features\"\n          },\n          {\n            \"type\": \"fix\",\n            \"section\": \"🐛 Bug Fixes\"\n          },\n          {\n            \"type\": \"perf\",\n            \"section\": \"⚡️ Performance Improvements\"\n          },\n          {\n            \"type\": \"revert\",\n            \"section\": \"⏪️ Reverts\"\n          },\n          {\n            \"type\": \"docs\",\n            \"section\": \"📝 Documentation\",\n            \"hidden\": true\n          },\n          {\n            \"type\": \"chore\",\n            \"section\": \"🔧 Chores\",\n            \"hidden\": true\n          }\n        ]\n      }\n    },\n    \"@release-it/bumper\": {\n      \"out\": {\n        \"file\": \"CITATION.cff\",\n        \"path\": \"version\",\n        \"type\": \"text/yaml\"\n      }\n    }\n  }\n}\n"
  },
  {
    "path": "CITATION.cff",
    "content": "cff-version: 1.2.0\ntitle: Portabase\nmessage: If you use this software, please cite it as below.\ntype: software\nauthors:\n  - family-names: Gauthereau\n    given-names: Charles\n  - family-names: Larcher\n    given-names: Killian\nrepository-code: https://github.com/Portabase/portabase\nurl: https://portabase.io\nabstract: >-\n  Portabase is a free, open-source, self-hosted solution for database\n  administration, providing backup and restore capabilities, scheduling,\n  retention policies, notifications, and support for multiple storage backends.\n  Its headless agent architecture enables connection to multiple database\n  instances securely and efficiently.\nkeywords:\n  - docker\n  - kubernetes\n  - backups\n  - postgresql\n  - mysql\n  - mariadb\n  - devops\n  - database\n  - monitoring\n  - s3\n  - self-hosted\n  - system-administration\n  - web-ui\n  - agent\nlicense: Apache-2.0\nversion: 1.13.0\ndate-released: '2026-03-02'\n"
  },
  {
    "path": "LICENSE",
    "content": "                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"[]\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright 2024 Portabase\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License."
  },
  {
    "path": "Makefile",
    "content": "CLUSTER_SCRIPT=docker/entrypoints/app-dev-entrypoint.sh\n\nup:\n\t@bash $(CLUSTER_SCRIPT)\n\nseed-keycloak:\n\t@[ $$(ls -1 seeds/keycloak/*.json 2>/dev/null | wc -l) -gt 0 ] || (echo \"No realm export found in seeds/keycloak. Add an export from Keycloak first.\"; exit 1)\n\t@docker compose -f docker-compose.func.yml stop keycloak >/dev/null 2>&1 || true\n\t@docker compose -f docker-compose.func.yml rm -f -s keycloak >/dev/null 2>&1 || true\n\t@docker volume rm portabase-dev-func_keycloak-data >/dev/null 2>&1 || true\n\t@docker compose -f docker-compose.func.yml up -d keycloak\n\t@echo \"Keycloak seed import triggered from seeds/keycloak/*.json\"\n\nseed-pocket:\n\t@[ -f seeds/pocket-id/portabase.zip ] || (echo \"No export found in seeds/pocket-id. Add an export from Pocket ID first.\"; exit 1)\n\t@docker compose -f docker-compose.func.yml stop pocket-id >/dev/null 2>&1 || true\n\t@docker compose -f docker-compose.func.yml rm -f -s pocket-id >/dev/null 2>&1 || true\n\t@docker volume rm portabase-dev-func_pocket-id-data >/dev/null 2>&1 || true\n\t@docker compose -f docker-compose.func.yml run --rm -v $$(pwd)/seeds/pocket-id/portabase.zip:/tmp/portabase.zip pocket-id ./pocket-id import --yes --path /tmp/portabase.zip >/dev/null\n\t@docker compose -f docker-compose.func.yml up -d pocket-id\n\t@sleep 2\n\t@docker compose -f docker-compose.func.yml exec pocket-id ./pocket-id one-time-access-token admin\n\t@echo \"Pocket ID data restored from seeds/pocket-id/portabase.zip\"\n\nseed-auth: seed-keycloak seed-pocket\n\npocket-token:\n\t@docker compose -f docker-compose.func.yml exec pocket-id ./pocket-id one-time-access-token admin\n\nexport-pocket:\n\t@echo \"Exporting Pocket ID data to seeds/pocket-id/portabase.zip...\"\n\t@mkdir -p ./seeds/pocket-id\n\t@docker compose -f docker-compose.func.yml exec pocket-id ./pocket-id export --path /tmp/portabase-export.zip\n\t@docker compose -f docker-compose.func.yml cp pocket-id:/tmp/portabase-export.zip ./seeds/pocket-id/portabase.zip\n\t@docker compose -f docker-compose.func.yml exec pocket-id rm /tmp/portabase-export.zip\n\t@echo \"Pocket ID data exported to seeds/pocket-id/portabase.zip\"\n\nexport-keycloak:\n\t@echo \"Exporting Keycloak configuration and users to seeds/keycloak/*.json...\"\n\t@mkdir -p ./seeds/keycloak\n\t@rm -f ./seeds/keycloak/*.json\n\t@docker compose -f docker-compose.func.yml stop keycloak >/dev/null 2>&1\n\t@docker rm -f kc-exporter >/dev/null 2>&1 || true\n\t@docker compose -f docker-compose.func.yml run --name kc-exporter keycloak export --dir /tmp/kc-export --users realm_file\n\t@docker cp kc-exporter:/tmp/kc-export/. ./seeds/keycloak/\n\t@docker rm -f kc-exporter >/dev/null 2>&1\n\t@docker compose -f docker-compose.func.yml start keycloak >/dev/null 2>&1\n\t@echo \"Keycloak configuration and users exported to seeds/keycloak/*.json\"\n\nend-to-end:\n\t@echo \"Starting E2E testing...\"\n\t@docker compose -f docker-compose.e2e.yml up -d\n\t@CI=true PROJECT_URL=http://localhost:8887 pnpm playwright test --project=chromium || (docker compose -f docker-compose.e2e.yml down --volumes && exit 1)\n\t@docker compose -f docker-compose.e2e.yml down --volumes\n\t@echo \"Finished E2E testing successfully.\"\n\ne2e-manual:\n\t@echo \"Starting E2E testing...\"\n\t@docker compose -f docker-compose.e2e.yml up -d\n\t@pnpm playwright test --ui || (docker compose -f docker-compose.e2e.yml down --volumes && exit 1)\n\t@docker compose -f docker-compose.e2e.yml down --volumes\n\t@echo \"Finished E2E testing successfully.\""
  },
  {
    "path": "README.md",
    "content": "<br />\n<div align=\"center\">\n  <a href=\"https://portabase.io\">\n    <img src=\"/.github/assets/logo.png\" alt=\"Logo\" width=\"80\" height=\"80\">\n  </a>\n\n<h3 align=\"center\">Portabase</h3>\n\n  <p align=\"center\" style=\"margin-top: 20px; font-style: italic;\">\n  <i>Portabase is a tool designed to simplify the backup and restoration of your database instances. It integrates seamlessly with <a href=\"https://github.com/Portabase/agent-rust\">Portabase agents</a> for managing operations securely and efficiently.</i>\n  </p>\n\n\n[![License: Apache](https://img.shields.io/badge/License-apache-yellow.svg)](LICENSE)\n[![Docker Pulls](https://img.shields.io/docker/pulls/portabase/portabase?color=brightgreen)](https://hub.docker.com/r/portabase/portabase)\n[![Helm Chart](https://img.shields.io/badge/Helm-Kubernetes-326ce5?logo=helm&logoColor=white)](https://github.com/Portabase/portabase/pkgs/container/charts%2Fportabase)\n[![Platform](https://img.shields.io/badge/platform-linux%20%7C%20macos%20%7C%20windows-lightgrey)](https://github.com/Portabase/portabase)\n[![Support Portabase](https://img.shields.io/badge/Support-Portabase-orange)](https://www.buymeacoffee.com/portabase)\n\n[![PostgreSQL](https://img.shields.io/badge/PostgreSQL-336791?logo=postgresql&logoColor=white)](https://www.postgresql.org/)\n[![MySQL](https://img.shields.io/badge/MySQL-4479A1?logo=mysql&logoColor=white)](https://www.mysql.com/)\n[![MariaDB](https://img.shields.io/badge/MariaDB-003545?logo=mariadb&logoColor=white)](https://mariadb.org/)\n[![SQLite](https://img.shields.io/badge/-SQLite-blue?logo=sqlite&logoColor=white)](https://sqlite.org/)\n[![Redis](https://img.shields.io/badge/Redis-DC382D?style=flat&logo=Redis&logoColor=white)](https://redis.io/)\n[![MongoDB](https://img.shields.io/badge/-MongoDB-13aa52?logo=mongodb&logoColor=white)](https://www.mongodb.com/)\n[![Valkey](https://img.shields.io/badge/Valkey-6284fc?style=flat&logo=Valkey&logoColor=white)](https://valkey.io/)\n[![Firebird](https://img.shields.io/badge/Firebird-f55b14?style=flat&logo=Firebird&logoColor=white)](https://firebirdsql.org/)\n\n[![Self Hosted](https://img.shields.io/badge/self--hosted-yes-brightgreen)](https://github.com/Portabase/portabase)\n[![Open Source](https://img.shields.io/badge/open%20source-❤️-red)](https://github.com/Portabase/portabase)\n\n[![NextJS][NextJS]][NextJS-url]\n[![BetterAuth][BetterAuth]][BetterAuth-url]\n[![Drizzle][Drizzle]][Drizzle-url]\n[![ShadcnUI][ShadcnUI]][ShadcnUI-url]\n[![Docker][Docker]][Docker-url]\n\n  <p>\n    <strong>\n        <a href=\"https://portabase.io\">Website</a> •\n        <a href=\"https://portabase.io/docs\">Documentation</a> •\n        <a href=\"https://www.youtube.com/watch?v=nSTzT27GgAg\">Demo</a> •\n        <a href=\"https://portabase.io/docs/dashboard/setup\">Installation</a> •\n        <a href=\"https://github.com/Portabase/portabase/issues/new?labels=bug&template=bug-report---.md\">Report Bug</a> •\n        <a href=\"https://github.com/Portabase/portabase/issues/new?labels=enhancement&template=feature-request---.md\">Request Feature</a>\n    </strong>\n  </p>\n\n![portabase-dashboard](https://github.com/user-attachments/assets/8f2c69d6-f1f9-4b80-b51c-01f6f13b9b62)\n\n\n</div>\n\n## Installation\n\nYou have 4 ways to install Portabase:\n\n- Automated CLI (recommended) - [details](https://portabase.io/docs/dashboard/setup#cli)\n- Docker Run - [details](https://portabase.io/docs/dashboard/setup#docker)\n- Docker Compose setup - [details](https://portabase.io/docs/dashboard/setup#docker-compose)\n- Kubernetes with Helm [details](https://portabase.io/docs/dashboard/setup#helm)\n- Development setup - [details](https://portabase.io/docs/dashboard/setup#development)\n\n**Ensure Docker is installed on your machine before getting started.**\n\n## Supported databases\n\n| Engine             | Support    | Supported Versions            | Restore |\n|:-------------------|:-----------|:------------------------------|:--------|\n| **PostgreSQL**     | ✅ Stable   | 12, 13, 14, 15, 16, 17 and 18 | Yes     |\n| **MySQL**          | ✅ Stable   | 5.7, 8 and 9                  | Yes     |\n| **MariaDB**        | ✅ Stable   | 10 and 11                     | Yes     |\n| **MongoDB**        | ✅ Stable   | 4, 5, 6, 7 and 8              | Yes     |\n| **SQLite**         | ✅ Stable   | 3.x                           | Yes     |\n| **Redis**          | ✅ Stable   | 2.8+                          | No      |\n| **Valkey**         | ✅ Stable   | 7.2+                          | No      |\n| **Firebird**       | ✅ Stable   | 3.0, 4.0, 5.0                 | Yes     |\n| **MSSQL Server**   | ❌ Ongoing  | -                             | Yes     |\n\nSee the [Database Servers documentation](https://portabase.io/docs/agent/db) for version-specific backup and restore details.\n\n## Contributors\n\n[![Contributors](https://contrib.rocks/image?repo=Portabase/portabase)](https://github.com/Portabase/portabase/graphs/contributors)\n\n[![\"Support Portabase\"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/portabase)\n\n## License\n\nDistributed under the Apache License. See `LICENSE.txt` for more details.\n\n\n[Docker]: https://img.shields.io/badge/Docker-2496ED?logo=docker&logoColor=fff&style=for-the-badge\n\n[NextJS]: https://img.shields.io/badge/next.js-000000?style=for-the-badge&logo=nextdotjs&logoColor=white\n\n[BetterAuth]: https://img.shields.io/badge/Better%20Auth-FFF?logo=betterauth&logoColor=000&style=for-the-badge\n\n[Drizzle]: https://img.shields.io/badge/Drizzle-111?style=for-the-badge&logo=Drizzle&logoColor=c5f74f\n\n[ShadcnUI]: https://img.shields.io/badge/shadcn/ui-000000?style=for-the-badge&logo=shadcn/ui&logoColor=white\n\n[NextJS-url]: https://nextjs.org/\n\n[BetterAuth-url]: https://www.better-auth.com/\n\n[Drizzle-url]: https://orm.drizzle.team/\n\n[ShadcnUI-url]: https://ui.shadcn.com/\n\n[Docker-url]: https://www.docker.com/\n"
  },
  {
    "path": "app/(auth)/forgot-password/page.tsx",
    "content": "import { CardContent, CardHeader } from \"@/components/ui/card\";\n\nimport { TooltipProvider } from \"@/components/ui/tooltip\";\nimport { ForgotPasswordForm } from \"@/components/wrappers/auth/login/forgot-password-form/forgot-password-form\";\nimport { env } from \"@/env.mjs\";\nimport { CardAuth } from \"@/features/layout/card-auth\";\nimport { redirect } from \"next/navigation\";\n\nexport default async function RoutePage(props: { searchParams: Promise<{ callbackUrl: string | undefined }> }) {\n    if (env.AUTH_EMAIL_PASSWORD_ENABLED !== \"true\") {\n        redirect(\"/login\");\n    }\n\n    return (\n        <TooltipProvider>\n            <CardAuth className=\"w-full\">\n                <CardHeader>\n                    <div className=\"grid gap-2 text-center mb-2\">\n                        <h1 className=\"text-3xl font-bold\">Reset password</h1>\n                        <p className=\"text-balance text-muted-foreground\">Enter your email address and we'll send you a link to reset your password.</p>\n                    </div>\n                </CardHeader>\n                <CardContent>\n                    <ForgotPasswordForm />\n                </CardContent>\n            </CardAuth>\n        </TooltipProvider>\n    );\n}\n"
  },
  {
    "path": "app/(auth)/guard/page.tsx",
    "content": "import {CardContent, CardHeader} from \"@/components/ui/card\";\nimport {TooltipProvider} from \"@/components/ui/tooltip\";\nimport {GuardForm} from \"@/components/wrappers/auth/guard/guard-form\";\nimport {cookies} from \"next/headers\";\nimport {redirect} from \"next/navigation\";\nimport {CardAuth} from \"@/features/layout/card-auth\";\n\nexport default async function GuardPage() {\n\n    const cookieStore = await cookies();\n    const token = cookieStore.get(\"better-auth.two_factor\")?.value || cookieStore.get(\"__Secure-better-auth.two_factor\")?.value;\n    \n    if (!token) {\n        redirect(\"/login\");\n    }\n\n    return (\n        <TooltipProvider>\n            <CardAuth className=\"w-full\">\n                <CardHeader>\n                    <div className=\"grid gap-2 text-center mb-2\">\n                        <h1 className=\"text-3xl font-bold\">Two-factor verification</h1>\n                        <p className=\"text-balance text-muted-foreground\">Please enter the verification code generated\n                            by your authentication app.</p>\n                    </div>\n                </CardHeader>\n                <CardContent>\n                    <GuardForm/>\n                </CardContent>\n            </CardAuth>\n        </TooltipProvider>\n    );\n}\n"
  },
  {
    "path": "app/(auth)/layout.tsx",
    "content": "import React from \"react\";\nimport { redirect } from \"next/navigation\";\nimport { currentUser } from \"@/lib/auth/current-user\";\nimport { AuthLogoSection } from \"@/components/wrappers/auth/auth-logo-section\";\nimport { Heart } from \"lucide-react\";\n\nexport default async function Layout({\n  children,\n}: {\n  children: React.ReactNode;\n}) {\n  const user = await currentUser();\n\n  if (user && !user.banned && user.role !== \"pending\") {\n    redirect(\"/dashboard/home\");\n  }\n\n  return (\n    <div className=\"flex min-h-screen flex-col justify-between py-10 sm:px-6 lg:px-8 \">\n      <div className=\"flex flex-col items-center justify-center flex-1\">\n        <div className=\"mx-auto w-full max-w-md\">\n          <AuthLogoSection />\n          <div className=\"mt-4\">{children}</div>\n        </div>\n      </div>\n      <footer className=\"mt-8 text-center text-xs text-muted-foreground flex flex-col gap-1\">\n        <p className=\"flex items-center justify-center gap-1\">\n          Made with{\" \"}\n          <Heart className=\"size-3 fill-red-500 text-red-500 animate-pulse\" />{\" \"}\n          by <span className=\"font-medium text-foreground\">Portabase</span>\n        </p>\n      </footer>\n    </div>\n  );\n}\n"
  },
  {
    "path": "app/(auth)/login/page.tsx",
    "content": "import { LoginForm } from \"@/components/wrappers/auth/login/login-form/login-form\";\nimport { Metadata } from \"next\";\nimport { SUPPORTED_PROVIDERS } from \"@/lib/auth/config\";\nimport { SocialAuthButtons } from \"@/components/wrappers/auth/social-buttons\";\nimport { TooltipProvider } from \"@/components/ui/tooltip\";\nimport { CardContent, CardHeader } from \"@/components/ui/card\";\nimport Link from \"next/link\";\nimport { Separator } from \"@/components/ui/separator\";\nimport { CardAuth } from \"@/features/layout/card-auth\";\nimport { env } from \"@/env.mjs\";\n\nexport const metadata: Metadata = {\n  title: \"Login\",\n};\n\nexport default async function SignInPage() {\n  return (\n    <TooltipProvider>\n      <CardAuth className=\"w-full\">\n        <CardHeader>\n          <div className=\"grid gap-2 text-center mb-2\">\n            <h1 className=\"text-3xl font-bold\">Login</h1>\n            <p className=\"text-balance text-muted-foreground\">\n              Fill your login informations\n            </p>\n          </div>\n        </CardHeader>\n        <CardContent className=\"space-y-4\">\n          {env.AUTH_EMAIL_PASSWORD_ENABLED === \"true\" && (\n            <LoginForm isPasskeyEnabled={env.AUTH_PASSKEY_ENABLED === \"true\"} />\n          )}\n\n          {env.AUTH_EMAIL_PASSWORD_ENABLED === \"true\" &&\n            SUPPORTED_PROVIDERS.filter((p) => !p.isManual && p.isActive)\n              .length > 0 && (\n              <div className=\"relative my-4 flex items-center justify-center overflow-hidden\">\n                <Separator />\n                <div className=\"px-2 text-center  text-sm\">OR</div>\n                <Separator />\n              </div>\n            )}\n\n          {SUPPORTED_PROVIDERS.filter((p) => !p.isManual && p.isActive).length >\n            0 && <SocialAuthButtons providers={SUPPORTED_PROVIDERS} />}\n\n          {env.AUTH_SIGNUP_ENABLED !== \"true\" ||\n            (env.AUTH_EMAIL_PASSWORD_ENABLED === \"true\" && (\n              <div className=\"mt-4 text-center text-sm\">\n                Don&apos;t have an account ?{\" \"}\n                <Link href=\"/register\" className=\"underline\">\n                  Sign up\n                </Link>\n              </div>\n            ))}\n        </CardContent>\n      </CardAuth>\n    </TooltipProvider>\n  );\n}\n"
  },
  {
    "path": "app/(auth)/register/page.tsx",
    "content": "import { PageParams } from \"@/types/next\";\nimport { RegisterForm } from \"@/components/wrappers/auth/register/register-form/register-form\";\nimport { Metadata } from \"next\";\nimport { redirect } from \"next/navigation\";\nimport { env } from \"@/env.mjs\";\n\nexport const metadata: Metadata = {\n  title: \"Register\",\n};\n\nexport default async function RoutePage(props: PageParams<{}>) {\n  if (\n    env.AUTH_SIGNUP_ENABLED !== \"true\" ||\n    env.AUTH_EMAIL_PASSWORD_ENABLED !== \"true\"\n  ) {\n    redirect(\"/login\");\n  }\n\n  return (\n    <div className=\"mx-auto grid w-full gap-6\">\n      <RegisterForm />\n    </div>\n  );\n}\n"
  },
  {
    "path": "app/(auth)/reset-password/page.tsx",
    "content": "import { CardContent, CardHeader } from \"@/components/ui/card\";\nimport { TooltipProvider } from \"@/components/ui/tooltip\";\nimport { ResetPasswordForm } from \"@/components/wrappers/auth/login/reset-password-form/reset-password-form\";\nimport { redirect } from \"next/navigation\";\nimport { auth } from \"@/lib/auth/auth\";\nimport { Avatar, AvatarImage, AvatarFallback } from \"@radix-ui/react-avatar\";\nimport { CardAuth } from \"@/features/layout/card-auth\";\nimport { env } from \"@/env.mjs\";\n\nexport default async function RoutePage(props: { searchParams: Promise<{ token: string | undefined }> }) {\n    if (env.AUTH_EMAIL_PASSWORD_ENABLED !== \"true\") {\n        return redirect(\"/login\");\n    }\n\n    const { token } = await props.searchParams;\n\n    if (!token) {\n        return redirect(`/login?error=invalid_or_expired_token`);\n    }\n\n    const verification = await (await auth.$context).internalAdapter.findVerificationValue(`reset-password:${token}`);\n\n    if (!verification || verification.expiresAt < new Date()) {\n        return redirect(`/login?error=invalid_or_expired_token`);\n    }\n\n    const user = await (await auth.$context).internalAdapter.findUserById(verification.value);\n\n    return (\n        <TooltipProvider>\n            <CardAuth className=\"w-full\">\n                <CardHeader className=\"space-y-4\">\n                    <div className=\"space-y-1 text-center\">\n                        <h1 className=\"text-2xl font-bold tracking-tight\">Set a new password</h1>\n                        <p className=\"text-sm text-muted-foreground text-balance\">Please enter your new password below.</p>\n                    </div>\n\n                    <div className=\"flex flex-col items-center space-y-2 text-center\">\n                        <Avatar className=\"relative flex h-16 w-16 shrink-0 overflow-hidden rounded-full border\">\n                            <AvatarImage src={user!.image ?? \"\"} alt={user!.name} className=\"aspect-square h-full w-full object-cover\" />\n                            <AvatarFallback className=\"flex h-full w-full items-center justify-center rounded-full bg-muted text-2xl font-medium text-muted-foreground\">\n                                {user!.name\n                                    .split(\" \")\n                                    .map((n) => n[0])\n                                    .join(\"\")\n                                    .toUpperCase()\n                                    .slice(0, 2)}\n                            </AvatarFallback>\n                        </Avatar>\n\n                        <div className=\"flex flex-col items-center\">\n                            <div className=\"font-semibold text-lg\">{user!.name}</div>\n                            <div className=\"text-sm text-muted-foreground\">{user!.email}</div>\n                        </div>\n                    </div>\n                </CardHeader>\n\n                <CardContent>\n                    <ResetPasswordForm />\n                </CardContent>\n            </CardAuth>\n        </TooltipProvider>\n    );\n}\n"
  },
  {
    "path": "app/(customer)/dashboard/(admin)/admin/organizations/[organizationId]/page.tsx",
    "content": "import {notFound} from \"next/navigation\";\nimport {eq} from \"drizzle-orm\";\nimport {db} from \"@/db\";\nimport * as drizzleDb from \"@/db\";\nimport {PageParams} from \"@/types/next\";\nimport {Page} from \"@/features/layout/page\";\nimport {OrganizationManagement} from \"@/components/wrappers/dashboard/admin/organizations/organization/organization-management\";\nimport {buildOrganizationWithMembers} from \"@/utils/common\";\nimport {isUUID} from \"@/utils/text\";\nimport {user} from \"@/db/schema/02_user\";\nimport {invitation} from \"@/db/schema/05_invitation\";\nimport {member} from \"@/db/schema/04_member\";\nimport {organization} from \"@/db/schema/03_organization\";\nimport {user as drizzleUser} from \"@/db/schema/02_user\";\n\n\nexport default async function RoutePage(props: PageParams<{ organizationId: string }>) {\n    const {organizationId} = await props.params;\n\n    if (!organizationId) {\n        return notFound();\n    }\n\n    if (!isUUID(organizationId)) {\n        return notFound();\n    }\n\n    const users = await db.select().from(drizzleUser);\n\n    const organizationData = await db\n        .select({organization, member, user, invitation})\n        .from(organization)\n        .leftJoin(member, eq(drizzleDb.schemas.organization.id, member.organizationId))\n        .leftJoin(invitation, eq(drizzleDb.schemas.invitation.id, invitation.organizationId))\n        .leftJoin(user, eq(drizzleDb.schemas.member.userId, user.id))\n        .where(eq(organization.id, organizationId));\n\n    const formattedData = buildOrganizationWithMembers(organizationData);\n\n    if (!formattedData) return notFound();\n\n    return (\n        <Page>\n            <OrganizationManagement organization={formattedData} users={users}/>\n        </Page>\n    );\n}\n"
  },
  {
    "path": "app/(customer)/dashboard/(admin)/admin/organizations/page.tsx",
    "content": "import {PageParams} from \"@/types/next\";\nimport {Page, PageActions, PageContent, PageHeader, PageTitle} from \"@/features/layout/page\";\nimport {db} from \"@/db\";\nimport {\n    AdminOrganizationAddModal\n} from \"@/components/wrappers/dashboard/admin/organizations/organization/admin-organization-add-modal\";\nimport {AdminOrganizationList} from \"@/components/wrappers/dashboard/admin/organizations/organization/admin-orgnization-list\";\nimport {isNull} from \"drizzle-orm\";\n\nexport default async function RoutePage(props: PageParams<{}>) {\n\n    const organizations = await db.query.organization.findMany({\n        where: (fields) => isNull(fields.deletedAt),\n        with: {\n            members: true,\n        },\n    });\n\n\n    return (\n        <Page>\n            <PageHeader className=\"flex flex-col\">\n                <div className=\"flex justify-between\">\n                    <PageTitle className=\"mb-3\">Active organizations</PageTitle>\n                    <PageActions>\n                        <AdminOrganizationAddModal/>\n                    </PageActions>\n                </div>\n            </PageHeader>\n            <PageContent className=\"flex flex-col gap-5\">\n                <AdminOrganizationList organizations={organizations}/>\n            </PageContent>\n        </Page>\n    );\n}\n"
  },
  {
    "path": "app/(customer)/dashboard/(admin)/admin/settings/page.tsx",
    "content": "import {PageParams} from \"@/types/next\";\nimport {Page, PageContent, PageHeader, PageTitle} from \"@/features/layout/page\";\nimport {db} from \"@/db\";\nimport {notFound} from \"next/navigation\";\nimport {SettingsTabs} from \"@/components/wrappers/dashboard/admin/settings/settings-tabs\";\nimport {desc, isNull} from \"drizzle-orm\";\nimport * as drizzleDb from \"@/db\";\nimport {StorageChannelWith} from \"@/db/schema/12_storage-channel\";\nimport {NotificationChannelWith} from \"@/db/schema/09_notification-channel\";\n\nexport default async function RoutePage(props: PageParams<{}>) {\n\n    const settings = await db.query.setting.findFirst({\n        where: (fields, {eq}) => eq(fields.name, \"system\"),\n    });\n\n    console.log(settings)\n\n    const storageChannels = await db.query.storageChannel.findMany({\n        with: {\n            organizations: true\n        },\n        where: isNull(drizzleDb.schemas.storageChannel.organizationId),\n        orderBy: desc(drizzleDb.schemas.storageChannel.createdAt)\n    }) as StorageChannelWith[]\n\n    const notificationChannels = await db.query.notificationChannel.findMany({\n        with: {\n            organizations: true\n        },\n        where: isNull(drizzleDb.schemas.notificationChannel.organizationId),\n        orderBy: desc(drizzleDb.schemas.notificationChannel.createdAt)\n    }) as NotificationChannelWith[]\n\n\n    if (!settings || !storageChannels || !notificationChannels ) {\n        notFound()\n    }\n\n    return (\n        <Page>\n            <PageHeader className=\"flex flex-col\">\n                <div className=\"flex justify-between\">\n                    <PageTitle className=\"mb-3\">System settings</PageTitle>\n                </div>\n            </PageHeader>\n            <PageContent className=\"flex flex-col gap-5\">\n                <SettingsTabs storageChannels={storageChannels} notificationChannels={notificationChannels} settings={settings} />\n            </PageContent>\n        </Page>\n    );\n}\n"
  },
  {
    "path": "app/(customer)/dashboard/(admin)/admin/users/page.tsx",
    "content": "import {PageParams} from \"@/types/next\";\nimport {Page, PageActions, PageContent, PageHeader, PageTitle} from \"@/features/layout/page\";\nimport {db} from \"@/db\";\nimport {desc, isNull} from \"drizzle-orm\";\nimport {AdminUserList} from \"@/components/wrappers/dashboard/admin/users/admin-user-list\";\nimport {AdminUserAddModal} from \"@/components/wrappers/dashboard/admin/users/admin-user-add-modal\";\nimport {SUPPORTED_PROVIDERS} from \"@/lib/auth/config\";\n\nexport default async function RoutePage(props: PageParams<{}>) {\n\n    const users = await db.query.user.findMany({\n        where: (fields) => isNull(fields.deletedAt),\n        with: {\n            accounts: true\n        },\n        orderBy: (fields) => desc(fields.createdAt),\n\n    });\n    const organizations = await db.query.organization.findMany({\n        with: {\n            members: true,\n        },\n    });\n\n    const credentialProvider = SUPPORTED_PROVIDERS.find(p => p.id === 'credential');\n    const isPasswordAuthEnabled = credentialProvider?.isActive || false;\n\n    return (\n        <Page>\n            <PageHeader className=\"flex flex-col\">\n                <div className=\"flex justify-between\">\n                    <PageTitle className=\"mb-3\">Active users</PageTitle>\n                    <PageActions>\n                        <AdminUserAddModal organizations={organizations}/>\n                    </PageActions>\n                </div>\n            </PageHeader>\n            <PageContent className=\"flex flex-col gap-5\">\n                <AdminUserList users={users} isPasswordAuthEnabled={isPasswordAuthEnabled}/>\n            </PageContent>\n        </Page>\n    );\n}\n\n\n"
  },
  {
    "path": "app/(customer)/dashboard/(admin)/agents/[agentId]/page.tsx",
    "content": "import { PageParams } from \"@/types/next\";\nimport {\n  Page,\n  PageContent,\n  PageDescription,\n  PageTitle,\n} from \"@/features/layout/page\";\nimport { db } from \"@/db\";\nimport * as drizzleDb from \"@/db\";\nimport {eq, isNull} from \"drizzle-orm\";\nimport { notFound } from \"next/navigation\";\nimport { ButtonDeleteAgent } from \"@/components/wrappers/dashboard/agent/button-delete-agent/button-delete-agent\";\nimport { capitalizeFirstLetter } from \"@/utils/text\";\nimport { generateEdgeKey } from \"@/utils/edge_key\";\nimport { getServerUrl } from \"@/utils/get-server-url\";\nimport { AgentContentPage } from \"@/components/wrappers/dashboard/agent/agent-content\";\nimport { AgentDialog } from \"@/features/agents/components/agent.dialog\";\n\n\nexport default async function RoutePage(\n  props: PageParams<{ agentId: string }>,\n) {\n  const { agentId } = await props.params;\n\n  const agent = await db.query.agent.findFirst({\n    where: eq(drizzleDb.schemas.agent.id, agentId),\n    with: {\n      databases: true,\n      organizations: true,\n    },\n  });\n\n  const organizations = await db.query.organization.findMany({\n    where: (fields) => isNull(fields.deletedAt),\n    with: {\n      members: true,\n    },\n  });\n\n\n  if (!agent) {\n    notFound();\n  }\n\n  const isOwnerByAnOrganization = agent.organizationId\n\n  if (isOwnerByAnOrganization){\n    notFound();\n  }\n\n  const organizationIds = agent.organizations.map(org => org.organizationId)\n\n  const edgeKey = await generateEdgeKey(getServerUrl(), agent.id);\n\n  return (\n    <Page>\n      <div className=\"justify-between gap-2 sm:flex\">\n        <PageTitle className=\"flex flex-col md:flex-row items-center justify-between w-full \">\n          <div className=\"min-w-full md:min-w-fit \">\n            {capitalizeFirstLetter(agent.name)}\n          </div>\n          <div className=\"flex items-center gap-2 md:justify-between w-full \">\n            <div className=\"flex items-center gap-2\">\n              <AgentDialog\n                agent={agent}\n                typeTrigger={\"edit\"}\n                adminView={true}\n                organizations={organizations}\n              />\n            </div>\n            <div className=\"flex items-center gap-2\">\n              <ButtonDeleteAgent organizationIds={organizationIds} agentId={agentId} text={\"Delete Agent\"} />\n            </div>\n          </div>\n        </PageTitle>\n      </div>\n\n      {agent.description && (\n        <PageDescription className=\"mt-5 sm:mt-0\">\n          {agent.description}\n        </PageDescription>\n      )}\n      <PageContent className=\"flex flex-col w-full h-full justify-between gap-6\">\n        <AgentContentPage agent={agent} edgeKey={edgeKey} />\n      </PageContent>\n    </Page>\n  );\n}\n"
  },
  {
    "path": "app/(customer)/dashboard/(admin)/agents/page.tsx",
    "content": "import {PageParams} from \"@/types/next\";\nimport {AgentCard} from \"@/components/wrappers/dashboard/agent/agent-card/agent-card\";\nimport {CardsWithPagination} from \"@/components/wrappers/common/cards-with-pagination\";\nimport {Page, PageActions, PageContent, PageHeader, PageTitle} from \"@/features/layout/page\";\nimport {notFound} from \"next/navigation\";\nimport {db} from \"@/db\";\nimport * as drizzleDb from \"@/db\";\nimport {and, desc, eq, isNull, not} from \"drizzle-orm\";\nimport {Metadata} from \"next\";\nimport {AgentDialog} from \"@/features/agents/components/agent.dialog\";\n\nexport const metadata: Metadata = {\n    title: \"Agents\",\n};\n\nexport default async function RoutePage(props: PageParams<{}>) {\n\n    const agents = await db.query.agent.findMany({\n        where: and(not(eq(drizzleDb.schemas.agent.isArchived, true)),isNull(drizzleDb.schemas.agent.organizationId)),\n        with: {\n            databases: true\n        },\n        orderBy: (fields) => desc(fields.lastContact),\n    });\n    \n    if (!agents) {\n        notFound();\n    }\n\n    return (\n        <Page>\n            <PageHeader>\n                <PageTitle>Agents</PageTitle>\n                {agents.length > 0 && (\n                    <PageActions>\n                         <AgentDialog typeTrigger={\"create\"} />\n                    </PageActions>\n                )}\n            </PageHeader>\n            <PageContent>\n                {agents.length > 0 ? (\n                    <CardsWithPagination data={agents} cardItem={AgentCard} cardsPerPage={4} numberOfColumns={1}/>\n                ) : (\n                     <AgentDialog typeTrigger=\"empty\"/>\n                )}\n            </PageContent>\n        </Page>\n    );\n}"
  },
  {
    "path": "app/(customer)/dashboard/(admin)/layout.tsx",
    "content": "import React from \"react\";\nimport { notFound } from \"next/navigation\";\nimport { currentUser } from \"@/lib/auth/current-user\";\n\nexport default async function Layout({ children }: { children: React.ReactNode }) {\n    const user = await currentUser();\n\n    if (user!.role !== \"superadmin\" && user!.role !== \"admin\") {\n        notFound();\n    }\n\n    return <>{children}</>;\n}\n"
  },
  {
    "path": "app/(customer)/dashboard/(admin)/notifications/channels/page.tsx",
    "content": "import {PageParams} from \"@/types/next\";\nimport {Page, PageActions, PageContent, PageHeader, PageTitle} from \"@/features/layout/page\";\nimport {Metadata} from \"next\";\nimport {db} from \"@/db\";\nimport {notificationChannel, NotificationChannelWith} from \"@/db/schema/09_notification-channel\";\nimport {desc, isNull} from \"drizzle-orm\";\nimport {ChannelsSection} from \"@/components/wrappers/dashboard/admin/channels/channels-section\";\nimport {ChannelAddEditModal} from \"@/components/wrappers/dashboard/admin/channels/channel/channel-add-edit-modal\";\nimport * as drizzleDb from \"@/db\";\n\nexport const metadata: Metadata = {\n    title: \"Notification Channels\",\n};\n\nexport default async function RoutePage(props: PageParams<{}>) {\n\n    const notificationChannels = await db.query.notificationChannel.findMany({\n        with: {\n            organizations: true\n        },\n        where: isNull(drizzleDb.schemas.notificationChannel.organizationId),\n        orderBy: desc(notificationChannel.createdAt)\n    }) as NotificationChannelWith[]\n\n    const organizations = await db.query.organization.findMany({\n        where: (fields) => isNull(fields.deletedAt),\n        with: {\n            members: true,\n        },\n    });\n\n\n    return (\n        <Page>\n            <PageHeader>\n                <PageTitle>Notification channels</PageTitle>\n                <PageActions>\n                    <ChannelAddEditModal kind=\"notification\" adminView={false}/>\n                </PageActions>\n            </PageHeader>\n            <PageContent>\n                <ChannelsSection kind=\"notification\" organizations={organizations}\n                                 channels={notificationChannels}/>\n            </PageContent>\n        </Page>\n    );\n}\n"
  },
  {
    "path": "app/(customer)/dashboard/(admin)/notifications/logs/page.tsx",
    "content": "import {PageParams} from \"@/types/next\";\nimport {Page, PageContent, PageHeader, PageTitle} from \"@/features/layout/page\";\nimport {Metadata} from \"next\";\nimport {NotificationLogsList} from \"@/components/wrappers/dashboard/admin/notifications/logs/notification-logs-list\";\nimport {notFound} from \"next/navigation\";\nimport {getNotificationHistory} from \"@/db/services/notification-log\";\n\nexport const metadata: Metadata = {\n    title: \"Activity logs\",\n};\n\nexport default async function RoutePage(props: PageParams<{}>) {\n\n    const notificationLogs = await getNotificationHistory()\n\n    if (!notificationLogs) {\n        notFound();\n    }\n\n    return (\n        <Page>\n            <PageHeader>\n                <PageTitle>Activity logs</PageTitle>\n            </PageHeader>\n            <PageContent>\n                <NotificationLogsList notificationLogs={notificationLogs} />\n            </PageContent>\n        </Page>\n    );\n}\n"
  },
  {
    "path": "app/(customer)/dashboard/(admin)/storages/channels/page.tsx",
    "content": "import {PageParams} from \"@/types/next\";\nimport {Page, PageActions, PageContent, PageHeader, PageTitle} from \"@/features/layout/page\";\nimport {Metadata} from \"next\";\nimport {ChannelsSection} from \"@/components/wrappers/dashboard/admin/channels/channels-section\";\nimport {db} from \"@/db\";\nimport {desc, eq, isNull} from \"drizzle-orm\";\nimport * as drizzleDb from \"@/db\";\nimport {StorageChannelWith} from \"@/db/schema/12_storage-channel\";\nimport {ChannelAddEditModal} from \"@/components/wrappers/dashboard/admin/channels/channel/channel-add-edit-modal\";\n\nexport const metadata: Metadata = {\n    title: \"Storage Channels\",\n};\n\nexport default async function RoutePage(props: PageParams<{}>) {\n\n    const storageChannels = await db.query.storageChannel.findMany({\n        with: {\n            organizations: true\n        },\n        where: isNull(drizzleDb.schemas.storageChannel.organizationId),\n        orderBy: desc(drizzleDb.schemas.storageChannel.createdAt)\n    }) as StorageChannelWith[]\n\n    const organizations = await db.query.organization.findMany({\n        where: (fields) => isNull(fields.deletedAt),\n        with: {\n            members: true,\n        },\n    });\n\n    const settings = await db.query.setting.findFirst({\n        where: eq(drizzleDb.schemas.setting.name, \"system\"),\n    });\n\n\n    return (\n        <Page>\n            <PageHeader>\n                <PageTitle>Storage channels</PageTitle>\n                <PageActions>\n                    <ChannelAddEditModal kind={\"storage\"} adminView={false}/>\n                </PageActions>\n            </PageHeader>\n            <PageContent>\n                <ChannelsSection defaultStorageChannelId={settings?.defaultStorageChannelId} kind={\"storage\"} organizations={organizations} channels={storageChannels}/>\n            </PageContent>\n        </Page>\n    );\n}\n"
  },
  {
    "path": "app/(customer)/dashboard/(organization)/migration/page.tsx",
    "content": "import {PageParams} from \"@/types/next\";\nimport {Page, PageContent, PageHeader, PageTitle} from \"@/features/layout/page\";\nimport {notFound} from \"next/navigation\";\nimport {getOrganization} from \"@/lib/auth/auth\";\nimport {Metadata} from \"next\";\nimport {db} from \"@/db\";\nimport {MigrationTool} from \"@/components/wrappers/dashboard/organization/migration/migration-tool\";\n\nexport const metadata: Metadata = {\n    title: \"Projects\",\n};\n\nexport default async function RoutePage(props: PageParams<{}>) {\n\n    const organization = await getOrganization({});\n\n    if (!organization) {\n        notFound();\n    }\n\n    const projects = await db.query.project.findMany({\n        where: (project, {eq, and, not}) =>\n            and(\n                eq(project.organizationId, organization.id),\n                not(eq(project.isArchived, true))\n            ),\n        with: {\n            organization: true,\n            databases: {\n                where: (database, { isNull, not, inArray, and }) =>\n                    and(\n                        isNull(database.deletedAt),\n                        not(inArray(database.dbms, [\"valkey\", \"redis\"]))\n                    ),\n\n                with: {\n                    backups: {\n                        where: (backup, { isNull, eq, and }) =>\n                            and(\n                                isNull(backup.deletedAt),\n                                eq(backup.status, \"success\")\n                            ),\n                        orderBy: (backup, {desc}) => [desc(backup.createdAt)],\n                        limit: 15,\n                    }\n                }\n            },\n        },\n    });\n    return (\n        <Page>\n            <PageHeader className=\"flex flex-col items-start justify-between mb-6\">\n                <PageTitle className=\"mb-2\">\n                    Database Migration\n                </PageTitle>\n                <p className=\"text-sm text-muted-foreground\">\n                    Import backups from a source project into your target database\n                </p>\n            </PageHeader>\n            <PageContent>\n                <MigrationTool projects={projects}/>\n            </PageContent>\n        </Page>\n    );\n}"
  },
  {
    "path": "app/(customer)/dashboard/(organization)/projects/[projectId]/database/[databaseId]/page.tsx",
    "content": "import {PageParams} from \"@/types/next\";\nimport {notFound, redirect} from \"next/navigation\";\nimport {Page} from \"@/features/layout/page\";\nimport {db} from \"@/db\";\nimport {eq, and, inArray} from \"drizzle-orm\";\nimport * as drizzleDb from \"@/db\";\nimport {getOrganizationProjectDatabases} from \"@/lib/services\";\nimport {getActiveMember, getOrganization} from \"@/lib/auth/auth\";\nimport {BackupModalProvider} from \"@/components/wrappers/dashboard/database/backup/backup-modal-context\";\nimport {DatabaseContent} from \"@/components/wrappers/dashboard/projects/database/database-content\";\nimport {getHealthLast12hLogs} from \"@/db/services/healthcheck\";\n\nexport default async function RoutePage(props: PageParams<{\n    projectId: string;\n    databaseId: string\n}>) {\n    const {projectId, databaseId} = await props.params;\n\n    const organization = await getOrganization({});\n    const activeMember = await getActiveMember()\n\n    if (!organization || !activeMember) {\n        notFound();\n    }\n\n    const databasesProject = await getOrganizationProjectDatabases({\n        organizationSlug: organization.slug,\n        projectId: projectId\n    })\n\n    const dbItem = await db.query.database.findFirst({\n        where: and(inArray(drizzleDb.schemas.backup.id, databasesProject.ids ?? []), eq(drizzleDb.schemas.database.id, databaseId), eq(drizzleDb.schemas.database.projectId, projectId)),\n        with: {\n            project: true,\n            retentionPolicy: true,\n            alertPolicies: true,\n            storagePolicies: true\n        }\n    });\n\n    if (!dbItem) {\n        redirect(\"/dashboard/projects\");\n    }\n\n    const backups = await db.query.backup.findMany({\n        where: eq(drizzleDb.schemas.backup.databaseId, dbItem.id),\n        with: {\n            restorations: true,\n            storages: {\n                with: {\n                    storageChannel: true\n                }\n            }\n        },\n        orderBy: (b, {desc}) => [desc(b.createdAt)],\n    });\n\n    const restorations = await db.query.restoration.findMany({\n        where: eq(drizzleDb.schemas.restoration.databaseId, dbItem.id),\n        orderBy: (r, {desc}) => [desc(r.createdAt)],\n    });\n\n    const isAlreadyBackup = backups.some((b) => b.status === \"waiting\" || b.status === \"ongoing\");\n    const isAlreadyRestore = restorations.some((r) => r.status === \"waiting\");\n\n    const totalBackups = await db.select({count: drizzleDb.schemas.backup.id})\n        .from(drizzleDb.schemas.backup)\n        .where(eq(drizzleDb.schemas.backup.databaseId, dbItem.id))\n        .then(rows => rows.length);\n\n    const availableBackups = backups.filter(b => !b.deletedAt).length;\n\n    const successfulBackups = await db.select({count: drizzleDb.schemas.backup.id})\n        .from(drizzleDb.schemas.backup)\n        .where(and(\n            eq(drizzleDb.schemas.backup.databaseId, dbItem.id),\n            eq(drizzleDb.schemas.backup.status, \"success\")\n        ))\n        .then(rows => rows.length);\n\n\n    const [settings] = await db.select().from(drizzleDb.schemas.setting).where(eq(drizzleDb.schemas.setting.name, \"system\")).limit(1);\n    if (!settings) {\n        notFound();\n    }\n\n    const databaseHealthLogs = dbItem ? await getHealthLast12hLogs({ id: dbItem.id }) : []\n\n\n    const successRate = totalBackups > 0 ? (successfulBackups / totalBackups) * 100 : null;\n\n    const isMember = activeMember?.role === \"member\";\n\n    return (\n        <Page>\n            <BackupModalProvider>\n                <DatabaseContent\n                    activeMember={activeMember}\n                    settings={settings}\n                    database={dbItem}\n                    databaseHealthLogs={databaseHealthLogs}\n                    isAlreadyRestore={isAlreadyRestore}\n                    restorations={restorations}\n                    backups={backups}\n                    totalBackups={totalBackups}\n                    availableBackups={availableBackups}\n                    successRate={successRate}\n                    organizationId={organization.id}\n                    activeOrganizationChannels={[]}\n                    activeOrganizationStorageChannels={[]}\n                />\n            </BackupModalProvider>\n        </Page>\n    );\n}"
  },
  {
    "path": "app/(customer)/dashboard/(organization)/projects/[projectId]/page.tsx",
    "content": "import {PageParams} from \"@/types/next\";\nimport {Page, PageContent, PageTitle} from \"@/features/layout/page\";\nimport {\n    ButtonDeleteProject\n} from \"@/components/wrappers/dashboard/projects/button-delete-project/button-delete-project\";\nimport {CardsWithPagination} from \"@/components/wrappers/common/cards-with-pagination\";\nimport {ProjectDatabaseCard} from \"@/components/wrappers/dashboard/projects/project-card/project-database-card\";\nimport {notFound, redirect} from \"next/navigation\";\nimport {db} from \"@/db\";\nimport {eq} from \"drizzle-orm\";\nimport {getActiveMember, getOrganization} from \"@/lib/auth/auth\";\nimport * as drizzleDb from \"@/db\";\nimport {capitalizeFirstLetter} from \"@/utils/text\";\nimport {ProjectDialog} from \"@/features/projects/components/project.dialog\";\nimport {ProjectWith} from \"@/db/schema/06_project\";\nimport {isUuidv4} from \"@/utils/verify-uuid\";\nimport {getOrganizationAvailableDatabases} from \"@/db/services/database\";\n\n\nexport default async function RoutePage(props: PageParams<{\n    projectId: string\n}>) {\n    const {\n        projectId\n    } = await props.params;\n\n    if (!isUuidv4(projectId)) {\n        notFound()\n    }\n\n    const organization = await getOrganization({});\n    const activeMember = await getActiveMember()\n\n    if (!organization) {\n        notFound();\n    }\n    const org = await db.query.organization.findFirst({\n        where: eq(drizzleDb.schemas.organization.slug, organization.slug),\n    });\n\n    if (!org) notFound();\n\n    const proj = await db.query.project.findFirst({\n        where: (proj, {\n            and,\n            eq,\n            not\n        }) => and(eq(proj.id, projectId), eq(proj.organizationId, org.id), not(eq(proj.isArchived, true))),\n        with: {\n            databases: true,\n        },\n    });\n\n    if (!proj) {\n        redirect(\"/dashboard/projects\");\n    }\n\n    const availableDatabases = await getOrganizationAvailableDatabases(organization.id, proj.id)\n    const isMember = activeMember?.role === \"member\";\n\n    return (\n        <Page>\n            <div className=\"justify-between gap-2 sm:flex\">\n                <PageTitle className=\"flex flex-col md:flex-row items-center justify-between w-full \">\n                    <div className=\"min-w-full md:min-w-fit \">\n                        {capitalizeFirstLetter(proj.name)}\n                    </div>\n                    {!isMember && (\n                        <div className=\"flex items-center gap-2 md:justify-between w-full \">\n                            <div className=\"flex items-center gap-2\">\n                                <ProjectDialog\n                                    databases={availableDatabases}\n                                    organization={org}\n                                    project={proj as ProjectWith}\n                                    isEdit={true}\n                                />\n                            </div>\n                            <div className=\"flex items-center gap-2\">\n                                <ButtonDeleteProject projectId={projectId} text={\"Delete Project\"}/>\n                            </div>\n                        </div>\n                    )}\n                </PageTitle>\n            </div>\n            <PageContent className=\"flex flex-col w-full h-full\">\n                {proj.databases.length > 0 ? (\n                    <CardsWithPagination\n                        data={proj.databases}\n                        organizationSlug={organization.slug}\n                        // @ts-ignore\n                        cardItem={ProjectDatabaseCard}\n                        cardsPerPage={20}\n                        numberOfColumns={3}\n                        pageSizeOptions={[10, 20, 50]}\n                        extendedProps={proj}\n                    />\n                ) : (\n                    <div className=\"flex flex-col items-center justify-center h-full text-muted-foreground py-20\">\n                        <p className=\"text-lg font-medium\">No databases found</p>\n                        <p className=\"text-sm mt-2\">You haven’t added any databases to this project yet.</p>\n                    </div>\n                )}\n            </PageContent>\n        </Page>\n    );\n}"
  },
  {
    "path": "app/(customer)/dashboard/(organization)/projects/page.tsx",
    "content": "import {PageParams} from \"@/types/next\";\nimport {CardsWithPagination} from \"@/components/wrappers/common/cards-with-pagination\";\nimport {Page, PageActions, PageContent, PageHeader, PageTitle} from \"@/features/layout/page\";\nimport {ProjectCard} from \"@/components/wrappers/dashboard/projects/project-card/project-card\";\nimport {db} from \"@/db\";\nimport {notFound} from \"next/navigation\";\nimport {getActiveMember, getOrganization} from \"@/lib/auth/auth\";\nimport {EmptyStatePlaceholder} from \"@/components/wrappers/common/empty-state-placeholder\";\nimport {Metadata} from \"next\";\nimport {ProjectDialog} from \"@/features/projects/components/project.dialog\";\nimport {DatabaseWith} from \"@/db/schema/07_database\";\nimport {getOrganizationAvailableDatabases} from \"@/db/services/database\";\n\nexport const metadata: Metadata = {\n    title: \"Projects\",\n};\n\nexport default async function RoutePage(props: PageParams<{}>) {\n\n    const organization = await getOrganization({});\n    const activeMember = await getActiveMember()\n\n    if (!organization) {\n        notFound();\n    }\n\n    const projects = await db.query.project.findMany({\n        where: (project, {\n            eq,\n            and,\n            not\n        }) => and(eq(project.organizationId, organization.id), not(eq(project.isArchived, true))),\n        with: {\n            databases: true,\n        },\n    });\n    const isMember = activeMember?.role === \"member\";\n\n    const availableDatabases = await getOrganizationAvailableDatabases(organization.id)\n\n\n    return (\n        <Page>\n            <PageHeader>\n                <PageTitle>Projects</PageTitle>\n                {(projects.length > 0 && !isMember) && (\n                    <PageActions>\n                        <ProjectDialog databases={availableDatabases} organization={organization}/>\n                    </PageActions>\n                )}\n            </PageHeader>\n\n            <PageContent>\n                {projects.length > 0 ? (\n                    <CardsWithPagination\n                        organizationSlug={organization.slug}\n                        data={projects}\n                        cardItem={ProjectCard}\n                        cardsPerPage={12}\n                        numberOfColumns={3}\n                        pageSizeOptions={[12, 24, 48]}\n                    />\n                ) : isMember ? (\n                    <EmptyStatePlaceholder state={\"empty\"} text=\"No project available\"/>\n                ) : (\n                    <ProjectDialog databases={availableDatabases} organization={organization} isEmpty={true}/>\n                )}\n            </PageContent>\n        </Page>\n    );\n}"
  },
  {
    "path": "app/(customer)/dashboard/(organization)/settings/agents/[agentId]/page.tsx",
    "content": "import {PageParams} from \"@/types/next\";\nimport {\n    Page,\n    PageContent,\n    PageDescription,\n    PageTitle,\n} from \"@/features/layout/page\";\nimport {db} from \"@/db\";\nimport * as drizzleDb from \"@/db\";\nimport {eq} from \"drizzle-orm\";\nimport {notFound} from \"next/navigation\";\nimport {ButtonDeleteAgent} from \"@/components/wrappers/dashboard/agent/button-delete-agent/button-delete-agent\";\nimport {capitalizeFirstLetter} from \"@/utils/text\";\nimport {generateEdgeKey} from \"@/utils/edge_key\";\nimport {getServerUrl} from \"@/utils/get-server-url\";\nimport {AgentContentPage} from \"@/components/wrappers/dashboard/agent/agent-content\";\nimport {AgentDialog} from \"@/features/agents/components/agent.dialog\";\nimport {getActiveMember, getOrganization} from \"@/lib/auth/auth\";\nimport {currentUser} from \"@/lib/auth/current-user\";\nimport {computeOrganizationPermissions} from \"@/lib/acl/organization-acl\";\n\n\nexport default async function RoutePage(\n    props: PageParams<{ agentId: string }>,\n) {\n    const {agentId} = await props.params;\n\n    const organization = await getOrganization({});\n    const user = await currentUser();\n    const activeMember = await getActiveMember();\n\n    if (!organization || !activeMember || !user) {\n        notFound();\n    }\n\n\n\n    const {canManageAgents} = computeOrganizationPermissions(activeMember);\n\n    if (!canManageAgents){\n        notFound();\n    }\n\n    const agent = await db.query.agent.findFirst({\n        where: eq(drizzleDb.schemas.agent.id, agentId),\n        with: {\n            databases: true,\n            organizations: true,\n        },\n    });\n\n\n    if (!agent) {\n        notFound();\n    }\n\n    const hasAccess =\n        agent.organizationId === organization.id ||\n        agent.organizations.some(org => org.organizationId === organization.id);\n\n    if (!hasAccess) {\n        notFound();\n    }\n\n    const isOwned = agent.organizationId\n    const edgeKey = await generateEdgeKey(getServerUrl(), agent.id);\n\n    return (\n        <Page>\n            <div className=\"justify-between gap-2 sm:flex\">\n                <PageTitle className=\"flex flex-col md:flex-row items-center justify-between w-full \">\n                    <div className=\"min-w-full md:min-w-fit \">\n                        {capitalizeFirstLetter(agent.name)}\n                    </div>\n                    {isOwned && (\n                        <div className=\"flex items-center gap-2 md:justify-between w-full \">\n                            <div className=\"flex items-center gap-2\">\n                                <AgentDialog\n                                    agent={agent}\n                                    typeTrigger={\"edit\"}\n                                />\n                            </div>\n                            <div className=\"flex items-center gap-2\">\n                                <ButtonDeleteAgent organizationId={organization.id ?? null} agentId={agentId} text={\"Delete Agent\"}/>\n                            </div>\n                        </div>\n                    )}\n                </PageTitle>\n            </div>\n\n            {agent.description && (\n                <PageDescription className=\"mt-5 sm:mt-0\">\n                    {agent.description}\n                </PageDescription>\n            )}\n            <PageContent className=\"flex flex-col w-full h-full justify-between gap-6\">\n                <AgentContentPage agent={agent} edgeKey={edgeKey}/>\n            </PageContent>\n        </Page>\n    );\n}\n"
  },
  {
    "path": "app/(customer)/dashboard/(organization)/settings/agents/page.tsx",
    "content": "import { redirect } from \"next/navigation\";\n\nexport default async function RoutePage() {\n    redirect(\"/dashboard/settings?tab=agents\");\n}\n"
  },
  {
    "path": "app/(customer)/dashboard/(organization)/settings/page.tsx",
    "content": "import {PageParams} from \"@/types/next\";\nimport {\n    Page,\n    PageContent,\n    PageHeader,\n    PageTitle,\n} from \"@/features/layout/page\";\nimport {currentUser} from \"@/lib/auth/current-user\";\nimport {getActiveMember, getOrganization} from \"@/lib/auth/auth\";\nimport {notFound} from \"next/navigation\";\nimport {Metadata} from \"next\";\nimport {OrganizationTabs} from \"@/components/wrappers/dashboard/organization/tabs/organization-tabs\";\nimport {getOrganizationChannels} from \"@/db/services/notification-channel\";\nimport {computeOrganizationPermissions} from \"@/lib/acl/organization-acl\";\nimport {getOrganizationStorageChannels} from \"@/db/services/storage-channel\";\nimport {DeleteOrganizationButton} from \"@/components/wrappers/dashboard/organization/delete-organization-button\";\nimport {EditOrganizationDialog} from \"@/features/organization/components/edit-organization.dialog\";\nimport {db} from \"@/db\";\nimport {isNull} from \"drizzle-orm\";\nimport * as drizzleDb from \"@/db\";\nimport {eq} from \"drizzle-orm\";\nimport {getOrganizationAgents} from \"@/db/services/agent\";\nimport {Tooltip, TooltipContent, TooltipTrigger} from \"@/components/ui/tooltip\";\n\nexport const metadata: Metadata = {\n    title: \"Settings\",\n};\n\nexport default async function RoutePage(props: PageParams<{ slug: string }>) {\n    const organization = await getOrganization({});\n    const user = await currentUser();\n    const activeMember = await getActiveMember();\n\n    if (!organization || !activeMember || !user) {\n        notFound();\n    }\n\n    const notificationChannels = await getOrganizationChannels(organization.id);\n    const storageChannels = await getOrganizationStorageChannels(organization.id);\n    const agents = await getOrganizationAgents(organization.id);\n    const permissions = computeOrganizationPermissions(activeMember);\n\n    const users = await db.query.user.findMany({\n        where: (fields) => isNull(fields.deletedAt),\n    });\n\n    const organizationWithMembers = await db.query.organization.findFirst({\n        where: eq(drizzleDb.schemas.organization.id, organization.id),\n        with: {\n            projects: true,\n            members: {\n                with: {\n                    user: true,\n                },\n            },\n        },\n    });\n\n    if (!organizationWithMembers) notFound();\n\n    return (\n        <Page>\n            <PageHeader>\n                <PageTitle className=\"flex flex-col md:flex-row items-center justify-between w-full \">\n                    <div className=\"min-w-full md:min-w-fit \">Organization settings</div>\n                    <div className=\"flex items-center gap-2 md:justify-between w-full \">\n                        <div className=\"flex items-center gap-2\">\n                            {permissions.canManageSettings &&\n                                organization.slug !== \"default\" && (\n                                    <EditOrganizationDialog\n                                        organization={organizationWithMembers}\n                                        users={users}\n                                        currentUser={user}\n                                    />\n                                )}\n                        </div>\n                        <div className=\"flex items-center gap-2\">\n                            {permissions.canManageDangerZone &&\n                                organization.slug !== \"default\" && (\n\n                                    <Tooltip>\n                                        <TooltipTrigger asChild>\n                                            <div>\n                                                <DeleteOrganizationButton\n                                                    disabled={organizationWithMembers.projects.length > 0}\n                                                    organizationSlug={organization.slug}\n                                                />\n                                            </div>\n\n                                        </TooltipTrigger>\n                                        {organizationWithMembers.projects.length > 0 && (\n                                            <TooltipContent>\n                                                <p>Your organization has some projects associated with it. Please delete them before deleting the organization.</p>\n                                            </TooltipContent>\n                                        )}\n                                    </Tooltip>\n\n                                )}\n                        </div>\n                    </div>\n                </PageTitle>\n            </PageHeader>\n            <PageContent>\n                <OrganizationTabs\n                    activeMember={activeMember}\n                    organization={organization}\n                    notificationChannels={notificationChannels}\n                    storageChannels={storageChannels}\n                    agents={agents}\n                />\n            </PageContent>\n        </Page>\n    );\n}\n"
  },
  {
    "path": "app/(customer)/dashboard/(organization)/statistics/page.tsx",
    "content": "import {PageParams} from \"@/types/next\";\nimport {Page, PageContent, PageHeader, PageTitle} from \"@/features/layout/page\";\nimport {Card, CardContent, CardHeader, CardTitle} from \"@/components/ui/card\";\nimport {EvolutionLineChart} from \"@/components/wrappers/dashboard/statistics/charts/evolution-line-chart\";\nimport {PercentageLineChart} from \"@/components/wrappers/dashboard/statistics/charts/percentage-line-chart\";\nimport {notFound} from \"next/navigation\";\nimport {db} from \"@/db\";\nimport {and, asc, count, eq, inArray} from \"drizzle-orm\";\nimport * as drizzleDb from \"@/db\";\nimport {getOrganization} from \"@/lib/auth/auth\";\nimport {Building2, DatabaseBackup, Folder, RefreshCcw} from \"lucide-react\";\nimport {Metadata} from \"next\";\n\nexport const metadata: Metadata = {\n    title: \"Statistics\",\n};\n\nexport default async function RoutePage(props: PageParams<{}>) {\n    const organization = await getOrganization({});\n\n    if (!organization) {\n        notFound();\n    }\n\n    const org = await db.query.organization.findFirst({\n        where: eq(drizzleDb.schemas.organization.slug, organization.slug),\n    });\n\n    if (!org) notFound();\n\n    const projects = await db.query.project.findMany({\n        where: eq(drizzleDb.schemas.project.organizationId, org.id),\n    });\n\n    const projectIds = projects.map(project => project.id);\n\n    const databasesOfAllProjects = await db.query.database.findMany({\n        where: inArray(drizzleDb.schemas.database.projectId, projectIds),\n    })\n    const databaseIds = databasesOfAllProjects.map((database) => database.id);\n\n\n    const backupsEvolution = await db.query.backup.findMany({\n        columns: {\n            id: true,\n            createdAt: true,\n        },\n        orderBy: [asc(drizzleDb.schemas.backup.id)],\n        where: inArray(drizzleDb.schemas.backup.databaseId, databaseIds),\n    });\n\n\n    const backupsRate = await db\n        .select({\n            createdAt: drizzleDb.schemas.backup.createdAt,\n            status: drizzleDb.schemas.backup.status,\n            _count: count(),\n        })\n        .from(drizzleDb.schemas.backup)\n        .where(and(inArray(drizzleDb.schemas.backup.status, [\"success\", \"failed\"]), inArray(drizzleDb.schemas.backup.databaseId, databaseIds)))\n        .groupBy(drizzleDb.schemas.backup.createdAt, drizzleDb.schemas.backup.status)\n        .orderBy(drizzleDb.schemas.backup.createdAt);\n\n\n    const restorationsCountResult = await db\n        .select({\n            count: count(),\n        })\n        .from(drizzleDb.schemas.restoration)\n        .where(inArray(drizzleDb.schemas.restoration.databaseId, databaseIds));\n\n\n    const restorationsCount = restorationsCountResult[0]?.count ?? 0;\n    const projectsCount = projects.length;\n    const backupsEvolutionCount = backupsEvolution.length;\n\n    const sortedBackupsEvolution = backupsEvolution.sort(\n        (a, b) => new Date(a.createdAt).getTime() - new Date(b.createdAt).getTime()\n    );\n\n\n    return (\n        <Page>\n            <PageHeader>\n                <PageTitle>Statistics Overview</PageTitle>\n            </PageHeader>\n\n            <PageContent className=\"flex flex-col gap-y-4\">\n                <div className=\"grid grid-cols-1 md:grid-cols-3 gap-4\">\n                    <Card className=\"w-full\">\n                        <CardHeader className=\"flex flex-row items-center justify-between pb-2\">\n                            <CardTitle className=\"text-sm font-medium\">Projects</CardTitle>\n                            <Building2 className=\"h-4 w-4 text-muted-foreground\"/>\n                        </CardHeader>\n                        <CardContent>\n                            <div className=\"text-2xl font-bold\">{projectsCount}</div>\n                            <p className=\"text-xs text-muted-foreground\">Active projects in this organization</p>\n                        </CardContent>\n                    </Card>\n\n                    <Card className=\"w-full\">\n                        <CardHeader className=\"flex flex-row items-center justify-between pb-2\">\n                            <CardTitle className=\"text-sm font-medium\">Backups</CardTitle>\n                            <DatabaseBackup className=\"h-4 w-4 text-muted-foreground\"/>\n                        </CardHeader>\n                        <CardContent>\n                            <div className=\"text-2xl font-bold\">{backupsEvolutionCount}</div>\n                            <p className=\"text-xs text-muted-foreground\">Total backups executed across all databases</p>\n                        </CardContent>\n                    </Card>\n\n                    <Card className=\"w-full\">\n                        <CardHeader className=\"flex flex-row items-center justify-between pb-2\">\n                            <CardTitle className=\"text-sm font-medium\">Restorations</CardTitle>\n                            <RefreshCcw className=\"h-4 w-4 text-muted-foreground\"/>\n                        </CardHeader>\n                        <CardContent>\n                            <div className=\"text-2xl font-bold\">{restorationsCount}</div>\n                            <p className=\"text-xs text-muted-foreground\">Total restoration operations performed</p>\n                        </CardContent>\n                    </Card>\n                </div>\n\n                <div className=\"flex flex-col md:flex-row gap-4\">\n                    <EvolutionLineChart\n                        data={sortedBackupsEvolution}\n                    />\n\n                    <PercentageLineChart\n                        data={backupsRate}/>\n                </div>\n            </PageContent>\n        </Page>\n    );\n}\n"
  },
  {
    "path": "app/(customer)/dashboard/home/page.tsx",
    "content": "import {PageParams} from \"@/types/next\";\nimport {Page, PageContent, PageHeader, PageTitle} from \"@/features/layout/page\";\nimport {Card, CardContent, CardHeader, CardTitle} from \"@/components/ui/card\";\nimport {Building2, Database, DatabaseBackup, Folder, RefreshCcw, Server, Workflow} from \"lucide-react\";\nimport {currentUser} from \"@/lib/auth/current-user\";\nimport {notFound} from \"next/navigation\";\nimport {db} from \"@/db\";\nimport {and, asc, eq, inArray} from \"drizzle-orm\";\nimport * as drizzleDb from \"@/db\";\nimport {listOrganizations} from \"@/lib/auth/auth\";\nimport {Metadata} from \"next\";\n\nexport const metadata: Metadata = {\n    title: \"Home\",\n};\n\nexport default async function RoutePage(props: PageParams<{}>) {\n\n    const user = await currentUser();\n    const organizations = await listOrganizations()\n\n    if (!user || !organizations) notFound();\n\n    const organizationIds = organizations.map(project => project.id);\n\n    const agents = await db.query.agent.findMany({});\n\n    const projects = await db.query.project.findMany({\n        where: and(inArray(drizzleDb.schemas.project.organizationId, organizationIds), eq(drizzleDb.schemas.project.isArchived, false)),\n    });\n\n    const projectIds = projects.map(project => project.id);\n\n\n    const databasesOfAllProjects = await db.query.database.findMany({\n        where: inArray(drizzleDb.schemas.database.projectId, projectIds),\n    })\n    const databaseIds = databasesOfAllProjects.map((database) => database.id);\n\n\n    const backupsEvolution = await db.query.backup.findMany({\n        columns: {\n            id: true,\n            createdAt: true,\n            deletedAt: true,\n        },\n        orderBy: [asc(drizzleDb.schemas.backup.id)],\n        where: inArray(drizzleDb.schemas.backup.databaseId, databaseIds),\n    });\n\n    const availableBackups = backupsEvolution.filter(backup => backup.deletedAt == null);\n\n\n    return (\n        <Page>\n            <PageHeader>\n                <PageTitle>Dashboard</PageTitle>\n            </PageHeader>\n            <PageContent className=\"flex flex-col gap-y-4\">\n                <div className=\"grid grid-cols-1 md:grid-cols-3 gap-4\">\n                    <Card className=\"w-full\">\n                        <CardHeader className=\"flex flex-row items-center justify-between space-y-0 pb-2\">\n                            <CardTitle className=\"text-sm font-medium\">Organizations</CardTitle>\n                            <Building2 className=\"h-4 w-4 text-muted-foreground\"/>\n                        </CardHeader>\n                        <CardContent>\n                            <div className=\"text-2xl font-bold\">{organizations.length}</div>\n                            <p className=\"text-xs text-muted-foreground\">Number of organizations</p>\n                        </CardContent>\n                    </Card>\n\n                    <Card className=\"w-full\">\n                        <CardHeader className=\"flex flex-row items-center justify-between space-y-0 pb-2\">\n                            <CardTitle className=\"text-sm font-medium\">Projects</CardTitle>\n                            <Folder className=\"h-4 w-4 text-muted-foreground\"/>\n                        </CardHeader>\n                        <CardContent>\n                            <div className=\"text-2xl font-bold\">{projects.length}</div>\n                            <p className=\"text-xs text-muted-foreground\">Number of projects</p>\n                        </CardContent>\n                    </Card>\n\n                    <Card className=\"w-full\">\n                        <CardHeader className=\"flex flex-row items-center justify-between space-y-0 pb-2\">\n                            <CardTitle className=\"text-sm font-medium\">Databases</CardTitle>\n                            <Database className=\"h-4 w-4 text-muted-foreground\"/>\n                        </CardHeader>\n                        <CardContent>\n                            <div className=\"text-2xl font-bold\">{databasesOfAllProjects.length}</div>\n                            <p className=\"text-xs text-muted-foreground\">Databases across all projects</p>\n                        </CardContent>\n                    </Card>\n\n                    <Card className=\"w-full\">\n                        <CardHeader className=\"flex flex-row items-center justify-between space-y-0 pb-2\">\n                            <CardTitle className=\"text-sm font-medium\">Agents</CardTitle>\n                            <Workflow className=\"h-4 w-4 text-muted-foreground\"/>\n                        </CardHeader>\n                        <CardContent>\n                            <div className=\"text-2xl font-bold\">{agents.length}</div>\n                            <p className=\"text-xs text-muted-foreground\">Registered agents</p>\n                        </CardContent>\n                    </Card>\n\n                    <Card className=\"w-full\">\n                        <CardHeader className=\"flex flex-row items-center justify-between space-y-0 pb-2\">\n                            <CardTitle className=\"text-sm font-medium\">Total Backups</CardTitle>\n                            <DatabaseBackup className=\"h-4 w-4 text-muted-foreground\"/>\n                        </CardHeader>\n                        <CardContent>\n                            <div className=\"text-2xl font-bold\">{backupsEvolution.length}</div>\n                            <p className=\"text-xs text-muted-foreground\">All backups recorded</p>\n                        </CardContent>\n                    </Card>\n\n                    <Card className=\"w-full\">\n                        <CardHeader className=\"flex flex-row items-center justify-between space-y-0 pb-2\">\n                            <CardTitle className=\"text-sm font-medium\">Available Backups</CardTitle>\n                            <RefreshCcw className=\"h-4 w-4 text-muted-foreground\"/>\n                        </CardHeader>\n                        <CardContent>\n                            <div className=\"text-2xl font-bold\">{availableBackups.length}</div>\n                            <p className=\"text-xs text-muted-foreground\">Currently active backups</p>\n                        </CardContent>\n                    </Card>\n                </div>\n                {/*Do not delete*/}\n                {/*<div className=\"flex flex-1 flex-col gap-4\">*/}\n                {/*    <div className=\"grid auto-rows-min gap-4 md:grid-cols-3\">*/}\n                {/*        <div className=\"aspect-video rounded-xl bg-muted/50\"/>*/}\n                {/*        <div className=\"aspect-video rounded-xl bg-muted/50\"/>*/}\n                {/*        <div className=\"aspect-video rounded-xl bg-muted/50\"/>*/}\n                {/*    </div>*/}\n                {/*</div>*/}\n            </PageContent>\n        </Page>\n\n    );\n}\n"
  },
  {
    "path": "app/(customer)/dashboard/layout.tsx",
    "content": "import { ReactNode } from \"react\";\nimport { redirect } from \"next/navigation\";\n\nimport { SidebarInset, SidebarProvider } from \"@/components/ui/sidebar\";\nimport { AppSidebar } from \"@/components/wrappers/dashboard/common/sidebar/app-sidebar\";\nimport { Header } from \"@/features/layout/Header\";\nimport { currentUser } from \"@/lib/auth/current-user\";\nimport { ThemeMetaUpdater } from \"@/features/browser/theme-meta-updater\";\n\nexport default async function Layout({ children }: { children: ReactNode }) {\n  const user = await currentUser();\n  if (!user) redirect(\"/login\");\n\n  return (\n    <SidebarProvider>\n      <div className=\"flex flex-col lg:flex-row w-full\">\n        <ThemeMetaUpdater />\n        <AppSidebar />\n        <SidebarInset>\n          <Header />\n          <main className=\"h-full\">{children}</main>\n        </SidebarInset>\n      </div>\n    </SidebarProvider>\n  );\n}\n"
  },
  {
    "path": "app/(customer)/dashboard/loading.tsx",
    "content": "import { LoadingSpinner } from \"@/components/wrappers/common/loading/loading-spinner\";\n\nexport default function Loading() {\n    return (\n        <div className=\"w-full h-full flex flex-col items-center justify-center\">\n            <LoadingSpinner size={50} />\n        </div>\n    );\n}\n"
  },
  {
    "path": "app/(landing)/home/page.tsx",
    "content": "export default function Home() {\n    return (\n        <div className=\"grid grid-rows-[20px_1fr_20px] items-center justify-items-center min-h-screen p-8 pb-20 gap-16 sm:p-20 font-[family-name:var(--font-geist-sans)]\">\n            <h1 className=\"font-bold text-4xl leading-tight\">Home landing page</h1>\n        </div>\n    );\n}\n"
  },
  {
    "path": "app/(landing)/page.tsx",
    "content": "import { redirect } from \"next/navigation\";\nimport { getCurrentOrganizationSlug } from \"@/features/dashboard/organization-cookie\";\nimport { currentUser } from \"@/lib/auth/current-user\";\n\nexport default async function Index() {\n    const user = await currentUser();\n    if (user) {\n        const currentOrganizationSlug = await getCurrentOrganizationSlug();\n        redirect(`/dashboard/home`);\n    }\n    redirect(\"/login\");\n    //Do not delete\n    // return (\n    //     <Home/>\n    // );\n}\n"
  },
  {
    "path": "app/api/agent/[agentId]/backup/helpers.ts",
    "content": "import {NextResponse} from \"next/server\";\nimport {and, eq} from \"drizzle-orm\";\nimport {db} from \"@/db\";\nimport * as drizzleDb from \"@/db\";\nimport {logger} from \"@/lib/logger\";\n\nconst log = logger.child({module: \"api/agent/backup/helpers\"});\n\nexport function withAgentCheck(handler: Function) {\n    return async (request: Request, context: { params: Promise<{ agentId: string }> }) => {\n        try {\n            const agentId = (await context.params).agentId;\n\n            const agent = await db.query.agent.findFirst({\n                where: and(eq(drizzleDb.schemas.agent.id, agentId), eq(drizzleDb.schemas.agent.isArchived, false)),\n            });\n\n            if (!agent) {\n                return NextResponse.json(\n                    {error: \"Agent not found\"},\n                    {status: 404}\n                );\n            }\n\n            return handler(request, {...context, agent});\n        } catch (err) {\n            log.error({error: err, name: \"withAgentCheck\"}, \"Error in agent middleware\");\n            return NextResponse.json(\n                {error: \"Internal server error\"},\n                {status: 500}\n            );\n        }\n    };\n}\n\nexport async function getDatabaseOrThrow(generatedId: string) {\n    const database = await db.query.database.findFirst({\n        where: eq(drizzleDb.schemas.database.agentDatabaseId, generatedId),\n        with: {\n            project: true,\n            alertPolicies: true,\n            storagePolicies: true\n        }\n    });\n\n    if (!database) {\n        throw NextResponse.json(\n            {error: \"Database associated with generatedId not found\"},\n            {status: 404}\n        );\n    }\n\n    return database;\n}"
  },
  {
    "path": "app/api/agent/[agentId]/backup/route.ts",
    "content": "import {NextResponse} from \"next/server\";\nimport {and, eq} from \"drizzle-orm\";\nimport * as drizzleDb from \"@/db\";\nimport {db as dbClient, db} from \"@/db\";\nimport {getDatabaseOrThrow, withAgentCheck} from \"./helpers\";\nimport {Backup} from \"@/db/schema/07_database\";\nimport {withUpdatedAt} from \"@/db/utils\";\nimport {eventEmitter} from \"@/features/shared/event\";\nimport {sendNotificationsBackupRestore} from \"@/features/notifications/helpers\";\nimport {EventKind} from \"@/features/notifications/types\";\nimport {logger} from \"@/lib/logger\";\n\nconst log = logger.child({module: \"api/agent/backup/route\"});\n\nexport type BodyPost = {\n    method: \"manual\" | \"automatic\"\n    generatedId: string\n}\n\nexport type BodyPatch = {\n    backupId: string\n    status: \"success\" | \"failed\"\n    size: number\n    generatedId: string\n}\n\nexport const POST = withAgentCheck(async (request: Request, {params, agent}: {\n    params: Promise<{ agentId: string }>,\n    agent: any\n}) => {\n    try {\n        const body: BodyPost = await request.json();\n        const method = body.method\n        const database = await getDatabaseOrThrow(body.generatedId);\n\n        let backup: Backup | null | undefined = null;\n\n        if (method === \"automatic\") {\n\n            const ongoingBackup = await db.query.backup.findFirst({\n                where: and(\n                    eq(drizzleDb.schemas.backup.status, 'ongoing'),\n                    eq(drizzleDb.schemas.backup.databaseId, database.id),\n                ),\n            });\n\n            if (!ongoingBackup) {\n                [backup] = await db\n                    .insert(drizzleDb.schemas.backup)\n                    .values({\n                        status: 'ongoing',\n                        databaseId: database.id,\n                    })\n                    .returning();\n                if (!backup) {\n                    return NextResponse.json(\n                        {error: \"Unable to create an automatic backup\"},\n                        {status: 500}\n                    );\n                }\n            } else {\n                return NextResponse.json(\n                    {error: \"A backup is already ongoing\"},\n                    {status: 500}\n                );\n            }\n        } else {\n            backup = await db.query.backup.findFirst({\n                where: and(\n                    eq(drizzleDb.schemas.backup.status, 'ongoing'),\n                    eq(drizzleDb.schemas.backup.databaseId, database.id),\n                ),\n            });\n\n            if (!backup) {\n                return NextResponse.json(\n                    {error: \"Unable to find the corresponding backup\"},\n                    {status: 404}\n                );\n            }\n        }\n\n        eventEmitter.emit('modification', {update: true});\n\n        return NextResponse.json(\n            {\n                message: \"Init backup success\",\n                backup: backup,\n            },\n            {status: 200}\n        );\n    } catch (error) {\n        log.error({error: error}, \"Error in POST for INIT backup\");\n        return NextResponse.json(\n            {error: \"Internal server error\"},\n            {status: 500}\n        );\n    }\n});\n\nexport const PATCH = withAgentCheck(async (request: Request, {params, agent}: {\n    params: Promise<{ agentId: string }>,\n    agent: any\n}) => {\n    try {\n        const body: BodyPatch = await request.json();\n        log.info({data: body}, \"Body from PATH in backup route\");\n\n        const status = body.status\n        const backupId = body.backupId\n        const backupSize = body.size\n\n        const database = await getDatabaseOrThrow(body.generatedId);\n\n        const backup = await db.query.backup.findFirst({\n            where: eq(drizzleDb.schemas.backup.id, backupId),\n        });\n\n        if (!backup) {\n            return NextResponse.json(\n                {error: \"No backup found\"},\n                {status: 500}\n            );\n        }\n\n        const [backupUpdated] = await dbClient\n            .update(drizzleDb.schemas.backup)\n            .set(withUpdatedAt({\n                status: status,\n                fileSize: backupSize\n            }))\n            .where(eq(drizzleDb.schemas.backup.id, backup.id))\n            .returning();\n\n\n        eventEmitter.emit('modification', {update: true});\n        await sendNotificationsBackupRestore(database, status == \"failed\" ? \"error_backup\" : \"success_backup\" as EventKind);\n\n        return NextResponse.json(\n            {\n                message: \"Backup successfully updated\",\n                backup: backupUpdated,\n            },\n            {status: 200}\n        );\n    } catch (error) {\n        log.error({error: error}, \"Error in PATCH backup\")\n        return NextResponse.json(\n            {error: \"Internal server error\"},\n            {status: 500}\n        );\n    }\n});\n\n"
  },
  {
    "path": "app/api/agent/[agentId]/backup/upload/init/route.ts",
    "content": "import {NextResponse} from \"next/server\";\nimport {and, eq} from \"drizzle-orm\";\nimport * as drizzleDb from \"@/db\";\nimport {db} from \"@/db\";\nimport {getDatabaseOrThrow, withAgentCheck} from \"../../helpers\";\nimport {isUuidv4} from \"@/utils/verify-uuid\";\nimport {eventEmitter} from \"@/features/shared/event\";\nimport {logger} from \"@/lib/logger\";\n\nconst log = logger.child({module: \"api/agent/backup/upload/init\"});\n\nexport type Body = {\n    generatedId: string\n    storageChannelId: string\n    backupId: string\n}\nexport const POST = withAgentCheck(async (request: Request, {params, agent}: {\n    params: Promise<{ agentId: string }>,\n    agent: any\n}) => {\n    try {\n        const body: Body = await request.json();\n\n        log.info({data: body}, \"Body for backup upload init\");\n\n        const generatedId = body.generatedId;\n        const storageChannelId = body.storageChannelId;\n        const backupId = body.backupId;\n\n        if (!generatedId || !isUuidv4(generatedId)) {\n            return NextResponse.json(\n                {error: \"generatedId is not a valid UUID\"},\n                {status: 400}\n            );\n        }\n\n        const database = await getDatabaseOrThrow(generatedId);\n\n        const backup = await db.query.backup.findFirst({\n            where: and(\n                eq(drizzleDb.schemas.backup.id, backupId),\n                eq(drizzleDb.schemas.backup.databaseId, database.id),\n            ),\n        });\n\n        if (!backup) {\n            return NextResponse.json(\n                {error: \"Unable to find the corresponding backup\"},\n                {status: 404}\n            );\n        }\n\n        const [backupStorage] = await db\n            .insert(drizzleDb.schemas.backupStorage)\n            .values({\n                backupId: backup.id,\n                storageChannelId: storageChannelId,\n                status: \"pending\",\n            })\n            .returning();\n\n        eventEmitter.emit('modification', {update: true});\n\n        return NextResponse.json(\n            {\n                message: \"Backup storage successfully created\",\n                backupStorage: backupStorage\n            },\n            {status: 200}\n        );\n    } catch (error) {\n        log.error({error: error}, \"Error in POST for INIT backup\");\n        return NextResponse.json(\n            {error: \"Internal server error\"},\n            {status: 500}\n        );\n    }\n});\n\n"
  },
  {
    "path": "app/api/agent/[agentId]/backup/upload/status/route.ts",
    "content": "import {NextResponse} from \"next/server\";\nimport {and, eq} from \"drizzle-orm\";\nimport * as drizzleDb from \"@/db\";\nimport {db as dbClient, db} from \"@/db\";\nimport {withUpdatedAt} from \"@/db/utils\";\nimport {getDatabaseOrThrow, withAgentCheck} from \"../../helpers\";\nimport {eventEmitter} from \"@/features/shared/event\";\nimport {logger} from \"@/lib/logger\";\n\nconst log = logger.child({module: \"api/agent/backup/upload/status\"});\n\nexport type Body = {\n    generatedId: string\n    status: \"success\" | \"failed\"\n    backupStorageId: string\n    path: string\n    size: number\n    backupId: string\n}\nexport const PATCH = withAgentCheck(async (request: Request, {params, agent}: {\n    params: Promise<{ agentId: string }>,\n    agent: any\n}) => {\n    try {\n        const body: Body = await request.json();\n        const generatedId = body.generatedId;\n        const status = body.status;\n        const filePath = body.path;\n        const fileSize = body.size;\n        const backupStorageId = body.backupStorageId;\n        const backupId = body.backupId;\n\n        log.info({data: body}, \"Body for backup upload status\");\n\n        const database = await getDatabaseOrThrow(generatedId);\n\n        const backup = await db.query.backup.findFirst({\n            where: and(\n                eq(drizzleDb.schemas.backup.id, backupId),\n                eq(drizzleDb.schemas.backup.databaseId, database.id),\n            ),\n            with: {\n                storages: true\n            }\n        });\n\n        if (!backup) {\n            return NextResponse.json(\n                {error: \"Unable to find the corresponding backup\"},\n                {status: 404}\n            );\n        }\n\n        const [backupStorage] = await dbClient\n            .update(drizzleDb.schemas.backupStorage)\n            .set(withUpdatedAt({\n                status: status,\n                path: filePath,\n                size: fileSize\n            }))\n            .where(eq(drizzleDb.schemas.backupStorage.id, backupStorageId))\n            .returning();\n\n\n        if (backup.storages.length > 0) {\n            const hasSuccessfulStorage = backup.storages.some(\n                (storage) => storage.status === \"success\"\n            );\n\n            if (hasSuccessfulStorage && backup.status !== \"success\") {\n                await db\n                    .update(drizzleDb.schemas.backup)\n                    .set(withUpdatedAt({\n                        status: \"success\",\n                        fileSize: fileSize,\n                    }))\n                    .where(eq(drizzleDb.schemas.backup.id, backup.id));\n            }\n        }\n\n        eventEmitter.emit('modification', {update: true});\n\n        return NextResponse.json({\n                message: \"Backup status successfully updated\",\n                backupStorage: backupStorage\n            },\n            {status: 200}\n        );\n    } catch (error) {\n        log.error({error: error},\"Error in POST for INIT backup\");\n        return NextResponse.json(\n            {error: \"Internal server error\"},\n            {status: 500}\n        );\n    }\n});\n\n"
  },
  {
    "path": "app/api/agent/[agentId]/restore/route.ts",
    "content": "import {NextResponse} from \"next/server\";\nimport {isUuidv4} from \"@/utils/verify-uuid\";\nimport * as drizzleDb from \"@/db\";\nimport {db} from \"@/db\";\nimport {and, eq} from \"drizzle-orm\";\nimport {sendNotificationsBackupRestore} from \"@/features/notifications/helpers\";\nimport {logger} from \"@/lib/logger\";\nimport {withUpdatedAt} from \"@/db/utils\";\n\nconst log = logger.child({module: \"api/agent/restore\"});\n\nexport type BodyResultRestore = {\n    generatedId: string\n    status: string\n}\ntype RestorationStatus = 'waiting' | 'ongoing' | 'failed' | 'success';\n\n\nexport async function POST(\n    request: Request,\n    {params}: { params: Promise<{ agentId: string }> }\n) {\n\n    try {\n\n        const agentId = (await params).agentId\n        const body: BodyResultRestore = await request.json();\n\n\n        if (!isUuidv4(body.generatedId)) {\n            return NextResponse.json(\n                {error: \"generatedId is not a valid uuid\"},\n                {status: 500}\n            );\n        }\n\n        const agent = await db.query.agent.findFirst({\n            where: and(eq(drizzleDb.schemas.agent.id, agentId), eq(drizzleDb.schemas.agent.isArchived, false)),\n        })\n        if (!agent) {\n            return NextResponse.json({error: \"Agent not found\"}, {status: 404})\n        }\n\n        const database = await db.query.database.findFirst({\n            where: eq(drizzleDb.schemas.database.agentDatabaseId, body.generatedId),\n            with: {\n                alertPolicies: true\n            }\n        })\n\n        if (!database) {\n            return NextResponse.json({error: \"Database associated with generatedId provided not found\"}, {status: 404})\n        }\n\n        const restoration = await db.query.restoration.findFirst({\n            where: and(eq(drizzleDb.schemas.restoration.status, \"ongoing\"), eq(drizzleDb.schemas.restoration.databaseId, database.id),)\n        })\n\n        if (!restoration) {\n            return NextResponse.json({error: \"Unable to fin the corresponding restoration\"}, {status: 404})\n        }\n\n\n        await db\n            .update(drizzleDb.schemas.restoration)\n            .set(withUpdatedAt({status: body.status as RestorationStatus}))\n            .where(eq(drizzleDb.schemas.restoration.id, restoration.id));\n\n        await sendNotificationsBackupRestore(database, body.status == \"failed\" ? \"error_restore\" : \"success_restore\");\n\n        const response = {\n            status: true,\n            message: \"Restoration successfully updated\"\n        }\n\n        return Response.json(response, {status: 200})\n    } catch (error) {\n        log.error({error: error}, \"Error in POST handler\")\n        return NextResponse.json(\n            {error: 'Internal server error'},\n            {status: 500}\n        );\n    }\n}"
  },
  {
    "path": "app/api/agent/[agentId]/status/helpers.ts",
    "content": "import {NextResponse} from \"next/server\";\nimport {Body} from \"./route\";\nimport {isUuidv4} from \"@/utils/verify-uuid\";\nimport {Agent} from \"@/db/schema/08_agent\";\nimport {DatabaseWith} from \"@/db/schema/07_database\";\nimport * as drizzleDb from \"@/db\";\nimport {db, db as dbClient} from \"@/db\";\nimport {and, eq, inArray} from \"drizzle-orm\";\nimport {dbmsEnumSchema, EDbmsSchema} from \"@/db/schema/types\";\nimport {withUpdatedAt} from \"@/db/utils\";\nimport type {StorageInput} from \"@/features/storages/types\";\nimport {dispatchStorage} from \"@/features/storages/dispatch\";\nimport {Setting} from \"@/db/schema/01_setting\";\nimport {logger} from \"@/lib/logger\";\n\nconst log = logger.child({module: \"api/agent/status/helpers\"});\n\nexport async function handleDatabases(body: Body, agent: Agent, lastContact: Date, settings: Setting) {\n    const databasesResponse = [];\n\n    const formatDatabase = (database: DatabaseWith, backupAction: boolean, restoreAction: boolean, UrlBackup: string | null, storages: PingDatabaseStorageChannels[], urlMeta: string | null) => ({\n        generatedId: database.agentDatabaseId,\n        dbms: database.dbms,\n        storages: storages,\n        encrypt: settings.encryption,\n        data: {\n            backup: {\n                action: backupAction,\n                cron: database.backupPolicy,\n            },\n            restore: {\n                action: restoreAction,\n                file: UrlBackup,\n                metaFile: urlMeta\n            },\n        },\n    });\n\n    for (const db of body.databases) {\n\n        const existingDatabase = await dbClient.query.database.findFirst({\n            where: eq(drizzleDb.schemas.database.agentDatabaseId, db.generatedId),\n            with: {\n                project: true\n            }\n        });\n\n        let backupAction: boolean = false\n        let restoreAction: boolean = false\n        let urlBackup: string | null = null;\n        let urlMeta: string | null = null\n\n        if (!existingDatabase) {\n            if (!isUuidv4(db.generatedId)) {\n                return NextResponse.json(\n                    {error: \"generatedId is not a valid uuid\"},\n                    {status: 500}\n                );\n            }\n\n            if (!dbmsEnumSchema.safeParse(db.dbms).success) {\n                log.error({name: \"handleDatabases\"},`Database type not available: ${db.dbms}`);\n                continue;\n            }\n\n            const [databaseCreated] = await dbClient\n                .insert(drizzleDb.schemas.database)\n                .values({\n                    agentId: agent.id,\n                    name: db.name,\n                    dbms: db.dbms as EDbmsSchema,\n                    agentDatabaseId: db.generatedId,\n                    lastContact: db.pingStatus ? lastContact : null,\n                    healthErrorCount: null\n                })\n                .returning();\n\n\n            if (databaseCreated) {\n\n\n                await dbClient\n                    .insert(drizzleDb.schemas.healthcheckLog)\n                    .values({\n                        kind: \"database\",\n                        status: db.pingStatus ? \"success\" : \"failed\",\n                        objectId: databaseCreated.id,\n                        date: lastContact\n                    })\n\n                const storages = await getDatabaseStorageChannels(databaseCreated.id)\n\n                databasesResponse.push(formatDatabase(databaseCreated, backupAction, restoreAction, urlBackup, storages, null));\n            }\n        } else {\n\n            const [databaseUpdated] = await dbClient\n                .update(drizzleDb.schemas.database)\n                .set(withUpdatedAt({\n                    name: db.name,\n                    agentId: agent.id,\n                    dbms: db.dbms as EDbmsSchema,\n                    lastContact: db.pingStatus ? lastContact : existingDatabase.lastContact,\n                    healthErrorCount: db.pingStatus ? null : existingDatabase.healthErrorCount,\n                }))\n                .where(eq(drizzleDb.schemas.database.id, existingDatabase.id))\n                .returning();\n\n\n            await dbClient\n                .insert(drizzleDb.schemas.healthcheckLog)\n                .values({\n                    kind: \"database\",\n                    status: db.pingStatus ? \"success\" : \"failed\",\n                    objectId: databaseUpdated.id,\n                    date: lastContact\n                })\n\n\n            const activeBackup = await dbClient.query.backup.findFirst({\n                where: and(\n                    eq(drizzleDb.schemas.backup.databaseId, databaseUpdated.id),\n                    inArray(drizzleDb.schemas.backup.status, [\"waiting\", \"ongoing\"])\n                )\n            })\n\n            const restoration = await dbClient.query.restoration.findFirst({\n                where: and(eq(drizzleDb.schemas.restoration.databaseId, databaseUpdated.id), eq(drizzleDb.schemas.restoration.status, \"waiting\")),\n                with: {\n                    backupStorage: true\n                }\n            })\n\n            if (activeBackup && activeBackup.status == \"waiting\") {\n                backupAction = true\n\n                await dbClient\n                    .update(drizzleDb.schemas.backup)\n                    .set(withUpdatedAt({status: \"ongoing\"}))\n                    .where(eq(drizzleDb.schemas.backup.id, activeBackup.id));\n            }\n\n            if (restoration) {\n                restoreAction = true\n\n                if (!restoration.backupStorage || restoration.backupStorage.status != \"success\" || !restoration.backupStorage.path) {\n                    restoreAction = false\n                    continue;\n                }\n\n                const input: StorageInput = {\n                    action: \"get\",\n                    data: {\n                        path: restoration.backupStorage.path,\n                        signedUrl: true,\n                    },\n                    metadata: {\n                        storageId: restoration.backupStorage.storageChannelId,\n                        fileKind: \"backups\"\n                    }\n                };\n\n                const inputMeta: StorageInput = {\n                    action: \"get\",\n                    data: {\n                        path: `${restoration.backupStorage.path}.meta`,\n                        signedUrl: true,\n                    },\n                    metadata: {\n                        storageId: restoration.backupStorage.storageChannelId,\n                        fileKind: \"backups\"\n                    }\n                };\n\n\n                try {\n                    const result = await dispatchStorage(input, undefined, restoration.backupStorage.storageChannelId);\n                    const resultMeta = await dispatchStorage(inputMeta, undefined, restoration.backupStorage.storageChannelId);\n\n                    if (result.success) {\n                        urlBackup = result.url ?? null;\n                        urlMeta = resultMeta.url ?? null\n                    } else {\n                        await dbClient\n                            .update(drizzleDb.schemas.restoration)\n                            .set(withUpdatedAt({status: \"failed\"}))\n                            .where(eq(drizzleDb.schemas.restoration.id, restoration.id));\n\n                        const errorMessage = \"Failed to get backup URL\";\n                        log.error({error: errorMessage, name: \"handleDatabases\"}, \"Restoration failed\");\n                        continue;\n                    }\n                } catch (err) {\n                    log.error({error: err, name: \"handleDatabases\"}, \"Restoration crashed unexpectedly\");\n                    await dbClient\n                        .update(drizzleDb.schemas.restoration)\n                        .set(withUpdatedAt({status: \"failed\"}))\n                        .where(eq(drizzleDb.schemas.restoration.id, restoration.id));\n                    continue;\n                }\n\n                await dbClient\n                    .update(drizzleDb.schemas.restoration)\n                    .set(withUpdatedAt({status: \"ongoing\"}))\n                    .where(eq(drizzleDb.schemas.restoration.id, restoration.id));\n            }\n            const storages = await getDatabaseStorageChannels(databaseUpdated.id)\n            databasesResponse.push(formatDatabase(databaseUpdated, backupAction, restoreAction, urlBackup, storages, urlMeta));\n        }\n    }\n    return databasesResponse;\n}\n\n\ntype PingDatabaseStorageChannels = {\n    id: string;\n    config: any\n    provider: string\n}\n\nasync function getDatabaseStorageChannels(databaseId: string): Promise<PingDatabaseStorageChannels[]> {\n\n    const database = await db.query.database.findFirst({\n        where: eq(drizzleDb.schemas.database.id, databaseId),\n        with: {\n            project: true,\n            retentionPolicy: true,\n            alertPolicies: true,\n            storagePolicies: true\n        }\n    });\n\n    if (!database) {\n        return []\n    }\n\n    const settings = await db.query.setting.findFirst({\n        where: eq(drizzleDb.schemas.setting.name, \"system\"),\n        with: {storageChannel: true},\n    });\n\n    const defaultStorageChannel: PingDatabaseStorageChannels[] = settings?.storageChannel\n        ? [{\n            id: settings.storageChannel.id,\n            provider: settings.storageChannel.provider,\n            config: settings.storageChannel.config,\n        }]\n        : [];\n\n\n    const enabledDatabaseStorageChannels = await Promise.all(\n        (database.storagePolicies ?? [])\n            .filter(p => p.enabled)\n            .map(async policy => {\n                const storageChannel = await db.query.storageChannel.findFirst({\n                    where: eq(drizzleDb.schemas.storageChannel.id, policy.storageChannelId),\n                });\n\n                if (!storageChannel) return null;\n\n                return {\n                    id: storageChannel.id,\n                    config: storageChannel.config,\n                    provider: storageChannel.provider,\n                } as PingDatabaseStorageChannels;\n            })\n    );\n\n    const filteredChannels: PingDatabaseStorageChannels[] = enabledDatabaseStorageChannels.filter(\n        (c): c is PingDatabaseStorageChannels => c !== null\n    );\n\n    return filteredChannels.length > 0 ? filteredChannels : defaultStorageChannel;\n}\n\n"
  },
  {
    "path": "app/api/agent/[agentId]/status/route.ts",
    "content": "import {NextResponse} from \"next/server\";\nimport {handleDatabases} from \"./helpers\";\nimport * as drizzleDb from \"@/db\";\nimport {db} from \"@/db\";\nimport {EDbmsSchema} from \"@/db/schema/types\";\nimport {and, eq} from \"drizzle-orm\";\nimport {isUuidv4} from \"@/utils/verify-uuid\";\nimport {withUpdatedAt} from \"@/db/utils\";\nimport {logger} from \"@/lib/logger\";\n\n\nconst log = logger.child({module: \"api/agent/status/route\"});\n\n\nexport type databaseAgent = {\n    name: string,\n    dbms: EDbmsSchema,\n    generatedId: string\n    pingStatus: boolean\n}\n\nexport type Body = {\n    version: string,\n    databases: databaseAgent[]\n}\n\n\nexport async function POST(\n    request: Request,\n    {params}: { params: Promise<{ agentId: string }> }\n) {\n    try {\n        const agentId = (await params).agentId\n        log.info(`Agent ID: ${agentId}`)\n        const body: Body = await request.json();\n        const lastContact = new Date();\n        let message: string\n\n        if (!isUuidv4(agentId)) {\n            message = \"agentId is not a valid uuid\"\n            log.error({error: message}, \"An error occurred\")\n            return NextResponse.json(\n                {error: \"agentId is not a valid uuid\"},\n                {status: 500}\n            );\n        }\n\n        const agent = await db.query.agent.findFirst({\n            where: and(eq(drizzleDb.schemas.agent.id, agentId), eq(drizzleDb.schemas.agent.isArchived, false)),\n        })\n\n        if (!agent) {\n            message = \"Agent not found\"\n            return NextResponse.json({error: message}, {status: 404})\n        }\n\n        const [settings] = await db.select().from(drizzleDb.schemas.setting).where(eq(drizzleDb.schemas.setting.name, \"system\")).limit(1);\n        if (!settings) {\n            return NextResponse.json({error: \"An error occured\"}, {status: 404})\n        }\n\n        const databasesResponse = await handleDatabases(body, agent, lastContact, settings)\n\n        await db\n            .update(drizzleDb.schemas.agent)\n            .set(withUpdatedAt({\n                version: body.version,\n                lastContact: lastContact,\n                healthErrorCount: null\n            }))\n            .where(eq(drizzleDb.schemas.agent.id, agentId));\n\n        await db\n            .insert(drizzleDb.schemas.healthcheckLog)\n            .values({\n                kind: \"agent\",\n                status: \"success\",\n                objectId: agentId,\n                date: lastContact\n            })\n\n        const response = {\n            agent: {\n                id: agentId,\n                lastContact: lastContact\n            },\n            databases: databasesResponse\n        }\n\n        return Response.json(response)\n    } catch (error) {\n        log.error({error: error}, \"Error in POST handler\")\n        return NextResponse.json(\n            {error: 'Internal server error'},\n            {status: 500}\n        );\n    }\n}\n\n"
  },
  {
    "path": "app/api/auth/[...all]/route.ts",
    "content": "import { auth } from \"@/lib/auth/auth\";\nimport { toNextJsHandler } from \"better-auth/next-js\";\n\nexport const { GET, POST } = toNextJsHandler(auth.handler);\n"
  },
  {
    "path": "app/api/config/route.ts",
    "content": "import { NextResponse } from \"next/server\";\n\nexport async function GET() {\n  return NextResponse.json({\n    PROJECT_URL: process.env.PROJECT_URL,\n    PROJECT_NAME: process.env.PROJECT_NAME,\n    PROJECT_DESCRIPTION: process.env.PROJECT_DESCRIPTION,\n  });\n}\n"
  },
  {
    "path": "app/api/events/route.ts",
    "content": "import {auth} from \"@/lib/auth/auth\";\nimport {headers} from \"next/headers\";\nimport {NextResponse} from \"next/server\";\nimport {eventEmitter} from \"@/features/shared/event\";\nimport {logger} from \"@/lib/logger\";\n\nconst log = logger.child({module: \"api/events\"});\n\nexport async function GET(request: Request) {\n\n    const session = await auth.api.getSession({\n        headers: await headers(),\n    });\n\n    if (!session) {\n        return NextResponse.json({error: \"Unauthorized\"}, {status: 403});\n    }\n\n    return new Response(\n        new ReadableStream({\n            start(controller) {\n                log.info(\"Stream started\");\n                const handleModification = (data: any) => {\n                    log.info({data: data},\"Modification event triggered\");\n                    controller.enqueue(`event: modification\\n`);\n                    controller.enqueue(`data: ${JSON.stringify(data)}\\n\\n`);\n                };\n\n                eventEmitter.on('modification', handleModification);\n\n                request.signal.addEventListener('abort', () => {\n                    log.info(\"Client disconnected\");\n                    controller.close();\n                    eventEmitter.off('modification', handleModification);\n                });\n            },\n        }),\n        {\n            status: 200,\n            headers: {\n                'Content-Type': 'text/event-stream',\n                'Cache-Control': 'no-cache',\n                Connection: 'keep-alive',\n            },\n        }\n    );\n}"
  },
  {
    "path": "app/api/files/backups/route.ts",
    "content": "import {NextResponse} from \"next/server\";\nimport path from \"path\";\nimport type {StorageInput} from \"@/features/storages/types\";\nimport {dispatchStorage} from \"@/features/storages/dispatch\";\nimport {Readable} from \"node:stream\";\nimport {logger} from \"@/lib/logger\";\n\nconst log = logger.child({module: \"api/files/backups\"});\n\nexport async function GET(\n    request: Request,\n) {\n\n    const {searchParams} = new URL(request.url);\n    const token = searchParams.get('token');\n    const expires = searchParams.get('expires');\n    const pathFromUrl = searchParams.get('path');\n    const storageId = searchParams.get('storageId');\n\n    if (!pathFromUrl || !storageId) {\n        return NextResponse.json({error: \"Missing search params\"}, {status: 404})\n    }\n\n    const input: StorageInput = {\n        action: \"get\",\n        data: {\n            path: pathFromUrl,\n            signedUrl: true,\n        },\n        metadata: {\n            storageId: storageId,\n            fileKind: \"backups\",\n        }\n    };\n\n    log.info({input: input}, \"Dispatch Storage\");\n\n    const result = await dispatchStorage(input, undefined, storageId);\n\n    if (!result.success) {\n        return NextResponse.json({error: \"Enable to get file from provided storage channel, an error occurred !\"})\n    }\n\n    const fileName = path.basename(pathFromUrl);\n\n    const crypto = require('crypto');\n    const expectedToken = crypto.createHash('sha256').update(`${fileName}${expires}`).digest('hex');\n    if (token !== expectedToken) {\n        return NextResponse.json(\n            {error: 'Invalid signed token'},\n            {status: 403}\n        );\n    }\n\n    const expiresAt = parseInt(expires!, 10);\n    if (Date.now() > expiresAt) {\n        return NextResponse.json(\n            {error: 'Signed token expired'},\n            {status: 403}\n        );\n    }\n\n    if (!result.file || !(result.file instanceof Readable)) {\n        return NextResponse.json(\n            {error: \"Invalid file payload\"},\n            {status: 500}\n        );\n    }\n\n    const fileStream = Readable.from(result.file as Readable);\n\n    const stream = new ReadableStream({\n        start(controller) {\n            fileStream.on('data', (chunk) => controller.enqueue(chunk));\n            fileStream.on('end', () => controller.close());\n            fileStream.on('error', (err) => controller.error(err));\n        },\n    });\n\n    return new NextResponse(stream, {\n        headers: {\n            'Content-Disposition': `attachment; filename=\"${fileName}\"`,\n            'Content-Type': 'application/octet-stream',\n        },\n    });\n}\n\n\n"
  },
  {
    "path": "app/api/files/images/[fileName]/route.ts",
    "content": "import {NextResponse} from \"next/server\";\nimport {auth} from \"@/lib/auth/auth\";\nimport {headers} from \"next/headers\";\nimport {StorageInput} from \"@/features/storages/types\";\nimport {dispatchStorage} from \"@/features/storages/dispatch\";\nimport {Readable} from \"node:stream\";\nimport {logger} from \"@/lib/logger\";\n\nconst log = logger.child({module: \"api/files/images\"});\n\nexport async function GET(\n    req: Request,\n    {params}: { params: Promise<{ fileName: string }> }\n) {\n    const {searchParams} = new URL(req.url);\n    const fileName = (await params).fileName;\n    const storageId = searchParams.get('storageId');\n\n    if (!fileName) return NextResponse.json({error: \"Missing file parameter\"}, {status: 400});\n\n    const session = await auth.api.getSession({headers: await headers()});\n    if (!session) return NextResponse.json({error: \"Unauthorized\"}, {status: 403});\n\n\n    if (!storageId) {\n        return NextResponse.json({error: \"Missing storageId in search params\"}, {status: 404})\n    }\n\n    const ext = fileName.split(\".\").pop()?.toLowerCase();\n    const contentType =\n        ext === \"png\"\n            ? \"image/png\"\n            : ext === \"jpg\" || ext === \"jpeg\"\n                ? \"image/jpeg\"\n                : ext === \"gif\"\n                    ? \"image/gif\"\n                    : ext === \"webp\"\n                        ? \"image/webp\"\n                        : \"application/octet-stream\";\n\n    try {\n\n        const path = `images/${fileName}`;\n\n        const input: StorageInput = {\n            action: \"get\",\n            data: {\n                path: path,\n            },\n            metadata: {\n                storageId: storageId,\n                fileKind: \"images\"\n            }\n        }\n\n        const result = await dispatchStorage(input, undefined, storageId);\n\n        if (!result.file || !(result.file instanceof Readable)) {\n            log.error({error: result}, `An error occurred while getting file`);\n            return NextResponse.json(\n                {error: \"Invalid file payload\"},\n                {status: 500}\n            );\n        }\n\n        const fileStream = Readable.from(result.file as Readable);\n\n        const stream = new ReadableStream({\n            start(controller) {\n                fileStream.on('data', (chunk) => controller.enqueue(chunk));\n                fileStream.on('end', () => controller.close());\n                fileStream.on('error', (err) => controller.error(err));\n            },\n        });\n\n        return new NextResponse(stream, {\n            headers: {\n                'Content-Disposition': `inline; filename=\"${fileName}\"`,\n                \"Cache-Control\": \"no-store\",\n                \"Content-Type\": contentType,\n            },\n        });\n\n    } catch (err) {\n        log.error({error: err}, `Error streaming image`);\n        return NextResponse.json({error: \"Error fetching file\"}, {status: 500});\n    }\n}"
  },
  {
    "path": "app/api/google/drive/callback/route.ts",
    "content": "export async function GET(request: Request) {\n    const url = new URL(request.url);\n    const code = url.searchParams.get(\"code\");\n\n    const success = Boolean(code);\n\n    return new Response(\n        `\n        <!DOCTYPE html>\n        <html>\n            <body>\n                <h1>${success ? \"Success\" : \"Failed\"}</h1>\n            </body>\n        </html>\n        `,\n        {\n            status: success ? 200 : 400,\n            headers: {\n                \"Content-Type\": \"text/html; charset=utf-8\",\n            },\n        }\n    );\n}\n"
  },
  {
    "path": "app/api/tus/hooks/route.ts",
    "content": "import {NextResponse} from \"next/server\";\nimport fs from \"fs\";\nimport path from \"path\";\nimport {env} from \"@/env.mjs\";\nimport {logger} from \"@/lib/logger\";\n\nconst log = logger.child({module: \"api/tus/hooks\"});\n\nexport async function POST(request: Request) {\n    try {\n        const body = await request.json();\n        const event = body.Event\n        const headers = event.HTTPRequest.Header\n        const uploadLength = headers[\"X-File-Size\"]?.[0];\n        const uploadOffset = headers[\"Upload-Offset\"]?.[0];\n        const status = headers[\"X-Status\"]?.[0];\n\n        log.info(`Upload ID : ${event.Upload.ID} (${uploadOffset}/${uploadLength})`);\n\n        if (status === \"success\") {\n            if (\n                body.Type === \"post-receive\" &&\n                event.Upload.SizeIsDeferred === false &&\n                event.Upload.Offset === event.Upload.Size\n            ) {\n                const id = event.Upload.ID;\n                const fileName = headers[\"X-File-Name\"]?.[0];\n                const filePath = headers[\"X-File-Path\"]?.[0];\n\n                if (!filePath) {\n                    return NextResponse.json({error: \"Missing X-File-Path\"}, {status: 500});\n                }\n\n                const uploadDir = path.join(env.PRIVATE_PATH!, \"/uploads/\");\n\n                const oldFilePath = path.join(uploadDir, \"tmp\", id);\n                const newFilePath = path.join(uploadDir, filePath);\n\n                fs.mkdirSync(path.dirname(newFilePath), {recursive: true});\n\n                let retries = 10;\n                while (!fs.existsSync(oldFilePath)) {\n                    if (retries-- === 0) {\n                        return NextResponse.json({error: `Upload file not found: ${oldFilePath}`}, {status: 500});\n                    }\n                    await new Promise(r => setTimeout(r, 200));\n                }\n\n                fs.renameSync(oldFilePath, newFilePath);\n\n                const infoFilePath = `${oldFilePath}.info`;\n                if (fs.existsSync(infoFilePath)) {\n                    fs.unlinkSync(infoFilePath);\n                }\n\n                const metadataHeaderB64 = headers[\"Upload-Metadata\"]?.[0];\n\n                if (metadataHeaderB64) {\n                    const metadataHeader = Buffer.from(metadataHeaderB64, \"base64\").toString(\"utf-8\");\n                    if (metadataHeader) {\n                        const tomlContent = metadataHeader\n                            .split(\",\")\n                            .map((pair) => {\n                                const [key, value] = pair.split(\" \");\n                                const escapedValue = value.replace(/\"/g, '\\\\\"');\n                                return `${key} = \"${escapedValue}\"`;\n                            })\n                            .join(\"\\n\");\n                        const metaFilePath = `${newFilePath}.meta`;\n                        fs.writeFileSync(metaFilePath, tomlContent, \"utf-8\");\n                    }\n                }\n            }\n        }\n        return NextResponse.json({});\n    } catch (error) {\n        log.error({error: error},\"TUS Hook error\");\n        return NextResponse.json({error: \"Internal server error\"}, {status: 500});\n    }\n}"
  },
  {
    "path": "app/error/page.tsx",
    "content": "\"use client\";\n\nimport { Loader2 } from \"lucide-react\";\nimport { useRouter, useSearchParams } from \"next/navigation\";\nimport { useEffect } from \"react\";\nimport { useSession } from \"@/lib/auth/auth-client\";\n\nexport default function ErrorPage() {\n  const router = useRouter();\n  const searchParams = useSearchParams();\n  const { data: session, isPending } = useSession();\n\n  useEffect(() => {\n    if (isPending) {\n      return;\n    }\n\n    const error = searchParams.get(\"error\");\n    const params = new URLSearchParams();\n    if (error) {\n      params.set(\"error\", error);\n    }\n\n    const destination = session ? \"/dashboard/home\" : \"/login\";\n    router.replace(`${destination}?${params.toString()}`);\n  }, [isPending, session, router, searchParams]);\n\n  return (\n    <div className=\"flex h-screen w-full items-center justify-center\">\n      <Loader2 className=\"h-8 w-8 animate-spin\" />\n    </div>\n  );\n}\n"
  },
  {
    "path": "app/globals.css",
    "content": "@import \"tailwindcss\";\n@import \"tw-animate-css\";\n\n@custom-variant dark (&:is(.dark *));\n\n@theme inline {\n    --color-background: var(--background);\n    --color-foreground: var(--foreground);\n    --font-sans: var(--font-poppins), ui-sans-serif, system-ui, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\";\n    --font-title: var(--font-poppins), var(--font-poppins), sans-serif;\n    --font-mono: var(--font-geist-mono);\n    --font-author: var(--font-author);\n    --font-poppins: var(--font-poppins);\n    --color-sidebar-ring: var(--sidebar-ring);\n    --color-sidebar-border: var(--sidebar-border);\n    --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);\n    --color-sidebar-accent: var(--sidebar-accent);\n    --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);\n    --color-sidebar-primary: var(--sidebar-primary);\n    --color-sidebar-foreground: var(--sidebar-foreground);\n    --color-sidebar: var(--sidebar);\n    --color-chart-5: var(--chart-5);\n    --color-chart-4: var(--chart-4);\n    --color-chart-3: var(--chart-3);\n    --color-chart-2: var(--chart-2);\n    --color-chart-1: var(--chart-1);\n    --color-ring: var(--ring);\n    --color-input: var(--input);\n    --color-border: var(--border);\n    --color-destructive: var(--destructive);\n    --color-accent-foreground: var(--accent-foreground);\n    --color-accent: var(--accent);\n    --color-muted-foreground: var(--muted-foreground);\n    --color-muted: var(--muted);\n    --color-secondary-foreground: var(--secondary-foreground);\n    --color-secondary: var(--secondary);\n    --color-primary-foreground: var(--primary-foreground);\n    --color-primary: var(--primary);\n    --color-popover-foreground: var(--popover-foreground);\n    --color-popover: var(--popover);\n    --color-card-foreground: var(--card-foreground);\n    --color-card: var(--card);\n    --radius-sm: calc(var(--radius) - 4px);\n    --radius-md: calc(var(--radius) - 2px);\n    --radius-lg: var(--radius);\n    --radius-xl: calc(var(--radius) + 4px);\n    --animate-accordion-down: accordion-down 0.2s ease-out;\n    --animate-accordion-up: accordion-up 0.2s ease-out;\n\n    @keyframes accordion-down {\n        from {\n            height: 0;\n        }\n        to {\n            height: var(--radix-accordion-content-height);\n        }\n    }\n\n    @keyframes accordion-up {\n        from {\n            height: var(--radix-accordion-content-height);\n        }\n        to {\n            height: 0;\n        }\n    }\n}\n\n:root {\n    --radius: 0.625rem;\n    --background: oklch(1 0 0);\n    --foreground: oklch(0.145 0 0);\n    --card: oklch(1 0 0);\n    --card-foreground: oklch(0.145 0 0);\n    --popover: oklch(1 0 0);\n    --popover-foreground: oklch(0.145 0 0);\n    --primary: oklch(0.611 0.204 42.149);\n    --primary-foreground: oklch(0.985 0 0);\n    --secondary: oklch(0.97 0 0);\n    --secondary-foreground: oklch(0.205 0 0);\n    --muted: oklch(0.97 0 0);\n    --muted-foreground: oklch(0.556 0 0);\n    --accent: oklch(0.97 0 0);\n    --accent-foreground: oklch(0.205 0 0);\n    --destructive: oklch(0.577 0.245 27.325);\n    --border: oklch(0.922 0 0);\n    --input: oklch(0.922 0 0);\n    --ring: oklch(0.611 0.204 42.149);\n    --chart-1: oklch(0.646 0.222 41.116);\n    --chart-2: oklch(0.6 0.118 184.704);\n    --chart-3: oklch(0.398 0.07 227.392);\n    --chart-4: oklch(0.828 0.189 84.429);\n    --chart-5: oklch(0.769 0.188 70.08);\n    --sidebar: oklch(0.985 0 0);\n    --sidebar-foreground: oklch(0.145 0 0);\n    --sidebar-primary: oklch(0.611 0.204 42.149);\n    --sidebar-primary-foreground: oklch(0.985 0 0);\n    --sidebar-accent: oklch(0.97 0 0);\n    --sidebar-accent-foreground: oklch(0.205 0 0);\n    --sidebar-border: oklch(0.922 0 0);\n    --sidebar-ring: oklch(0.611 0.204 42.149);\n}\n\n.dark {\n    --background: oklch(0.145 0 0);\n    --foreground: oklch(0.985 0 0);\n    --card: oklch(0.205 0 0);\n    --card-foreground: oklch(0.985 0 0);\n    --popover: oklch(0.205 0 0);\n    --popover-foreground: oklch(0.985 0 0);\n    --primary: oklch(0.704 0.191 47.132);\n    --primary-foreground: oklch(0.985 0 0);\n    --secondary: oklch(0.269 0 0);\n    --secondary-foreground: oklch(0.985 0 0);\n    --muted: oklch(0.269 0 0);\n    --muted-foreground: oklch(0.708 0 0);\n    --accent: oklch(0.269 0 0);\n    --accent-foreground: oklch(0.985 0 0);\n    --destructive: oklch(0.704 0.191 22.216);\n    --border: oklch(1 0 0 / 10%);\n    --input: oklch(1 0 0 / 15%);\n    --ring: oklch(0.704 0.191 47.132);\n    --chart-1: oklch(0.488 0.243 264.376);\n    --chart-2: oklch(0.696 0.17 162.48);\n    --chart-3: oklch(0.769 0.188 70.08);\n    --chart-4: oklch(0.627 0.265 303.9);\n    --chart-5: oklch(0.645 0.246 16.439);\n    --sidebar: oklch(0.205 0 0);\n    --sidebar-foreground: oklch(0.985 0 0);\n    --sidebar-primary: oklch(0.704 0.191 47.132);\n    --sidebar-primary-foreground: oklch(0.985 0 0);\n    --sidebar-accent: oklch(0.269 0 0);\n    --sidebar-accent-foreground: oklch(0.985 0 0);\n    --sidebar-border: oklch(1 0 0 / 10%);\n    --sidebar-ring: oklch(0.704 0.191 47.132);\n}\n\n@layer base {\n    * {\n        @apply border-border outline-ring/50;\n    }\n    body {\n        @apply bg-background text-foreground font-sans;\n    }\n    h1, h2, h3, h4, h5, h6 {\n        @apply font-title;\n    }\n\n    .scrollbar-hide {\n        -ms-overflow-style: none;\n        scrollbar-width: none;\n    }\n\n    .scrollbar-hide::-webkit-scrollbar {\n        display: none;\n    }\n}\n"
  },
  {
    "path": "app/layout.tsx",
    "content": "import type { Metadata } from \"next\";\nimport type React from \"react\";\nimport \"./globals.css\";\nimport { ConsoleSilencer } from \"@/components/wrappers/common/console-silencer\";\nimport { author, geistMono, poppins } from \"@/fonts/fonts\";\nimport { cn } from \"@/lib/utils\";\nimport { Providers } from \"./providers\";\n\nconst title = process.env.PROJECT_NAME ?? \"Portabase\";\n\nexport const metadata: Metadata = {\n  title: {\n    default: title,\n    template: `%s - ${title}`,\n  },\n  description: process.env.PROJECT_DESCRIPTION ?? undefined,\n};\n\nexport default async function RootLayout({\n  children,\n}: Readonly<{\n  children: React.ReactNode;\n}>) {\n  return (\n    <html lang=\"en\" suppressHydrationWarning>\n      <head>\n        <meta name=\"apple-mobile-web-app-title\" content={title} />\n      </head>\n      <body\n        className={cn(\n          poppins.variable,\n          author.variable,\n          geistMono.variable,\n          \"font-sans h-full\",\n        )}\n      >\n        <ConsoleSilencer />\n        <Providers>{children}</Providers>\n      </body>\n    </html>\n  );\n}\n"
  },
  {
    "path": "app/manifest.json",
    "content": "{\n  \"name\": \"Portabase\",\n  \"short_name\": \"Portabase\",\n  \"icons\": [\n    {\n      \"src\": \"/web-app-manifest-192x192.png\",\n      \"sizes\": \"192x192\",\n      \"type\": \"image/png\",\n      \"purpose\": \"maskable\"\n    },\n    {\n      \"src\": \"/web-app-manifest-512x512.png\",\n      \"sizes\": \"512x512\",\n      \"type\": \"image/png\",\n      \"purpose\": \"maskable\"\n    }\n  ],\n  \"theme_color\": \"#ffffff\",\n  \"background_color\": \"#ffffff\",\n  \"display\": \"standalone\"\n}"
  },
  {
    "path": "app/not-found.tsx",
    "content": "import BackButton from \"@/components/wrappers/common/button/back-button\";\n\nexport default async function NotFound() {\n  return (\n    <div className=\"flex items-center min-h-screen px-4 py-12 sm:px-6 md:px-8 lg:px-12 xl:px-16\">\n      <div className=\"w-full space-y-6 text-center\">\n        <div className=\"space-y-3\">\n          <h1 className=\"scroll-m-20 text-4xl font-extrabold tracking-tight lg:text-5xl\">\n            Not found\n          </h1>\n          <p className=\"leading-7 not-first:mt-6\">\n            The content you are trying to view is not available.\n          </p>\n        </div>\n        <BackButton>Go home</BackButton>\n      </div>\n    </div>\n  );\n}\n"
  },
  {
    "path": "app/providers.tsx",
    "content": "\"use client\";\n\nimport { QueryClient, QueryClientProvider } from \"@tanstack/react-query\";\nimport { type PropsWithChildren, Suspense } from \"react\";\n\nimport { Toaster } from \"@/components/ui/sonner\";\nimport { ErrorLayout } from \"@/components/wrappers/common/error-layout\";\nimport { ThemeMetaUpdaterRoot } from \"@/features/browser/theme-meta-updater-root\";\nimport { ThemeProvider } from \"@/features/theme/theme-provider\";\n\nexport type ProviderProps = PropsWithChildren<{}>;\nconst queryClient = new QueryClient();\n\nexport const Providers = (props: ProviderProps) => {\n  return (\n    <Suspense fallback={null}>\n      <ThemeProvider attribute=\"class\" defaultTheme=\"system\" enableSystem>\n        <ThemeMetaUpdaterRoot />\n        <QueryClientProvider client={queryClient}>\n          <ErrorLayout>\n            <Toaster />\n            {props.children}\n          </ErrorLayout>\n        </QueryClientProvider>\n      </ThemeProvider>\n    </Suspense>\n  );\n};\n"
  },
  {
    "path": "components.json",
    "content": "{\n  \"$schema\": \"https://ui.shadcn.com/schema.json\",\n  \"style\": \"new-york\",\n  \"rsc\": true,\n  \"tsx\": true,\n  \"tailwind\": {\n    \"config\": \"tailwind.config.ts\",\n    \"css\": \"app/globals.css\",\n    \"baseColor\": \"neutral\",\n    \"cssVariables\": true,\n    \"prefix\": \"\"\n  },\n  \"iconLibrary\": \"radix\",\n  \"aliases\": {\n    \"components\": \"@/components\",\n    \"utils\": \"@/lib/utils\",\n    \"ui\": \"@/components/ui\",\n    \"lib\": \"@/lib\",\n    \"hooks\": \"@/hooks\"\n  },\n  \"registries\": {\n    \"@reui\": \"https://reui.io/r/{name}.json\"\n  }\n}\n"
  },
  {
    "path": "docker/dockerfile/Dockerfile",
    "content": "FROM --platform=$BUILDPLATFORM node:22-bullseye AS base\n\nRUN apt-get update && apt-get install -y \\\n    curl \\\n    ca-certificates \\\n    bash \\\n    tzdata \\\n    libc6 \\\n    build-essential \\\n    g++ \\\n    make \\\n    autoconf \\\n    automake \\\n    libtool \\\n    git \\\n    nginx \\\n    && rm -rf /var/lib/apt/lists/*\n\n\nRUN mkdir -p /etc/apt/keyrings \\\n    && curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc \\\n    | gpg --dearmor -o /etc/apt/keyrings/postgresql.gpg \\\n    && echo \"deb [signed-by=/etc/apt/keyrings/postgresql.gpg] http://apt.postgresql.org/pub/repos/apt bullseye-pgdg main\" \\\n    > /etc/apt/sources.list.d/pgdg.list\n\nRUN apt-get update && apt-get install -y \\\n    postgresql-18 \\\n    postgresql-client-18 \\\n    postgresql-contrib-18 \\\n    && rm -rf /var/lib/apt/lists/*\n\nENV PATH=\"/usr/lib/postgresql/18/bin:${PATH}\"\n\n\nFROM --platform=$BUILDPLATFORM golang:1.23-bookworm AS tusd-base\n\nARG TUSD_VERSION=2.8.0\n\nRUN apt-get update && apt-get install -y --no-install-recommends git ca-certificates \\\n    && rm -rf /var/lib/apt/lists/*\n\nWORKDIR /build\n\nRUN git clone https://github.com/tus/tusd.git . \\\n    && git checkout v${TUSD_VERSION}\n\nRUN CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} \\\n    go build -ldflags=\"-s -w\" -o /tusddist/tusd ./cmd/tusd\n\nFROM scratch AS tusd-dist\nCOPY --from=tusd-base /tusddist/tusd /tusd\n\n\nFROM base AS build-env\n\nRUN corepack enable && corepack prepare pnpm@latest --activate\n\nFROM build-env AS deps\n\nWORKDIR /app\n\nCOPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./\nRUN pnpm i --frozen-lockfile\n\nFROM build-env AS dev\n\nCOPY --from=deps /app/node_modules ./node_modules\nCOPY --from=tusd-base /usr/local/bin/tusd /usr/local/bin/tusd\nWORKDIR /app\nCOPY . .\n\nUSER root\nRUN chmod +x /app/docker/entrypoints/app-dev-entrypoint.sh\n\nENTRYPOINT [\"sh\",\"/app/docker/entrypoints/app-dev-entrypoint.sh\"]\n\nFROM build-env AS builder\n\nWORKDIR /app\nCOPY --from=deps /app/node_modules ./node_modules\nCOPY . .\n\nENV NEXT_TELEMETRY_DISABLED=1\nRUN pnpm run build\n\nFROM base AS prod\n\nWORKDIR /app\nENV NODE_ENV=production\nENV NEXT_TELEMETRY_DISABLED=1\nENV PORT=80\nENV HOSTNAME=\"0.0.0.0\"\nENV PGDATA=/data/postgres\nENV PRIVATE_PATH=/data/private\n\n\nRUN addgroup --system --gid 1001 nodejs\nRUN adduser --system --uid 1001 nextjs\n\nCOPY --from=builder /app/public ./public\nCOPY --from=builder /app/next.config.ts ./\nCOPY --from=builder /app/portabase.config.ts ./\nCOPY --from=builder /app/drizzle.config.ts ./\nCOPY --from=builder --chown=1001:1001 /app/.next/standalone ./\nCOPY --from=builder --chown=1001:1001 /app/.next/static ./.next/static\nCOPY --chown=1001:1001 src/db ./src/db\nCOPY --from=deps /app/node_modules ./node_modules\n\nCOPY --from=tusd-dist /tusd /usr/local/bin/tusd\nRUN chmod +x /usr/local/bin/tusd\n\nCOPY docker/nginx/nginx.conf /etc/nginx/nginx.conf\n\n\nRUN mkdir -p .next /data/private/uploads \\\n    && chown -R nextjs:nodejs .next /data/private /app/public\n\n\nUSER root\nCOPY ./docker/entrypoints/app-prod-entrypoint.sh /app/app-prod-entrypoint.sh\nRUN chmod +x /app/app-prod-entrypoint.sh\n\nEXPOSE 80\nENTRYPOINT [\"sh\",\"/app/app-prod-entrypoint.sh\"]\n"
  },
  {
    "path": "docker/entrypoints/app-dev-entrypoint.sh",
    "content": "#!/bin/bash\n\nset -euo pipefail\n\necho \"▶ Running Drizzle codegen...\"\npnpm drizzle-kit generate\n\necho \"▶ Applying migrations...\"\npnpm drizzle-kit migrate\n\necho \"▶ Starting Next.js dev server...\"\nexec pnpm dev"
  },
  {
    "path": "docker/entrypoints/app-prod-entrypoint.sh",
    "content": "#!/bin/bash\n\nif [ -n \"$TZ\" ]; then\n    echo \"[INFO] Application timezone set to $TZ (environment only)\"\n    export TZ=\"$TZ\"\nelse\n    echo \"[WARN] No TZ provided, using default container timezone\"\nfi\n\nPOSTGRES_BIN=$(ls -d /usr/lib/postgresql/*/bin | head -n 1)\n\nif [ -z \"$POSTGRES_BIN\" ]; then\n    echo \"PostgreSQL binaries not found\"\n    exit 1\nfi\n\nexport PATH=\"$POSTGRES_BIN:$PATH\"\n\nif [ -z \"$DATABASE_URL\" ]; then\n    echo \"[INFO] No DATABASE_URL provided, starting internal Postgres...\"\n\n    mkdir -p \"$PGDATA\"\n    chown -R postgres:postgres \"$PGDATA\"\n\n    if [ ! -f \"$PGDATA/PG_VERSION\" ]; then\n        echo \"[INFO] Initializing database cluster...\"\n        if ! su postgres -c \"initdb -D '$PGDATA'\" > /dev/null 2>&1; then\n            echo \"[ERROR] initdb failed\"\n            exit 1\n        fi\n    fi\n\n    if ! su postgres -c \"pg_ctl -D '$PGDATA' \\\n        -o \\\"-c listen_addresses='localhost' -c logging_collector=on\\\" \\\n        -l $PGDATA/postgres.log -w start\" > /dev/null 2>&1; then\n        echo \"[ERROR] PostgreSQL failed to start\"\n        exit 1\n    fi\n\n    until su postgres -c \"pg_isready -h 127.0.0.1 -p 5432\" > /dev/null 2>&1; do\n        sleep 1\n    done\n\n    echo \"[INFO] PostgreSQL server is up and accepting connections\"\n\n    DB_USER=\"${POSTGRES_USER:-portabase_user}\"\n    DB_PASS=\"${POSTGRES_PASSWORD:-JaB6b1SUtIWYvt7srnOt}\"\n    DB_NAME=\"${POSTGRES_DB:-portabase_db}\"\n\n    USER_EXISTS=$(su postgres -c \"psql -tAc \\\"SELECT 1 FROM pg_roles WHERE rolname='$DB_USER'\\\"\" 2>/dev/null)\n    if [ \"$USER_EXISTS\" != \"1\" ]; then\n        if ! su postgres -c \"psql -c \\\"CREATE USER $DB_USER WITH PASSWORD '$DB_PASS';\\\"\" > /dev/null 2>&1; then\n            echo \"[ERROR] Failed creating user\"\n            exit 1\n        fi\n    fi\n\n    DB_EXISTS=$(su postgres -c \"psql -tAc \\\"SELECT 1 FROM pg_database WHERE datname='$DB_NAME'\\\"\" 2>/dev/null)\n    if [ \"$DB_EXISTS\" != \"1\" ]; then\n        if ! su postgres -c \"psql -c \\\"CREATE DATABASE $DB_NAME OWNER $DB_USER;\\\"\" > /dev/null 2>&1; then\n            echo \"[ERROR] Failed creating database\"\n            exit 1\n        fi\n    fi\n\n    export DATABASE_URL=\"postgres://$DB_USER:$DB_PASS@127.0.0.1:5432/$DB_NAME\"\n\n    echo \"[SUCCESS] Internal PostgreSQL started successfully\"\n    echo \"[SUCCESS] Database: $DB_NAME | User: $DB_USER | Host: 127.0.0.1:5432\"\nfi\n\n\nmkdir -p /data/private/uploads/tmp\necho \"▶ Starting tusd server...\"\ntusd --base-path /tus/files/ --upload-dir /data/private/uploads/tmp --hooks-http http://127.0.0.1:3000/api/tus/hooks --port 1080 --max-size 21474836480 &\n\necho \"▶ Starting Next.js server...\"\nPORT=3000 node server.js &\n\necho \"▶ Starting nginx...\"\nexec nginx -g \"daemon off;\"\n\n\n"
  },
  {
    "path": "docker/nginx/nginx.conf",
    "content": "events {}\n\nhttp {\n    client_max_body_size 20G;\n    ignore_invalid_headers  off;\n\n    server {\n        listen 80;\n\n       location /tus/ {\n            proxy_pass http://127.0.0.1:1080/tus/;\n\n            proxy_pass_request_headers on;\n\n            proxy_request_buffering  off;\n            proxy_buffering          off;\n            proxy_http_version       1.1;\n\n            proxy_set_header Host $http_host;\n            proxy_set_header X-Forwarded-Host $http_host;\n            proxy_set_header X-Forwarded-Proto $scheme;\n            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n\n            proxy_set_header         Upgrade $http_upgrade;\n            proxy_set_header         Connection \"upgrade\";\n        }\n\n        location / {\n            proxy_pass http://127.0.0.1:3000;\n\n            proxy_http_version 1.1;\n            proxy_set_header Upgrade $http_upgrade;\n            proxy_set_header Connection \"upgrade\";\n\n            proxy_set_header Host $http_host;\n            proxy_set_header X-Forwarded-Host $http_host;\n            proxy_set_header X-Forwarded-Proto $scheme;\n            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n        }\n    }\n}\n"
  },
  {
    "path": "docker-compose.e2e.yml",
    "content": "services:\n  app:\n    build:\n      context: .\n      dockerfile: docker/dockerfile/Dockerfile\n      target: prod\n    ports:\n      - '8887:80'\n    environment:\n      TZ: \"Europe/Paris\"\n    env_file:\n      - .env\n    volumes:\n      - portabase-e2e-data:/data\n    depends_on:\n      db:\n        condition: service_healthy\n\n  db:\n    image: postgres:18-alpine\n    ports:\n      - \"5433:5432\"\n    volumes:\n      - postgres-e2e-data:/var/lib/postgresql/data\n    environment:\n      - POSTGRES_DB=devdb\n      - POSTGRES_USER=devuser\n      - POSTGRES_PASSWORD=changeme\n    healthcheck:\n      test: [\"CMD-SHELL\", \"pg_isready -U devuser -d devdb\"]\n      interval: 10s\n      timeout: 5s\n      retries: 5\n\nvolumes:\n  portabase-e2e-data:\n  postgres-e2e-data:\n"
  },
  {
    "path": "docker-compose.func.yml",
    "content": "name: portabase-dev-func\n\nservices:\n  keycloak:\n    image: quay.io/keycloak/keycloak:latest\n    command: start-dev --import-realm\n    # environment:\n    #   KC_BOOTSTRAP_ADMIN_USERNAME: admin\n    #   KC_BOOTSTRAP_ADMIN_PASSWORD: admin\n    ports:\n      - \"3056:8080\"\n    volumes:\n      - keycloak-data:/opt/keycloak/data\n      - ./seeds/keycloak:/opt/keycloak/data/import:ro\n      - ./export:/tmp/export\n  pocket-id:\n    image: ghcr.io/pocket-id/pocket-id\n    restart: unless-stopped\n    environment:\n      - APP_URL=http://localhost:3055\n      - ENCRYPTION_KEY=QwHyjbZvSsDUAcjpdmSPsuYxaH6vET6OeBaeLwXccCb43L6Om3W1AoU5pKIJTzYr\n    ports:\n      - 3055:1411\n    volumes:\n      - pocket-id-data:/app/data\n      - ./seeds/pocket-id:/seed:ro\n    healthcheck:\n      test: \"curl -f http://localhost:1411/healthz\"\n      interval: 1m30s\n      timeout: 5s\n      retries: 2\n      start_period: 10s\nvolumes:\n  keycloak-data:\n  pocket-id-data:\n"
  },
  {
    "path": "docker-compose.prod.yml",
    "content": "services:\n  app:\n#        build:\n#          context: .\n#          dockerfile: docker/dockerfile/Dockerfile\n#          target: prod\n    image: portabase/portabase:1.7.1\n    ports:\n      - '8887:80'\n    environment:\n      TZ: \"Europe/Paris\"\n    env_file:\n      - .env\n    volumes:\n      - portabase-data:/data\n    depends_on:\n      db:\n        condition: service_healthy\n    container_name: portabase-app-prod\n\n  db:\n    image: postgres:16-alpine\n    ports:\n      - \"5433:5432\"\n    volumes:\n      - postgres-data:/var/lib/postgresql/data\n    environment:\n      - POSTGRES_DB=devdb\n      - POSTGRES_USER=devuser\n      - POSTGRES_PASSWORD=changeme\n    healthcheck:\n      test: [ \"CMD-SHELL\", \"pg_isready -U devuser -d devdb\" ]\n      interval: 10s\n      timeout: 5s\n      retries: 5\n\nvolumes:\n  portabase-data:\n  postgres-data:\n"
  },
  {
    "path": "docker-compose.yml",
    "content": "name: portabase-dev\n\nservices:\n  db:\n    image: postgres:17-alpine\n    ports:\n      - \"5433:5432\"\n    volumes:\n      - postgres-data:/var/lib/postgresql/data\n    environment:\n      - POSTGRES_DB=devdb\n      - POSTGRES_USER=devuser\n      - POSTGRES_PASSWORD=changeme\n    healthcheck:\n      test: [\"CMD-SHELL\", \"pg_isready -U devuser -d devdb\"]\n      interval: 10s\n      timeout: 5s\n      retries: 5\n\n  tusd:\n    image: tusproject/tusd:v2.8.0\n    ports:\n      - \"1080:8080\"\n    command: >\n      -upload-dir /data/uploads/tmp\n      -hooks-http http://localhost:8887/api/tus/hooks\n      -max-size 21474836480\n      -base-path /tus/files/\n    extra_hosts:\n      - \"localhost:host-gateway\"\n    volumes:\n      - ./private/uploads/tmp:/data/uploads/tmp\n    user: \"1000:1000\"\n\nvolumes:\n  postgres-data:\n"
  },
  {
    "path": "drizzle.config.ts",
    "content": "import { defineConfig } from \"drizzle-kit\";\n\nimport dotenv from \"dotenv\";\n\ndotenv.config({\n    path: \".env\",\n});\n\nexport default defineConfig({\n    out: \"./src/db/migrations\",\n    schema: [\"./src/db/schema\", \"./src/db/schema/types.ts\"],\n    dialect: \"postgresql\",\n    dbCredentials: {\n        url: process.env.DATABASE_URL!,\n    },\n});\n"
  },
  {
    "path": "e2e/access-management.spec.ts",
    "content": "import {expect, test} from \"@playwright/test\";\nimport {users} from \"./helpers/auth\";\nimport {changeUserRole, create, switchToDefault} from \"./helpers/access-management\";\nimport {LOCAL_STORAGE_PATH} from \"./helpers/session\";\n\ntest.use({storageState: LOCAL_STORAGE_PATH});\n\nconst firstOrganization = \"Organization A\";\nconst secondOrganization = \"Organization B\";\n\ntest.describe.serial(() => {\n    test(\"Create an organization from organizations page\", async ({page}) => {\n        await page.goto(\"/dashboard/admin/organizations\");\n        await expect(page.getByRole(\"heading\", {name: \"Active organizations\"})).toBeVisible();\n\n        await create(page, \"button\", firstOrganization);\n\n        await expect(page.getByText(/Organization has been successfully created\\./i)).toBeVisible();\n        await expect(page).toHaveURL(\"/dashboard/admin/organizations\");\n        await expect(page.getByRole(\"button\", {name: firstOrganization, exact: true})).toBeVisible();\n\n        await switchToDefault(page);\n    });\n\n    test(\"Create an organization from sidebar button\", async ({page}) => {\n        await page.goto(\"/dashboard/home\");\n        await expect(page.getByRole(\"heading\", {name: \"Dashboard\"})).toBeVisible();\n\n        await create(page, \"sidebar\", secondOrganization);\n\n        await expect(page.getByText(/Organization has been successfully created\\./i)).toBeVisible();\n        await expect(page).toHaveURL(\"/dashboard/home\");\n        await expect(page.getByRole(\"button\", {name: secondOrganization, exact: true})).toBeVisible();\n\n        await switchToDefault(page);\n    });\n\n    test(\"Change John Doe's role from pending to user\", async ({page}) => {\n        await page.goto(\"/dashboard/admin/users\");\n        await expect(page.getByText(users.normal.email, {exact: true})).toBeVisible();\n\n        const userRow = page.locator(\"tr\").filter({hasText: users.normal.email}).first();\n        await expect(userRow).toBeVisible();\n        await userRow.locator(\"button\").last().click();\n        await page.getByRole('menuitem', {name: 'Role'}).click();\n\n        await expect(page.getByRole(\"heading\", {name: \"Change the user's role\"})).toBeVisible();\n\n        await changeUserRole(page, \"user\")\n\n        await expect(page.getByText(\"User role changed successfully.\")).toBeVisible();\n        await expect(page.locator(\"tr\").filter({hasText: users.normal.email}).getByText(\"user\", {exact: true})).toBeVisible();\n    });\n\n    test(\"Add John Doe to Organization A\", async ({page}) => {\n        await page.goto(\"/dashboard/admin/organizations\");\n        await expect(page.getByRole(\"heading\", {name: \"Active organizations\"})).toBeVisible();\n\n        const organizationRow = page.locator(\"tr\").filter({hasText: firstOrganization}).first();\n        await expect(organizationRow).toBeVisible();\n        await organizationRow.locator('a[href*=\"/dashboard/admin/organizations/\"], a[href*=\"organizations/\"]').click();\n\n        await expect(page.getByText(firstOrganization, {exact: true})).toBeVisible();\n        await page.getByRole(\"button\", {name: /Add member/i}).click();\n        await expect(page.getByRole(\"heading\", {name: \"Add member to your organization\"})).toBeVisible();\n\n        await page.getByPlaceholder(\"Enter a user email\").fill(users.normal.email);\n        await page.getByRole(\"option\", {name: new RegExp(users.normal.email, \"i\")}).click();\n        await page.getByRole(\"button\", {name: \"Confirm\"}).click();\n\n        await expect(page.getByText(\"Member successfully added!\")).toBeVisible();\n        await expect(page.getByText(users.normal.email, {exact: true})).toBeVisible();\n    });\n});\n"
  },
  {
    "path": "e2e/agent.spec.ts",
    "content": "import {expect, test} from \"@playwright/test\";\nimport {execSync} from \"child_process\";\nimport fs from \"fs\";\nimport os from \"os\";\nimport path from \"path\";\nimport {createAgentWithDockerDatabases} from \"./helpers/agent-cli\";\nimport {create, edit, get, remove} from \"./helpers/agent\";\nimport {LOCAL_STORAGE_PATH} from \"./helpers/session\";\n\nconst agent = {\n    aName: \"Agent A\",\n    aUpdatedName: \"Agent A Updated\",\n    bName: \"Agent B\",\n    description: \"Agent created by Playwright E2E\",\n    updatedDescription: \"Agent updated by Playwright E2E\",\n};\n\ntest.use({storageState: LOCAL_STORAGE_PATH});\n\ntest.describe.serial(() => {\n    let agentWorkspace: string | null = null;\n\n    test(\"Create agent A from empty state\", async ({page}) => {\n        await page.goto(\"/dashboard/agents\");\n        await expect(page.getByRole(\"heading\", {name: \"Agents\"})).toBeVisible();\n        await expect(page.getByText(\"Create new Agent\", {exact: true})).toBeVisible();\n        await create(page, \"emptyState\", agent.aName, agent.description);\n\n        await expect(page.getByText(\"Success creating agent\")).toBeVisible();\n        await expect(get(page, agent.aName)).toBeVisible();\n        await expect(page.getByText(\"Create new Agent\", {exact: true})).toHaveCount(0);\n    });\n\n    test(\"Edit agent A\", async ({page}) => {\n        await page.goto(\"/dashboard/agents\");\n        await expect(page.getByRole(\"heading\", {name: \"Agents\"})).toBeVisible();\n        await expect(get(page, agent.aName)).toBeVisible();\n\n        await edit(page, agent.aName, agent.aUpdatedName, agent.updatedDescription);\n\n        await expect(page.getByText(\"Success updating agent\")).toBeVisible();\n        await expect(page.getByText(agent.aUpdatedName, {exact: true})).toBeVisible();\n        await expect(page.getByText(agent.updatedDescription, {exact: true})).toBeVisible();\n    });\n\n    test(\"Create agent B from classic button\", async ({page}) => {\n        await page.goto(\"/dashboard/agents\");\n        await expect(page.getByRole(\"heading\", {name: \"Agents\"})).toBeVisible();\n        await expect(page.getByRole(\"button\", {name: /Create Agent/i})).toBeVisible();\n        await create(page, \"button\", agent.bName, agent.description);\n\n        await expect(page.getByText(\"Success creating agent\")).toBeVisible();\n        await expect(get(page, agent.bName)).toBeVisible();\n    });\n\n    test(\"Delete Agent B\", async ({page}) => {\n        await page.goto(\"/dashboard/agents\");\n        await expect(page.getByRole(\"heading\", {name: \"Agents\"})).toBeVisible();\n        await expect(get(page, agent.bName)).toBeVisible();\n        await remove(page, agent.bName);\n\n        await expect(page.getByText(\"Agent has been successfully deleted.\")).toBeVisible();\n        await expect(page).toHaveURL(\"/dashboard/agents\");\n        await expect(page.getByText(agent.bName)).toHaveCount(0);\n    });\n\n    // test(\"Launch the updated agent\", async ({page}) => {\n    //     await page.goto(\"/dashboard/agents\");\n    //     await expect(page.getByRole(\"heading\", {name: \"Agents\"})).toBeVisible();\n    //     await get(page, agent.aName).click();\n    //\n    //     await expect(page).toHaveURL(/\\/dashboard\\/agents\\/.+/);\n    //     await expect(page.getByText(agent.aName, {exact: true})).toBeVisible();\n    //     await expect(page.getByText(\"Registration & Setup\")).toBeVisible();\n    //\n    //     const commandInput = page.locator(\"input[readonly]\").first();\n    //     await page.locator(\"input[readonly]\").first().locator(\"xpath=following-sibling::button[1]\").click();\n    //     const command = await commandInput.inputValue();\n    //\n    //     agentWorkspace = fs.mkdtempSync(path.join(os.tmpdir(), \"portabase-agent-\"));\n    //     await createAgentWithDockerDatabases(command, agentWorkspace);\n    //     execSync(`portabase start \"${agent.aName}\"`, {\n    //         cwd: agentWorkspace,\n    //         stdio: \"pipe\",\n    //         timeout: 120_000,\n    //     });\n    //\n    //     await expect(page.getByText(\"Never connected.\")).toHaveCount(0, {timeout: 120_000});\n    //     await expect(page.getByText(\"Action Required\")).toHaveCount(0);\n    // });\n\n    test.afterAll(async () => {\n        if (agentWorkspace) {\n            try {\n                execSync(`portabase stop \"${agent.aName}\"`, {\n                    cwd: agentWorkspace,\n                    stdio: \"pipe\",\n                    timeout: 30_000,\n                });\n            } catch {\n            }\n\n            try {\n                execSync(`portabase uninstall --force \"${agent.aName}\"`, {\n                    cwd: agentWorkspace,\n                    stdio: \"pipe\",\n                    timeout: 30_000,\n                });\n            } catch {\n            }\n\n            fs.rmSync(agentWorkspace, {recursive: true, force: true});\n            agentWorkspace = null;\n        }\n    });\n});"
  },
  {
    "path": "e2e/auth.spec.ts",
    "content": "import {test, expect} from '@playwright/test';\nimport {login, register, users} from \"./helpers/auth\";\nimport {LOCAL_STORAGE_PATH} from \"./helpers/session\";\n\nconst TIMEOUT = undefined\n// const TIMEOUT = 5000\n\ntest.use({storageState: LOCAL_STORAGE_PATH})\n\ntest.describe.serial( () => {\n\n    test('Redirect to login if not connected', async ({page}) => {\n        await page.goto('/dashboard/projects');\n        await expect(page).toHaveURL(\"login?redirect=%2Fdashboard%2Fprojects\", {timeout: TIMEOUT});\n    });\n\n    test('Password too short', async ({page}) => {\n        await page.goto('')\n        await page.click('text=Sign up')\n        await expect(page).toHaveURL('/register')\n\n        let password = '123456'\n        await register(page, users[\"admin\"].username, users[\"admin\"].email, password, password)\n\n        const toast = page.locator('text=Must have at least 8 character')\n        await expect(toast).toBeVisible()\n    })\n\n    test('Password too simple', async ({page}) => {\n        await page.goto('')\n        await page.click('text=Sign up')\n        await expect(page).toHaveURL('/register')\n\n        let password = '12345678'\n        await register(page, users[\"admin\"].username, users[\"admin\"].email, password, password)\n\n        const toast = page.locator('text=Your password must contain at least one uppercase letter, one lowercase letter, one number, and one special character.')\n        await expect(toast).toBeVisible()\n    })\n\n    test('Password and confirm password mismatch', async ({page}) => {\n        await page.goto('/')\n        await page.click('text=Sign up')\n        await expect(page).toHaveURL('/register')\n\n        let password = 'testPASS123456!'\n        let confirmPassword = 'testPASS123456!!'\n        await register(page, users[\"admin\"].username, users[\"admin\"].email, password, confirmPassword)\n\n        const toast = page.locator('text=The passwords did not match')\n        await expect(toast).toBeVisible()\n    })\n\n    test('Successful register for admin', async ({page}) => {\n        await page.goto('/')\n\n        await page.click('text=Sign up')\n        await expect(page).toHaveURL('/register')\n\n        await register(page, users[\"admin\"].username, users[\"admin\"].email, users[\"admin\"].password, users[\"admin\"].password)\n\n        await expect(page).toHaveURL('/login', {timeout: TIMEOUT})\n    })\n\n    test('User already exists.', async ({page}) => {\n        await page.goto('/')\n\n        await page.click('text=Sign up')\n        await expect(page).toHaveURL('/register')\n\n        await register(page, users[\"admin\"].username, users[\"admin\"].email, users[\"admin\"].password, users[\"admin\"].password)\n\n        const toast = page.locator('text=User already exists. Use another email.')\n        await expect(toast).toBeVisible()\n    })\n\n    test('Successful register for normal', async ({page}) => {\n        await page.goto('/')\n\n        await page.click('text=Sign up')\n        await expect(page).toHaveURL('/register')\n\n        await register(page, users[\"normal\"].username, users[\"normal\"].email, users[\"normal\"].password, users[\"normal\"].password)\n\n        await expect(page).toHaveURL('/login', {timeout: TIMEOUT})\n    })\n\n    test('Failed login because account not active', async ({page}) => {\n        await page.goto('/login')\n        await login(page, users[\"normal\"].email, users[\"normal\"].password)\n\n        const toast = page.locator('text=Your account is not active.')\n        await expect(toast).toBeVisible()\n    })\n\n    test('Successful login', async ({page}) => {\n        await page.goto('/login')\n        await login(page, users[\"admin\"].email, users[\"admin\"].password)\n\n        await expect(page).toHaveURL('/dashboard/home', {timeout: TIMEOUT})\n        await expect(page.getByRole('link', {name: 'Logo Portabase'})).toBeVisible()\n        await page.context().storageState({path: LOCAL_STORAGE_PATH})\n    })\n})\n"
  },
  {
    "path": "e2e/cleanup.spec.ts",
    "content": "import {expect, test} from \"@playwright/test\";\nimport fs from \"fs\";\nimport {logout} from \"./helpers/auth\";\nimport {LOCAL_STORAGE_PATH} from \"./helpers/session\";\n\n\ntest.use({storageState: LOCAL_STORAGE_PATH});\n\ntest.describe( () => {\n    test.afterAll(async () => {\n        if (fs.existsSync(LOCAL_STORAGE_PATH)) {\n            fs.unlinkSync(LOCAL_STORAGE_PATH);\n        }\n    });\n\n    test(\"Remove shared storage state\", async ({page}) => {\n        await test.step(\"Logout shared authenticated session\", async () => {\n            if (!fs.existsSync(LOCAL_STORAGE_PATH)) {\n                return;\n            }\n\n            const content = fs.readFileSync(LOCAL_STORAGE_PATH, \"utf-8\").trim();\n            if (!content || content === \"{}\") {\n                return;\n            }\n\n            await page.goto('/dashboard/home');\n            await logout(page);\n            await expect(page).toHaveURL(/\\/login(?:\\?.*)?$/);\n        });\n    });\n});\n"
  },
  {
    "path": "e2e/helpers/access-management.ts",
    "content": "import {Page} from \"@playwright/test\";\n\nexport function getUserRow(page: Page, email: string) {\n    return page.locator(\"tr\").filter({hasText: email}).first();\n}\n\nexport function getOrganizationRow(page: Page, organizationName: string) {\n    return page.locator(\"tr\").filter({hasText: organizationName}).first();\n}\n\n/**\n * Create an organization from the selected entrypoint.\n *\n * Available entrypoints:\n * - `button`: the organizations page create button.\n * - `sidebar`: the sidebar organization switcher.\n *\n * Executes from:\n * - `/dashboard/admin/organizations` for \"button\" entrypoint\n * - any `/dashboard/**` page for \"sidebar\" entrypoint\n */\nexport async function create(page: Page, entrypoint: \"button\" | \"sidebar\", name: string) {\n    if (entrypoint === \"sidebar\") {\n        await page.getByRole(\"button\", {name: \"Default Organization\"}).click();\n        await page.getByText(\"Create organization\", {exact: true}).click();\n    } else {\n        await page.getByRole(\"button\", {name: /Create a new organization/i}).click();\n    }\n\n    await page.getByLabel(\"Name\").fill(name);\n    await page.getByRole(\"button\", {name: \"Create\"}).click();\n}\n\n/**\n * Switch the active organization from the sidebar switcher.\n *\n * Executes from: any `/dashboard/**` if the sidebar is visible.\n */\nexport async function switchTo(page: Page, name: string) {\n    await page.getByTestId('organization-dropdown').click();\n    await page.getByRole('menuitem', {name: name}).click();\n}\n\n/**\n * Switch back to the default organization.\n *\n * Executes from: any `/dashboard/**` if the sidebar is visible.\n */\nexport async function switchToDefault(page: Page) {\n    await switchTo(page, \"Default Organization\");\n}\n\nconst ROLE_LABELS = {\n    pending: \"Pending\",\n    user: \"User\",\n    admin: \"Admin\",\n} as const;\n\n/**\n * Change the global role of a user from the admin users role modal.\n *\n * Executes from: the \"Change the user's role\" dialog opened from `/dashboard/admin/users`.\n */\nexport async function changeUserRole(page: Page, role: keyof typeof ROLE_LABELS) {\n    const roleOption = ROLE_LABELS[role];\n\n    await page.getByRole(\"combobox\").click();\n    await page.getByRole(\"option\", {name: roleOption}).click();\n    await page.getByRole(\"button\", {name: \"Validate\"}).click();\n}"
  },
  {
    "path": "e2e/helpers/agent-cli.ts",
    "content": "import * as pty from \"node-pty\";\n\ntype InteractiveStep = {\n    match: RegExp;\n    reply: string;\n};\n\nfunction normalizeOutput(output: string) {\n    return output.replace(/\\u001b\\[[0-9;?]*[ -/]*[@-~]/g, \"\");\n}\n\n/**\n * Run an interactive CLI command and answer prompts in sequence.\n * Entry point:\n * - `command` is the full CLI command executed in the PTY.\n * - `cwd` is the local workspace where the command is launched.\n * - `steps` defines which prompt text is matched and which reply is sent.\n * - `timeoutMs` controls when the command is aborted if it stalls.\n * Executes from: not page-bound; runs from a local test workspace on the Node.js side.\n */\nexport async function runInteractiveCommand(\n    command: string,\n    cwd: string,\n    steps: InteractiveStep[],\n    timeoutMs: number = 120_000,\n) {\n    await new Promise<void>((resolve, reject) => {\n        const child = pty.spawn(\"sh\", [\"-lc\", command], {\n            cwd,\n            env: {\n                ...process.env,\n                TERM: \"xterm-256color\",\n            },\n            cols: 120,\n            rows: 30,\n        });\n\n        let currentStep = 0;\n        let output = \"\";\n        const timer = setTimeout(() => {\n            child.kill();\n            reject(new Error(`Interactive command timed out.\\n\\nCommand: ${command}\\n\\nOutput:\\n${normalizeOutput(output)}`));\n        }, timeoutMs);\n\n        const handleChunk = (chunk: string) => {\n            output += chunk;\n            const normalizedOutput = normalizeOutput(output);\n\n            while (currentStep < steps.length && steps[currentStep].match.test(normalizedOutput)) {\n                child.write(steps[currentStep].reply);\n                currentStep += 1;\n            }\n        };\n\n        child.onData(handleChunk);\n        child.onExit(({exitCode}) => {\n            clearTimeout(timer);\n            if (exitCode === 0) {\n                resolve();\n                return;\n            }\n\n            reject(new Error(`Interactive command failed with exit code ${exitCode}.\\n\\nCommand: ${command}\\n\\nOutput:\\n${normalizeOutput(output)}`));\n        });\n    });\n}\n\n/**\n * Create and configure a Portabase agent with two Docker-backed databases.\n * Entry point:\n * - `command` is the CLI setup command copied from the agent details page.\n * - `cwd` is the local workspace where the agent is installed.\n * - this helper answers the wizard for PostgreSQL first, then MariaDB.\n * Executes from: not page-bound; runs from a local test workspace on the Node.js side.\n */\nexport async function createAgentWithDockerDatabases(command: string, cwd: string) {\n    await runInteractiveCommand(command, cwd, [\n        {\n            match: /configure.*database|add.*database/i,\n            reply: \"y\\n\",\n        },\n        {\n            match: /docker.*new local container|manual.*external|external.*existing/i,\n            reply: \"\\r\",\n        },\n        {\n            match: /postgresql|mariadb/i,\n            reply: \"\\r\",\n        },\n        {\n            match: /another.*database|add.*another|configure.*another/i,\n            reply: \"y\\n\",\n        },\n        {\n            match: /docker.*new local container|manual.*external|external.*existing/i,\n            reply: \"\\r\",\n        },\n        {\n            match: /postgresql|mariadb/i,\n            reply: \"\\u001B[B\\r\",\n        },\n        {\n            match: /another.*database|add.*another|configure.*another/i,\n            reply: \"n\\n\",\n        },\n    ]);\n}\n"
  },
  {
    "path": "e2e/helpers/agent.ts",
    "content": "import {Page} from \"@playwright/test\";\n\n\n/**\n * Locate an agent card in the list.\n\n * Executes from: `/dashboard/agents`.\n */\nexport function get(page: Page, name: string) {\n    return page.locator('a[href^=\"/dashboard/agents\"]').filter({hasText: name}).first();\n}\n\n/**\n * Create an agent from the selected entrypoint.\n *\n * Available entrypoints:\n * - `button`: the classic create button.\n * - `emptyState`: the empty-state CTA.\n * - `auto`: uses the classic create button and falls back to the empty-state CTA.\n *\n * Executes from: `/dashboard/agents`.\n */\nexport async function create(page: Page, entrypoint: \"auto\" | \"emptyState\" | \"button\" = \"auto\", agentName: string, description: string) {\n    if (entrypoint === \"auto\") {\n        const createButton = page.getByRole(\"button\", {name: /Create Agent/i});\n        if (await createButton.isVisible()) await page.getByRole(\"button\", {name: /Create Agent/i}).click();\n        await page.getByText(\"Create new Agent\", {exact: true}).click();\n    } else if (entrypoint === \"button\") {\n        await page.getByRole(\"button\", {name: /Create Agent/i}).click();\n    } else if (entrypoint === \"emptyState\") {\n        await page.getByText(\"Create new Agent\", {exact: true}).click();\n    }\n\n    await page.getByLabel(\"Name\").fill(agentName);\n    await page.getByLabel(\"Description\").fill(description);\n    await page.getByRole(\"button\", {name: \"Create\"}).click();\n}\n\n/**\n * Edit an existing agent (name and description) from its details page.\n *\n * Executes from: `/dashboard/agents/[agentId]`.\n */\nexport async function edit(page: Page, currentName: string, updatedName: string, updatedDescription: string) {\n    await get(page, currentName).click();\n\n    await page\n        .getByRole(\"button\", {name: /Delete Agent/i})\n        .locator(\"xpath=ancestor::div[1]/preceding-sibling::div[1]/*[1]\")\n        .click();\n\n    await page.getByLabel(\"Name\").fill(updatedName);\n    await page.getByLabel(\"Description\").fill(updatedDescription);\n    await page.getByRole(\"button\", {name: \"Update\"}).click();\n}\n\n/**\n * Delete an agent from its details page.\n\n * Executes from: `/dashboard/agents/[agentId]`.\n */\nexport async function remove(page: Page, name: string) {\n    await get(page, name).click();\n    await page.getByRole(\"button\", {name: /Delete Agent/i}).click();\n    await page.getByRole(\"button\", {name: \"Delete\", exact: true}).click();\n}\n"
  },
  {
    "path": "e2e/helpers/auth.ts",
    "content": "import {Page} from \"@playwright/test\";\n\nexport type UserCredentials = {\n    username: string\n    email: string\n    password: string\n}\n\nexport const users: Record<string, UserCredentials> = {\n    admin: {username: \"Admin\", email: \"admin@example.com\", password: \"testPASS123456!\"},\n    normal: {username: \"John Doe\", email: \"john.doe@example.com\", password: \"testPASS123456!\"},\n}\n\n/**\n * Fill and submit the registration form.\n *\n * Executes from: `/register`.\n */\nexport async function register(page: Page, name: string, email: string, password: string, confirmPassword: string) {\n    await page.locator('input[name=\"name\"]').fill(name)\n    await page.locator('input[name=\"email\"]').fill(email)\n    await page.locator('input[name=\"password\"]').fill(password)\n    await page.locator('input[name=\"confirmPassword\"]').fill(confirmPassword)\n\n    await page.click('button[type=\"submit\"]')\n}\n\n/**\n * Fill and submit the login form.\n *\n * Executes from: `/login`.\n */\nexport async function login(page: Page, email: string, password: string) {\n    await page.locator('input[name=\"email\"]').fill(email)\n    await page.locator('input[name=\"password\"]').fill(password)\n\n    await page.locator('button:has-text(\"Login\")').click()\n}\n\n/**\n * Log out the current authenticated user.\n *\n * Executes from: any authenticated `/dashboard/**` page.\n */\nexport async function logout(page: Page) {\n    const profileButton = page.getByTestId('profile-dropdown')\n    await profileButton.first().click();\n\n    await page.getByRole(\"menuitem\").filter({hasText: /Logout/i}).click();\n}\n"
  },
  {
    "path": "e2e/helpers/env.ts",
    "content": "const REQUIRED_E2E_ENV_VARS = [\n    \"E2E_NOTIFICATION_SMTP_HOST\",\n    \"E2E_NOTIFICATION_SMTP_PORT\",\n    \"E2E_NOTIFICATION_SMTP_USER\",\n    \"E2E_NOTIFICATION_SMTP_PASSWORD\",\n    \"E2E_NOTIFICATION_SMTP_FROM\",\n    \"E2E_NOTIFICATION_SMTP_TO\",\n    \"E2E_NOTIFICATION_SLACK_WEBHOOK\",\n    \"E2E_NOTIFICATION_DISCORD_WEBHOOK\",\n    \"E2E_NOTIFICATION_TELEGRAM_BOT_TOKEN\",\n    \"E2E_NOTIFICATION_TELEGRAM_CHAT_ID\",\n    \"E2E_NOTIFICATION_TELEGRAM_TOPIC_ID\",\n    \"E2E_NOTIFICATION_GOTIFY_SERVER_URL\",\n    \"E2E_NOTIFICATION_GOTIFY_APP_TOKEN\",\n    \"E2E_NOTIFICATION_NTFY_TOPIC\",\n    \"E2E_NOTIFICATION_NTFY_SERVER_URL\",\n    \"E2E_NOTIFICATION_NTFY_TOKEN\",\n    \"E2E_NOTIFICATION_NTFY_USERNAME\",\n    \"E2E_NOTIFICATION_NTFY_PASSWORD\",\n    \"E2E_NOTIFICATION_WEBHOOK_URL\",\n    \"E2E_NOTIFICATION_WEBHOOK_SECRET_HEADER\",\n    \"E2E_NOTIFICATION_WEBHOOK_SECRET\",\n    \"E2E_STORAGE_AWS_S3_ENDPOINT_URL\",\n    \"E2E_STORAGE_AWS_S3_REGION\",\n    \"E2E_STORAGE_AWS_S3_ACCESS_KEY\",\n    \"E2E_STORAGE_AWS_S3_SECRET_KEY\",\n    \"E2E_STORAGE_AWS_S3_BUCKET_NAME\",\n    \"E2E_STORAGE_AWS_S3_PORT\",\n    \"E2E_STORAGE_R2_ENDPOINT_URL\",\n    \"E2E_STORAGE_R2_REGION\",\n    \"E2E_STORAGE_R2_ACCESS_KEY\",\n    \"E2E_STORAGE_R2_SECRET_KEY\",\n    \"E2E_STORAGE_R2_BUCKET_NAME\",\n    \"E2E_STORAGE_R2_PORT\",\n    \"E2E_STORAGE_GOOGLE_DRIVE_CLIENT_ID\",\n    \"E2E_STORAGE_GOOGLE_DRIVE_CLIENT_SECRET\",\n    \"E2E_STORAGE_GOOGLE_DRIVE_FOLDER_ID\",\n] as const;\n\nfunction assertRequiredEnvVars() {\n    const missingVars = REQUIRED_E2E_ENV_VARS.filter((name) => {\n        const value = process.env[name]?.trim();\n        return !value;\n    });\n\n    if (missingVars.length > 0) {\n        throw new Error(\n            `Missing required environment variables:\\n${missingVars.map((name) => `- ${name}`).join(\"\\n\")}`,\n        );\n    }\n}\n\nassertRequiredEnvVars();\n\nexport function getEnv(name: string): string {\n    const value = process.env[name]?.trim();\n    if (!value) {\n        throw new Error(`Missing required environment variable: ${name}`);\n    }\n\n    return value;\n}\n"
  },
  {
    "path": "e2e/helpers/notification.ts",
    "content": "import {Page} from \"@playwright/test\";\n\n\n/**\n * Locate a notification channel card in the list.\n *\n * Executes from: `/dashboard/notifications/channels`.\n */\nexport function get(page: Page, channelName: string) {\n    return page.locator('div.block.transition-all.duration-200.rounded-xl', {\n        has: page.locator('h3', {hasText: channelName}),\n    }).first();\n}\n\n/**\n * Open the edit dialog for an existing notification channel.\n *\n * Executes from: `/dashboard/notifications/channels`.\n */\nexport async function edit(page: Page, channelName: string) {\n    const card = get(page, channelName);\n    await card.locator(\"button\").nth(1).click();\n}\n\n/**\n * Delete an existing notification channel.\n *\n * Executes from: `/dashboard/notifications/channels`.\n */\nexport async function remove(page: Page, channelName: string) {\n    const card = get(page, channelName);\n    await card.locator(\"button\").nth(2).click();\n    await page.getByRole(\"button\", {name: \"Delete\"}).click();\n}\n\n/**\n * Fill the notification channel creation form.\n *\n * Available entrypoints:\n * - `button`: the classic add button.\n * - `emptyState`: the empty-state CTA.\n * - `auto` use the classic add button and falls back to the empty-state CTA.\n *\n * Executes from: `/dashboard/notifications/channels`.\n */\nexport async function create(\n    page: Page,\n    provider: \"Discord\" | \"Gotify\" | \"ntfy.sh\" | \"Slack\" | \"Email\" | \"Telegram\" | \"Webhook\",\n    channelName: string,\n    fillConfig: (page: Page) => Promise<void>,\n    entrypoint: \"auto\" | \"emptyState\" | \"button\" = \"auto\",\n) {\n    if (entrypoint === \"auto\") {\n        const addButton = page.getByRole(\"button\", {name: /Add notification channel/i});\n        if (await addButton.isVisible()) await page.getByRole(\"button\", {name: /Add notification channel/i}).click();\n        else await page.getByRole(\"button\", {name: /No notification channels configured yet/i}).click();\n    } else if (entrypoint === \"button\") {\n        await page.getByRole(\"button\", {name: /Add notification channel/i}).click();\n    } else if (entrypoint === \"emptyState\") {\n        await page.getByRole(\"button\", {name: /No notification channels configured yet/i}).click();\n    }\n\n    await page.getByText(provider, {exact: true}).click();\n    await page.getByLabel(/Channel Name/).fill(channelName);\n    await fillConfig(page);\n}\n\n/**\n * Submit the notification channel creation form.\n *\n * Executes from: the add notification channel dialog opened from `/dashboard/notifications/channels`.\n */\nexport async function submit(page: Page) {\n    await page.getByRole(\"button\", {name: \"Add Channel\"}).click();\n}\n\n/**\n * Open the edit dialog for a notification channel and trigger the test action.\n *\n * Executes from: `/dashboard/notifications/channels`.\n */\nexport async function testFromEdit(page: Page, channelName: string) {\n    await edit(page, channelName);\n    await page.getByRole(\"button\", {name: /Test Channel/i}).click();\n}\n\n/**\n * Close the current notification channel dialog without saving.\n *\n * Executes from: the add or edit notification channel dialog.\n */\nexport async function cancel(page: Page) {\n    await page.getByRole(\"button\", {name: \"Cancel\"}).click();\n}\n"
  },
  {
    "path": "e2e/helpers/project.ts",
    "content": "import {Page} from \"@playwright/test\";\n\n\n/**\n * Locate a project card in the list.\n *\n * Executes from: `/dashboard/projects`.\n */\nexport function get(page: Page, projectName: string) {\n    return page.locator('a[href^=\"/dashboard/projects/\"]').filter({hasText: projectName}).first();\n}\n\n/**\n * Create a project from the selected entrypoint.\n *\n * Available entrypoints:\n * - `emptyState`: the empty-state CTA.\n * - `button`: the classic create button.\n *\n * * Executes from: `/dashboard/projects`.\n */\nexport async function create(page: Page, entrypoint: \"emptyState\" | \"button\", projectName: string) {\n    if (entrypoint === \"emptyState\") {\n        await page.getByText(\"Create new Project\", {exact: true}).click();\n    } else {\n        await page.getByRole(\"button\", {name: /Create Project/i}).click();\n    }\n\n    await page.getByLabel(\"Name\").fill(projectName);\n    await page.getByRole(\"button\", {name: \"Create\"}).click();\n}\n\n/**\n * Edit an existing project from its details page.\n *\n * Executes from: `/dashboard/projects/[projectId]`.\n */\nexport async function edit(page: Page, currentName: string, updatedName: string) {\n    await get(page, currentName).click();\n\n    await page\n        .getByRole(\"button\", {name: /Delete Project/i})\n        .locator(\"xpath=ancestor::div[1]/preceding-sibling::div[1]/*[1]\")\n        .click();\n\n    await page.getByLabel(\"Name\").fill(updatedName);\n    await page.getByRole(\"button\", {name: \"Update\"}).click();\n}\n\n/**\n * Delete an existing project from its details page.\n *\n * Executes from: `/dashboard/projects/[projectId]`.\n * */\nexport async function remove(page: Page, projectName: string) {\n    await get(page, projectName).click();\n    await page.getByRole(\"button\", {name: /Delete Project/i}).click();\n    await page.getByRole(\"button\", {name: \"Delete\", exact: true}).click();\n}\n"
  },
  {
    "path": "e2e/helpers/session.ts",
    "content": "export const LOCAL_STORAGE_PATH = \"./e2e/local-storage.json\";\n"
  },
  {
    "path": "e2e/helpers/storage.ts",
    "content": "import {Page} from \"@playwright/test\";\n\n\n/**\n * Locate a storage channel card in the channels list.\n *\n * Executes from: `/dashboard/storages/channels`.\n */\nexport function get(page: Page, channelName: string) {\n    return page.locator('div.block.transition-all.duration-200.rounded-xl', {\n        has: page.locator('h3', {hasText: channelName}),\n    }).first();\n}\n\n/**\n * Fill the storage channel creation form.\n *\n * Available entrypoints:\n * - `button`: the classic add button.\n * - `emptyState`: the empty-state CTA.\n * - `auto`: uses the classic add button and falls back to the empty-state CTA.\n *\n * Executes from: `/dashboard/storages/channels`.\n */\nexport async function create(\n    page: Page,\n    provider: \"S3\" | \"Google Drive\",\n    channelName: string,\n    fillConfig: (page: Page) => Promise<void>,\n    entrypoint: \"auto\" | \"emptyState\" | \"button\" = \"auto\",\n) {\n    if (entrypoint === \"auto\") {\n        const addButton = page.getByRole(\"button\", {name: /Add storage channel/i});\n        if (await addButton.isVisible()) await page.getByRole(\"button\", {name: /Add storage channel/i}).click();\n        else await page.getByText(\"No storage channels configured yet\", {exact: true}).click();\n    } else if (entrypoint === \"button\") {\n        await page.getByRole(\"button\", {name: /Add storage channel/i}).click();\n    } else if (entrypoint === \"emptyState\") {\n        await page.getByText(\"No storage channels configured yet\", {exact: true}).click();\n    }\n\n    await page.getByText(provider, {exact: true}).click();\n    await page.getByLabel(/Channel Name/).fill(channelName);\n    await fillConfig(page);\n}\n\n/**\n * Open the edit dialog for an existing storage channel.\n *\n * Executes from: `/dashboard/storages/channels`.\n */\nexport async function edit(page: Page, channelName: string) {\n    const card = get(page, channelName);\n    await card.locator(\"button\").nth(1).click();\n}\n\n/**\n * Delete an existing storage channel.\n *\n * Executes from: `/dashboard/storages/channels`.\n */\nexport async function remove(page: Page, channelName: string) {\n    const card = get(page, channelName);\n    await card.locator(\"button\").nth(2).click();\n    await page.getByRole(\"button\", {name: \"Delete\"}).click();\n}\n\n/**\n * Trigger the storage connection test in the current dialog.\n *\n * Executes from: the add or edit storage channel dialog opened from `/dashboard/storages/channels`.\n */\nexport async function testConnection(page: Page) {\n    await page.getByRole(\"button\", {name: /Test Storage/i}).click();\n}\n\n/**\n * Submit the storage channel creation form.\n *\n * Executes from: the add storage channel dialog opened from `/dashboard/storages/channels`.\n */\nexport async function submit(page: Page) {\n    await page.getByRole(\"button\", {name: \"Add Channel\"}).click();\n}\n\n/**\n * Open the edit dialog for a storage channel and trigger the test action.\n *\n * Executes from: `/dashboard/storages/channels`.\n */\nexport async function testFromEdit(page: Page, channelName: string) {\n    await edit(page, channelName);\n    await testConnection(page);\n}\n\n/**\n * Close the current storage channel dialog without saving.\n *\n * Executes from: the add or edit storage channel dialog.\n */\nexport async function cancel(page: Page) {\n    await page.getByRole(\"button\", {name: \"Cancel\"}).click();\n}\n"
  },
  {
    "path": "e2e/notification/discord.spec.ts",
    "content": "import {expect, test} from \"@playwright/test\";\nimport {\n    cancel, create, get, remove, submit, testFromEdit,\n} from \"../helpers/notification\";\nimport {getEnv} from \"../helpers/env\";\nimport {LOCAL_STORAGE_PATH} from \"../helpers/session\";\n\ntest.use({storageState: LOCAL_STORAGE_PATH});\n\nconst validChannelName = \"Discord E2E Required\";\nconst invalidChannelName = \"Discord E2E Invalid\";\n\n// test.describe.serial(\"Valid channel\", () => {\n//     test(\"Create and test a valid Discord channel\", async ({page}) => {\n//         await page.goto(\"/dashboard/notifications/channels\");\n//         await expect(page.getByRole(\"heading\", {name: \"Notification channels\"})).toBeVisible();\n//         await create(page, \"Discord\", validChannelName, async (page) => {\n//             await page.getByLabel(/Discord Webhook URL/).fill(getEnv(\"E2E_NOTIFICATION_DISCORD_WEBHOOK\"));\n//         });\n//         await expect(page.getByRole(\"heading\", {name: \"Add Notification Channel\"})).toBeVisible();\n//         await submit(page);\n//         await expect(page.getByText(\"Notification channel has been successfully created.\")).toBeVisible();\n//         await expect(get(page, validChannelName)).toBeVisible();\n//\n//         await testFromEdit(page, validChannelName);\n//         await expect(page.getByRole(\"heading\", {name: \"Edit Notification Channel\"})).toBeVisible();\n//         await expect(page.getByText(\"Sent to Discord\")).toBeVisible();\n//         await cancel(page);\n//         await expect(page.getByRole(\"heading\", {name: \"Edit Notification Channel\"})).toHaveCount(0);\n//     });\n//\n//     test(\"Edit and test a valid Discord channel\", async ({page}) => {\n//         await page.goto(\"/dashboard/notifications/channels\");\n//         await expect(page.getByRole(\"heading\", {name: \"Notification channels\"})).toBeVisible();\n//         await expect(get(page, validChannelName)).toBeVisible();\n//         await testFromEdit(page, validChannelName);\n//         await expect(page.getByRole(\"heading\", {name: \"Edit Notification Channel\"})).toBeVisible();\n//         await expect(page.getByText(\"Sent to Discord\")).toBeVisible();\n//         await cancel(page);\n//         await expect(page.getByRole(\"heading\", {name: \"Edit Notification Channel\"})).toHaveCount(0);\n//     });\n// });\n\ntest.describe.serial(\"Invalid channel\", () => {\n    test(\"Create and test invalid Discord channel\", async ({page}) => {\n        await page.goto(\"/dashboard/notifications/channels\");\n        await expect(page.getByRole(\"heading\", {name: \"Notification channels\"})).toBeVisible();\n        await create(page, \"Discord\", invalidChannelName, async (page) => {\n            await page.getByLabel(/Discord Webhook URL/).fill(\"https://discord.com/api/webhooks/123456789012345678/wrong-discord-webhook-token\");\n        });\n        await expect(page.getByRole(\"heading\", {name: \"Add Notification Channel\"})).toBeVisible();\n        await submit(page);\n        await expect(page.getByText(\"Notification channel has been successfully created.\")).toBeVisible();\n        await expect(get(page, invalidChannelName)).toBeVisible();\n\n        await testFromEdit(page, invalidChannelName);\n        await expect(page.getByRole(\"heading\", {name: \"Edit Notification Channel\"})).toBeVisible();\n        await expect(page.getByText(\"An error occurred while testing the notification channel, check your configuration\")).toBeVisible();\n        await cancel(page);\n        await expect(page.getByRole(\"heading\", {name: \"Edit Notification Channel\"})).toHaveCount(0);\n    });\n\n    test(\"Delete invalid Discord channel\", async ({page}) => {\n        await page.goto(\"/dashboard/notifications/channels\");\n        await expect(page.getByRole(\"heading\", {name: \"Notification channels\"})).toBeVisible();\n        await expect(get(page, invalidChannelName)).toBeVisible();\n        await remove(page, invalidChannelName);\n        await expect(page.getByText(\"Notification channel has been successfully removed.\")).toBeVisible();\n        await expect(page.getByText(invalidChannelName)).toHaveCount(0);\n    });\n});\n"
  },
  {
    "path": "e2e/notification/gotify.spec.ts",
    "content": "import {expect, test} from \"@playwright/test\";\nimport {\n    cancel, create, get, remove, submit, testFromEdit,\n} from \"../helpers/notification\";\nimport {getEnv} from \"../helpers/env\";\nimport {LOCAL_STORAGE_PATH} from \"../helpers/session\";\n\ntest.use({storageState: LOCAL_STORAGE_PATH});\n\nconst validChannelName = \"Gotify E2E Required\";\nconst invalidChannelName = \"Gotify E2E Invalid\";\n\n// test.describe.serial(\"Valid channel\", () => {\n//     test(\"Create and test a valid Gotify channel\", async ({page}) => {\n//         await page.goto(\"/dashboard/notifications/channels\");\n//         await expect(page.getByRole(\"heading\", {name: \"Notification channels\"})).toBeVisible();\n//         await create(page, \"Gotify\", validChannelName, async (page) => {\n//             await page.getByLabel(/Gotify Server URL/).fill(getEnv(\"E2E_NOTIFICATION_GOTIFY_SERVER_URL\"));\n//             await page.getByLabel(/Application Token/).fill(getEnv(\"E2E_NOTIFICATION_GOTIFY_APP_TOKEN\"));\n//         });\n//         await expect(page.getByRole(\"heading\", {name: \"Add Notification Channel\"})).toBeVisible();\n//         await submit(page);\n//         await expect(page.getByText(\"Notification channel has been successfully created.\")).toBeVisible();\n//         await expect(get(page, validChannelName)).toBeVisible();\n//\n//         await testFromEdit(page, validChannelName);\n//         await expect(page.getByText(\"Sent to Gotify\")).toBeVisible();\n//         await cancel(page);\n//     });\n//\n//     test(\"Edit and test a valid Gotify channel\", async ({page}) => {\n//         await page.goto(\"/dashboard/notifications/channels\");\n//         await expect(page.getByRole(\"heading\", {name: \"Notification channels\"})).toBeVisible();\n//         await expect(get(page, validChannelName)).toBeVisible();\n//         await testFromEdit(page, validChannelName);\n//         await expect(page.getByText(\"Sent to Gotify\")).toBeVisible();\n//         await cancel(page);\n//     });\n// });\n\ntest.describe.serial(\"Invalid channel\", () => {\n    test(\"Create and test invalid Gotify channel\", async ({page}) => {\n        await page.goto(\"/dashboard/notifications/channels\");\n        await expect(page.getByRole(\"heading\", {name: \"Notification channels\"})).toBeVisible();\n        await create(page, \"Gotify\", invalidChannelName, async (page) => {\n            await page.getByLabel(/Gotify Server URL/).fill(getEnv(\"E2E_NOTIFICATION_GOTIFY_SERVER_URL\"));\n            await page.getByLabel(/Application Token/).fill(\"wrong-gotify-app-token\");\n        });\n        await expect(page.getByRole(\"heading\", {name: \"Add Notification Channel\"})).toBeVisible();\n        await submit(page);\n        await expect(page.getByText(\"Notification channel has been successfully created.\")).toBeVisible();\n        await expect(get(page, invalidChannelName)).toBeVisible();\n        await testFromEdit(page, invalidChannelName);\n        await expect(page.getByText(\"An error occurred while testing the notification channel, check your configuration\")).toBeVisible();\n        await cancel(page);\n    });\n\n    test(\"Delete invalid Gotify channel\", async ({page}) => {\n        await page.goto(\"/dashboard/notifications/channels\");\n        await expect(page.getByRole(\"heading\", {name: \"Notification channels\"})).toBeVisible();\n        await expect(get(page, invalidChannelName)).toBeVisible();\n        await remove(page, invalidChannelName);\n        await expect(page.getByText(\"Notification channel has been successfully removed.\")).toBeVisible();\n        await expect(page.getByText(invalidChannelName)).toHaveCount(0);\n    });\n});\n"
  },
  {
    "path": "e2e/notification/ntfy.spec.ts",
    "content": "import {expect, test} from \"@playwright/test\";\nimport {\n    cancel, create, get, remove, submit, testFromEdit,\n} from \"../helpers/notification\";\nimport {getEnv} from \"../helpers/env\";\nimport {LOCAL_STORAGE_PATH} from \"../helpers/session\";\n\ntest.use({storageState: LOCAL_STORAGE_PATH});\n\nconst requiredChannelName = \"Ntfy E2E Required\";\nconst optionalChannelName = \"Ntfy E2E Optional\";\nconst invalidChannelName = \"Ntfy E2E Invalid\";\n\n// test.describe.serial(\"Valid channels\", () => {\n//     test(\"Create and test a valid Ntfy channel with only required fields\", async ({page}) => {\n//         await page.goto(\"/dashboard/notifications/channels\");\n//         await expect(page.getByRole(\"heading\", {name: \"Notification channels\"})).toBeVisible();\n//         await create(page, \"ntfy.sh\", requiredChannelName, async (page) => {\n//             await page.getByLabel(/Topic Name/).fill(getEnv(\"E2E_NOTIFICATION_NTFY_TOPIC\"));\n//         });\n//         await submit(page);\n//         await expect(page.getByText(\"Notification channel has been successfully created.\")).toBeVisible();\n//         await expect(get(page, requiredChannelName)).toBeVisible();\n//         await testFromEdit(page, requiredChannelName);\n//         await expect(page.getByText(\"Sent to ntfy\")).toBeVisible();\n//         await cancel(page);\n//     });\n//\n//     test(\"Create and test a valid Ntfy channel with optional fields\", async ({page}) => {\n//         await page.goto(\"/dashboard/notifications/channels\");\n//         await expect(page.getByRole(\"heading\", {name: \"Notification channels\"})).toBeVisible();\n//         await create(page, \"ntfy.sh\", optionalChannelName, async (page) => {\n//             await page.getByLabel(/Topic Name/).fill(getEnv(\"E2E_NOTIFICATION_NTFY_TOPIC\"));\n//             await page.getByLabel(/^Server URL$/).fill(getEnv(\"E2E_NOTIFICATION_NTFY_SERVER_URL\"));\n//             await page.getByLabel(/^Access Token$/).fill(getEnv(\"E2E_NOTIFICATION_NTFY_TOKEN\"));\n//             await page.getByLabel(/^Basic Auth Username$/).fill(getEnv(\"E2E_NOTIFICATION_NTFY_USERNAME\"));\n//             await page.getByLabel(/^Basic Auth Password$/).fill(getEnv(\"E2E_NOTIFICATION_NTFY_PASSWORD\"));\n//         });\n//         await submit(page);\n//         await expect(page.getByText(\"Notification channel has been successfully created.\")).toBeVisible();\n//         await expect(get(page, optionalChannelName)).toBeVisible();\n//         await testFromEdit(page, optionalChannelName);\n//         await expect(page.getByText(\"Sent to ntfy\")).toBeVisible();\n//         await cancel(page);\n//     });\n// });\n\ntest.describe.serial(\"Invalid channel\", () => {\n    test(\"Create and test invalid Ntfy channel\", async ({page}) => {\n        await page.goto(\"/dashboard/notifications/channels\");\n        await expect(page.getByRole(\"heading\", {name: \"Notification channels\"})).toBeVisible();\n        await create(page, \"ntfy.sh\", invalidChannelName, async (page) => {\n            await page.getByLabel(/Topic Name/).fill(\"wrong-ntfy-topic\");\n            await page.getByLabel(/^Server URL$/).fill(getEnv(\"E2E_NOTIFICATION_NTFY_SERVER_URL\"));\n            await page.getByLabel(/^Access Token$/).fill(\"wrong-ntfy-token\");\n        });\n        await submit(page);\n        await expect(page.getByText(\"Notification channel has been successfully created.\")).toBeVisible();\n        await expect(get(page, invalidChannelName)).toBeVisible();\n        await testFromEdit(page, invalidChannelName);\n        await expect(page.getByText(\"An error occurred while testing the notification channel, check your configuration\")).toBeVisible();\n        await cancel(page);\n    });\n\n    test(\"Delete invalid Ntfy channel\", async ({page}) => {\n        await page.goto(\"/dashboard/notifications/channels\");\n        await expect(page.getByRole(\"heading\", {name: \"Notification channels\"})).toBeVisible();\n        await expect(get(page, invalidChannelName)).toBeVisible();\n        await remove(page, invalidChannelName);\n        await expect(page.getByText(\"Notification channel has been successfully removed.\")).toBeVisible();\n        await expect(page.getByText(invalidChannelName)).toHaveCount(0);\n    });\n});\n"
  },
  {
    "path": "e2e/notification/slack.spec.ts",
    "content": "import {expect, test} from \"@playwright/test\";\nimport {\n    cancel, create, get, remove, submit, testFromEdit,\n} from \"../helpers/notification\";\nimport {getEnv} from \"../helpers/env\";\nimport {LOCAL_STORAGE_PATH} from \"../helpers/session\";\n\ntest.use({storageState: LOCAL_STORAGE_PATH});\n\nconst validChannelName = \"Slack E2E Required\";\nconst invalidChannelName = \"Slack E2E Invalid\";\n\n// test.describe.serial(\"Valid channel\", () => {\n//     test(\"Create and test a valid Slack channel\", async ({page}) => {\n//         await page.goto(\"/dashboard/notifications/channels\");\n//         await expect(page.getByRole(\"heading\", {name: \"Notification channels\"})).toBeVisible();\n//         await create(page, \"Slack\", validChannelName, async (page) => {\n//             await page.getByLabel(/Slack Webhook URL/).fill(getEnv(\"E2E_NOTIFICATION_SLACK_WEBHOOK\"));\n//         });\n//         await submit(page);\n//         await expect(page.getByText(\"Notification channel has been successfully created.\")).toBeVisible();\n//         await expect(get(page, validChannelName)).toBeVisible();\n//         await testFromEdit(page, validChannelName);\n//         await expect(page.getByText(\"Sent to Slack\")).toBeVisible();\n//         await cancel(page);\n//     });\n//\n//     test(\"Edit and test a valid Slack E2E channel\", async ({page}) => {\n//         await page.goto(\"/dashboard/notifications/channels\");\n//         await expect(page.getByRole(\"heading\", {name: \"Notification channels\"})).toBeVisible();\n//         await expect(get(page, validChannelName)).toBeVisible();\n//         await testFromEdit(page, validChannelName);\n//         await expect(page.getByText(\"Sent to Slack\")).toBeVisible();\n//         await cancel(page);\n//     });\n// });\n\ntest.describe.serial(\"Invalid channel\", () => {\n    test(\"Create and test invalid Slack channel\", async ({page}) => {\n        await page.goto(\"/dashboard/notifications/channels\");\n        await expect(page.getByRole(\"heading\", {name: \"Notification channels\"})).toBeVisible();\n        await create(page, \"Slack\", invalidChannelName, async (page) => {\n            await page.getByLabel(/Slack Webhook URL/).fill(\"https://WRONG_SLACK_WEBHOOK\");\n        });\n        await submit(page);\n        await expect(page.getByText(\"Notification channel has been successfully created.\")).toBeVisible();\n        await expect(get(page, invalidChannelName)).toBeVisible();\n        await testFromEdit(page, invalidChannelName);\n        await expect(page.getByText(\"An error occurred while testing the notification channel, check your configuration\")).toBeVisible();\n        await cancel(page);\n    });\n\n    test(\"Delete invalid Slack channel\", async ({page}) => {\n        await page.goto(\"/dashboard/notifications/channels\");\n        await expect(page.getByRole(\"heading\", {name: \"Notification channels\"})).toBeVisible();\n        await expect(get(page, invalidChannelName)).toBeVisible();\n        await remove(page, invalidChannelName);\n        await expect(page.getByText(\"Notification channel has been successfully removed.\")).toBeVisible();\n        await expect(page.getByText(invalidChannelName)).toHaveCount(0);\n    });\n});\n"
  },
  {
    "path": "e2e/notification/smtp.spec.ts",
    "content": "import {expect, test} from \"@playwright/test\";\nimport {getEnv} from \"../helpers/env\";\nimport {\n    cancel, create, get, remove, submit, testFromEdit,\n} from \"../helpers/notification\";\nimport {LOCAL_STORAGE_PATH} from \"../helpers/session\";\n\ntest.use({storageState: LOCAL_STORAGE_PATH});\n\nconst validChannelName = \"SMTP E2E Required\";\nconst invalidChannelName = \"SMTP E2E Invalid\";\nconst successMessage = `Email sent: ${getEnv(\"E2E_NOTIFICATION_SMTP_TO\")}`;\n\n// test.describe.serial(\"Valid channel\", () => {\n//     test(\"Create and test a valid SMTP channel\", async ({page}) => {\n//         await page.goto(\"/dashboard/notifications/channels\");\n//         await expect(page.getByRole(\"heading\", {name: \"Notification channels\"})).toBeVisible();\n//         await create(page, \"Email\", validChannelName, async (page) => {\n//             await page.getByLabel(/SMTP Host/).fill(getEnv(\"E2E_NOTIFICATION_SMTP_HOST\"));\n//             await page.getByLabel(/SMTP Port/).fill(getEnv(\"E2E_NOTIFICATION_SMTP_PORT\"));\n//             await page.getByLabel(/Username/).fill(getEnv(\"E2E_NOTIFICATION_SMTP_USER\"));\n//             await page.getByLabel(/Password/).fill(getEnv(\"E2E_NOTIFICATION_SMTP_PASSWORD\"));\n//             await page.getByLabel(/From Email/).fill(getEnv(\"E2E_NOTIFICATION_SMTP_FROM\"));\n//             await page.getByLabel(/To Email/).fill(getEnv(\"E2E_NOTIFICATION_SMTP_TO\"));\n//         });\n//         await submit(page);\n//         await expect(page.getByText(\"Notification channel has been successfully created.\")).toBeVisible();\n//         await expect(get(page, validChannelName)).toBeVisible();\n//         await testFromEdit(page, validChannelName);\n//         await expect(page.getByText(successMessage)).toBeVisible();\n//         await cancel(page);\n//     });\n//\n//     test(\"Edit and test a valid SMTP channel\", async ({page}) => {\n//         await page.goto(\"/dashboard/notifications/channels\");\n//         await expect(page.getByRole(\"heading\", {name: \"Notification channels\"})).toBeVisible();\n//         await expect(get(page, validChannelName)).toBeVisible();\n//         await testFromEdit(page, validChannelName);\n//         await expect(page.getByText(successMessage)).toBeVisible();\n//         await cancel(page);\n//     });\n// });\n\ntest.describe.serial(\"Invalid channel\", () => {\n    test(\"Create and test invalid SMTP E2E channel\", async ({page}) => {\n        await page.goto(\"/dashboard/notifications/channels\");\n        await expect(page.getByRole(\"heading\", {name: \"Notification channels\"})).toBeVisible();\n        await create(page, \"Email\", invalidChannelName, async (page) => {\n            await page.getByLabel(/SMTP Host/).fill(\"smtp.invalid\");\n            await page.getByLabel(/SMTP Port/).fill(getEnv(\"E2E_NOTIFICATION_SMTP_PORT\"));\n            await page.getByLabel(/Username/).fill(getEnv(\"E2E_NOTIFICATION_SMTP_USER\"));\n            await page.getByLabel(/Password/).fill(\"wrong-password\");\n            await page.getByLabel(/From Email/).fill(getEnv(\"E2E_NOTIFICATION_SMTP_FROM\"));\n            await page.getByLabel(/To Email/).fill(getEnv(\"E2E_NOTIFICATION_SMTP_TO\"));\n        });\n        await submit(page);\n        await expect(page.getByText(\"Notification channel has been successfully created.\")).toBeVisible();\n        await expect(get(page, invalidChannelName)).toBeVisible();\n        await testFromEdit(page, invalidChannelName);\n        await expect(page.getByText(\"An error occurred while testing the notification channel, check your configuration\")).toBeVisible();\n        await cancel(page);\n    });\n\n    test(\"Delete invalid SMTP channel\", async ({page}) => {\n        await page.goto(\"/dashboard/notifications/channels\");\n        await expect(page.getByRole(\"heading\", {name: \"Notification channels\"})).toBeVisible();\n        await expect(get(page, invalidChannelName)).toBeVisible();\n        await remove(page, invalidChannelName);\n        await expect(page.getByText(\"Notification channel has been successfully removed.\")).toBeVisible();\n        await expect(page.getByText(invalidChannelName)).toHaveCount(0);\n    });\n});\n"
  },
  {
    "path": "e2e/notification/teams.spec.ts",
    "content": ""
  },
  {
    "path": "e2e/notification/telegram.spec.ts",
    "content": "import {expect, test} from \"@playwright/test\";\nimport {\n    cancel, create, get, remove, submit, testFromEdit,\n} from \"../helpers/notification\";\nimport {getEnv} from \"../helpers/env\";\nimport {LOCAL_STORAGE_PATH} from \"../helpers/session\";\n\ntest.use({storageState: LOCAL_STORAGE_PATH});\n\nconst requiredChannelName = \"Telegram E2E Required\";\nconst optionalChannelName = \"Telegram E2E Optional\";\nconst invalidChannelName = \"Telegram E2E Invalid\";\n\n// test.describe.serial(\"Valid channels\", () => {\n//     test(\"Create and test a valid Telegram channel\", async ({page}) => {\n//         await page.goto(\"/dashboard/notifications/channels\");\n//         await expect(page.getByRole(\"heading\", {name: \"Notification channels\"})).toBeVisible();\n//         await create(page, \"Telegram\", requiredChannelName, async (page) => {\n//             await page.getByLabel(/Telegram Bot Token/).fill(getEnv(\"E2E_NOTIFICATION_TELEGRAM_BOT_TOKEN\"));\n//             await page.getByLabel(/Telegram Chat ID/).fill(getEnv(\"E2E_NOTIFICATION_TELEGRAM_CHAT_ID\"));\n//         });\n//         await submit(page);\n//         await expect(page.getByText(\"Notification channel has been successfully created.\")).toBeVisible();\n//         await expect(get(page, requiredChannelName)).toBeVisible();\n//         await testFromEdit(page, requiredChannelName);\n//         await expect(page.getByText(\"Sent to Telegram\")).toBeVisible();\n//         await cancel(page);\n//     });\n//\n//     test(\"Create and test a valid Telegram channel with Topic ID\", async ({page}) => {\n//         await page.goto(\"/dashboard/notifications/channels\");\n//         await expect(page.getByRole(\"heading\", {name: \"Notification channels\"})).toBeVisible();\n//         await create(page, \"Telegram\", optionalChannelName, async (page) => {\n//             await page.getByLabel(/Telegram Bot Token/).fill(getEnv(\"E2E_NOTIFICATION_TELEGRAM_BOT_TOKEN\"));\n//             await page.getByLabel(/Telegram Chat ID/).fill(getEnv(\"E2E_NOTIFICATION_TELEGRAM_CHAT_ID\"));\n//             await page.getByLabel(/Telegram Topic ID/).fill(getEnv(\"E2E_NOTIFICATION_TELEGRAM_TOPIC_ID\"));\n//         });\n//         await submit(page);\n//         await expect(page.getByText(\"Notification channel has been successfully created.\")).toBeVisible();\n//         await expect(get(page, optionalChannelName)).toBeVisible();\n//         await testFromEdit(page, optionalChannelName);\n//         await expect(page.getByText(\"Sent to Telegram\")).toBeVisible();\n//         await cancel(page);\n//     });\n// });\n\ntest.describe.serial(\"Invalid channel\", () => {\n    test(\"Create and test invalid Telegram channel\", async ({page}) => {\n        await page.goto(\"/dashboard/notifications/channels\");\n        await expect(page.getByRole(\"heading\", {name: \"Notification channels\"})).toBeVisible();\n        await create(page, \"Telegram\", invalidChannelName, async (page) => {\n            await page.getByLabel(/Telegram Bot Token/).fill(\"wrong-telegram-bot-token\");\n            await page.getByLabel(/Telegram Chat ID/).fill(getEnv(\"E2E_NOTIFICATION_TELEGRAM_CHAT_ID\"));\n            await page.getByLabel(/Telegram Topic ID/).fill(getEnv(\"E2E_NOTIFICATION_TELEGRAM_TOPIC_ID\"));\n        });\n        await submit(page);\n        await expect(page.getByText(\"Notification channel has been successfully created.\")).toBeVisible();\n        await expect(get(page, invalidChannelName)).toBeVisible();\n        await testFromEdit(page, invalidChannelName);\n        await expect(page.getByText(\"An error occurred while testing the notification channel, check your configuration\")).toBeVisible();\n        await cancel(page);\n    });\n\n    test(\"Delete invalid Telegram channel\", async ({page}) => {\n        await page.goto(\"/dashboard/notifications/channels\");\n        await expect(page.getByRole(\"heading\", {name: \"Notification channels\"})).toBeVisible();\n        await expect(get(page, invalidChannelName)).toBeVisible();\n        await remove(page, invalidChannelName);\n        await expect(page.getByText(\"Notification channel has been successfully removed.\")).toBeVisible();\n        await expect(page.getByText(invalidChannelName)).toHaveCount(0);\n    });\n});\n"
  },
  {
    "path": "e2e/notification/webhook.spec.ts",
    "content": "import {expect, test} from \"@playwright/test\";\nimport {\n    cancel, create, get, remove, submit, testFromEdit,\n} from \"../helpers/notification\";\nimport {getEnv} from \"../helpers/env\";\nimport {LOCAL_STORAGE_PATH} from \"../helpers/session\";\n\ntest.use({storageState: LOCAL_STORAGE_PATH});\n\nconst requiredChannelName = \"Webhook E2E Required\";\nconst optionalChannelName = \"Webhook E2E Optional\";\nconst invalidChannelName = \"Webhook E2E Invalid\";\n\n// test.describe.serial(\"Valid channels\", () => {\n//     test(\"Create and test a valid Webhook channel\", async ({page}) => {\n//         await page.goto(\"/dashboard/notifications/channels\");\n//         await expect(page.getByRole(\"heading\", {name: \"Notification channels\"})).toBeVisible();\n//         await create(page, \"Webhook\", requiredChannelName, async (page) => {\n//             await page.getByLabel(/Webhook URL/).fill(getEnv(\"E2E_NOTIFICATION_WEBHOOK_URL\"));\n//         });\n//         await submit(page);\n//         await expect(page.getByText(\"Notification channel has been successfully created.\")).toBeVisible();\n//         await expect(get(page, requiredChannelName)).toBeVisible();\n//         await testFromEdit(page, requiredChannelName);\n//         await expect(page.getByText(\"Sent to Webhook\")).toBeVisible();\n//         await cancel(page);\n//     });\n//\n//     test(\"Create and test a valid Webhook channel with optional header\", async ({page}) => {\n//         await page.goto(\"/dashboard/notifications/channels\");\n//         await expect(page.getByRole(\"heading\", {name: \"Notification channels\"})).toBeVisible();\n//         await create(page, \"Webhook\", optionalChannelName, async (page) => {\n//             await page.getByLabel(/Webhook URL/).fill(getEnv(\"E2E_NOTIFICATION_WEBHOOK_URL\"));\n//             await page.getByLabel(/^Header Name$/).fill(getEnv(\"E2E_NOTIFICATION_WEBHOOK_SECRET_HEADER\"));\n//             await page.getByLabel(/^Secret Value$/).fill(getEnv(\"E2E_NOTIFICATION_WEBHOOK_SECRET\"));\n//         });\n//         await submit(page);\n//         await expect(page.getByText(\"Notification channel has been successfully created.\")).toBeVisible();\n//         await expect(get(page, optionalChannelName)).toBeVisible();\n//         await testFromEdit(page, optionalChannelName);\n//         await expect(page.getByText(\"Sent to Webhook\")).toBeVisible();\n//         await cancel(page);\n//     });\n// });\n\ntest.describe.serial(\"Invalid channel\", () => {\n    test(\"Create and test invalid Webhook channel\", async ({page}) => {\n        await page.goto(\"/dashboard/notifications/channels\");\n        await expect(page.getByRole(\"heading\", {name: \"Notification channels\"})).toBeVisible();\n        await create(page, \"Webhook\", invalidChannelName, async (page) => {\n            await page.getByLabel(/Webhook URL/).fill(\"https://webhook.example.com/api/wrong-webhook\");\n            await page.getByLabel(/^Header Name$/).fill(getEnv(\"E2E_NOTIFICATION_WEBHOOK_SECRET_HEADER\"));\n            await page.getByLabel(/^Secret Value$/).fill(\"wrong-webhook-secret\");\n        });\n        await submit(page);\n        await expect(page.getByText(\"Notification channel has been successfully created.\")).toBeVisible();\n        await expect(get(page, invalidChannelName)).toBeVisible();\n        await testFromEdit(page, invalidChannelName);\n        await expect(page.getByText(\"An error occurred while testing the notification channel, check your configuration\")).toBeVisible();\n        await cancel(page);\n    });\n\n    test(\"Delete invalid Webhook E2E channel\", async ({page}) => {\n        await page.goto(\"/dashboard/notifications/channels\");\n        await expect(page.getByRole(\"heading\", {name: \"Notification channels\"})).toBeVisible();\n        await expect(get(page, invalidChannelName)).toBeVisible();\n        await remove(page, invalidChannelName);\n        await expect(page.getByText(\"Notification channel has been successfully removed.\")).toBeVisible();\n        await expect(page.getByText(invalidChannelName)).toHaveCount(0);\n    });\n});\n"
  },
  {
    "path": "e2e/project.spec.ts",
    "content": "import {expect, test} from \"@playwright/test\";\nimport {create, edit, get, remove} from \"./helpers/project\";\nimport {LOCAL_STORAGE_PATH} from \"./helpers/session\";\n\ntest.use({storageState: LOCAL_STORAGE_PATH});\n\nconst project = {\n    emptyStateName: \"Project A\",\n    buttonName: \"Project B\",\n    updatedButtonName: \"Project B Updated\",\n};\n\ntest.describe.serial(() => {\n    test(\"Create a project from empty state\", async ({page}) => {\n        await page.goto(\"/dashboard/projects\");\n        await expect(page.getByRole(\"heading\", {name: \"Projects\"})).toBeVisible();\n        await expect(page.getByText(\"Create new Project\", {exact: true})).toBeVisible();\n\n        await create(page, \"emptyState\", project.emptyStateName);\n\n        await expect(page.getByText(\"Project has been successfully created.\")).toBeVisible();\n        await expect(get(page, project.emptyStateName)).toBeVisible();\n        await expect(page.getByText(\"Create new Project\", {exact: true})).toHaveCount(0);\n    });\n\n    test(\"Create a project from classic button\", async ({page}) => {\n        await page.goto(\"/dashboard/projects\");\n        await expect(page.getByRole(\"heading\", {name: \"Projects\"})).toBeVisible();\n        await expect(get(page, project.emptyStateName)).toBeVisible();\n\n        await create(page, \"button\", project.buttonName);\n\n        await expect(page.getByText(\"Project has been successfully created.\")).toBeVisible();\n        await expect(get(page, project.buttonName)).toBeVisible();\n    });\n\n    test(\"Edit the second created project\", async ({page}) => {\n        await page.goto(\"/dashboard/projects\");\n        await expect(page.getByRole(\"heading\", {name: \"Projects\"})).toBeVisible();\n        await expect(get(page, project.buttonName)).toBeVisible();\n\n        await edit(page, project.buttonName, project.updatedButtonName);\n\n        await expect(page.getByText(\"Project has been successfully updated.\")).toBeVisible();\n        await expect(page.getByText(project.updatedButtonName, {exact: true})).toBeVisible();\n    });\n\n    test(\"Delete the second created project\", async ({page}) => {\n        await page.goto(\"/dashboard/projects\");\n        await expect(page.getByRole(\"heading\", {name: \"Projects\"})).toBeVisible();\n        await expect(get(page, project.updatedButtonName)).toBeVisible();\n\n        await remove(page, project.updatedButtonName);\n\n        await expect(page).toHaveURL(\"/dashboard/projects\");\n        await expect(page.getByText(\"Projects has been successfully archived.\")).toBeVisible();\n        await expect(page.getByText(project.updatedButtonName)).toHaveCount(0);\n    });\n});\n"
  },
  {
    "path": "e2e/setup.spec.ts",
    "content": "import {test} from \"@playwright/test\";\nimport fs from \"fs\";\nimport {LOCAL_STORAGE_PATH} from \"./helpers/session\";\n\ntest.describe(() => {\n    test.beforeAll(async () => {\n        if (fs.existsSync(LOCAL_STORAGE_PATH)) fs.unlinkSync(LOCAL_STORAGE_PATH);\n        fs.writeFileSync(LOCAL_STORAGE_PATH, JSON.stringify({}));\n    });\n\n    test(\"Prepare shared storage state\", async () => {\n    });\n});\n"
  },
  {
    "path": "e2e/storage/azure.spec.ts",
    "content": ""
  },
  {
    "path": "e2e/storage/gcs.spec.ts",
    "content": ""
  },
  {
    "path": "e2e/storage/google-drive.spec.ts",
    "content": "import {expect, test} from \"@playwright/test\";\nimport {getEnv} from \"../helpers/env\";\nimport {LOCAL_STORAGE_PATH} from \"../helpers/session\";\nimport {\n    cancel, create, get, remove, submit, testConnection, testFromEdit,\n} from \"../helpers/storage\";\n\ntest.use({storageState: LOCAL_STORAGE_PATH});\n\nconst requiredChannelName = \"Google Drive E2E Required\";\nconst invalidChannelName = \"Google Drive E2E Invalid\";\n\n// test.describe.serial(\"Valid channel\", () => {\n//     test(\"Create and test a valid Google Drive channel\", async ({page}) => {\n//         await page.goto(\"/dashboard/storages/channels\");\n//         await expect(page.getByRole(\"heading\", {name: \"Storage channels\"})).toBeVisible();\n//         await create(page, \"Google Drive\", requiredChannelName, async (page) => {\n//             await page.getByLabel(/Client ID/).fill(getEnv(\"E2E_STORAGE_GOOGLE_DRIVE_CLIENT_ID\"));\n//             await page.getByLabel(/Client Secret/).fill(getEnv(\"E2E_STORAGE_GOOGLE_DRIVE_CLIENT_SECRET\"));\n//             await page.getByLabel(/Folder ID/).fill(getEnv(\"E2E_STORAGE_GOOGLE_DRIVE_FOLDER_ID\"));\n//         });\n//         await expect(page.getByRole(\"heading\", {name: \"Add Storage Channel\"})).toBeVisible();\n//         await testConnection(page);\n//         await expect(page.getByText(\"Successfully connected to storage channel\")).toBeVisible();\n//         await submit(page);\n//         await expect(page.getByText(\"Storage channel has been successfully created.\")).toBeVisible();\n//         await expect(get(page, requiredChannelName)).toBeVisible();\n//\n//         await testFromEdit(page, requiredChannelName);\n//         await expect(page.getByRole(\"heading\", {name: \"Edit Storage Channel\"})).toBeVisible();\n//         await expect(page.getByText(\"Successfully connected to storage channel\")).toBeVisible();\n//         await cancel(page);\n//     });\n// });\n\ntest.describe.serial(\"Invalid channel\", () => {\n    test(\"Create and test invalid Google Drive channel\", async ({page}) => {\n        await page.goto(\"/dashboard/storages/channels\");\n        await expect(page.getByRole(\"heading\", {name: \"Storage channels\"})).toBeVisible();\n        await create(page, \"Google Drive\", invalidChannelName, async (page) => {\n            await page.getByLabel(/Client ID/).fill(getEnv(\"E2E_STORAGE_GOOGLE_DRIVE_CLIENT_ID\"));\n            await page.getByLabel(/Client Secret/).fill(\"wrong-google-drive-client-secret\");\n            await page.getByLabel(/Folder ID/).fill(getEnv(\"E2E_STORAGE_GOOGLE_DRIVE_FOLDER_ID\"));\n        });\n        await testConnection(page);\n        await expect(page.getByText(\"An error occurred while testing the storage channel\")).toBeVisible();\n        await submit(page);\n        await expect(page.getByText(\"Storage channel has been successfully created.\")).toBeVisible();\n        await expect(get(page, invalidChannelName)).toBeVisible();\n    });\n\n    test(\"Delete invalid Google Drive E2E channel\", async ({page}) => {\n        await page.goto(\"/dashboard/storages/channels\");\n        await expect(page.getByRole(\"heading\", {name: \"Storage channels\"})).toBeVisible();\n        await expect(get(page, invalidChannelName)).toBeVisible();\n        await remove(page, invalidChannelName);\n        await expect(page.getByText(\"Storage channel has been successfully removed.\")).toBeVisible();\n        await expect(page.getByText(invalidChannelName)).toHaveCount(0);\n    });\n});\n"
  },
  {
    "path": "e2e/storage/s3.spec.ts",
    "content": "import {expect, test} from \"@playwright/test\";\nimport {getEnv} from \"../helpers/env\";\nimport {LOCAL_STORAGE_PATH} from \"../helpers/session\";\nimport {\n    cancel, create, get, remove, submit, testConnection, testFromEdit,\n} from \"../helpers/storage\";\n\ntest.use({storageState: LOCAL_STORAGE_PATH});\n\nconst providers = [\n    {\n        title: \"AWS S3\",\n        requiredChannelName: \"AWS S3 E2E Required\",\n        optionalChannelName: \"AWS S3 E2E Optional\",\n        invalidChannelName: \"AWS S3 E2E Invalid\",\n        endpointUrl: getEnv(\"E2E_STORAGE_AWS_S3_ENDPOINT_URL\"),\n        region: getEnv(\"E2E_STORAGE_AWS_S3_REGION\"),\n        accessKey: getEnv(\"E2E_STORAGE_AWS_S3_ACCESS_KEY\"),\n        secretKey: getEnv(\"E2E_STORAGE_AWS_S3_SECRET_KEY\"),\n        bucketName: getEnv(\"E2E_STORAGE_AWS_S3_BUCKET_NAME\"),\n        port: getEnv(\"E2E_STORAGE_AWS_S3_PORT\"),\n        invalidAccessKey: \"wrong-aws-access-key\",\n        invalidSecretKey: \"wrong-aws-secret-key\",\n    },\n    {\n        title: \"Cloudflare R2\",\n        requiredChannelName: \"Cloudflare R2 E2E Required\",\n        optionalChannelName: \"Cloudflare R2 E2E Optional\",\n        invalidChannelName: \"Cloudflare R2 E2E Invalid\",\n        endpointUrl: getEnv(\"E2E_STORAGE_R2_ENDPOINT_URL\"),\n        region: getEnv(\"E2E_STORAGE_R2_REGION\"),\n        accessKey: getEnv(\"E2E_STORAGE_R2_ACCESS_KEY\"),\n        secretKey: getEnv(\"E2E_STORAGE_R2_SECRET_KEY\"),\n        bucketName: getEnv(\"E2E_STORAGE_R2_BUCKET_NAME\"),\n        port: getEnv(\"E2E_STORAGE_R2_PORT\"),\n        invalidAccessKey: \"wrong-r2-access-key\",\n        invalidSecretKey: \"wrong-r2-secret-key\",\n    },\n] as const;\n\nfor (const provider of providers) {\n    test.describe(provider.title, () => {\n        // test.describe.serial(\"Valid channels\", () => {\n        //     test(`Create and test a valid ${provider.title} channel`, async ({page}) => {\n        //         await page.goto(\"/dashboard/storages/channels\");\n        //         await expect(page.getByRole(\"heading\", {name: \"Storage channels\"})).toBeVisible();\n        //         await create(page, \"S3\", provider.requiredChannelName, async (page) => {\n        //             await page.getByLabel(/Endpoint URL/).fill(provider.endpointUrl);\n        //             await page.getByLabel(/Access Key/).fill(provider.accessKey);\n        //             await page.getByLabel(/Secret Key/).fill(provider.secretKey);\n        //             await page.getByLabel(/Bucket name/).fill(provider.bucketName);\n        //         });\n        //         await expect(page.getByRole(\"heading\", {name: \"Add Storage Channel\"})).toBeVisible();\n        //         await testConnection(page);\n        //         await expect(page.getByText(\"Successfully connected to storage channel\")).toBeVisible();\n        //         await submit(page);\n        //         await expect(page.getByText(\"Storage channel has been successfully created.\")).toBeVisible();\n        //         await expect(get(page, provider.requiredChannelName)).toBeVisible();\n        //\n        //         await testFromEdit(page, provider.requiredChannelName);\n        //         await expect(page.getByRole(\"heading\", {name: \"Edit Storage Channel\"})).toBeVisible();\n        //         await expect(page.getByText(\"Successfully connected to storage channel\")).toBeVisible();\n        //         await cancel(page);\n        //     });\n        //\n        //     test(`Create and test a valid ${provider.title} channel with optional region and port`, async ({page}) => {\n        //         await page.goto(\"/dashboard/storages/channels\");\n        //         await expect(page.getByRole(\"heading\", {name: \"Storage channels\"})).toBeVisible();\n        //         await create(page, \"S3\", provider.optionalChannelName, async (page) => {\n        //             await page.getByLabel(/Endpoint URL/).fill(provider.endpointUrl);\n        //             await page.getByLabel(/^Region$/).fill(provider.region);\n        //             await page.getByLabel(/Access Key/).fill(provider.accessKey);\n        //             await page.getByLabel(/Secret Key/).fill(provider.secretKey);\n        //             await page.getByLabel(/Bucket name/).fill(provider.bucketName);\n        //             await page.getByLabel(/^Port$/).fill(provider.port);\n        //         });\n        //         await expect(page.getByRole(\"heading\", {name: \"Add Storage Channel\"})).toBeVisible();\n        //         await testConnection(page);\n        //         await expect(page.getByText(\"Successfully connected to storage channel\")).toBeVisible();\n        //         await submit(page);\n        //         await expect(page.getByText(\"Storage channel has been successfully created.\")).toBeVisible();\n        //         await expect(get(page, provider.optionalChannelName)).toBeVisible();\n        //\n        //         await testFromEdit(page, provider.optionalChannelName);\n        //         await expect(page.getByRole(\"heading\", {name: \"Edit Storage Channel\"})).toBeVisible();\n        //         await expect(page.getByText(\"Successfully connected to storage channel\")).toBeVisible();\n        //         await cancel(page);\n        //     });\n        // });\n\n        test.describe.serial(\"Invalid channel\", () => {\n            test(`Create and test invalid ${provider.title} channel`, async ({page}) => {\n                await page.goto(\"/dashboard/storages/channels\");\n                await expect(page.getByRole(\"heading\", {name: \"Storage channels\"})).toBeVisible();\n                await create(page, \"S3\", provider.invalidChannelName, async (page) => {\n                    await page.getByLabel(/Endpoint URL/).fill(provider.endpointUrl);\n                    await page.getByLabel(/^Region$/).fill(provider.region);\n                    await page.getByLabel(/Access Key/).fill(provider.invalidAccessKey);\n                    await page.getByLabel(/Secret Key/).fill(provider.invalidSecretKey);\n                    await page.getByLabel(/Bucket name/).fill(provider.bucketName);\n                    await page.getByLabel(/^Port$/).fill(provider.port);\n                });\n                await expect(page.getByRole(\"heading\", {name: \"Add Storage Channel\"})).toBeVisible();\n                await testConnection(page);\n                await expect(page.getByText(\"An error occurred while testing the storage channel\")).toBeVisible();\n                await submit(page);\n                await expect(page.getByText(\"Storage channel has been successfully created.\")).toBeVisible();\n                await expect(get(page, provider.invalidChannelName)).toBeVisible();\n            });\n\n            test(`Delete invalid ${provider.title} channel`, async ({page}) => {\n                await page.goto(\"/dashboard/storages/channels\");\n                await expect(page.getByRole(\"heading\", {name: \"Storage channels\"})).toBeVisible();\n                await expect(get(page, provider.invalidChannelName)).toBeVisible();\n                await remove(page, provider.invalidChannelName);\n                await expect(page.getByText(\"Storage channel has been successfully removed.\")).toBeVisible();\n                await expect(page.getByText(provider.invalidChannelName)).toHaveCount(0);\n            });\n        });\n    });\n}\n"
  },
  {
    "path": "eslint.config.mjs",
    "content": "import {defineConfig, globalIgnores} from 'eslint/config'\nimport nextVitals from 'eslint-config-next/core-web-vitals'\n\nconst eslintConfig = defineConfig([\n    ...nextVitals,\n    globalIgnores([\n        '.next/**',\n        'out/**',\n        'build/**',\n        'next-env.d.ts',\n    ]),\n])\n\nexport default eslintConfig"
  },
  {
    "path": "helm/.helmignore",
    "content": ".DS_Store\n.git/\n.gitignore\n.bzr/\n.bzrignore\n.hg/\n.hgignore\n.svn/\n*.swp\n*.bak\n*.tmp\n*.orig\n*~\n.project\n.idea/\n*.tmproj\n.vscode/\n"
  },
  {
    "path": "helm/Chart.yaml",
    "content": "apiVersion: v2\nname: portabase\ndescription: Helm chart for Portabase\ntype: application\nversion: 0.0.0\nappVersion: \"latest\"\nkeywords:\n  - postgresql\n  - mariadb\n  - mongodb\n  - mysql\n  - sqlite\n  - backup\n  - database\n  - restore\nhome: https://github.com/Portabase/portabase\n\nsources:\n  - https://github.com/Portabase/portabase\n  - https://github.com/Portabase/portabase/tree/main/helm\n\nmaintainers:\n  - name: Charles Gauthereau\n    url: https://github.com/RambokDev\n  - name: Killian Larcher\n    url: https://github.com/KillianLarcher\n\nicon: https://raw.githubusercontent.com/Portabase/portabase/main/.github/assets/logo.png"
  },
  {
    "path": "helm/README.md",
    "content": "# Development Notes\n\n## Check that Kubernetes is reachable locally\n\n```bash\nkubectl get nodes\n```\n\n## Install the local Portabase Helm chart\n\n```bash\nhelm install portabase . \\\n--set project.secret=$(openssl rand -hex 32)\n```\n\n## Check the pods\n\n```bash\nkubectl get pods\n```\n\n## Check the services\n\n```bash\nkubectl get svc\n```\n\n## If the service type is ClusterIP, expose it locally using port forwarding:\n\n```bash\nkubectl port-forward svc/portabase 8887:80\n```\n"
  },
  {
    "path": "helm/templates/deployment.yaml",
    "content": "apiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: portabase\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      app: portabase\n  template:\n    metadata:\n      labels:\n        app: portabase\n    spec:\n      containers:\n        - name: portabase\n          image: \"{{ .Values.image.repository }}:{{ .Values.image.tag }}\"\n          ports:\n            - containerPort: 80\n          env:\n            - name: TZ\n              value: {{ .Values.timezone }}\n            - name: PROJECT_URL\n              value: {{ .Values.project.url }}\n            - name: PROJECT_SECRET\n              value: {{ .Values.project.secret }}\n          volumeMounts:\n            - name: data\n              mountPath: /data\n      volumes:\n        - name: data\n          persistentVolumeClaim:\n            claimName: portabase-data"
  },
  {
    "path": "helm/templates/pvc.yaml",
    "content": "apiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: portabase-data\nspec:\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: {{ .Values.persistence.size }}"
  },
  {
    "path": "helm/templates/service.yaml",
    "content": "apiVersion: v1\nkind: Service\nmetadata:\n  name: portabase\nspec:\n  type: {{ .Values.service.type }}\n  selector:\n    app: portabase\n  ports:\n    - port: {{ .Values.service.port }}\n      targetPort: 80\n      nodePort: {{ .Values.service.nodePort }}"
  },
  {
    "path": "helm/values.yaml",
    "content": "image:\n  repository: portabase/portabase\n  tag: latest\n  pullPolicy: Always\n\nreplicaCount: 1\n\nservice:\n  type: ClusterIP\n  port: 80\n  targetPort: 80\n\nresources:\n  requests:\n    memory: \"1Gi\"\n    cpu: \"1\"\n  limits:\n    memory: \"1Gi\"\n    cpu: \"1\"\n\ntimezone: Europe/Paris\n\nproject:\n  url: http://localhost:8887\n  secret: \"change_me_generate_secure_secret\"\n\npersistence:\n  enabled: true\n  storageClassName: \"\"\n  accessMode: ReadWriteOnce\n  size: 10Gi\n  mountPath: /data\n\ningress:\n  enabled: false\n  className: nginx\n  hosts:\n    - host: portabase.example.com\n      paths:\n        - path: /\n          pathType: Prefix\n  tls: []\n\nupdateStrategy:\n  type: RollingUpdate\n  rollingUpdate:\n    partition: 0\n"
  },
  {
    "path": "instrumentation.ts",
    "content": "export async function register() {\n    if (process.env.NEXT_RUNTIME === \"nodejs\") {\n        const init = await import(\"@/utils/init\");\n        await init.init();\n    }\n}\n"
  },
  {
    "path": "next.config.ts",
    "content": "import type {NextConfig} from \"next\";\nimport {PORTABASE_DEFAULT_SETTINGS} from \"./portabase.config\";\n\nconst isDev = process.env.NODE_ENV === \"development\";\n\n\nfunction buildCSPHeader(): string {\n    const {CSP} = PORTABASE_DEFAULT_SETTINGS.SECURITY;\n\n    const directives = [\n        `default-src ${CSP.DEFAULT_SRC.join(\" \")}`,\n        `script-src ${CSP.SCRIPT_SRC.join(\" \")}`,\n        `style-src ${CSP.STYLE_SRC.join(\" \")}`,\n        `img-src ${CSP.IMG_SRC.join(\" \")}`,\n        `font-src ${CSP.FONT_SRC.join(\" \")}`,\n        `object-src ${CSP.OBJECT_SRC.join(\" \")}`,\n        `connect-src ${CSP.CONNECT_SRC.join(\" \")}`,\n        `base-uri ${CSP.BASE_URI.join(\" \")}`,\n        `form-action ${CSP.FORM_ACTION.join(\" \")}`,\n        `frame-ancestors ${CSP.FRAME_ANCESTORS.join(\" \")}`,\n    ];\n\n    if (CSP.BLOCK_ALL_MIXED_CONTENT) {\n        directives.push(\"block-all-mixed-content\");\n    }\n\n    if (CSP.UPGRADE_INSECURE_REQUESTS) {\n        directives.push(\"upgrade-insecure-requests\");\n    }\n\n    return directives.join(\"; \");\n}\n\nfunction buildPermissionsPolicy(): string {\n    return Object.entries(PORTABASE_DEFAULT_SETTINGS.SECURITY.PERMISSIONS_POLICY)\n        .map(([feature, values]) => `${feature.toLowerCase()}=${values.join(\", \")}`)\n        .join(\", \");\n}\n\n\nconst nextConfig: NextConfig = {\n    output: \"standalone\",\n    typescript: {\n        ignoreBuildErrors: true,\n    },\n    logging: {\n        browserToTerminal: false,\n    },\n    experimental: {\n        serverActions: {\n            bodySizeLimit: \"10gb\",\n        },\n        proxyClientMaxBodySize: '10gb',\n    },\n    async rewrites() {\n        if (!isDev) return [];\n\n        return [\n            {\n                source: \"/tus/:path*\",\n                destination: \"http://localhost:1080/tus/:path*\",\n            },\n        ];\n    },\n\n    async headers() {\n        return [\n            {\n                source: \"/(.*)\",\n                headers: [\n                    {\n                        key: \"Content-Security-Policy\",\n                        value: buildCSPHeader(),\n                    },\n                    {\n                        key: \"Permissions-Policy\",\n                        value: buildPermissionsPolicy(),\n                    },\n                    {\n                        key: 'X-Content-Type-Options',\n                        value: 'nosniff',\n                    },\n                    {\n                        key: 'X-Frame-Options',\n                        value: 'DENY',\n                    },\n                    {\n                        key: 'Referrer-Policy',\n                        value: 'strict-origin-when-cross-origin',\n                    },\n                    {\n                        key: 'Strict-Transport-Security',\n                        value: 'max-age=63072000; includeSubDomains; preload',\n                    }\n                    // ...other security headers\n                ],\n            },\n        ];\n    },\n};\n\nexport default nextConfig;\n"
  },
  {
    "path": "package.json",
    "content": "{\n  \"name\": \"portabase\",\n  \"version\": \"1.13.0\",\n  \"private\": true,\n  \"scripts\": {\n    \"dev\": \"next dev --turbopack -p 8887\",\n    \"build\": \"next build --experimental-build-mode compile\",\n    \"start\": \"next start\",\n    \"lint\": \"next lint\",\n    \"email\": \"email dev --dir ./src/components/emails\",\n    \"db:generate\": \"drizzle-kit generate\",\n    \"db:migrate\": \"drizzle-kit migrate\",\n    \"db:drop\": \"drizzle-kit drop\",\n    \"auth:generate\": \"npx @better-auth/cli generate --config ./src/lib/auth/auth.ts\",\n    \"release\": \"release-it\"\n  },\n  \"dependencies\": {\n    \"@better-auth/core\": \"1.6.2\",\n    \"@better-auth/passkey\": \"^1.6.2\",\n    \"@better-auth/sso\": \"^1.6.2\",\n    \"@hookform/resolvers\": \"^5.2.2\",\n    \"@radix-ui/react-accordion\": \"^1.2.12\",\n    \"@radix-ui/react-alert-dialog\": \"^1.1.15\",\n    \"@radix-ui/react-aspect-ratio\": \"^1.1.8\",\n    \"@radix-ui/react-avatar\": \"^1.1.11\",\n    \"@radix-ui/react-checkbox\": \"^1.3.3\",\n    \"@radix-ui/react-collapsible\": \"^1.1.12\",\n    \"@radix-ui/react-context-menu\": \"^2.2.16\",\n    \"@radix-ui/react-dialog\": \"^1.1.15\",\n    \"@radix-ui/react-dropdown-menu\": \"^2.1.16\",\n    \"@radix-ui/react-hover-card\": \"^1.1.15\",\n    \"@radix-ui/react-icons\": \"^1.3.2\",\n    \"@radix-ui/react-label\": \"^2.1.8\",\n    \"@radix-ui/react-menubar\": \"^1.1.16\",\n    \"@radix-ui/react-navigation-menu\": \"^1.2.14\",\n    \"@radix-ui/react-popover\": \"^1.1.15\",\n    \"@radix-ui/react-progress\": \"^1.1.8\",\n    \"@radix-ui/react-radio-group\": \"^1.3.8\",\n    \"@radix-ui/react-scroll-area\": \"^1.2.10\",\n    \"@radix-ui/react-select\": \"^2.2.6\",\n    \"@radix-ui/react-separator\": \"^1.1.8\",\n    \"@radix-ui/react-slider\": \"^1.3.6\",\n    \"@radix-ui/react-slot\": \"^1.2.4\",\n    \"@radix-ui/react-switch\": \"^1.2.6\",\n    \"@radix-ui/react-tabs\": \"^1.1.13\",\n    \"@radix-ui/react-toast\": \"^1.2.15\",\n    \"@radix-ui/react-toggle\": \"^1.1.10\",\n    \"@radix-ui/react-toggle-group\": \"^1.1.11\",\n    \"@radix-ui/react-tooltip\": \"^1.2.8\",\n    \"@react-email/components\": \"^0.0.41\",\n    \"@t3-oss/env-nextjs\": \"^0.13.11\",\n    \"@tanstack/react-query\": \"^5.97.0\",\n    \"@tanstack/react-table\": \"^8.21.3\",\n    \"@types/nodemailer\": \"^6.4.23\",\n    \"@types/ws\": \"^8.18.1\",\n    \"@zenstackhq/runtime\": \"2.14.2\",\n    \"argon2\": \"^0.43.1\",\n    \"bcrypt\": \"^6.0.0\",\n    \"better-auth\": \"1.6.2\",\n    \"class-variance-authority\": \"^0.7.1\",\n    \"clsx\": \"^2.1.1\",\n    \"cmdk\": \"^1.1.1\",\n    \"date-fns\": \"^4.1.0\",\n    \"dockerode\": \"^4.0.10\",\n    \"dotenv\": \"^16.6.1\",\n    \"drizzle-orm\": \"0.45.2\",\n    \"drizzle-zod\": \"0.8.3\",\n    \"embla-carousel-react\": \"^8.6.0\",\n    \"googleapis\": \"^170.1.0\",\n    \"input-otp\": \"^1.4.2\",\n    \"lucide-react\": \"^0.553.0\",\n    \"minio\": \"^8.0.7\",\n    \"motion\": \"^12.38.0\",\n    \"next\": \"16.2.3\",\n    \"next-safe-action\": \"^7.10.8\",\n    \"next-themes\": \"^0.4.6\",\n    \"node-cron\": \"^4.2.1\",\n    \"node-forge\": \"^1.4.0\",\n    \"nodemailer\": \"8.0.5\",\n    \"npm-check-updates\": \"^18.3.1\",\n    \"pg\": \"^8.20.0\",\n    \"pino\": \"^10.3.1\",\n    \"pino-pretty\": \"^13.1.3\",\n    \"prettier\": \"^3.8.2\",\n    \"react\": \"^19.2.5\",\n    \"react-day-picker\": \"9.7.0\",\n    \"react-dom\": \"^19.2.5\",\n    \"react-dropzone\": \"^14.4.1\",\n    \"react-email\": \"^4.3.2\",\n    \"react-hook-form\": \"^7.72.1\",\n    \"react-qr-code\": \"^2.0.18\",\n    \"react-resizable-panels\": \"^3.0.6\",\n    \"react-twc\": \"^1.5.1\",\n    \"react-use-measure\": \"^2.1.7\",\n    \"recharts\": \"^2.15.4\",\n    \"sharp\": \"^0.34.5\",\n    \"socket.io\": \"^4.8.3\",\n    \"socket.io-client\": \"^4.8.3\",\n    \"sonner\": \"^2.0.7\",\n    \"swiper\": \"^12.1.3\",\n    \"tailwind-merge\": \"^3.5.0\",\n    \"uuid\": \"^11.1.0\",\n    \"vaul\": \"^1.1.2\",\n    \"ws\": \"^8.20.0\",\n    \"zod\": \"4.3.6\"\n  },\n  \"devDependencies\": {\n    \"@iconify/react\": \"^6.0.2\",\n    \"@playwright/test\": \"1.58.2\",\n    \"@react-email/preview-server\": \"4.3.2\",\n    \"@react-email/render\": \"^2.0.6\",\n    \"@release-it/bumper\": \"^7.0.5\",\n    \"@release-it/conventional-changelog\": \"^10.0.6\",\n    \"@tailwindcss/postcss\": \"^4.2.2\",\n    \"@types/eslint-plugin-tailwindcss\": \"^3.17.0\",\n    \"@types/node\": \"^22.19.17\",\n    \"@types/node-forge\": \"^1.3.14\",\n    \"@types/pg\": \"^8.20.0\",\n    \"@types/react\": \"^19.2.14\",\n    \"@types/react-dom\": \"^19.2.3\",\n    \"@zenstackhq/openapi\": \"^2.22.1\",\n    \"@zenstackhq/tanstack-query\": \"^2.22.2\",\n    \"baseline-browser-mapping\": \"^2.10.17\",\n    \"drizzle-kit\": \"^0.31.10\",\n    \"esbuild\": \"^0.27.7\",\n    \"eslint\": \"^9.39.4\",\n    \"eslint-config-next\": \"^16.2.3\",\n    \"eslint-plugin-tailwindcss\": \"^3.18.2\",\n    \"framer-motion\": \"^12.38.0\",\n    \"node-pty\": \"^1.1.0\",\n    \"postcss\": \"^8.5.9\",\n    \"release-it\": \"^19.2.4\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"tsx\": \"^4.21.0\",\n    \"tw-animate-css\": \"^1.4.0\",\n    \"typescript\": \"^5.9.3\",\n    \"zenstack\": \"2.14.2\"\n  },\n  \"packageManager\": \"pnpm@10.33.0\"\n}\n"
  },
  {
    "path": "playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test';\nimport dotenv from 'dotenv';\nimport path from 'path';\n\n/**\n * Read environment variables from file.\n * https://github.com/motdotla/dotenv\n */\ndotenv.config({ path: path.resolve(__dirname, '.env') });\n\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './e2e',\n  /* Run tests in files in parallel */\n  fullyParallel: true,\n  /* Fail the build on CI if you accidentally left test.only in the source code. */\n  forbidOnly: !!process.env.CI,\n  /* Retry on CI only */\n  retries: process.env.CI ? 2 : 0,\n  /* Opt out of parallel tests on CI. */\n  workers: process.env.CI ? 1 : undefined,\n  /* Reporter to use. See https://playwright.dev/docs/test-reporters */\n  reporter: 'html',\n  /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */\n  use: {\n    ...devices['Desktop Chrome'],\n    baseURL: process.env.PROJECT_URL,\n\n    /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */\n    trace: 'on-first-retry',\n  },\n\n  /* Configure projects and dependency order */\n    projects: [\n        {\n            name: 'setup',\n            testMatch: '**/setup.spec.ts',\n        },\n        {\n            name: 'auth',\n            testMatch: '**/auth.spec.ts',\n            dependencies: ['setup'],\n        },\n        {\n            name: 'access-management',\n            testMatch: '**/access-management.spec.ts',\n            dependencies: ['auth'],\n        },\n        {\n            name: 'notification',\n            testMatch: '**/notification/**/*.spec.ts',\n            dependencies: ['access-management'],\n        },\n        {\n            name: 'storage',\n            testMatch: '**/storage/**/*.spec.ts',\n            dependencies: ['access-management'],\n        },\n        {\n            name: 'agent',\n            testMatch: '**/agent.spec.ts',\n            dependencies: ['access-management'],\n        },\n\n        {\n            name: 'project',\n            testMatch: '**/project.spec.ts',\n            dependencies: ['access-management'],\n        },\n        {\n            name: 'cleanup',\n            testMatch: '**/cleanup.spec.ts',\n            dependencies: ['agent', 'storage', 'notification', 'project'],\n        },\n    ]\n\n});\n"
  },
  {
    "path": "pnpm-workspace.yaml",
    "content": "ignoredBuiltDependencies:\n  - node-pty\nonlyBuiltDependencies:\n  - '@prisma/client'\n  - '@prisma/engines'\n  - argon2\n  - bcrypt\n  - cpu-features\n  - esbuild\n  - prisma\n  - protobufjs\n  - sharp\n  - ssh2\n  - unrs-resolver\n  - zenstack\n"
  },
  {
    "path": "portabase.config.ts",
    "content": "\n\nexport const PORTABASE_DEFAULT_SETTINGS = {\n    SECURITY: {\n        CSP: {\n            DEFAULT_SRC: [\"'self'\"],\n            SCRIPT_SRC: [\n                \"'self'\",\n                \"'unsafe-eval'\",\n                \"'unsafe-inline'\",\n                \"https://cdn.jsdelivr.net\",\n                \"https://www.googletagmanager.com\",\n                \"https://code.iconify.design\",\n                \"https://code.iconify.com\",\n                \"https://cdn.iconify.design\",\n                \"https://api.iconify.design\",\n\n            ],\n            STYLE_SRC: [\n                \"'self'\",\n                \"'unsafe-inline'\",\n                \"https://fonts.googleapis.com\",\n                \"https://code.iconify.design\",\n                \"https://cdn.iconify.design\",\n                \"https://code.iconify.com\",\n            ],\n            IMG_SRC: [\n                \"'self'\",\n                \"blob:\",\n                \"data:\",\n                \"https:\",\n                \"https://code.iconify.design\",\n                \"https://cdn.iconify.design\",\n                \"https://code.iconify.com\",\n                \"https://api.iconify.design\",\n                \"http://localhost:9000\",\n            ],\n            FONT_SRC: [\n                \"'self'\",\n                \"https://fonts.gstatic.com\",\n                \"https://cdn.iconify.design\",\n            ],\n            CONNECT_SRC: [\n                \"'self'\",\n                \"https://api.iconify.design\",\n                \"https://code.iconify.design\",\n                \"https://api.github.com\",\n\n            ],\n            OBJECT_SRC: [\"'none'\"],\n            BASE_URI: [\"'self'\"],\n            FORM_ACTION: [\"'self'\"],\n            FRAME_ANCESTORS: [\"'none'\"],\n            BLOCK_ALL_MIXED_CONTENT: false,\n            UPGRADE_INSECURE_REQUESTS: process.env.PROJECT_URL?.startsWith(\"https://\") || false,\n        },\n        PERMISSIONS_POLICY: {\n            CAMERA: [\"()\"],\n            MICROPHONE: [\"()\"],\n            GEOLOCATION: [\"()\"],\n            FULLSCREEN: [\"(self)\"],\n            // ...other features\n        },\n    },\n};\n\n"
  },
  {
    "path": "postcss.config.mjs",
    "content": "/** @type {import('postcss-load-config').Config} */\nconst config = {\n  plugins: {\n    '@tailwindcss/postcss': {},\n  },\n};\n\nexport default config;\n"
  },
  {
    "path": "proxy.ts",
    "content": "import { NextRequest, NextResponse } from \"next/server\";\nimport { loggingMiddleware } from \"@/middleware/loggingMiddleware\";\nimport { errorHandler } from \"@/middleware/errorHandler\";\nimport { auth } from \"@/lib/auth/auth\";\nimport { headers } from \"next/headers\";\n\nexport async function proxy(request: NextRequest) {\n  const url = request.nextUrl.clone();\n  const redirectUrl = encodeURIComponent(request.nextUrl.pathname);\n\n  if (url.pathname.startsWith(\"/dashboard\")) {\n    const session = await auth.api.getSession({\n      headers: await headers(),\n    });\n    if (!session) {\n      return NextResponse.redirect(\n        new URL(`/login?redirect=${redirectUrl}`, request.url),\n      );\n    }\n    if (session.user.banned) {\n      await auth.api.signOut({ headers: await headers() });\n      return NextResponse.redirect(new URL(\"/login?error=banned\", request.url));\n    }\n    if (session.user.role === \"pending\") {\n      await auth.api.signOut({ headers: await headers() });\n      return NextResponse.redirect(\n        new URL(`/login?error=pending?redirect=${redirectUrl}`, request.url),\n      );\n    }\n    if (url.pathname === \"/dashboard\") {\n      return NextResponse.redirect(new URL(`/dashboard/home`, request.url));\n    }\n    return NextResponse.next();\n  }\n\n  if (url.pathname.startsWith(\"/api/auth\")) {\n    return NextResponse.next();\n  }\n\n  if (url.pathname.startsWith(\"/api\")) {\n    const routeExists = checkRouteExists(url.pathname);\n    if (!routeExists) {\n      return new NextResponse(\n        JSON.stringify({\n          message: \"This API route does not exist.\",\n          status: 404,\n        }),\n        {\n          status: 404,\n          headers: { \"Content-Type\": \"application/json\" },\n        },\n      );\n    }\n  }\n  try {\n    loggingMiddleware(request);\n  } catch (err) {\n    errorHandler(err);\n  }\n}\n\nfunction checkRouteExists(pathname: string) {\n  const routePatterns = [\n    /^\\/api\\/agent\\/[^/]+\\/status\\/?$/,\n    /^\\/api\\/agent\\/[^/]+\\/backup\\/?$/,\n    /^\\/api\\/agent\\/[^/]+\\/backup\\/upload\\/init\\/?$/,\n    /^\\/api\\/agent\\/[^/]+\\/backup\\/upload\\/status\\/?$/,\n    /^\\/api\\/agent\\/[^/]+\\/restore\\/?$/,\n    /^\\/api\\/files\\/images\\/[^/]+\\/?$/,\n    /^\\/api\\/files\\/backups\\/?$/,\n    /^\\/api\\/tus\\/hooks\\/?$/,\n    /^\\/api\\/events\\/?$/,\n    /^\\/api\\/config\\/?$/,\n    /^\\/api\\/google\\/drive\\/callback\\/?$/,\n  ];\n  return routePatterns.some((pattern) => pattern.test(pathname));\n}\n\nexport const config = {\n  matcher: [\"/api/:path*\", \"/dashboard/:path*\", \"/dashboard\"],\n};\n"
  },
  {
    "path": "seeds/keycloak/master-realm.json",
    "content": "{\n  \"id\" : \"fb9cf3e7-ba35-48d2-b40e-8a48a98f8acd\",\n  \"realm\" : \"master\",\n  \"displayName\" : \"Portabase\",\n  \"displayNameHtml\" : \"<div class=\\\"kc-logo-text\\\"><span>Portabase</span></div>\",\n  \"notBefore\" : 0,\n  \"defaultSignatureAlgorithm\" : \"RS256\",\n  \"revokeRefreshToken\" : false,\n  \"refreshTokenMaxReuse\" : 0,\n  \"accessTokenLifespan\" : 60,\n  \"accessTokenLifespanForImplicitFlow\" : 900,\n  \"ssoSessionIdleTimeout\" : 1800,\n  \"ssoSessionMaxLifespan\" : 36000,\n  \"ssoSessionIdleTimeoutRememberMe\" : 0,\n  \"ssoSessionMaxLifespanRememberMe\" : 0,\n  \"offlineSessionIdleTimeout\" : 2592000,\n  \"offlineSessionMaxLifespanEnabled\" : false,\n  \"offlineSessionMaxLifespan\" : 5184000,\n  \"clientSessionIdleTimeout\" : 0,\n  \"clientSessionMaxLifespan\" : 0,\n  \"clientOfflineSessionIdleTimeout\" : 0,\n  \"clientOfflineSessionMaxLifespan\" : 0,\n  \"accessCodeLifespan\" : 60,\n  \"accessCodeLifespanUserAction\" : 300,\n  \"accessCodeLifespanLogin\" : 1800,\n  \"actionTokenGeneratedByAdminLifespan\" : 43200,\n  \"actionTokenGeneratedByUserLifespan\" : 300,\n  \"oauth2DeviceCodeLifespan\" : 600,\n  \"oauth2DevicePollingInterval\" : 5,\n  \"enabled\" : true,\n  \"sslRequired\" : \"none\",\n  \"registrationAllowed\" : false,\n  \"registrationEmailAsUsername\" : false,\n  \"rememberMe\" : false,\n  \"verifyEmail\" : false,\n  \"loginWithEmailAllowed\" : true,\n  \"duplicateEmailsAllowed\" : false,\n  \"resetPasswordAllowed\" : false,\n  \"editUsernameAllowed\" : false,\n  \"bruteForceProtected\" : false,\n  \"permanentLockout\" : false,\n  \"maxTemporaryLockouts\" : 0,\n  \"bruteForceStrategy\" : \"MULTIPLE\",\n  \"maxFailureWaitSeconds\" : 900,\n  \"minimumQuickLoginWaitSeconds\" : 60,\n  \"waitIncrementSeconds\" : 60,\n  \"quickLoginCheckMilliSeconds\" : 1000,\n  \"maxDeltaTimeSeconds\" : 43200,\n  \"failureFactor\" : 30,\n  \"roles\" : {\n    \"realm\" : [ {\n      \"id\" : \"e2068803-d2fb-4955-928d-35afa1b552cf\",\n      \"name\" : \"admin\",\n      \"description\" : \"${role_admin}\",\n      \"composite\" : true,\n      \"composites\" : {\n        \"realm\" : [ \"create-realm\" ],\n        \"client\" : {\n          \"master-realm\" : [ \"create-client\", \"view-users\", \"query-realms\", \"view-authorization\", \"view-identity-providers\", \"query-users\", \"query-groups\", \"manage-users\", \"manage-events\", \"view-clients\", \"view-realm\", \"manage-authorization\", \"manage-realm\", \"view-events\", \"impersonation\", \"query-clients\", \"manage-identity-providers\", \"manage-clients\" ]\n        }\n      },\n      \"clientRole\" : false,\n      \"containerId\" : \"fb9cf3e7-ba35-48d2-b40e-8a48a98f8acd\",\n      \"attributes\" : { }\n    }, {\n      \"id\" : \"1c6d4bb7-a9f0-4bf8-9780-d97e99de3c3d\",\n      \"name\" : \"default-roles-master\",\n      \"description\" : \"${role_default-roles}\",\n      \"composite\" : true,\n      \"composites\" : {\n        \"realm\" : [ \"offline_access\", \"uma_authorization\" ],\n        \"client\" : {\n          \"account\" : [ \"view-profile\", \"manage-account\" ]\n        }\n      },\n      \"clientRole\" : false,\n      \"containerId\" : \"fb9cf3e7-ba35-48d2-b40e-8a48a98f8acd\",\n      \"attributes\" : { }\n    }, {\n      \"id\" : \"26712408-59c8-463f-bce1-d8f961b4bf51\",\n      \"name\" : \"create-realm\",\n      \"description\" : \"${role_create-realm}\",\n      \"composite\" : false,\n      \"clientRole\" : false,\n      \"containerId\" : \"fb9cf3e7-ba35-48d2-b40e-8a48a98f8acd\",\n      \"attributes\" : { }\n    }, {\n      \"id\" : \"546e3598-8de5-4e05-8823-5abe2efebf43\",\n      \"name\" : \"offline_access\",\n      \"description\" : \"${role_offline-access}\",\n      \"composite\" : false,\n      \"clientRole\" : false,\n      \"containerId\" : \"fb9cf3e7-ba35-48d2-b40e-8a48a98f8acd\",\n      \"attributes\" : { }\n    }, {\n      \"id\" : \"b8bf1864-b840-4377-9f6f-373a7f645dcc\",\n      \"name\" : \"uma_authorization\",\n      \"description\" : \"${role_uma_authorization}\",\n      \"composite\" : false,\n      \"clientRole\" : false,\n      \"containerId\" : \"fb9cf3e7-ba35-48d2-b40e-8a48a98f8acd\",\n      \"attributes\" : { }\n    } ],\n    \"client\" : {\n      \"portabase\" : [ {\n        \"id\" : \"180dc40c-1c09-49a2-a86b-782f1a2182c4\",\n        \"name\" : \"uma_protection\",\n        \"composite\" : false,\n        \"clientRole\" : true,\n        \"containerId\" : \"7b8c7b35-8ffd-47b3-82b5-b152b521cd77\",\n        \"attributes\" : { }\n      } ],\n      \"security-admin-console\" : [ ],\n      \"admin-cli\" : [ ],\n      \"account-console\" : [ ],\n      \"broker\" : [ {\n        \"id\" : \"695d4423-e83d-403f-baf1-35076a456366\",\n        \"name\" : \"read-token\",\n        \"description\" : \"${role_read-token}\",\n        \"composite\" : false,\n        \"clientRole\" : true,\n        \"containerId\" : \"af9b43bb-1902-4ed8-b4f6-caa7ec27efd5\",\n        \"attributes\" : { }\n      } ],\n      \"master-realm\" : [ {\n        \"id\" : \"27fbd47b-0350-4f11-a83c-a0134f9079b1\",\n        \"name\" : \"create-client\",\n        \"description\" : \"${role_create-client}\",\n        \"composite\" : false,\n        \"clientRole\" : true,\n        \"containerId\" : \"6022c206-5f1f-45b7-af07-74ce6804cbc7\",\n        \"attributes\" : { }\n      }, {\n        \"id\" : \"672a49fe-69f9-4371-b945-8bb539a76fa7\",\n        \"name\" : \"view-users\",\n        \"description\" : \"${role_view-users}\",\n        \"composite\" : true,\n        \"composites\" : {\n          \"client\" : {\n            \"master-realm\" : [ \"query-users\", \"query-groups\" ]\n          }\n        },\n        \"clientRole\" : true,\n        \"containerId\" : \"6022c206-5f1f-45b7-af07-74ce6804cbc7\",\n        \"attributes\" : { }\n      }, {\n        \"id\" : \"3df2803b-1be3-4446-ad55-de4a1654f0f1\",\n        \"name\" : \"query-realms\",\n        \"description\" : \"${role_query-realms}\",\n        \"composite\" : false,\n        \"clientRole\" : true,\n        \"containerId\" : \"6022c206-5f1f-45b7-af07-74ce6804cbc7\",\n        \"attributes\" : { }\n      }, {\n        \"id\" : \"963cdf89-9884-493f-b553-d095a190db70\",\n        \"name\" : \"view-authorization\",\n        \"description\" : \"${role_view-authorization}\",\n        \"composite\" : false,\n        \"clientRole\" : true,\n        \"containerId\" : \"6022c206-5f1f-45b7-af07-74ce6804cbc7\",\n        \"attributes\" : { }\n      }, {\n        \"id\" : \"0c7db742-fb5a-41ca-816a-ade107446ee8\",\n        \"name\" : \"view-identity-providers\",\n        \"description\" : \"${role_view-identity-providers}\",\n        \"composite\" : false,\n        \"clientRole\" : true,\n        \"containerId\" : \"6022c206-5f1f-45b7-af07-74ce6804cbc7\",\n        \"attributes\" : { }\n      }, {\n        \"id\" : \"9741b23a-9efa-4fbc-bfae-683f84997e8b\",\n        \"name\" : \"query-users\",\n        \"description\" : \"${role_query-users}\",\n        \"composite\" : false,\n        \"clientRole\" : true,\n        \"containerId\" : \"6022c206-5f1f-45b7-af07-74ce6804cbc7\",\n        \"attributes\" : { }\n      }, {\n        \"id\" : \"65439bfe-de32-499f-9f68-44ecd96ff49c\",\n        \"name\" : \"query-groups\",\n        \"description\" : \"${role_query-groups}\",\n        \"composite\" : false,\n        \"clientRole\" : true,\n        \"containerId\" : \"6022c206-5f1f-45b7-af07-74ce6804cbc7\",\n        \"attributes\" : { }\n      }, {\n        \"id\" : \"ecaab7fc-da4b-4613-8b7c-959ed4e225cc\",\n        \"name\" : \"manage-events\",\n        \"description\" : \"${role_manage-events}\",\n        \"composite\" : false,\n        \"clientRole\" : true,\n        \"containerId\" : \"6022c206-5f1f-45b7-af07-74ce6804cbc7\",\n        \"attributes\" : { }\n      }, {\n        \"id\" : \"e260a5cc-91c5-41db-86f8-01b494c4e66b\",\n        \"name\" : \"manage-users\",\n        \"description\" : \"${role_manage-users}\",\n        \"composite\" : false,\n        \"clientRole\" : true,\n        \"containerId\" : \"6022c206-5f1f-45b7-af07-74ce6804cbc7\",\n        \"attributes\" : { }\n      }, {\n        \"id\" : \"db6d0e0a-4193-4f6a-9343-d1f182fdda15\",\n        \"name\" : \"view-clients\",\n        \"description\" : \"${role_view-clients}\",\n        \"composite\" : true,\n        \"composites\" : {\n          \"client\" : {\n            \"master-realm\" : [ \"query-clients\" ]\n          }\n        },\n        \"clientRole\" : true,\n        \"containerId\" : \"6022c206-5f1f-45b7-af07-74ce6804cbc7\",\n        \"attributes\" : { }\n      }, {\n        \"id\" : \"f8bc7291-d450-48f6-820e-67a8ab2a6b5b\",\n        \"name\" : \"view-realm\",\n        \"description\" : \"${role_view-realm}\",\n        \"composite\" : false,\n        \"clientRole\" : true,\n        \"containerId\" : \"6022c206-5f1f-45b7-af07-74ce6804cbc7\",\n        \"attributes\" : { }\n      }, {\n        \"id\" : \"3444137f-0938-4340-9d5b-ceef2f7b1e97\",\n        \"name\" : \"manage-authorization\",\n        \"description\" : \"${role_manage-authorization}\",\n        \"composite\" : false,\n        \"clientRole\" : true,\n        \"containerId\" : \"6022c206-5f1f-45b7-af07-74ce6804cbc7\",\n        \"attributes\" : { }\n      }, {\n        \"id\" : \"a39bf436-1fa4-42d2-80ed-a010b43853aa\",\n        \"name\" : \"manage-realm\",\n        \"description\" : \"${role_manage-realm}\",\n        \"composite\" : false,\n        \"clientRole\" : true,\n        \"containerId\" : \"6022c206-5f1f-45b7-af07-74ce6804cbc7\",\n        \"attributes\" : { }\n      }, {\n        \"id\" : \"baa18f46-7d1d-4298-b3b0-9b0ecb945557\",\n        \"name\" : \"view-events\",\n        \"description\" : \"${role_view-events}\",\n        \"composite\" : false,\n        \"clientRole\" : true,\n        \"containerId\" : \"6022c206-5f1f-45b7-af07-74ce6804cbc7\",\n        \"attributes\" : { }\n      }, {\n        \"id\" : \"91298b5d-5182-4056-8240-8fdb188f865e\",\n        \"name\" : \"impersonation\",\n        \"description\" : \"${role_impersonation}\",\n        \"composite\" : false,\n        \"clientRole\" : true,\n        \"containerId\" : \"6022c206-5f1f-45b7-af07-74ce6804cbc7\",\n        \"attributes\" : { }\n      }, {\n        \"id\" : \"a5a58b82-32eb-4c78-993a-cf9c7e37eabb\",\n        \"name\" : \"query-clients\",\n        \"description\" : \"${role_query-clients}\",\n        \"composite\" : false,\n        \"clientRole\" : true,\n        \"containerId\" : \"6022c206-5f1f-45b7-af07-74ce6804cbc7\",\n        \"attributes\" : { }\n      }, {\n        \"id\" : \"c8c85c54-7bfb-4d45-8ccc-6253e429f649\",\n        \"name\" : \"manage-clients\",\n        \"description\" : \"${role_manage-clients}\",\n        \"composite\" : false,\n        \"clientRole\" : true,\n        \"containerId\" : \"6022c206-5f1f-45b7-af07-74ce6804cbc7\",\n        \"attributes\" : { }\n      }, {\n        \"id\" : \"baed486e-dc69-44a9-9630-9a88987142ee\",\n        \"name\" : \"manage-identity-providers\",\n        \"description\" : \"${role_manage-identity-providers}\",\n        \"composite\" : false,\n        \"clientRole\" : true,\n        \"containerId\" : \"6022c206-5f1f-45b7-af07-74ce6804cbc7\",\n        \"attributes\" : { }\n      } ],\n      \"account\" : [ {\n        \"id\" : \"8085c714-b840-4539-823d-a8df8bab3db3\",\n        \"name\" : \"view-applications\",\n        \"description\" : \"${role_view-applications}\",\n        \"composite\" : false,\n        \"clientRole\" : true,\n        \"containerId\" : \"18b5dfb2-44d4-448e-98df-9652daef1a22\",\n        \"attributes\" : { }\n      }, {\n        \"id\" : \"12089b7a-e685-4c87-bb81-997ecc04ed17\",\n        \"name\" : \"view-profile\",\n        \"description\" : \"${role_view-profile}\",\n        \"composite\" : false,\n        \"clientRole\" : true,\n        \"containerId\" : \"18b5dfb2-44d4-448e-98df-9652daef1a22\",\n        \"attributes\" : { }\n      }, {\n        \"id\" : \"ea9e72d8-1d23-4f50-86b3-1795067da29f\",\n        \"name\" : \"view-groups\",\n        \"description\" : \"${role_view-groups}\",\n        \"composite\" : false,\n        \"clientRole\" : true,\n        \"containerId\" : \"18b5dfb2-44d4-448e-98df-9652daef1a22\",\n        \"attributes\" : { }\n      }, {\n        \"id\" : \"2bd8114a-75cf-4d6b-8f42-229f6a5c66a0\",\n        \"name\" : \"delete-account\",\n        \"description\" : \"${role_delete-account}\",\n        \"composite\" : false,\n        \"clientRole\" : true,\n        \"containerId\" : \"18b5dfb2-44d4-448e-98df-9652daef1a22\",\n        \"attributes\" : { }\n      }, {\n        \"id\" : \"7303b334-e9e0-4236-89b8-e1c9d6562138\",\n        \"name\" : \"view-consent\",\n        \"description\" : \"${role_view-consent}\",\n        \"composite\" : false,\n        \"clientRole\" : true,\n        \"containerId\" : \"18b5dfb2-44d4-448e-98df-9652daef1a22\",\n        \"attributes\" : { }\n      }, {\n        \"id\" : \"12c6fe35-ec80-4ca2-b2a8-9d6eae4c3a92\",\n        \"name\" : \"manage-account-links\",\n        \"description\" : \"${role_manage-account-links}\",\n        \"composite\" : false,\n        \"clientRole\" : true,\n        \"containerId\" : \"18b5dfb2-44d4-448e-98df-9652daef1a22\",\n        \"attributes\" : { }\n      }, {\n        \"id\" : \"e56b828b-7d5d-49a2-b686-c1bd535900ac\",\n        \"name\" : \"manage-consent\",\n        \"description\" : \"${role_manage-consent}\",\n        \"composite\" : true,\n        \"composites\" : {\n          \"client\" : {\n            \"account\" : [ \"view-consent\" ]\n          }\n        },\n        \"clientRole\" : true,\n        \"containerId\" : \"18b5dfb2-44d4-448e-98df-9652daef1a22\",\n        \"attributes\" : { }\n      }, {\n        \"id\" : \"98e19002-4144-48fc-bcca-4ac6f19a6a37\",\n        \"name\" : \"manage-account\",\n        \"description\" : \"${role_manage-account}\",\n        \"composite\" : true,\n        \"composites\" : {\n          \"client\" : {\n            \"account\" : [ \"manage-account-links\" ]\n          }\n        },\n        \"clientRole\" : true,\n        \"containerId\" : \"18b5dfb2-44d4-448e-98df-9652daef1a22\",\n        \"attributes\" : { }\n      } ]\n    }\n  },\n  \"groups\" : [ {\n    \"id\" : \"f523647e-76b3-493f-bb1e-f2a3f7deebdb\",\n    \"name\" : \"Admin\",\n    \"description\" : \"\",\n    \"path\" : \"/Admin\",\n    \"subGroups\" : [ ],\n    \"attributes\" : { },\n    \"realmRoles\" : [ \"admin\" ],\n    \"clientRoles\" : { }\n  }, {\n    \"id\" : \"f3b7286d-8169-41eb-b3a2-6241bf58907d\",\n    \"name\" : \"Default\",\n    \"description\" : \"\",\n    \"path\" : \"/Default\",\n    \"subGroups\" : [ ],\n    \"attributes\" : { },\n    \"realmRoles\" : [ ],\n    \"clientRoles\" : { }\n  }, {\n    \"id\" : \"eda8d5c9-d29a-4b35-9372-2b088b9a9d8d\",\n    \"name\" : \"Pending\",\n    \"description\" : \"\",\n    \"path\" : \"/Pending\",\n    \"subGroups\" : [ ],\n    \"attributes\" : { },\n    \"realmRoles\" : [ ],\n    \"clientRoles\" : { }\n  } ],\n  \"defaultRole\" : {\n    \"id\" : \"1c6d4bb7-a9f0-4bf8-9780-d97e99de3c3d\",\n    \"name\" : \"default-roles-master\",\n    \"description\" : \"${role_default-roles}\",\n    \"composite\" : true,\n    \"clientRole\" : false,\n    \"containerId\" : \"fb9cf3e7-ba35-48d2-b40e-8a48a98f8acd\"\n  },\n  \"requiredCredentials\" : [ \"password\" ],\n  \"otpPolicyType\" : \"totp\",\n  \"otpPolicyAlgorithm\" : \"HmacSHA1\",\n  \"otpPolicyInitialCounter\" : 0,\n  \"otpPolicyDigits\" : 6,\n  \"otpPolicyLookAheadWindow\" : 1,\n  \"otpPolicyPeriod\" : 30,\n  \"otpPolicyCodeReusable\" : false,\n  \"otpSupportedApplications\" : [ \"totpAppFreeOTPName\", \"totpAppGoogleName\", \"totpAppMicrosoftAuthenticatorName\" ],\n  \"localizationTexts\" : { },\n  \"webAuthnPolicyRpEntityName\" : \"keycloak\",\n  \"webAuthnPolicySignatureAlgorithms\" : [ \"ES256\", \"RS256\" ],\n  \"webAuthnPolicyRpId\" : \"\",\n  \"webAuthnPolicyAttestationConveyancePreference\" : \"not specified\",\n  \"webAuthnPolicyAuthenticatorAttachment\" : \"not specified\",\n  \"webAuthnPolicyRequireResidentKey\" : \"not specified\",\n  \"webAuthnPolicyUserVerificationRequirement\" : \"not specified\",\n  \"webAuthnPolicyCreateTimeout\" : 0,\n  \"webAuthnPolicyAvoidSameAuthenticatorRegister\" : false,\n  \"webAuthnPolicyAcceptableAaguids\" : [ ],\n  \"webAuthnPolicyExtraOrigins\" : [ ],\n  \"webAuthnPolicyPasswordlessRpEntityName\" : \"keycloak\",\n  \"webAuthnPolicyPasswordlessSignatureAlgorithms\" : [ \"ES256\", \"RS256\" ],\n  \"webAuthnPolicyPasswordlessRpId\" : \"\",\n  \"webAuthnPolicyPasswordlessAttestationConveyancePreference\" : \"not specified\",\n  \"webAuthnPolicyPasswordlessAuthenticatorAttachment\" : \"not specified\",\n  \"webAuthnPolicyPasswordlessRequireResidentKey\" : \"Yes\",\n  \"webAuthnPolicyPasswordlessUserVerificationRequirement\" : \"required\",\n  \"webAuthnPolicyPasswordlessCreateTimeout\" : 0,\n  \"webAuthnPolicyPasswordlessAvoidSameAuthenticatorRegister\" : false,\n  \"webAuthnPolicyPasswordlessAcceptableAaguids\" : [ ],\n  \"webAuthnPolicyPasswordlessExtraOrigins\" : [ ],\n  \"users\" : [ {\n    \"id\" : \"9bd127a6-a29f-4a3d-a530-9b7284cf9770\",\n    \"username\" : \"admin\",\n    \"emailVerified\" : false,\n    \"attributes\" : {\n      \"is_temporary_admin\" : [ \"true\" ]\n    },\n    \"enabled\" : true,\n    \"createdTimestamp\" : 1772178626982,\n    \"totp\" : false,\n    \"credentials\" : [ {\n      \"id\" : \"731ce7c2-9141-4ff1-8856-3e8625cf1929\",\n      \"type\" : \"password\",\n      \"createdDate\" : 1772178627073,\n      \"secretData\" : \"{\\\"value\\\":\\\"quuOeVW9VVoilChYLmvjJWCnAM23OA/gK54tYoJ6atw=\\\",\\\"salt\\\":\\\"khqIggSOfCNLqP1i9qiwvQ==\\\",\\\"additionalParameters\\\":{}}\",\n      \"credentialData\" : \"{\\\"hashIterations\\\":5,\\\"algorithm\\\":\\\"argon2\\\",\\\"additionalParameters\\\":{\\\"hashLength\\\":[\\\"32\\\"],\\\"memory\\\":[\\\"7168\\\"],\\\"type\\\":[\\\"id\\\"],\\\"version\\\":[\\\"1.3\\\"],\\\"parallelism\\\":[\\\"1\\\"]}}\"\n    } ],\n    \"disableableCredentialTypes\" : [ ],\n    \"requiredActions\" : [ ],\n    \"realmRoles\" : [ \"admin\", \"default-roles-master\" ],\n    \"notBefore\" : 0,\n    \"groups\" : [ ]\n  }, {\n    \"id\" : \"c62607eb-fe31-4ea4-b8cb-56c37039c1b3\",\n    \"username\" : \"development\",\n    \"firstName\" : \"Tech\",\n    \"lastName\" : \"Portabase\",\n    \"email\" : \"keycloak@portabase.io\",\n    \"emailVerified\" : true,\n    \"enabled\" : true,\n    \"createdTimestamp\" : 1772179382148,\n    \"totp\" : false,\n    \"credentials\" : [ {\n      \"id\" : \"b1cedcac-5207-4479-bc29-065ba849e414\",\n      \"type\" : \"password\",\n      \"userLabel\" : \"My password\",\n      \"createdDate\" : 1772179391727,\n      \"secretData\" : \"{\\\"value\\\":\\\"IXr6L3pvO2BAkn/cH3rh3v2tg1R83u2f8SWEZK2fq5E=\\\",\\\"salt\\\":\\\"XWV8/yKm7Rw/YXiwXZZUig==\\\",\\\"additionalParameters\\\":{}}\",\n      \"credentialData\" : \"{\\\"hashIterations\\\":5,\\\"algorithm\\\":\\\"argon2\\\",\\\"additionalParameters\\\":{\\\"hashLength\\\":[\\\"32\\\"],\\\"memory\\\":[\\\"7168\\\"],\\\"type\\\":[\\\"id\\\"],\\\"version\\\":[\\\"1.3\\\"],\\\"parallelism\\\":[\\\"1\\\"]}}\"\n    } ],\n    \"disableableCredentialTypes\" : [ ],\n    \"requiredActions\" : [ ],\n    \"realmRoles\" : [ \"admin\", \"default-roles-master\" ],\n    \"notBefore\" : 0,\n    \"groups\" : [ \"/Admin\" ]\n  }, {\n    \"id\" : \"718dfe46-dbef-41a3-9120-78aeac240431\",\n    \"username\" : \"service-account-portabase\",\n    \"emailVerified\" : false,\n    \"enabled\" : true,\n    \"createdTimestamp\" : 1772177793553,\n    \"totp\" : false,\n    \"serviceAccountClientId\" : \"portabase\",\n    \"credentials\" : [ ],\n    \"disableableCredentialTypes\" : [ ],\n    \"requiredActions\" : [ ],\n    \"realmRoles\" : [ \"default-roles-master\" ],\n    \"clientRoles\" : {\n      \"portabase\" : [ \"uma_protection\" ]\n    },\n    \"notBefore\" : 0,\n    \"groups\" : [ ]\n  } ],\n  \"scopeMappings\" : [ {\n    \"clientScope\" : \"offline_access\",\n    \"roles\" : [ \"offline_access\" ]\n  } ],\n  \"clientScopeMappings\" : {\n    \"account\" : [ {\n      \"client\" : \"account-console\",\n      \"roles\" : [ \"manage-account\", \"view-groups\" ]\n    } ]\n  },\n  \"clients\" : [ {\n    \"id\" : \"18b5dfb2-44d4-448e-98df-9652daef1a22\",\n    \"clientId\" : \"account\",\n    \"name\" : \"${client_account}\",\n    \"rootUrl\" : \"${authBaseUrl}\",\n    \"baseUrl\" : \"/realms/master/account/\",\n    \"surrogateAuthRequired\" : false,\n    \"enabled\" : true,\n    \"alwaysDisplayInConsole\" : false,\n    \"clientAuthenticatorType\" : \"client-secret\",\n    \"redirectUris\" : [ \"/realms/master/account/*\" ],\n    \"webOrigins\" : [ ],\n    \"notBefore\" : 0,\n    \"bearerOnly\" : false,\n    \"consentRequired\" : false,\n    \"standardFlowEnabled\" : true,\n    \"implicitFlowEnabled\" : false,\n    \"directAccessGrantsEnabled\" : false,\n    \"serviceAccountsEnabled\" : false,\n    \"publicClient\" : true,\n    \"frontchannelLogout\" : false,\n    \"protocol\" : \"openid-connect\",\n    \"attributes\" : {\n      \"realm_client\" : \"false\",\n      \"post.logout.redirect.uris\" : \"+\"\n    },\n    \"authenticationFlowBindingOverrides\" : { },\n    \"fullScopeAllowed\" : false,\n    \"nodeReRegistrationTimeout\" : 0,\n    \"defaultClientScopes\" : [ \"web-origins\", \"acr\", \"profile\", \"roles\", \"basic\", \"email\" ],\n    \"optionalClientScopes\" : [ \"address\", \"phone\", \"organization\", \"offline_access\", \"microprofile-jwt\" ]\n  }, {\n    \"id\" : \"b07531b2-43f4-4487-8068-46001dd1abf7\",\n    \"clientId\" : \"account-console\",\n    \"name\" : \"${client_account-console}\",\n    \"rootUrl\" : \"${authBaseUrl}\",\n    \"baseUrl\" : \"/realms/master/account/\",\n    \"surrogateAuthRequired\" : false,\n    \"enabled\" : true,\n    \"alwaysDisplayInConsole\" : false,\n    \"clientAuthenticatorType\" : \"client-secret\",\n    \"redirectUris\" : [ \"/realms/master/account/*\" ],\n    \"webOrigins\" : [ ],\n    \"notBefore\" : 0,\n    \"bearerOnly\" : false,\n    \"consentRequired\" : false,\n    \"standardFlowEnabled\" : true,\n    \"implicitFlowEnabled\" : false,\n    \"directAccessGrantsEnabled\" : false,\n    \"serviceAccountsEnabled\" : false,\n    \"publicClient\" : true,\n    \"frontchannelLogout\" : false,\n    \"protocol\" : \"openid-connect\",\n    \"attributes\" : {\n      \"realm_client\" : \"false\",\n      \"post.logout.redirect.uris\" : \"+\",\n      \"pkce.code.challenge.method\" : \"S256\"\n    },\n    \"authenticationFlowBindingOverrides\" : { },\n    \"fullScopeAllowed\" : false,\n    \"nodeReRegistrationTimeout\" : 0,\n    \"protocolMappers\" : [ {\n      \"id\" : \"ad646174-e521-4bd5-8f78-eb8eed2befb8\",\n      \"name\" : \"audience resolve\",\n      \"protocol\" : \"openid-connect\",\n      \"protocolMapper\" : \"oidc-audience-resolve-mapper\",\n      \"consentRequired\" : false,\n      \"config\" : { }\n    } ],\n    \"defaultClientScopes\" : [ \"web-origins\", \"acr\", \"profile\", \"roles\", \"basic\", \"email\" ],\n    \"optionalClientScopes\" : [ \"address\", \"phone\", \"organization\", \"offline_access\", \"microprofile-jwt\" ]\n  }, {\n    \"id\" : \"8ad89892-6f85-4f07-b6b6-1fcb1eda58e2\",\n    \"clientId\" : \"admin-cli\",\n    \"name\" : \"${client_admin-cli}\",\n    \"surrogateAuthRequired\" : false,\n    \"enabled\" : true,\n    \"alwaysDisplayInConsole\" : false,\n    \"clientAuthenticatorType\" : \"client-secret\",\n    \"redirectUris\" : [ ],\n    \"webOrigins\" : [ ],\n    \"notBefore\" : 0,\n    \"bearerOnly\" : false,\n    \"consentRequired\" : false,\n    \"standardFlowEnabled\" : false,\n    \"implicitFlowEnabled\" : false,\n    \"directAccessGrantsEnabled\" : true,\n    \"serviceAccountsEnabled\" : false,\n    \"publicClient\" : true,\n    \"frontchannelLogout\" : false,\n    \"protocol\" : \"openid-connect\",\n    \"attributes\" : {\n      \"realm_client\" : \"false\",\n      \"client.use.lightweight.access.token.enabled\" : \"true\",\n      \"post.logout.redirect.uris\" : \"+\"\n    },\n    \"authenticationFlowBindingOverrides\" : { },\n    \"fullScopeAllowed\" : true,\n    \"nodeReRegistrationTimeout\" : 0,\n    \"defaultClientScopes\" : [ \"web-origins\", \"acr\", \"profile\", \"roles\", \"basic\", \"email\" ],\n    \"optionalClientScopes\" : [ \"address\", \"phone\", \"organization\", \"offline_access\", \"microprofile-jwt\" ]\n  }, {\n    \"id\" : \"af9b43bb-1902-4ed8-b4f6-caa7ec27efd5\",\n    \"clientId\" : \"broker\",\n    \"name\" : \"${client_broker}\",\n    \"surrogateAuthRequired\" : false,\n    \"enabled\" : true,\n    \"alwaysDisplayInConsole\" : false,\n    \"clientAuthenticatorType\" : \"client-secret\",\n    \"redirectUris\" : [ ],\n    \"webOrigins\" : [ ],\n    \"notBefore\" : 0,\n    \"bearerOnly\" : true,\n    \"consentRequired\" : false,\n    \"standardFlowEnabled\" : true,\n    \"implicitFlowEnabled\" : false,\n    \"directAccessGrantsEnabled\" : false,\n    \"serviceAccountsEnabled\" : false,\n    \"publicClient\" : false,\n    \"frontchannelLogout\" : false,\n    \"protocol\" : \"openid-connect\",\n    \"attributes\" : {\n      \"realm_client\" : \"true\",\n      \"post.logout.redirect.uris\" : \"+\"\n    },\n    \"authenticationFlowBindingOverrides\" : { },\n    \"fullScopeAllowed\" : false,\n    \"nodeReRegistrationTimeout\" : 0,\n    \"defaultClientScopes\" : [ \"web-origins\", \"acr\", \"profile\", \"roles\", \"basic\", \"email\" ],\n    \"optionalClientScopes\" : [ \"address\", \"phone\", \"organization\", \"offline_access\", \"microprofile-jwt\" ]\n  }, {\n    \"id\" : \"6022c206-5f1f-45b7-af07-74ce6804cbc7\",\n    \"clientId\" : \"master-realm\",\n    \"name\" : \"master Realm\",\n    \"surrogateAuthRequired\" : false,\n    \"enabled\" : true,\n    \"alwaysDisplayInConsole\" : false,\n    \"clientAuthenticatorType\" : \"client-secret\",\n    \"redirectUris\" : [ ],\n    \"webOrigins\" : [ ],\n    \"notBefore\" : 0,\n    \"bearerOnly\" : true,\n    \"consentRequired\" : false,\n    \"standardFlowEnabled\" : true,\n    \"implicitFlowEnabled\" : false,\n    \"directAccessGrantsEnabled\" : false,\n    \"serviceAccountsEnabled\" : false,\n    \"publicClient\" : false,\n    \"frontchannelLogout\" : false,\n    \"protocol\" : \"openid-connect\",\n    \"attributes\" : {\n      \"realm_client\" : \"true\",\n      \"post.logout.redirect.uris\" : \"+\"\n    },\n    \"authenticationFlowBindingOverrides\" : { },\n    \"fullScopeAllowed\" : false,\n    \"nodeReRegistrationTimeout\" : 0,\n    \"defaultClientScopes\" : [ \"web-origins\", \"acr\", \"profile\", \"roles\", \"basic\", \"email\" ],\n    \"optionalClientScopes\" : [ \"address\", \"phone\", \"organization\", \"offline_access\", \"microprofile-jwt\" ]\n  }, {\n    \"id\" : \"7b8c7b35-8ffd-47b3-82b5-b152b521cd77\",\n    \"clientId\" : \"portabase\",\n    \"name\" : \"Portabase\",\n    \"description\" : \"\",\n    \"rootUrl\" : \"http://localhost:8887\",\n    \"adminUrl\" : \"http://localhost:8887\",\n    \"baseUrl\" : \"http://localhost:8887\",\n    \"surrogateAuthRequired\" : false,\n    \"enabled\" : true,\n    \"alwaysDisplayInConsole\" : false,\n    \"clientAuthenticatorType\" : \"client-secret\",\n    \"secret\" : \"**********\",\n    \"redirectUris\" : [ \"http://localhost:8887/api/auth/sso/callback/keycloak\" ],\n    \"webOrigins\" : [ \"http://localhost:8887\" ],\n    \"notBefore\" : 0,\n    \"bearerOnly\" : false,\n    \"consentRequired\" : false,\n    \"standardFlowEnabled\" : true,\n    \"implicitFlowEnabled\" : false,\n    \"directAccessGrantsEnabled\" : false,\n    \"serviceAccountsEnabled\" : true,\n    \"authorizationServicesEnabled\" : true,\n    \"publicClient\" : false,\n    \"frontchannelLogout\" : true,\n    \"protocol\" : \"openid-connect\",\n    \"attributes\" : {\n      \"realm_client\" : \"false\",\n      \"oidc.ciba.grant.enabled\" : \"false\",\n      \"client.secret.creation.time\" : \"1772177793\",\n      \"backchannel.logout.session.required\" : \"true\",\n      \"standard.token.exchange.enabled\" : \"false\",\n      \"post.logout.redirect.uris\" : \"http://localhost:8887\",\n      \"oauth2.device.authorization.grant.enabled\" : \"true\",\n      \"pkce.code.challenge.method\" : \"S256\",\n      \"backchannel.logout.revoke.offline.tokens\" : \"false\",\n      \"dpop.bound.access.tokens\" : \"false\"\n    },\n    \"authenticationFlowBindingOverrides\" : { },\n    \"fullScopeAllowed\" : true,\n    \"nodeReRegistrationTimeout\" : -1,\n    \"protocolMappers\" : [ {\n      \"id\" : \"3e8f8909-e718-4ebe-80b9-ed6501e94cbe\",\n      \"name\" : \"groups\",\n      \"protocol\" : \"openid-connect\",\n      \"protocolMapper\" : \"oidc-group-membership-mapper\",\n      \"consentRequired\" : false,\n      \"config\" : {\n        \"full.path\" : \"false\",\n        \"introspection.token.claim\" : \"true\",\n        \"userinfo.token.claim\" : \"true\",\n        \"multivalued\" : \"true\",\n        \"id.token.claim\" : \"true\",\n        \"lightweight.claim\" : \"false\",\n        \"access.token.claim\" : \"true\",\n        \"claim.name\" : \"groups\"\n      }\n    } ],\n    \"defaultClientScopes\" : [ \"web-origins\", \"service_account\", \"acr\", \"profile\", \"roles\", \"basic\", \"email\" ],\n    \"optionalClientScopes\" : [ \"address\", \"phone\", \"organization\", \"offline_access\", \"microprofile-jwt\" ],\n    \"authorizationSettings\" : {\n      \"allowRemoteResourceManagement\" : true,\n      \"policyEnforcementMode\" : \"ENFORCING\",\n      \"resources\" : [ ],\n      \"policies\" : [ ],\n      \"scopes\" : [ ],\n      \"decisionStrategy\" : \"UNANIMOUS\"\n    }\n  }, {\n    \"id\" : \"320637e2-0aa2-4601-8862-fe465e887167\",\n    \"clientId\" : \"security-admin-console\",\n    \"name\" : \"${client_security-admin-console}\",\n    \"rootUrl\" : \"${authAdminUrl}\",\n    \"baseUrl\" : \"/admin/master/console/\",\n    \"surrogateAuthRequired\" : false,\n    \"enabled\" : true,\n    \"alwaysDisplayInConsole\" : false,\n    \"clientAuthenticatorType\" : \"client-secret\",\n    \"redirectUris\" : [ \"/admin/master/console/*\" ],\n    \"webOrigins\" : [ \"+\" ],\n    \"notBefore\" : 0,\n    \"bearerOnly\" : false,\n    \"consentRequired\" : false,\n    \"standardFlowEnabled\" : true,\n    \"implicitFlowEnabled\" : false,\n    \"directAccessGrantsEnabled\" : false,\n    \"serviceAccountsEnabled\" : false,\n    \"publicClient\" : true,\n    \"frontchannelLogout\" : false,\n    \"protocol\" : \"openid-connect\",\n    \"attributes\" : {\n      \"realm_client\" : \"false\",\n      \"client.use.lightweight.access.token.enabled\" : \"true\",\n      \"post.logout.redirect.uris\" : \"+\",\n      \"pkce.code.challenge.method\" : \"S256\"\n    },\n    \"authenticationFlowBindingOverrides\" : { },\n    \"fullScopeAllowed\" : true,\n    \"nodeReRegistrationTimeout\" : 0,\n    \"protocolMappers\" : [ {\n      \"id\" : \"59aa4c07-4e3b-4abd-947c-94e4840aab0f\",\n      \"name\" : \"locale\",\n      \"protocol\" : \"openid-connect\",\n      \"protocolMapper\" : \"oidc-usermodel-attribute-mapper\",\n      \"consentRequired\" : false,\n      \"config\" : {\n        \"introspection.token.claim\" : \"true\",\n        \"userinfo.token.claim\" : \"true\",\n        \"user.attribute\" : \"locale\",\n        \"id.token.claim\" : \"true\",\n        \"access.token.claim\" : \"true\",\n        \"claim.name\" : \"locale\",\n        \"jsonType.label\" : \"String\"\n      }\n    } ],\n    \"defaultClientScopes\" : [ \"web-origins\", \"acr\", \"profile\", \"roles\", \"basic\", \"email\" ],\n    \"optionalClientScopes\" : [ \"address\", \"phone\", \"organization\", \"offline_access\", \"microprofile-jwt\" ]\n  } ],\n  \"clientScopes\" : [ {\n    \"id\" : \"1c5c7377-5552-4f36-8073-5b7c50ba0b58\",\n    \"name\" : \"microprofile-jwt\",\n    \"description\" : \"Microprofile - JWT built-in scope\",\n    \"protocol\" : \"openid-connect\",\n    \"attributes\" : {\n      \"include.in.token.scope\" : \"true\",\n      \"display.on.consent.screen\" : \"false\"\n    },\n    \"protocolMappers\" : [ {\n      \"id\" : \"d26ac380-69ea-47c8-9342-f8108b8b1c7a\",\n      \"name\" : \"upn\",\n      \"protocol\" : \"openid-connect\",\n      \"protocolMapper\" : \"oidc-usermodel-attribute-mapper\",\n      \"consentRequired\" : false,\n      \"config\" : {\n        \"introspection.token.claim\" : \"true\",\n        \"userinfo.token.claim\" : \"true\",\n        \"user.attribute\" : \"username\",\n        \"id.token.claim\" : \"true\",\n        \"access.token.claim\" : \"true\",\n        \"claim.name\" : \"upn\",\n        \"jsonType.label\" : \"String\"\n      }\n    }, {\n      \"id\" : \"47e583ab-95d7-4b9e-83c3-37689f6808ff\",\n      \"name\" : \"groups\",\n      \"protocol\" : \"openid-connect\",\n      \"protocolMapper\" : \"oidc-usermodel-realm-role-mapper\",\n      \"consentRequired\" : false,\n      \"config\" : {\n        \"introspection.token.claim\" : \"true\",\n        \"multivalued\" : \"true\",\n        \"userinfo.token.claim\" : \"true\",\n        \"user.attribute\" : \"foo\",\n        \"id.token.claim\" : \"true\",\n        \"access.token.claim\" : \"true\",\n        \"claim.name\" : \"groups\",\n        \"jsonType.label\" : \"String\"\n      }\n    } ]\n  }, {\n    \"id\" : \"b92d26a9-7930-4f6c-add6-082374546966\",\n    \"name\" : \"roles\",\n    \"description\" : \"OpenID Connect scope for add user roles to the access token\",\n    \"protocol\" : \"openid-connect\",\n    \"attributes\" : {\n      \"include.in.token.scope\" : \"false\",\n      \"consent.screen.text\" : \"${rolesScopeConsentText}\",\n      \"display.on.consent.screen\" : \"true\"\n    },\n    \"protocolMappers\" : [ {\n      \"id\" : \"0bf151da-a754-460b-bc53-1d78249c3ac1\",\n      \"name\" : \"audience resolve\",\n      \"protocol\" : \"openid-connect\",\n      \"protocolMapper\" : \"oidc-audience-resolve-mapper\",\n      \"consentRequired\" : false,\n      \"config\" : {\n        \"introspection.token.claim\" : \"true\",\n        \"access.token.claim\" : \"true\"\n      }\n    }, {\n      \"id\" : \"a806de62-0e08-456f-9e16-76e8b186c724\",\n      \"name\" : \"realm roles\",\n      \"protocol\" : \"openid-connect\",\n      \"protocolMapper\" : \"oidc-usermodel-realm-role-mapper\",\n      \"consentRequired\" : false,\n      \"config\" : {\n        \"user.attribute\" : \"foo\",\n        \"introspection.token.claim\" : \"true\",\n        \"access.token.claim\" : \"true\",\n        \"claim.name\" : \"realm_access.roles\",\n        \"jsonType.label\" : \"String\",\n        \"multivalued\" : \"true\"\n      }\n    }, {\n      \"id\" : \"9063017e-d52e-4624-acff-22833103a577\",\n      \"name\" : \"client roles\",\n      \"protocol\" : \"openid-connect\",\n      \"protocolMapper\" : \"oidc-usermodel-client-role-mapper\",\n      \"consentRequired\" : false,\n      \"config\" : {\n        \"user.attribute\" : \"foo\",\n        \"introspection.token.claim\" : \"true\",\n        \"access.token.claim\" : \"true\",\n        \"claim.name\" : \"resource_access.${client_id}.roles\",\n        \"jsonType.label\" : \"String\",\n        \"multivalued\" : \"true\"\n      }\n    } ]\n  }, {\n    \"id\" : \"dce5baba-c90f-4347-8b84-3162868c7ffa\",\n    \"name\" : \"basic\",\n    \"description\" : \"OpenID Connect scope for add all basic claims to the token\",\n    \"protocol\" : \"openid-connect\",\n    \"attributes\" : {\n      \"include.in.token.scope\" : \"false\",\n      \"display.on.consent.screen\" : \"false\"\n    },\n    \"protocolMappers\" : [ {\n      \"id\" : \"1457d324-6006-4141-b8a7-c45d7ab8814c\",\n      \"name\" : \"auth_time\",\n      \"protocol\" : \"openid-connect\",\n      \"protocolMapper\" : \"oidc-usersessionmodel-note-mapper\",\n      \"consentRequired\" : false,\n      \"config\" : {\n        \"user.session.note\" : \"AUTH_TIME\",\n        \"introspection.token.claim\" : \"true\",\n        \"userinfo.token.claim\" : \"true\",\n        \"id.token.claim\" : \"true\",\n        \"access.token.claim\" : \"true\",\n        \"claim.name\" : \"auth_time\",\n        \"jsonType.label\" : \"long\"\n      }\n    }, {\n      \"id\" : \"0d3b31e5-31f5-4778-adbd-36a06b301af6\",\n      \"name\" : \"sub\",\n      \"protocol\" : \"openid-connect\",\n      \"protocolMapper\" : \"oidc-sub-mapper\",\n      \"consentRequired\" : false,\n      \"config\" : {\n        \"introspection.token.claim\" : \"true\",\n        \"access.token.claim\" : \"true\"\n      }\n    } ]\n  }, {\n    \"id\" : \"f65dc085-328e-41d8-a3f3-933eed32c804\",\n    \"name\" : \"email\",\n    \"description\" : \"OpenID Connect built-in scope: email\",\n    \"protocol\" : \"openid-connect\",\n    \"attributes\" : {\n      \"include.in.token.scope\" : \"true\",\n      \"consent.screen.text\" : \"${emailScopeConsentText}\",\n      \"display.on.consent.screen\" : \"true\"\n    },\n    \"protocolMappers\" : [ {\n      \"id\" : \"084130d1-642b-4b44-8643-60962e0a01d0\",\n      \"name\" : \"email\",\n      \"protocol\" : \"openid-connect\",\n      \"protocolMapper\" : \"oidc-usermodel-attribute-mapper\",\n      \"consentRequired\" : false,\n      \"config\" : {\n        \"introspection.token.claim\" : \"true\",\n        \"userinfo.token.claim\" : \"true\",\n        \"user.attribute\" : \"email\",\n        \"id.token.claim\" : \"true\",\n        \"access.token.claim\" : \"true\",\n        \"claim.name\" : \"email\",\n        \"jsonType.label\" : \"String\"\n      }\n    }, {\n      \"id\" : \"894569d9-bf66-425e-a07e-892e97d4ac3d\",\n      \"name\" : \"email verified\",\n      \"protocol\" : \"openid-connect\",\n      \"protocolMapper\" : \"oidc-usermodel-property-mapper\",\n      \"consentRequired\" : false,\n      \"config\" : {\n        \"introspection.token.claim\" : \"true\",\n        \"userinfo.token.claim\" : \"true\",\n        \"user.attribute\" : \"emailVerified\",\n        \"id.token.claim\" : \"true\",\n        \"access.token.claim\" : \"true\",\n        \"claim.name\" : \"email_verified\",\n        \"jsonType.label\" : \"boolean\"\n      }\n    } ]\n  }, {\n    \"id\" : \"ae961041-beb6-4d8e-b9f2-b0a1f88423f6\",\n    \"name\" : \"address\",\n    \"description\" : \"OpenID Connect built-in scope: address\",\n    \"protocol\" : \"openid-connect\",\n    \"attributes\" : {\n      \"include.in.token.scope\" : \"true\",\n      \"consent.screen.text\" : \"${addressScopeConsentText}\",\n      \"display.on.consent.screen\" : \"true\"\n    },\n    \"protocolMappers\" : [ {\n      \"id\" : \"84d4f934-f761-4741-bca5-b48581c6b2de\",\n      \"name\" : \"address\",\n      \"protocol\" : \"openid-connect\",\n      \"protocolMapper\" : \"oidc-address-mapper\",\n      \"consentRequired\" : false,\n      \"config\" : {\n        \"user.attribute.formatted\" : \"formatted\",\n        \"user.attribute.country\" : \"country\",\n        \"introspection.token.claim\" : \"true\",\n        \"user.attribute.postal_code\" : \"postal_code\",\n        \"userinfo.token.claim\" : \"true\",\n        \"user.attribute.street\" : \"street\",\n        \"id.token.claim\" : \"true\",\n        \"user.attribute.region\" : \"region\",\n        \"access.token.claim\" : \"true\",\n        \"user.attribute.locality\" : \"locality\"\n      }\n    } ]\n  }, {\n    \"id\" : \"5e1cf5ad-00e6-4092-b8aa-76bb293a3efa\",\n    \"name\" : \"saml_organization\",\n    \"description\" : \"Organization Membership\",\n    \"protocol\" : \"saml\",\n    \"attributes\" : {\n      \"display.on.consent.screen\" : \"false\"\n    },\n    \"protocolMappers\" : [ {\n      \"id\" : \"10efbc9e-4f21-42b7-832b-f5de7b3a666c\",\n      \"name\" : \"organization\",\n      \"protocol\" : \"saml\",\n      \"protocolMapper\" : \"saml-organization-membership-mapper\",\n      \"consentRequired\" : false,\n      \"config\" : { }\n    } ]\n  }, {\n    \"id\" : \"a1c75182-21f3-4e70-83f4-67e42f28267c\",\n    \"name\" : \"web-origins\",\n    \"description\" : \"OpenID Connect scope for add allowed web origins to the access token\",\n    \"protocol\" : \"openid-connect\",\n    \"attributes\" : {\n      \"include.in.token.scope\" : \"false\",\n      \"consent.screen.text\" : \"\",\n      \"display.on.consent.screen\" : \"false\"\n    },\n    \"protocolMappers\" : [ {\n      \"id\" : \"1a570c6f-6f1a-4503-8677-5762b7b5578a\",\n      \"name\" : \"allowed web origins\",\n      \"protocol\" : \"openid-connect\",\n      \"protocolMapper\" : \"oidc-allowed-origins-mapper\",\n      \"consentRequired\" : false,\n      \"config\" : {\n        \"introspection.token.claim\" : \"true\",\n        \"access.token.claim\" : \"true\"\n      }\n    } ]\n  }, {\n    \"id\" : \"4e350025-c16f-4a34-b132-4c6c07d0d90f\",\n    \"name\" : \"profile\",\n    \"description\" : \"OpenID Connect built-in scope: profile\",\n    \"protocol\" : \"openid-connect\",\n    \"attributes\" : {\n      \"include.in.token.scope\" : \"true\",\n      \"consent.screen.text\" : \"${profileScopeConsentText}\",\n      \"display.on.consent.screen\" : \"true\"\n    },\n    \"protocolMappers\" : [ {\n      \"id\" : \"7b1a561c-f0d0-4979-ab02-0e9d564cb5af\",\n      \"name\" : \"middle name\",\n      \"protocol\" : \"openid-connect\",\n      \"protocolMapper\" : \"oidc-usermodel-attribute-mapper\",\n      \"consentRequired\" : false,\n      \"config\" : {\n        \"introspection.token.claim\" : \"true\",\n        \"userinfo.token.claim\" : \"true\",\n        \"user.attribute\" : \"middleName\",\n        \"id.token.claim\" : \"true\",\n        \"access.token.claim\" : \"true\",\n        \"claim.name\" : \"middle_name\",\n        \"jsonType.label\" : \"String\"\n      }\n    }, {\n      \"id\" : \"ed49a16e-928f-4882-a8b6-835b83445349\",\n      \"name\" : \"zoneinfo\",\n      \"protocol\" : \"openid-connect\",\n      \"protocolMapper\" : \"oidc-usermodel-attribute-mapper\",\n      \"consentRequired\" : false,\n      \"config\" : {\n        \"introspection.token.claim\" : \"true\",\n        \"userinfo.token.claim\" : \"true\",\n        \"user.attribute\" : \"zoneinfo\",\n        \"id.token.claim\" : \"true\",\n        \"access.token.claim\" : \"true\",\n        \"claim.name\" : \"zoneinfo\",\n        \"jsonType.label\" : \"String\"\n      }\n    }, {\n      \"id\" : \"0fea1c8d-77a9-4325-a414-ca503a702ea1\",\n      \"name\" : \"family name\",\n      \"protocol\" : \"openid-connect\",\n      \"protocolMapper\" : \"oidc-usermodel-attribute-mapper\",\n      \"consentRequired\" : false,\n      \"config\" : {\n        \"introspection.token.claim\" : \"true\",\n        \"userinfo.token.claim\" : \"true\",\n        \"user.attribute\" : \"lastName\",\n        \"id.token.claim\" : \"true\",\n        \"access.token.claim\" : \"true\",\n        \"claim.name\" : \"family_name\",\n        \"jsonType.label\" : \"String\"\n      }\n    }, {\n      \"id\" : \"4ec1df3c-803c-4b3d-a96d-054f17b3745c\",\n      \"name\" : \"gender\",\n      \"protocol\" : \"openid-connect\",\n      \"protocolMapper\" : \"oidc-usermodel-attribute-mapper\",\n      \"consentRequired\" : false,\n      \"config\" : {\n        \"introspection.token.claim\" : \"true\",\n        \"userinfo.token.claim\" : \"true\",\n        \"user.attribute\" : \"gender\",\n        \"id.token.claim\" : \"true\",\n        \"access.token.claim\" : \"true\",\n        \"claim.name\" : \"gender\",\n        \"jsonType.label\" : \"String\"\n      }\n    }, {\n      \"id\" : \"b066efb7-76f4-4a42-97ae-39cb8883898a\",\n      \"name\" : \"nickname\",\n      \"protocol\" : \"openid-connect\",\n      \"protocolMapper\" : \"oidc-usermodel-attribute-mapper\",\n      \"consentRequired\" : false,\n      \"config\" : {\n        \"introspection.token.claim\" : \"true\",\n        \"userinfo.token.claim\" : \"true\",\n        \"user.attribute\" : \"nickname\",\n        \"id.token.claim\" : \"true\",\n        \"access.token.claim\" : \"true\",\n        \"claim.name\" : \"nickname\",\n        \"jsonType.label\" : \"String\"\n      }\n    }, {\n      \"id\" : \"0ef7cb1a-75f4-4b57-8614-3d35d7f93fc5\",\n      \"name\" : \"birthdate\",\n      \"protocol\" : \"openid-connect\",\n      \"protocolMapper\" : \"oidc-usermodel-attribute-mapper\",\n      \"consentRequired\" : false,\n      \"config\" : {\n        \"introspection.token.claim\" : \"true\",\n        \"userinfo.token.claim\" : \"true\",\n        \"user.attribute\" : \"birthdate\",\n        \"id.token.claim\" : \"true\",\n        \"access.token.claim\" : \"true\",\n        \"claim.name\" : \"birthdate\",\n        \"jsonType.label\" : \"String\"\n      }\n    }, {\n      \"id\" : \"dd8c2607-67ab-4f25-96cc-19c9751a0e03\",\n      \"name\" : \"profile\",\n      \"protocol\" : \"openid-connect\",\n      \"protocolMapper\" : \"oidc-usermodel-attribute-mapper\",\n      \"consentRequired\" : false,\n      \"config\" : {\n        \"introspection.token.claim\" : \"true\",\n        \"userinfo.token.claim\" : \"true\",\n        \"user.attribute\" : \"profile\",\n        \"id.token.claim\" : \"true\",\n        \"access.token.claim\" : \"true\",\n        \"claim.name\" : \"profile\",\n        \"jsonType.label\" : \"String\"\n      }\n    }, {\n      \"id\" : \"f2fdb527-5bb8-4c41-a260-7b8f2653baa8\",\n      \"name\" : \"updated at\",\n      \"protocol\" : \"openid-connect\",\n      \"protocolMapper\" : \"oidc-usermodel-attribute-mapper\",\n      \"consentRequired\" : false,\n      \"config\" : {\n        \"introspection.token.claim\" : \"true\",\n        \"userinfo.token.claim\" : \"true\",\n        \"user.attribute\" : \"updatedAt\",\n        \"id.token.claim\" : \"true\",\n        \"access.token.claim\" : \"true\",\n        \"claim.name\" : \"updated_at\",\n        \"jsonType.label\" : \"long\"\n      }\n    }, {\n      \"id\" : \"672a0701-67a0-4aa4-bbeb-93fa325d2921\",\n      \"name\" : \"username\",\n      \"protocol\" : \"openid-connect\",\n      \"protocolMapper\" : \"oidc-usermodel-attribute-mapper\",\n      \"consentRequired\" : false,\n      \"config\" : {\n        \"introspection.token.claim\" : \"true\",\n        \"userinfo.token.claim\" : \"true\",\n        \"user.attribute\" : \"username\",\n        \"id.token.claim\" : \"true\",\n        \"access.token.claim\" : \"true\",\n        \"claim.name\" : \"preferred_username\",\n        \"jsonType.label\" : \"String\"\n      }\n    }, {\n      \"id\" : \"a3ca4541-9326-4b34-b59d-5f6f366e2ff9\",\n      \"name\" : \"website\",\n      \"protocol\" : \"openid-connect\",\n      \"protocolMapper\" : \"oidc-usermodel-attribute-mapper\",\n      \"consentRequired\" : false,\n      \"config\" : {\n        \"introspection.token.claim\" : \"true\",\n        \"userinfo.token.claim\" : \"true\",\n        \"user.attribute\" : \"website\",\n        \"id.token.claim\" : \"true\",\n        \"access.token.claim\" : \"true\",\n        \"claim.name\" : \"website\",\n        \"jsonType.label\" : \"String\"\n      }\n    }, {\n      \"id\" : \"ccdc393d-6aee-4c88-b071-b708f4cf2b05\",\n      \"name\" : \"locale\",\n      \"protocol\" : \"openid-connect\",\n      \"protocolMapper\" : \"oidc-usermodel-attribute-mapper\",\n      \"consentRequired\" : false,\n      \"config\" : {\n        \"introspection.token.claim\" : \"true\",\n        \"userinfo.token.claim\" : \"true\",\n        \"user.attribute\" : \"locale\",\n        \"id.token.claim\" : \"true\",\n        \"access.token.claim\" : \"true\",\n        \"claim.name\" : \"locale\",\n        \"jsonType.label\" : \"String\"\n      }\n    }, {\n      \"id\" : \"cbf3d8ee-c2d9-445d-8662-279fd1160c80\",\n      \"name\" : \"full name\",\n      \"protocol\" : \"openid-connect\",\n      \"protocolMapper\" : \"oidc-full-name-mapper\",\n      \"consentRequired\" : false,\n      \"config\" : {\n        \"id.token.claim\" : \"true\",\n        \"introspection.token.claim\" : \"true\",\n        \"access.token.claim\" : \"true\",\n        \"userinfo.token.claim\" : \"true\"\n      }\n    }, {\n      \"id\" : \"fc8b06a9-e4fc-4381-830a-2e03f8982ff6\",\n      \"name\" : \"given name\",\n      \"protocol\" : \"openid-connect\",\n      \"protocolMapper\" : \"oidc-usermodel-attribute-mapper\",\n      \"consentRequired\" : false,\n      \"config\" : {\n        \"introspection.token.claim\" : \"true\",\n        \"userinfo.token.claim\" : \"true\",\n        \"user.attribute\" : \"firstName\",\n        \"id.token.claim\" : \"true\",\n        \"access.token.claim\" : \"true\",\n        \"claim.name\" : \"given_name\",\n        \"jsonType.label\" : \"String\"\n      }\n    }, {\n      \"id\" : \"a46cc2ac-d92c-4b61-b119-910b4e96e456\",\n      \"name\" : \"picture\",\n      \"protocol\" : \"openid-connect\",\n      \"protocolMapper\" : \"oidc-usermodel-attribute-mapper\",\n      \"consentRequired\" : false,\n      \"config\" : {\n        \"introspection.token.claim\" : \"true\",\n        \"userinfo.token.claim\" : \"true\",\n        \"user.attribute\" : \"picture\",\n        \"id.token.claim\" : \"true\",\n        \"access.token.claim\" : \"true\",\n        \"claim.name\" : \"picture\",\n        \"jsonType.label\" : \"String\"\n      }\n    } ]\n  }, {\n    \"id\" : \"2b7175c7-d59b-4dea-9759-405299298c21\",\n    \"name\" : \"organization\",\n    \"description\" : \"Additional claims about the organization a subject belongs to\",\n    \"protocol\" : \"openid-connect\",\n    \"attributes\" : {\n      \"include.in.token.scope\" : \"true\",\n      \"consent.screen.text\" : \"${organizationScopeConsentText}\",\n      \"display.on.consent.screen\" : \"true\"\n    },\n    \"protocolMappers\" : [ {\n      \"id\" : \"cd6a70e3-ebb8-4892-975e-4bece535c387\",\n      \"name\" : \"organization\",\n      \"protocol\" : \"openid-connect\",\n      \"protocolMapper\" : \"oidc-organization-membership-mapper\",\n      \"consentRequired\" : false,\n      \"config\" : {\n        \"introspection.token.claim\" : \"true\",\n        \"multivalued\" : \"true\",\n        \"userinfo.token.claim\" : \"true\",\n        \"id.token.claim\" : \"true\",\n        \"access.token.claim\" : \"true\",\n        \"claim.name\" : \"organization\",\n        \"jsonType.label\" : \"String\"\n      }\n    } ]\n  }, {\n    \"id\" : \"074912fc-e8b4-4369-8842-d8e44479e5d7\",\n    \"name\" : \"role_list\",\n    \"description\" : \"SAML role list\",\n    \"protocol\" : \"saml\",\n    \"attributes\" : {\n      \"consent.screen.text\" : \"${samlRoleListScopeConsentText}\",\n      \"display.on.consent.screen\" : \"true\"\n    },\n    \"protocolMappers\" : [ {\n      \"id\" : \"8e4761c8-96b5-422b-b9ef-f18970f9a677\",\n      \"name\" : \"role list\",\n      \"protocol\" : \"saml\",\n      \"protocolMapper\" : \"saml-role-list-mapper\",\n      \"consentRequired\" : false,\n      \"config\" : {\n        \"single\" : \"false\",\n        \"attribute.nameformat\" : \"Basic\",\n        \"attribute.name\" : \"Role\"\n      }\n    } ]\n  }, {\n    \"id\" : \"8b3b526e-ea3d-497a-b346-5852ddd29d01\",\n    \"name\" : \"service_account\",\n    \"description\" : \"Specific scope for a client enabled for service accounts\",\n    \"protocol\" : \"openid-connect\",\n    \"attributes\" : {\n      \"include.in.token.scope\" : \"false\",\n      \"display.on.consent.screen\" : \"false\"\n    },\n    \"protocolMappers\" : [ {\n      \"id\" : \"7e347974-b093-4a66-8fe0-8bdbab526232\",\n      \"name\" : \"Client Host\",\n      \"protocol\" : \"openid-connect\",\n      \"protocolMapper\" : \"oidc-usersessionmodel-note-mapper\",\n      \"consentRequired\" : false,\n      \"config\" : {\n        \"user.session.note\" : \"clientHost\",\n        \"introspection.token.claim\" : \"true\",\n        \"userinfo.token.claim\" : \"true\",\n        \"id.token.claim\" : \"true\",\n        \"access.token.claim\" : \"true\",\n        \"claim.name\" : \"clientHost\",\n        \"jsonType.label\" : \"String\"\n      }\n    }, {\n      \"id\" : \"0a4fe9bc-c5b1-45fc-80c1-7de78eda92ab\",\n      \"name\" : \"Client IP Address\",\n      \"protocol\" : \"openid-connect\",\n      \"protocolMapper\" : \"oidc-usersessionmodel-note-mapper\",\n      \"consentRequired\" : false,\n      \"config\" : {\n        \"user.session.note\" : \"clientAddress\",\n        \"introspection.token.claim\" : \"true\",\n        \"userinfo.token.claim\" : \"true\",\n        \"id.token.claim\" : \"true\",\n        \"access.token.claim\" : \"true\",\n        \"claim.name\" : \"clientAddress\",\n        \"jsonType.label\" : \"String\"\n      }\n    }, {\n      \"id\" : \"9b86ae58-d68d-4be7-9e48-3113a22caf5f\",\n      \"name\" : \"Client ID\",\n      \"protocol\" : \"openid-connect\",\n      \"protocolMapper\" : \"oidc-usersessionmodel-note-mapper\",\n      \"consentRequired\" : false,\n      \"config\" : {\n        \"user.session.note\" : \"client_id\",\n        \"introspection.token.claim\" : \"true\",\n        \"userinfo.token.claim\" : \"true\",\n        \"id.token.claim\" : \"true\",\n        \"access.token.claim\" : \"true\",\n        \"claim.name\" : \"client_id\",\n        \"jsonType.label\" : \"String\"\n      }\n    } ]\n  }, {\n    \"id\" : \"09e32dbb-120d-44bc-89eb-803b2caf35fc\",\n    \"name\" : \"phone\",\n    \"description\" : \"OpenID Connect built-in scope: phone\",\n    \"protocol\" : \"openid-connect\",\n    \"attributes\" : {\n      \"include.in.token.scope\" : \"true\",\n      \"consent.screen.text\" : \"${phoneScopeConsentText}\",\n      \"display.on.consent.screen\" : \"true\"\n    },\n    \"protocolMappers\" : [ {\n      \"id\" : \"83dc1340-1f91-47eb-8bb5-d324084687f2\",\n      \"name\" : \"phone number verified\",\n      \"protocol\" : \"openid-connect\",\n      \"protocolMapper\" : \"oidc-usermodel-attribute-mapper\",\n      \"consentRequired\" : false,\n      \"config\" : {\n        \"introspection.token.claim\" : \"true\",\n        \"userinfo.token.claim\" : \"true\",\n        \"user.attribute\" : \"phoneNumberVerified\",\n        \"id.token.claim\" : \"true\",\n        \"access.token.claim\" : \"true\",\n        \"claim.name\" : \"phone_number_verified\",\n        \"jsonType.label\" : \"boolean\"\n      }\n    }, {\n      \"id\" : \"014dfa26-791d-414b-bfb6-0b08605bf30f\",\n      \"name\" : \"phone number\",\n      \"protocol\" : \"openid-connect\",\n      \"protocolMapper\" : \"oidc-usermodel-attribute-mapper\",\n      \"consentRequired\" : false,\n      \"config\" : {\n        \"introspection.token.claim\" : \"true\",\n        \"userinfo.token.claim\" : \"true\",\n        \"user.attribute\" : \"phoneNumber\",\n        \"id.token.claim\" : \"true\",\n        \"access.token.claim\" : \"true\",\n        \"claim.name\" : \"phone_number\",\n        \"jsonType.label\" : \"String\"\n      }\n    } ]\n  }, {\n    \"id\" : \"e582a1a0-4ad9-4bbd-b41e-a503b435da3a\",\n    \"name\" : \"acr\",\n    \"description\" : \"OpenID Connect scope for add acr (authentication context class reference) to the token\",\n    \"protocol\" : \"openid-connect\",\n    \"attributes\" : {\n      \"include.in.token.scope\" : \"false\",\n      \"display.on.consent.screen\" : \"false\"\n    },\n    \"protocolMappers\" : [ {\n      \"id\" : \"f762a161-89f2-47a7-83cb-686362280a14\",\n      \"name\" : \"acr loa level\",\n      \"protocol\" : \"openid-connect\",\n      \"protocolMapper\" : \"oidc-acr-mapper\",\n      \"consentRequired\" : false,\n      \"config\" : {\n        \"id.token.claim\" : \"true\",\n        \"introspection.token.claim\" : \"true\",\n        \"access.token.claim\" : \"true\",\n        \"userinfo.token.claim\" : \"true\"\n      }\n    } ]\n  }, {\n    \"id\" : \"b288b9a7-e8a8-4b0a-8972-af6083835858\",\n    \"name\" : \"offline_access\",\n    \"description\" : \"OpenID Connect built-in scope: offline_access\",\n    \"protocol\" : \"openid-connect\",\n    \"attributes\" : {\n      \"consent.screen.text\" : \"${offlineAccessScopeConsentText}\",\n      \"display.on.consent.screen\" : \"true\"\n    }\n  } ],\n  \"defaultDefaultClientScopes\" : [ \"role_list\", \"saml_organization\", \"profile\", \"email\", \"roles\", \"web-origins\", \"acr\", \"basic\" ],\n  \"defaultOptionalClientScopes\" : [ \"offline_access\", \"address\", \"phone\", \"microprofile-jwt\", \"organization\" ],\n  \"browserSecurityHeaders\" : {\n    \"contentSecurityPolicyReportOnly\" : \"\",\n    \"xContentTypeOptions\" : \"nosniff\",\n    \"referrerPolicy\" : \"no-referrer\",\n    \"xRobotsTag\" : \"none\",\n    \"xFrameOptions\" : \"SAMEORIGIN\",\n    \"contentSecurityPolicy\" : \"frame-src 'self'; frame-ancestors 'self'; object-src 'none';\",\n    \"strictTransportSecurity\" : \"max-age=31536000; includeSubDomains\"\n  },\n  \"smtpServer\" : { },\n  \"eventsEnabled\" : false,\n  \"eventsListeners\" : [ \"jboss-logging\" ],\n  \"enabledEventTypes\" : [ ],\n  \"adminEventsEnabled\" : false,\n  \"adminEventsDetailsEnabled\" : false,\n  \"identityProviders\" : [ ],\n  \"identityProviderMappers\" : [ ],\n  \"components\" : {\n    \"org.keycloak.services.clientregistration.policy.ClientRegistrationPolicy\" : [ {\n      \"id\" : \"c7eaaf0f-7650-4fc1-968a-889667759858\",\n      \"name\" : \"Allowed Client Scopes\",\n      \"providerId\" : \"allowed-client-templates\",\n      \"subType\" : \"anonymous\",\n      \"subComponents\" : { },\n      \"config\" : {\n        \"allow-default-scopes\" : [ \"true\" ]\n      }\n    }, {\n      \"id\" : \"1f0661c3-25de-4ff6-92bf-dbb36264a71b\",\n      \"name\" : \"Max Clients Limit\",\n      \"providerId\" : \"max-clients\",\n      \"subType\" : \"anonymous\",\n      \"subComponents\" : { },\n      \"config\" : {\n        \"max-clients\" : [ \"200\" ]\n      }\n    }, {\n      \"id\" : \"a889dafe-f9d0-4728-bdf5-9421d1077d1f\",\n      \"name\" : \"Consent Required\",\n      \"providerId\" : \"consent-required\",\n      \"subType\" : \"anonymous\",\n      \"subComponents\" : { },\n      \"config\" : { }\n    }, {\n      \"id\" : \"4790f0a4-3450-4dbf-9153-0a1805e02d98\",\n      \"name\" : \"Allowed Registration Web Origins\",\n      \"providerId\" : \"registration-web-origins\",\n      \"subType\" : \"authenticated\",\n      \"subComponents\" : { },\n      \"config\" : { }\n    }, {\n      \"id\" : \"4084bb89-71f9-4363-a5dd-dfa74e638d80\",\n      \"name\" : \"Allowed Protocol Mapper Types\",\n      \"providerId\" : \"allowed-protocol-mappers\",\n      \"subType\" : \"anonymous\",\n      \"subComponents\" : { },\n      \"config\" : {\n        \"allowed-protocol-mapper-types\" : [ \"saml-user-attribute-mapper\", \"oidc-sha256-pairwise-sub-mapper\", \"oidc-address-mapper\", \"saml-role-list-mapper\", \"oidc-usermodel-attribute-mapper\", \"oidc-usermodel-property-mapper\", \"saml-user-property-mapper\", \"oidc-full-name-mapper\" ]\n      }\n    }, {\n      \"id\" : \"dba96a52-5743-47d2-b5f5-42452892b0bd\",\n      \"name\" : \"Allowed Client Scopes\",\n      \"providerId\" : \"allowed-client-templates\",\n      \"subType\" : \"authenticated\",\n      \"subComponents\" : { },\n      \"config\" : {\n        \"allow-default-scopes\" : [ \"true\" ]\n      }\n    }, {\n      \"id\" : \"85b9458c-d890-48b8-87b7-7d3d5f331d5f\",\n      \"name\" : \"Allowed Protocol Mapper Types\",\n      \"providerId\" : \"allowed-protocol-mappers\",\n      \"subType\" : \"authenticated\",\n      \"subComponents\" : { },\n      \"config\" : {\n        \"allowed-protocol-mapper-types\" : [ \"saml-user-attribute-mapper\", \"oidc-full-name-mapper\", \"saml-user-property-mapper\", \"oidc-usermodel-property-mapper\", \"oidc-sha256-pairwise-sub-mapper\", \"saml-role-list-mapper\", \"oidc-usermodel-attribute-mapper\", \"oidc-address-mapper\" ]\n      }\n    }, {\n      \"id\" : \"181cd220-28a9-4a5e-b2d7-c9092c26ef67\",\n      \"name\" : \"Full Scope Disabled\",\n      \"providerId\" : \"scope\",\n      \"subType\" : \"anonymous\",\n      \"subComponents\" : { },\n      \"config\" : { }\n    }, {\n      \"id\" : \"be0c3922-b432-408c-935b-81923b0e7018\",\n      \"name\" : \"Trusted Hosts\",\n      \"providerId\" : \"trusted-hosts\",\n      \"subType\" : \"anonymous\",\n      \"subComponents\" : { },\n      \"config\" : {\n        \"host-sending-registration-request-must-match\" : [ \"true\" ],\n        \"client-uris-must-match\" : [ \"true\" ]\n      }\n    }, {\n      \"id\" : \"81fe5bf6-4e18-40b8-8cf6-46028fb6704c\",\n      \"name\" : \"Allowed Registration Web Origins\",\n      \"providerId\" : \"registration-web-origins\",\n      \"subType\" : \"anonymous\",\n      \"subComponents\" : { },\n      \"config\" : { }\n    } ],\n    \"org.keycloak.userprofile.UserProfileProvider\" : [ {\n      \"id\" : \"bd8f87c6-ffc2-401d-baab-cccb228e9b50\",\n      \"providerId\" : \"declarative-user-profile\",\n      \"subComponents\" : { },\n      \"config\" : {\n        \"kc.user.profile.config\" : [ \"{\\\"attributes\\\":[{\\\"name\\\":\\\"username\\\",\\\"displayName\\\":\\\"${username}\\\",\\\"validations\\\":{\\\"length\\\":{\\\"min\\\":3,\\\"max\\\":255},\\\"username-prohibited-characters\\\":{},\\\"up-username-not-idn-homograph\\\":{}},\\\"permissions\\\":{\\\"view\\\":[\\\"admin\\\",\\\"user\\\"],\\\"edit\\\":[\\\"admin\\\",\\\"user\\\"]},\\\"multivalued\\\":false},{\\\"name\\\":\\\"email\\\",\\\"displayName\\\":\\\"${email}\\\",\\\"validations\\\":{\\\"email\\\":{},\\\"length\\\":{\\\"max\\\":255}},\\\"permissions\\\":{\\\"view\\\":[\\\"admin\\\",\\\"user\\\"],\\\"edit\\\":[\\\"admin\\\",\\\"user\\\"]},\\\"multivalued\\\":false},{\\\"name\\\":\\\"firstName\\\",\\\"displayName\\\":\\\"${firstName}\\\",\\\"validations\\\":{\\\"length\\\":{\\\"max\\\":255},\\\"person-name-prohibited-characters\\\":{}},\\\"permissions\\\":{\\\"view\\\":[\\\"admin\\\",\\\"user\\\"],\\\"edit\\\":[\\\"admin\\\",\\\"user\\\"]},\\\"multivalued\\\":false},{\\\"name\\\":\\\"lastName\\\",\\\"displayName\\\":\\\"${lastName}\\\",\\\"validations\\\":{\\\"length\\\":{\\\"max\\\":255},\\\"person-name-prohibited-characters\\\":{}},\\\"permissions\\\":{\\\"view\\\":[\\\"admin\\\",\\\"user\\\"],\\\"edit\\\":[\\\"admin\\\",\\\"user\\\"]},\\\"multivalued\\\":false}],\\\"groups\\\":[{\\\"name\\\":\\\"user-metadata\\\",\\\"displayHeader\\\":\\\"User metadata\\\",\\\"displayDescription\\\":\\\"Attributes, which refer to user metadata\\\"}]}\" ]\n      }\n    } ],\n    \"org.keycloak.keys.KeyProvider\" : [ {\n      \"id\" : \"2068dd28-1706-4fc6-8751-ead7dc26cf90\",\n      \"name\" : \"aes-generated\",\n      \"providerId\" : \"aes-generated\",\n      \"subComponents\" : { },\n      \"config\" : {\n        \"kid\" : [ \"81bfaacd-ca1f-4b68-a1b2-80102555f5d6\" ],\n        \"secret\" : [ \"XEHl3aG9cESD4wedDu3uAg\" ],\n        \"priority\" : [ \"100\" ]\n      }\n    }, {\n      \"id\" : \"4bc97a67-b5fd-4bd5-9df9-7366efc0e091\",\n      \"name\" : \"hmac-generated-hs512\",\n      \"providerId\" : \"hmac-generated\",\n      \"subComponents\" : { },\n      \"config\" : {\n        \"kid\" : [ \"31342681-e4fb-428d-bd54-07a77581ec75\" ],\n        \"secret\" : [ \"UhZlVtujVRkaFsvdVAOGPTEsNIwAJIOfmJDjQeciaQuWIGKWd-RBdKcS0II053kVswbJRGitqc-e0iqBfhZrUBrQyUmmcrCJT09BiaKCicdgRwYrb8fhYagiIg-70jk7fc3j3VINu5eeKjkTiDyfAf_0HS62-8eO4e98A5IW6QE\" ],\n        \"priority\" : [ \"100\" ],\n        \"algorithm\" : [ \"HS512\" ]\n      }\n    }, {\n      \"id\" : \"1cf333a1-b495-47b5-94f4-138e34e92ec7\",\n      \"name\" : \"rsa-generated\",\n      \"providerId\" : \"rsa-generated\",\n      \"subComponents\" : { },\n      \"config\" : {\n        \"privateKey\" : [ \"MIIEpAIBAAKCAQEAvQ5kJj9mHLGm5zMvW5kYgSbEVvZYWcmMJKMQRWni4RdvbrKpkgsLv6gkH0xiwKU5aaUmk/e6hAZO2UvZ8Tp180VBhk2BXtS21Jm7KbZSVtQBFf33zVqjEXB2d89E1R6RlopzF4+Y6X1xxPnJ1UGxM0yT8uSrGB4CbJaNO4YH6/vUsJWoNXS9MJKFIvm0HP6t+o6DvWGn5HjLK7jhhF6iATZpp0JwqkG5Y+xo6TObx3m11aCR1HrFqlVg6zC3Ht4lhlQh3VhKcoO80gRAURU7WjOOAwauJViYrOF6eAsbMbpTD8EAyXL/4KCFWoITwRpHYNXwSzdR/BvgFlsJwLxJGwIDAQABAoIBABTzpleyyP8/FO8kdgghtFyDzliQ3oO82WIqDCCVNoaZkUjkVfSQctHfsXkifwM4jF9P5TGaz7nX9R8Rz+py/yVhtHxM1JyM2GJBU0OxJ/jlb+VfCvpgJBhHrWljuA4iYCId39lpmZmuxE//GsYejKPRxceyXd/DW6NrH+XL2c7mHe0AznAEfDeIsKWRDCoOjgm2xfpjU204HGLGmU+qTzH4EeZPWvpCnXWZiNBrxSiBUdauCMz6jWBZXW173rfd430t9JMu7zuPqFpcZ/RsLw3blHoPWpbpeULloxfSgxcYD+KP+oCk8t2oubTDGX2ES7OVfSbgy5yMYPbg7g+G97kCgYEA7Jj4d4tdTCOfk5kdqU2R7LB5IX3gsCohmp6FH3yPA2JBQ95Mk6IK15mIvvCXF4zyDvESsevjjQSlEhmYOQ1Us5MdvKZVtM/EgIZmI+3Z+r5M39QWQ8XYkOJr1DT990ed+QVF7H0khT7nmvmVzDYjPE1qtTtzadhwxY8r0Kcmew0CgYEAzI9bpm5rvpf3jfTPZeKb8pc1/4zlUqV0kH+P5BHnssXBX8nVJNgUxcv5xFZrL3MVr5BIYrXSh5qzYduGXkjsjCvo0zdhPmGvRYeL13xJi8EijbK78eORpdx5dN1Oht36+THtWSYnOyFU1gYZEdb3JC0Sc9TwjDPh5RWWLp2MqscCgYEAq85xLy3uc+myaVXYqiZ//qYvb9ieno4ZlNPjy3eBym1BA22boeEbinAdUroWna1l4N/COZ0XwkFLNReM6HD7vuLnxyPqPMBa6xGtfg2sKl6iKC80c8ZpetxQfOp2OWiyGDByFEbTjEafnHP9CSuO7q0w/aXMK2JWkb9ji8K1OMkCgYBmFPB2uMn5/hpi9BV/0btjL4SZ9/UE7l6iMZZcCXdn5noe1DkSvuZ24tjM2xd4QWVEDKui3vumAlScdBG1AY1SUiNJLGzR1avC9eaabYLCRGp67gQOrTMk40aVRE+IzEQPkZPRllGjl3mfqMFf/resjPWVamF0hfun98LPln35RwKBgQCrD+b/1kcSdHRUsaG04vEK8Qpm86E9GV8eLorMJv+gaOAAQXAgxQTp1QXlK/1A11Fj5CYTYg5vQtI16K3KYuF2tdhRR5LRlp0NDK7wf4QNhuK9OQfroHoETngOXGnA2p/RMaDKkAgh49GLT7vMo98ztjsrcRQqNOMGya8L1k48Jg==\" ],\n        \"certificate\" : [ \"MIICmzCCAYMCBgGcnhPYNDANBgkqhkiG9w0BAQsFADARMQ8wDQYDVQQDDAZtYXN0ZXIwHhcNMjYwMjI3MDc0ODQ2WhcNMzYwMjI3MDc1MDI2WjARMQ8wDQYDVQQDDAZtYXN0ZXIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC9DmQmP2YcsabnMy9bmRiBJsRW9lhZyYwkoxBFaeLhF29usqmSCwu/qCQfTGLApTlppSaT97qEBk7ZS9nxOnXzRUGGTYFe1LbUmbsptlJW1AEV/ffNWqMRcHZ3z0TVHpGWinMXj5jpfXHE+cnVQbEzTJPy5KsYHgJslo07hgfr+9Swlag1dL0wkoUi+bQc/q36joO9YafkeMsruOGEXqIBNmmnQnCqQblj7GjpM5vHebXVoJHUesWqVWDrMLce3iWGVCHdWEpyg7zSBEBRFTtaM44DBq4lWJis4Xp4CxsxulMPwQDJcv/goIVaghPBGkdg1fBLN1H8G+AWWwnAvEkbAgMBAAEwDQYJKoZIhvcNAQELBQADggEBABWqPOyc4ReF3EnjSaD3n6Fk0ZVGDJZ6/du2cqlFm9rFEVlnJ0GS7Cz8an88PTge098gxM3+NSCjfgDN3B2QO//H3SdwjmGvKm1hghQVYvfFafW/Cat/nNqm68K6MCGNGP67OeNMLyl3OAL68SRNM1hoNbCplDt6HhX5s1Cn/iZPEQ7t4o6tt/aO/07E+3WfS3+PNqvt7jPrf0y5OlZ7oCAN0cnegSkbanvZehBlRpLkWhxphlAR90PomrW59Ok60EITscXr1jD1vlOgrvnw41y1L5eSvO3g19rKgqB5NrniavRdonP605109SQacZ31g7vmH/2qvV3MUuT9UBoRRFI=\" ],\n        \"priority\" : [ \"100\" ]\n      }\n    }, {\n      \"id\" : \"b68cba6a-7e0b-42be-a3aa-25d5c342801a\",\n      \"name\" : \"rsa-enc-generated\",\n      \"providerId\" : \"rsa-enc-generated\",\n      \"subComponents\" : { },\n      \"config\" : {\n        \"privateKey\" : [ \"MIIEowIBAAKCAQEApFfSvqZKE30r0gu77DbLv5P6NBiEsCC30KlQp4gbyyHgQuHFWhPyUNJKi0NJGjyFzkw7cztmB7uJOa9oc54QQITdlzLEQ1Z8zvsv6hG5aNDwSLgCNiKHaIAxe6XmCYwhQX3LNGaUidf/a9JS+Kr/WMjQb9Y2NGbKqM5V2vAskq/p7CR2TLVShX2iGlPVO34qYbJSA6nF98n0x2ZxAdj8P77HqWJs0z/wRGxEFPmoWP4QR+b9q9f2ewr7EmIXOi7ZsxNF4g0CCo4zqUD4VGnGABl158zx+9ONedgBTnZNwnb9iM++bFt5exuvjbQ86jpnPrMR1yhIVKGSAddUlbV9IwIDAQABAoIBAE569BSAM7K/3SvG17yTZFQ99cdoCAFV9oHKQU5nxKIKMN6vkz+Tc+2dpuR/QsspKNrd86vxKyW5LGxkNBS2YFt3N5yrLSddB2gOcxCr2ydPU9feK4wvjAte4IKENGjNxtnQGTiSXg+/muWiAGZovlznNQabPLJkfhYDxuMxO4/mdcNSX3riJ/u6MtUS2BZMxOZWvZZ+t1boakJsn7LUycXngpMlZBrivZ9+bckD75iEAsTlwAzj2Tm1VgycmtwcOwvNAL/Eb35yqemBggYNqjxpdi+3Mm2OgHdWmWIdXpHbuYcw/FaKUKIFJ9JiBZYeDYK2Adb8pHQh050assU6m+ECgYEA5Xe0M6a/yL+j+0lpM9xrz4R21c67uy9Tg70l8/8N1rtam+M7hqtHYMwvtWZ1pSFSoxZ+6iVlI2xg5BqSX1tkV5QNtHcOlrrgysBWPXzz6oyrG+j2pAJ2bvNd+haCu2WOANPbs03bIc4/PUiPevXGKBf0ZuJ22P78GCp+/VZt4YMCgYEAt1hq2ufPSlbYJ3uItmBBPoIHvHDm4MELqjCSPqTo4BKrPdmlDv7p3pAG8+D/8K2jZEDRMyOatEnUH64RqQBuCs9YgcrRqkrzxhnqLGKllH+Z3QOwT+xCntkAnxI8fULeAbOJvw8Nb1dAtTODY+wrvmUEhvbyYQ76guzqtSTfQ+ECgYEA09acf4qTRurUoel1u7DjvqIVavD9kqLwQJBf908hIXm4/mzayUpaDNyzto2uUhHfTjw4UkTPh9JH6I03T9z5V3iQ5md7Cl/foo3Jj95I9+GBHbUF7Qdw+qClw3kAm6v3WoA7NN7NS/oxm4vfGa7Hjr/+mvS6rz1G0bB5p7sgma0CgYAtXwoCZf8cLGWNT7rDNwquR0tWzLG1yM/0K9Tk/7ZJTRVnVubL0TVayFWQIIv1qWKXupqKhzMPjn2Z4V+pbNvOfQUwCVrdQ3MUAPG8TiUfnHwc/36wKI1L9fN7ae3iKZv6280opLb0aKkwrjDDl3wzv5fhNldAwY4ovCxQ63D8wQKBgE6ZR/2bPYAa0O5pA7lPGSKfKYZY4U4zNwhgTAgzm2b7ONyJSP00yVwXoBX4j8qHbotVQY+8VMfFo49t3JCJ61g/Q/T3Uyd43fz1LzoQKFInDe1B7yXfPkEL4R7rllVmEvhoszgivYtevIoE//ZeHiMAn53nBJFgGuQyk7BMx7z0\" ],\n        \"certificate\" : [ \"MIICmzCCAYMCBgGcnhPYrjANBgkqhkiG9w0BAQsFADARMQ8wDQYDVQQDDAZtYXN0ZXIwHhcNMjYwMjI3MDc0ODQ2WhcNMzYwMjI3MDc1MDI2WjARMQ8wDQYDVQQDDAZtYXN0ZXIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCkV9K+pkoTfSvSC7vsNsu/k/o0GISwILfQqVCniBvLIeBC4cVaE/JQ0kqLQ0kaPIXOTDtzO2YHu4k5r2hznhBAhN2XMsRDVnzO+y/qEblo0PBIuAI2IodogDF7peYJjCFBfcs0ZpSJ1/9r0lL4qv9YyNBv1jY0ZsqozlXa8CySr+nsJHZMtVKFfaIaU9U7fiphslIDqcX3yfTHZnEB2Pw/vsepYmzTP/BEbEQU+ahY/hBH5v2r1/Z7CvsSYhc6LtmzE0XiDQIKjjOpQPhUacYAGXXnzPH704152AFOdk3Cdv2Iz75sW3l7G6+NtDzqOmc+sxHXKEhUoZIB11SVtX0jAgMBAAEwDQYJKoZIhvcNAQELBQADggEBAKNZLkRF4xSD7KltDoHn3ND+ouDaK5AQH4uZtbp5Rl+3beqwOpnPEJmCzhuhvij6eVngviL0Ga8pFIBzX7zQu2v8oxTFIbGvAYBH9NNkA8R/qsaosC4C/mEmY/H9UDGUXp1VSFI8e08n2GlnVoll9t1wCvhyaMqpFqglmD8SccGTKiBKeSD4v+SWN19+Wi4KOvI5wqR0KKrvlmNWDxbsYzsUbU/gII7Y5nsUB3L2RvugXssX8+zgTYuyBoygEgdXcOKsyWRQ/vmGr9ZE+8RuBsWTS0at8m3SN/nCkarboVFLhnqbRVpV5uLrx4LVRkGNmVCXKccf3Poh+DbxgLD/kNU=\" ],\n        \"priority\" : [ \"100\" ],\n        \"algorithm\" : [ \"RSA-OAEP\" ]\n      }\n    } ]\n  },\n  \"internationalizationEnabled\" : false,\n  \"authenticationFlows\" : [ {\n    \"id\" : \"f1ec49bd-55dd-4584-9438-bedf328b356d\",\n    \"alias\" : \"Account verification options\",\n    \"description\" : \"Method with which to verify the existing account\",\n    \"providerId\" : \"basic-flow\",\n    \"topLevel\" : false,\n    \"builtIn\" : true,\n    \"authenticationExecutions\" : [ {\n      \"authenticator\" : \"idp-email-verification\",\n      \"authenticatorFlow\" : false,\n      \"requirement\" : \"ALTERNATIVE\",\n      \"priority\" : 10,\n      \"autheticatorFlow\" : false,\n      \"userSetupAllowed\" : false\n    }, {\n      \"authenticatorFlow\" : true,\n      \"requirement\" : \"ALTERNATIVE\",\n      \"priority\" : 20,\n      \"autheticatorFlow\" : true,\n      \"flowAlias\" : \"Verify Existing Account by Re-authentication\",\n      \"userSetupAllowed\" : false\n    } ]\n  }, {\n    \"id\" : \"72f9d538-d665-468f-8c06-cc6ef863d699\",\n    \"alias\" : \"Browser - Conditional 2FA\",\n    \"description\" : \"Flow to determine if any 2FA is required for the authentication\",\n    \"providerId\" : \"basic-flow\",\n    \"topLevel\" : false,\n    \"builtIn\" : true,\n    \"authenticationExecutions\" : [ {\n      \"authenticator\" : \"conditional-user-configured\",\n      \"authenticatorFlow\" : false,\n      \"requirement\" : \"REQUIRED\",\n      \"priority\" : 10,\n      \"autheticatorFlow\" : false,\n      \"userSetupAllowed\" : false\n    }, {\n      \"authenticatorConfig\" : \"browser-conditional-credential\",\n      \"authenticator\" : \"conditional-credential\",\n      \"authenticatorFlow\" : false,\n      \"requirement\" : \"REQUIRED\",\n      \"priority\" : 20,\n      \"autheticatorFlow\" : false,\n      \"userSetupAllowed\" : false\n    }, {\n      \"authenticator\" : \"auth-otp-form\",\n      \"authenticatorFlow\" : false,\n      \"requirement\" : \"ALTERNATIVE\",\n      \"priority\" : 30,\n      \"autheticatorFlow\" : false,\n      \"userSetupAllowed\" : false\n    }, {\n      \"authenticator\" : \"webauthn-authenticator\",\n      \"authenticatorFlow\" : false,\n      \"requirement\" : \"DISABLED\",\n      \"priority\" : 40,\n      \"autheticatorFlow\" : false,\n      \"userSetupAllowed\" : false\n    }, {\n      \"authenticator\" : \"auth-recovery-authn-code-form\",\n      \"authenticatorFlow\" : false,\n      \"requirement\" : \"DISABLED\",\n      \"priority\" : 50,\n      \"autheticatorFlow\" : false,\n      \"userSetupAllowed\" : false\n    } ]\n  }, {\n    \"id\" : \"b7e3c8f7-17bf-4a76-8921-2afb316272dd\",\n    \"alias\" : \"Direct Grant - Conditional OTP\",\n    \"description\" : \"Flow to determine if the OTP is required for the authentication\",\n    \"providerId\" : \"basic-flow\",\n    \"topLevel\" : false,\n    \"builtIn\" : true,\n    \"authenticationExecutions\" : [ {\n      \"authenticator\" : \"conditional-user-configured\",\n      \"authenticatorFlow\" : false,\n      \"requirement\" : \"REQUIRED\",\n      \"priority\" : 10,\n      \"autheticatorFlow\" : false,\n      \"userSetupAllowed\" : false\n    }, {\n      \"authenticator\" : \"direct-grant-validate-otp\",\n      \"authenticatorFlow\" : false,\n      \"requirement\" : \"REQUIRED\",\n      \"priority\" : 20,\n      \"autheticatorFlow\" : false,\n      \"userSetupAllowed\" : false\n    } ]\n  }, {\n    \"id\" : \"8bb954d6-800e-4ff4-bea8-d5fe51a101e6\",\n    \"alias\" : \"First broker login - Conditional 2FA\",\n    \"description\" : \"Flow to determine if any 2FA is required for the authentication\",\n    \"providerId\" : \"basic-flow\",\n    \"topLevel\" : false,\n    \"builtIn\" : true,\n    \"authenticationExecutions\" : [ {\n      \"authenticator\" : \"conditional-user-configured\",\n      \"authenticatorFlow\" : false,\n      \"requirement\" : \"REQUIRED\",\n      \"priority\" : 10,\n      \"autheticatorFlow\" : false,\n      \"userSetupAllowed\" : false\n    }, {\n      \"authenticatorConfig\" : \"first-broker-login-conditional-credential\",\n      \"authenticator\" : \"conditional-credential\",\n      \"authenticatorFlow\" : false,\n      \"requirement\" : \"REQUIRED\",\n      \"priority\" : 20,\n      \"autheticatorFlow\" : false,\n      \"userSetupAllowed\" : false\n    }, {\n      \"authenticator\" : \"auth-otp-form\",\n      \"authenticatorFlow\" : false,\n      \"requirement\" : \"ALTERNATIVE\",\n      \"priority\" : 30,\n      \"autheticatorFlow\" : false,\n      \"userSetupAllowed\" : false\n    }, {\n      \"authenticator\" : \"webauthn-authenticator\",\n      \"authenticatorFlow\" : false,\n      \"requirement\" : \"DISABLED\",\n      \"priority\" : 40,\n      \"autheticatorFlow\" : false,\n      \"userSetupAllowed\" : false\n    }, {\n      \"authenticator\" : \"auth-recovery-authn-code-form\",\n      \"authenticatorFlow\" : false,\n      \"requirement\" : \"DISABLED\",\n      \"priority\" : 50,\n      \"autheticatorFlow\" : false,\n      \"userSetupAllowed\" : false\n    } ]\n  }, {\n    \"id\" : \"9459afd7-9f72-4702-9f60-989664925fd3\",\n    \"alias\" : \"Handle Existing Account\",\n    \"description\" : \"Handle what to do if there is existing account with same email/username like authenticated identity provider\",\n    \"providerId\" : \"basic-flow\",\n    \"topLevel\" : false,\n    \"builtIn\" : true,\n    \"authenticationExecutions\" : [ {\n      \"authenticator\" : \"idp-confirm-link\",\n      \"authenticatorFlow\" : false,\n      \"requirement\" : \"REQUIRED\",\n      \"priority\" : 10,\n      \"autheticatorFlow\" : false,\n      \"userSetupAllowed\" : false\n    }, {\n      \"authenticatorFlow\" : true,\n      \"requirement\" : \"REQUIRED\",\n      \"priority\" : 20,\n      \"autheticatorFlow\" : true,\n      \"flowAlias\" : \"Account verification options\",\n      \"userSetupAllowed\" : false\n    } ]\n  }, {\n    \"id\" : \"f78ffd37-a52e-4c1a-b524-e7e30e8b59b0\",\n    \"alias\" : \"Reset - Conditional OTP\",\n    \"description\" : \"Flow to determine if the OTP should be reset or not. Set to REQUIRED to force.\",\n    \"providerId\" : \"basic-flow\",\n    \"topLevel\" : false,\n    \"builtIn\" : true,\n    \"authenticationExecutions\" : [ {\n      \"authenticator\" : \"conditional-user-configured\",\n      \"authenticatorFlow\" : false,\n      \"requirement\" : \"REQUIRED\",\n      \"priority\" : 10,\n      \"autheticatorFlow\" : false,\n      \"userSetupAllowed\" : false\n    }, {\n      \"authenticator\" : \"reset-otp\",\n      \"authenticatorFlow\" : false,\n      \"requirement\" : \"REQUIRED\",\n      \"priority\" : 20,\n      \"autheticatorFlow\" : false,\n      \"userSetupAllowed\" : false\n    } ]\n  }, {\n    \"id\" : \"221d25d8-15e0-44f0-ab87-890091819de2\",\n    \"alias\" : \"User creation or linking\",\n    \"description\" : \"Flow for the existing/non-existing user alternatives\",\n    \"providerId\" : \"basic-flow\",\n    \"topLevel\" : false,\n    \"builtIn\" : true,\n    \"authenticationExecutions\" : [ {\n      \"authenticatorConfig\" : \"create unique user config\",\n      \"authenticator\" : \"idp-create-user-if-unique\",\n      \"authenticatorFlow\" : false,\n      \"requirement\" : \"ALTERNATIVE\",\n      \"priority\" : 10,\n      \"autheticatorFlow\" : false,\n      \"userSetupAllowed\" : false\n    }, {\n      \"authenticatorFlow\" : true,\n      \"requirement\" : \"ALTERNATIVE\",\n      \"priority\" : 20,\n      \"autheticatorFlow\" : true,\n      \"flowAlias\" : \"Handle Existing Account\",\n      \"userSetupAllowed\" : false\n    } ]\n  }, {\n    \"id\" : \"3abe4382-9087-4654-9f6a-13a882af038c\",\n    \"alias\" : \"Verify Existing Account by Re-authentication\",\n    \"description\" : \"Reauthentication of existing account\",\n    \"providerId\" : \"basic-flow\",\n    \"topLevel\" : false,\n    \"builtIn\" : true,\n    \"authenticationExecutions\" : [ {\n      \"authenticator\" : \"idp-username-password-form\",\n      \"authenticatorFlow\" : false,\n      \"requirement\" : \"REQUIRED\",\n      \"priority\" : 10,\n      \"autheticatorFlow\" : false,\n      \"userSetupAllowed\" : false\n    }, {\n      \"authenticatorFlow\" : true,\n      \"requirement\" : \"CONDITIONAL\",\n      \"priority\" : 20,\n      \"autheticatorFlow\" : true,\n      \"flowAlias\" : \"First broker login - Conditional 2FA\",\n      \"userSetupAllowed\" : false\n    } ]\n  }, {\n    \"id\" : \"bb681a9f-3bfa-4fa8-a8b6-74463a6cf493\",\n    \"alias\" : \"browser\",\n    \"description\" : \"Browser based authentication\",\n    \"providerId\" : \"basic-flow\",\n    \"topLevel\" : true,\n    \"builtIn\" : true,\n    \"authenticationExecutions\" : [ {\n      \"authenticator\" : \"auth-cookie\",\n      \"authenticatorFlow\" : false,\n      \"requirement\" : \"ALTERNATIVE\",\n      \"priority\" : 10,\n      \"autheticatorFlow\" : false,\n      \"userSetupAllowed\" : false\n    }, {\n      \"authenticator\" : \"auth-spnego\",\n      \"authenticatorFlow\" : false,\n      \"requirement\" : \"DISABLED\",\n      \"priority\" : 20,\n      \"autheticatorFlow\" : false,\n      \"userSetupAllowed\" : false\n    }, {\n      \"authenticator\" : \"identity-provider-redirector\",\n      \"authenticatorFlow\" : false,\n      \"requirement\" : \"ALTERNATIVE\",\n      \"priority\" : 25,\n      \"autheticatorFlow\" : false,\n      \"userSetupAllowed\" : false\n    }, {\n      \"authenticatorFlow\" : true,\n      \"requirement\" : \"ALTERNATIVE\",\n      \"priority\" : 30,\n      \"autheticatorFlow\" : true,\n      \"flowAlias\" : \"forms\",\n      \"userSetupAllowed\" : false\n    } ]\n  }, {\n    \"id\" : \"f02d0da2-4f63-4ec1-ad1e-1bf5b9388e44\",\n    \"alias\" : \"clients\",\n    \"description\" : \"Base authentication for clients\",\n    \"providerId\" : \"client-flow\",\n    \"topLevel\" : true,\n    \"builtIn\" : true,\n    \"authenticationExecutions\" : [ {\n      \"authenticator\" : \"client-secret\",\n      \"authenticatorFlow\" : false,\n      \"requirement\" : \"ALTERNATIVE\",\n      \"priority\" : 10,\n      \"autheticatorFlow\" : false,\n      \"userSetupAllowed\" : false\n    }, {\n      \"authenticator\" : \"client-jwt\",\n      \"authenticatorFlow\" : false,\n      \"requirement\" : \"ALTERNATIVE\",\n      \"priority\" : 20,\n      \"autheticatorFlow\" : false,\n      \"userSetupAllowed\" : false\n    }, {\n      \"authenticator\" : \"client-secret-jwt\",\n      \"authenticatorFlow\" : false,\n      \"requirement\" : \"ALTERNATIVE\",\n      \"priority\" : 30,\n      \"autheticatorFlow\" : false,\n      \"userSetupAllowed\" : false\n    }, {\n      \"authenticator\" : \"client-x509\",\n      \"authenticatorFlow\" : false,\n      \"requirement\" : \"ALTERNATIVE\",\n      \"priority\" : 40,\n      \"autheticatorFlow\" : false,\n      \"userSetupAllowed\" : false\n    } ]\n  }, {\n    \"id\" : \"0326d889-4cc3-43fd-94eb-fc05ae1277eb\",\n    \"alias\" : \"direct grant\",\n    \"description\" : \"OpenID Connect Resource Owner Grant\",\n    \"providerId\" : \"basic-flow\",\n    \"topLevel\" : true,\n    \"builtIn\" : true,\n    \"authenticationExecutions\" : [ {\n      \"authenticator\" : \"direct-grant-validate-username\",\n      \"authenticatorFlow\" : false,\n      \"requirement\" : \"REQUIRED\",\n      \"priority\" : 10,\n      \"autheticatorFlow\" : false,\n      \"userSetupAllowed\" : false\n    }, {\n      \"authenticator\" : \"direct-grant-validate-password\",\n      \"authenticatorFlow\" : false,\n      \"requirement\" : \"REQUIRED\",\n      \"priority\" : 20,\n      \"autheticatorFlow\" : false,\n      \"userSetupAllowed\" : false\n    }, {\n      \"authenticatorFlow\" : true,\n      \"requirement\" : \"CONDITIONAL\",\n      \"priority\" : 30,\n      \"autheticatorFlow\" : true,\n      \"flowAlias\" : \"Direct Grant - Conditional OTP\",\n      \"userSetupAllowed\" : false\n    } ]\n  }, {\n    \"id\" : \"5cf04370-c12d-484f-befb-47fec450afc7\",\n    \"alias\" : \"docker auth\",\n    \"description\" : \"Used by Docker clients to authenticate against the IDP\",\n    \"providerId\" : \"basic-flow\",\n    \"topLevel\" : true,\n    \"builtIn\" : true,\n    \"authenticationExecutions\" : [ {\n      \"authenticator\" : \"docker-http-basic-authenticator\",\n      \"authenticatorFlow\" : false,\n      \"requirement\" : \"REQUIRED\",\n      \"priority\" : 10,\n      \"autheticatorFlow\" : false,\n      \"userSetupAllowed\" : false\n    } ]\n  }, {\n    \"id\" : \"e9abe54d-edc6-4c80-b72a-e6603fb03a02\",\n    \"alias\" : \"first broker login\",\n    \"description\" : \"Actions taken after first broker login with identity provider account, which is not yet linked to any Keycloak account\",\n    \"providerId\" : \"basic-flow\",\n    \"topLevel\" : true,\n    \"builtIn\" : true,\n    \"authenticationExecutions\" : [ {\n      \"authenticatorConfig\" : \"review profile config\",\n      \"authenticator\" : \"idp-review-profile\",\n      \"authenticatorFlow\" : false,\n      \"requirement\" : \"REQUIRED\",\n      \"priority\" : 10,\n      \"autheticatorFlow\" : false,\n      \"userSetupAllowed\" : false\n    }, {\n      \"authenticatorFlow\" : true,\n      \"requirement\" : \"REQUIRED\",\n      \"priority\" : 20,\n      \"autheticatorFlow\" : true,\n      \"flowAlias\" : \"User creation or linking\",\n      \"userSetupAllowed\" : false\n    } ]\n  }, {\n    \"id\" : \"39318842-fb7e-4356-a97e-69db12d00280\",\n    \"alias\" : \"forms\",\n    \"description\" : \"Username, password, otp and other auth forms.\",\n    \"providerId\" : \"basic-flow\",\n    \"topLevel\" : false,\n    \"builtIn\" : true,\n    \"authenticationExecutions\" : [ {\n      \"authenticator\" : \"auth-username-password-form\",\n      \"authenticatorFlow\" : false,\n      \"requirement\" : \"REQUIRED\",\n      \"priority\" : 10,\n      \"autheticatorFlow\" : false,\n      \"userSetupAllowed\" : false\n    }, {\n      \"authenticatorFlow\" : true,\n      \"requirement\" : \"CONDITIONAL\",\n      \"priority\" : 20,\n      \"autheticatorFlow\" : true,\n      \"flowAlias\" : \"Browser - Conditional 2FA\",\n      \"userSetupAllowed\" : false\n    } ]\n  }, {\n    \"id\" : \"725e0d82-e0b9-428b-88ed-d11ddab6159a\",\n    \"alias\" : \"registration\",\n    \"description\" : \"Registration flow\",\n    \"providerId\" : \"basic-flow\",\n    \"topLevel\" : true,\n    \"builtIn\" : true,\n    \"authenticationExecutions\" : [ {\n      \"authenticator\" : \"registration-page-form\",\n      \"authenticatorFlow\" : true,\n      \"requirement\" : \"REQUIRED\",\n      \"priority\" : 10,\n      \"autheticatorFlow\" : true,\n      \"flowAlias\" : \"registration form\",\n      \"userSetupAllowed\" : false\n    } ]\n  }, {\n    \"id\" : \"ba6f9d02-2a96-4220-9cbf-d3f64718923d\",\n    \"alias\" : \"registration form\",\n    \"description\" : \"Registration form\",\n    \"providerId\" : \"form-flow\",\n    \"topLevel\" : false,\n    \"builtIn\" : true,\n    \"authenticationExecutions\" : [ {\n      \"authenticator\" : \"registration-user-creation\",\n      \"authenticatorFlow\" : false,\n      \"requirement\" : \"REQUIRED\",\n      \"priority\" : 20,\n      \"autheticatorFlow\" : false,\n      \"userSetupAllowed\" : false\n    }, {\n      \"authenticator\" : \"registration-password-action\",\n      \"authenticatorFlow\" : false,\n      \"requirement\" : \"REQUIRED\",\n      \"priority\" : 50,\n      \"autheticatorFlow\" : false,\n      \"userSetupAllowed\" : false\n    }, {\n      \"authenticator\" : \"registration-recaptcha-action\",\n      \"authenticatorFlow\" : false,\n      \"requirement\" : \"DISABLED\",\n      \"priority\" : 60,\n      \"autheticatorFlow\" : false,\n      \"userSetupAllowed\" : false\n    }, {\n      \"authenticator\" : \"registration-terms-and-conditions\",\n      \"authenticatorFlow\" : false,\n      \"requirement\" : \"DISABLED\",\n      \"priority\" : 70,\n      \"autheticatorFlow\" : false,\n      \"userSetupAllowed\" : false\n    } ]\n  }, {\n    \"id\" : \"3a53ff54-b0cb-465f-86c8-e243d4ec0004\",\n    \"alias\" : \"reset credentials\",\n    \"description\" : \"Reset credentials for a user if they forgot their password or something\",\n    \"providerId\" : \"basic-flow\",\n    \"topLevel\" : true,\n    \"builtIn\" : true,\n    \"authenticationExecutions\" : [ {\n      \"authenticator\" : \"reset-credentials-choose-user\",\n      \"authenticatorFlow\" : false,\n      \"requirement\" : \"REQUIRED\",\n      \"priority\" : 10,\n      \"autheticatorFlow\" : false,\n      \"userSetupAllowed\" : false\n    }, {\n      \"authenticator\" : \"reset-credential-email\",\n      \"authenticatorFlow\" : false,\n      \"requirement\" : \"REQUIRED\",\n      \"priority\" : 20,\n      \"autheticatorFlow\" : false,\n      \"userSetupAllowed\" : false\n    }, {\n      \"authenticator\" : \"reset-password\",\n      \"authenticatorFlow\" : false,\n      \"requirement\" : \"REQUIRED\",\n      \"priority\" : 30,\n      \"autheticatorFlow\" : false,\n      \"userSetupAllowed\" : false\n    }, {\n      \"authenticatorFlow\" : true,\n      \"requirement\" : \"CONDITIONAL\",\n      \"priority\" : 40,\n      \"autheticatorFlow\" : true,\n      \"flowAlias\" : \"Reset - Conditional OTP\",\n      \"userSetupAllowed\" : false\n    } ]\n  }, {\n    \"id\" : \"b977c3de-2d43-4759-ba01-3fc5af17b0dd\",\n    \"alias\" : \"saml ecp\",\n    \"description\" : \"SAML ECP Profile Authentication Flow\",\n    \"providerId\" : \"basic-flow\",\n    \"topLevel\" : true,\n    \"builtIn\" : true,\n    \"authenticationExecutions\" : [ {\n      \"authenticator\" : \"http-basic-authenticator\",\n      \"authenticatorFlow\" : false,\n      \"requirement\" : \"REQUIRED\",\n      \"priority\" : 10,\n      \"autheticatorFlow\" : false,\n      \"userSetupAllowed\" : false\n    } ]\n  } ],\n  \"authenticatorConfig\" : [ {\n    \"id\" : \"c10561b1-ae3f-4cb4-9608-72fb3d83a98a\",\n    \"alias\" : \"browser-conditional-credential\",\n    \"config\" : {\n      \"credentials\" : \"webauthn-passwordless\"\n    }\n  }, {\n    \"id\" : \"d22338ae-5ecc-4b20-b781-fbcd610ffcb6\",\n    \"alias\" : \"create unique user config\",\n    \"config\" : {\n      \"require.password.update.after.registration\" : \"false\"\n    }\n  }, {\n    \"id\" : \"4338fbaa-8922-4274-9b3b-f6c9c00002a3\",\n    \"alias\" : \"first-broker-login-conditional-credential\",\n    \"config\" : {\n      \"credentials\" : \"webauthn-passwordless\"\n    }\n  }, {\n    \"id\" : \"48dfd05d-b3be-4d5d-a704-e1a1ac93b8eb\",\n    \"alias\" : \"review profile config\",\n    \"config\" : {\n      \"update.profile.on.first.login\" : \"missing\"\n    }\n  } ],\n  \"requiredActions\" : [ {\n    \"alias\" : \"CONFIGURE_TOTP\",\n    \"name\" : \"Configure OTP\",\n    \"providerId\" : \"CONFIGURE_TOTP\",\n    \"enabled\" : true,\n    \"defaultAction\" : false,\n    \"priority\" : 10,\n    \"config\" : { }\n  }, {\n    \"alias\" : \"TERMS_AND_CONDITIONS\",\n    \"name\" : \"Terms and Conditions\",\n    \"providerId\" : \"TERMS_AND_CONDITIONS\",\n    \"enabled\" : false,\n    \"defaultAction\" : false,\n    \"priority\" : 20,\n    \"config\" : { }\n  }, {\n    \"alias\" : \"UPDATE_PASSWORD\",\n    \"name\" : \"Update Password\",\n    \"providerId\" : \"UPDATE_PASSWORD\",\n    \"enabled\" : true,\n    \"defaultAction\" : false,\n    \"priority\" : 30,\n    \"config\" : { }\n  }, {\n    \"alias\" : \"UPDATE_PROFILE\",\n    \"name\" : \"Update Profile\",\n    \"providerId\" : \"UPDATE_PROFILE\",\n    \"enabled\" : true,\n    \"defaultAction\" : false,\n    \"priority\" : 40,\n    \"config\" : { }\n  }, {\n    \"alias\" : \"VERIFY_EMAIL\",\n    \"name\" : \"Verify Email\",\n    \"providerId\" : \"VERIFY_EMAIL\",\n    \"enabled\" : true,\n    \"defaultAction\" : false,\n    \"priority\" : 50,\n    \"config\" : { }\n  }, {\n    \"alias\" : \"delete_account\",\n    \"name\" : \"Delete Account\",\n    \"providerId\" : \"delete_account\",\n    \"enabled\" : false,\n    \"defaultAction\" : false,\n    \"priority\" : 60,\n    \"config\" : { }\n  }, {\n    \"alias\" : \"UPDATE_EMAIL\",\n    \"name\" : \"Update Email\",\n    \"providerId\" : \"UPDATE_EMAIL\",\n    \"enabled\" : false,\n    \"defaultAction\" : false,\n    \"priority\" : 70,\n    \"config\" : { }\n  }, {\n    \"alias\" : \"webauthn-register\",\n    \"name\" : \"Webauthn Register\",\n    \"providerId\" : \"webauthn-register\",\n    \"enabled\" : true,\n    \"defaultAction\" : false,\n    \"priority\" : 80,\n    \"config\" : { }\n  }, {\n    \"alias\" : \"webauthn-register-passwordless\",\n    \"name\" : \"Webauthn Register Passwordless\",\n    \"providerId\" : \"webauthn-register-passwordless\",\n    \"enabled\" : true,\n    \"defaultAction\" : false,\n    \"priority\" : 90,\n    \"config\" : { }\n  }, {\n    \"alias\" : \"VERIFY_PROFILE\",\n    \"name\" : \"Verify Profile\",\n    \"providerId\" : \"VERIFY_PROFILE\",\n    \"enabled\" : true,\n    \"defaultAction\" : false,\n    \"priority\" : 100,\n    \"config\" : { }\n  }, {\n    \"alias\" : \"delete_credential\",\n    \"name\" : \"Delete Credential\",\n    \"providerId\" : \"delete_credential\",\n    \"enabled\" : true,\n    \"defaultAction\" : false,\n    \"priority\" : 110,\n    \"config\" : { }\n  }, {\n    \"alias\" : \"idp_link\",\n    \"name\" : \"Linking Identity Provider\",\n    \"providerId\" : \"idp_link\",\n    \"enabled\" : true,\n    \"defaultAction\" : false,\n    \"priority\" : 120,\n    \"config\" : { }\n  }, {\n    \"alias\" : \"CONFIGURE_RECOVERY_AUTHN_CODES\",\n    \"name\" : \"Recovery Authentication Codes\",\n    \"providerId\" : \"CONFIGURE_RECOVERY_AUTHN_CODES\",\n    \"enabled\" : true,\n    \"defaultAction\" : false,\n    \"priority\" : 130,\n    \"config\" : { }\n  }, {\n    \"alias\" : \"update_user_locale\",\n    \"name\" : \"Update User Locale\",\n    \"providerId\" : \"update_user_locale\",\n    \"enabled\" : true,\n    \"defaultAction\" : false,\n    \"priority\" : 1000,\n    \"config\" : { }\n  } ],\n  \"browserFlow\" : \"browser\",\n  \"registrationFlow\" : \"registration\",\n  \"directGrantFlow\" : \"direct grant\",\n  \"resetCredentialsFlow\" : \"reset credentials\",\n  \"clientAuthenticationFlow\" : \"clients\",\n  \"dockerAuthenticationFlow\" : \"docker auth\",\n  \"firstBrokerLoginFlow\" : \"first broker login\",\n  \"attributes\" : {\n    \"cibaBackchannelTokenDeliveryMode\" : \"poll\",\n    \"cibaAuthRequestedUserHint\" : \"login_hint\",\n    \"clientOfflineSessionMaxLifespan\" : \"0\",\n    \"oauth2DevicePollingInterval\" : \"5\",\n    \"clientSessionIdleTimeout\" : \"0\",\n    \"clientOfflineSessionIdleTimeout\" : \"0\",\n    \"cibaInterval\" : \"5\",\n    \"realmReusableOtpCode\" : \"false\",\n    \"cibaExpiresIn\" : \"120\",\n    \"oauth2DeviceCodeLifespan\" : \"600\",\n    \"saml.signature.algorithm\" : \"\",\n    \"parRequestUriLifespan\" : \"60\",\n    \"clientSessionMaxLifespan\" : \"0\",\n    \"frontendUrl\" : \"\",\n    \"acr.loa.map\" : \"{}\"\n  },\n  \"keycloakVersion\" : \"26.5.4\",\n  \"userManagedAccessAllowed\" : false,\n  \"organizationsEnabled\" : false,\n  \"verifiableCredentialsEnabled\" : false,\n  \"adminPermissionsEnabled\" : false,\n  \"clientProfiles\" : {\n    \"profiles\" : [ ]\n  },\n  \"clientPolicies\" : {\n    \"policies\" : [ ]\n  }\n}"
  },
  {
    "path": "src/components/emails/auth/email-forgot-password.tsx",
    "content": "import * as React from \"react\";\nimport EmailLayout from \"../email-layout\";\nimport {Heading, Text, Section, Button} from \"@react-email/components\";\nimport {getServerUrl} from \"@/utils/get-server-url\";\n\ninterface EmailCreateUserProps {\n    firstname?: string;\n    token: string;\n}\n\nexport const EmailForgotPassword = ({firstname, token}: EmailCreateUserProps) => {\n    const baseUrl = getServerUrl();\n\n    return (\n        <EmailLayout preview=\"Portabase - Forgot Password\">\n            <Heading className=\"mx-0 my-[30px] p-0 text-center font-normal text-[24px] text-black\">\n                Hello <strong>{firstname}</strong>,\n            </Heading>\n            <Text className=\"text-[14px] text-black leading-[24px]\">\n                We received a request to reset the password for your account associated with this email.\n            </Text>\n            <Text className=\"text-[14px] text-black leading-[24px]\">\n                If you did not request this password reset, please ignore this email. Your current password\n                will remain unchanged. If this seems suspicious, please contact your administrator.\n            </Text>\n            <Section className=\"mt-[32px] mb-[32px] text-center\">\n                <Button\n                    className=\"rounded bg-[#000000] px-5 py-3 text-center font-semibold text-[12px] text-white no-underline\"\n                    href={`${baseUrl}/reset-password?token=${token}`}\n                >\n                    Reset my password\n                </Button>\n            </Section>\n        </EmailLayout>\n    );\n};\n\nexport default EmailForgotPassword;\n"
  },
  {
    "path": "src/components/emails/auth/email-new-login.tsx",
    "content": "import * as React from \"react\";\nimport EmailLayout from \"../email-layout\";\nimport {Heading, Text} from \"@react-email/components\";\n\ninterface EmailCreateUserProps {\n    firstname?: string;\n    os: string;\n    browser: string;\n    ipAddress?: string;\n}\n\nexport const EmailNewLogin = ({firstname, ipAddress, os, browser}: EmailCreateUserProps) => {\n    return (\n        <EmailLayout preview=\"Portabase - New Login\">\n            <Heading className=\"mx-0 my-[30px] p-0 text-center font-normal text-[24px] text-black\">\n                Hello <strong>{firstname}</strong>,\n            </Heading>\n            <Text className=\"text-[14px] text-black leading-[24px]\">\n                We detected a new login to your account.\n            </Text>\n            <Text className=\"text-[14px] text-black leading-[24px]\">\n                <strong>Login details:</strong>\n                <br/>\n                Device: {os} - {browser}\n                <br/>\n                IP Address: {ipAddress}\n            </Text>\n        </EmailLayout>\n    );\n};\n\nexport default EmailNewLogin;\n"
  },
  {
    "path": "src/components/emails/auth/email-verification.tsx",
    "content": "import {Heading, Text, Section, Button} from \"@react-email/components\";\nimport {getServerUrl} from \"@/utils/get-server-url\";\nimport EmailLayout from \"@/components/emails/email-layout\";\n\ninterface EmailCreateUserProps {\n    firstname?: string;\n    oldEmail?: string;\n    newEmail?: string;\n    url: string;\n}\n\nexport const EmailVerification = ({firstname, oldEmail, newEmail, url: urlVerification}: EmailCreateUserProps) => {\n    const serverUrl = new URL(getServerUrl());\n    const url = new URL(urlVerification);\n    url.hostname = serverUrl.hostname;\n    url.port = serverUrl.port == \"80\" ? \"\" : serverUrl.port;\n    const newUrl = url.toString();\n\n    return (\n        <EmailLayout preview=\"Portabase email verification\">\n            <Heading className=\"mx-0 my-[30px] p-0 text-center font-normal text-[24px] text-black\">\n                Hello <strong>{firstname}</strong>,\n            </Heading>\n            <Text className=\"text-[14px] text-black leading-[24px]\">\n                We received a request to change the email address associated with your account.\n            </Text>\n            <Text className=\"text-[14px] text-black leading-[24px]\">\n                If you did not request this change, please ignore this email. Your current email address will remain\n                unchanged. If this seems suspicious, contact your administrator.\n            </Text>\n\n            {oldEmail && newEmail ? (\n                <Text className=\"text-[14px] text-black leading-[24px]\">\n                    <strong>Old email address:</strong> {oldEmail}\n                    <br/>\n                    <strong>New email address:</strong> {newEmail}\n                </Text>\n            ) : null}\n\n            <Section className=\"mt-[32px] mb-[32px] text-center\">\n                <Button\n                    className=\"rounded bg-[#000000] px-5 py-3 text-center font-semibold text-[12px] text-white no-underline\"\n                    href={newUrl}>\n                    Confirm email address\n                </Button>\n            </Section>\n        </EmailLayout>\n    );\n};\n\nexport default EmailVerification;\n"
  },
  {
    "path": "src/components/emails/email-create-user.tsx",
    "content": "import * as React from \"react\";\nimport EmailLayout from \"./email-layout\";\nimport {Heading, Text, Section, Button} from \"@react-email/components\";\nimport {getServerUrl} from \"@/utils/get-server-url\";\nimport {env} from \"@/env.mjs\";\n\ninterface EmailCreateUserProps {\n    email: string;\n    password?: string;\n}\n\nexport const EmailCreateUser = ({email, password}: EmailCreateUserProps) => {\n    const baseUrl = getServerUrl();\n\n\n    return (\n        <EmailLayout preview=\"Portabase Dashboard\">\n            <Heading className=\"mx-0 my-[30px] p-0 text-center font-normal text-[24px] text-black\">\n                Your account on {env.PROJECT_NAME} has just been created!\n            </Heading>\n\n            <Text className=\"text-[14px] text-black leading-[24px]\">\n                <strong>Email: </strong>{email}\n            </Text>\n\n            {password ? (\n                <Text className=\"text-[14px] text-black leading-[24px]\">\n                    <strong>Default password: </strong>{password}\n                </Text>\n            ) : (\n                <Text className=\"text-[14px] text-black leading-[24px]\">\n                    You can log in using one of the single sign-on (SSO) providers configured by your administrator.\n                </Text>\n            )}\n\n            <Section className=\"mt-[32px] mb-[32px] text-center\">\n                <Button\n                    className=\"rounded bg-[#000000] px-5 py-3 text-center font-semibold text-[12px] text-white no-underline\"\n                    href={baseUrl}\n                >\n                    Sign in\n                </Button>\n            </Section>\n        </EmailLayout>\n    );\n};\n\nexport default EmailCreateUser;\n"
  },
  {
    "path": "src/components/emails/email-layout.tsx",
    "content": "import { Body, Container, Head, Html, Img, Preview, Section, Tailwind } from \"@react-email/components\";\nimport * as React from \"react\";\nimport { PropsWithChildren } from \"react\";\nimport { getServerUrl } from \"@/utils/get-server-url\";\n\nconst baseUrl = getServerUrl();\n\nexport const EmailLayout = ({ children, preview }: PropsWithChildren<{ preview?: string }>) => {\n    return (\n        <Tailwind>\n            <Html>\n                <Head />\n                <Body className=\"mx-auto my-auto bg-white px-2 font-sans\">\n                    {preview ? <Preview>{preview}</Preview> : <Preview>Please check your mails</Preview>}\n                    <Container className=\"mx-auto my-[40px] max-w-[465px] rounded border border-[#eaeaea] border-solid p-[20px]\">\n                        <Section className=\"mt-[32px]\">\n                            <Img\n                                src={`${baseUrl}/images/logo.png`}\n                                width=\"50\"\n                                height=\"auto\"\n                                alt=\"Logo\"\n                                className=\"mx-auto my-0\"\n                            />\n                        </Section>\n                        {children}\n                    </Container>\n                </Body>\n            </Html>\n        </Tailwind>\n    );\n};\n\nexport default EmailLayout;\n"
  },
  {
    "path": "src/components/emails/email-notification.tsx",
    "content": "// import * as React from \"react\";\n// import EmailLayout from \"./email-layout\";\n// import {Text, Section, Button} from \"@react-email/components\";\n// import type {EventPayload} from \"@/features/notifications/types\";\n//\n// export interface EmailNotificationProps {\n//     payload: EventPayload\n// }\n//\n// export const EmailNotification = ({payload}: EmailNotificationProps) => {\n//     return (\n//         <EmailLayout preview={payload.title}>\n//             <Text className=\"text-base  text-green-800 font-bold \">${payload.title}</Text>\n//             <Text className=\"text-base  text-green-800 font-bold \"><strong>Level:</strong> ${payload.level}</Text>\n//\n//\n//             <Text className=\"text-base font-light  text-green-800 \">\n//                 ${payload.message.replace(/\\n/g, '<br>')}\n//             </Text>{\" \"}\n//\n//\n//             <Section className=\"mt-[32px] mb-[32px] text-center\">\n//\n//             </Section>\n//\n//             {payload.data && (\n//                 <Section className=\"mt-[16px] text-sm text-gray-700\">\n//                     <pre>{JSON.stringify(payload.data, null, 2)}</pre>\n//                 </Section>\n//             )}\n//\n//             <Text className=\"text-base font-light text-green-800 \">Regards,<br/>Portabase</Text>\n//         </EmailLayout>\n//     );\n// };\n//\n// export default EmailNotification;\n\n\n//       const html = `\n//       <h2>${payload.title}</h2>\n//       <p><strong>Level:</strong> ${payload.level}</p>\n//       <p>${payload.message.replace(/\\n/g, '<br>')}</p>\n//       ${payload.data ? `<pre>${JSON.stringify(payload.data, null, 2)}</pre>` : ''}\n//     `;\n//\n\nimport * as React from \"react\";\nimport EmailLayout from \"./email-layout\";\nimport {Text, Section, Button} from \"@react-email/components\";\nimport type {EventPayload} from \"@/features/notifications/types\";\n\nexport interface EmailNotificationProps {\n    payload: EventPayload;\n}\n\nexport const EmailNotification = ({payload}: EmailNotificationProps) => {\n    return (\n        <EmailLayout preview={payload.message}>\n            <Section>\n                <Text className=\"text-xl font-bold \">\n                    {payload.title}\n                </Text>\n                <Text className=\" font-semibold \">\n                    Level: {payload.level}\n                </Text>\n            </Section>\n\n            {payload.message && (\n                <Section className=\"mb-2\">\n                    <Text\n                        className=\"text-base  font-light\"\n                        dangerouslySetInnerHTML={{__html: payload.message.replace(/\\n/g, \"<br>\")}}\n                    />\n                </Section>\n            )}\n\n            {payload.data && (\n                <Section className=\"mb-6 p-4 bg-gray-100 rounded text-sm text-gray-700\">\n                    <Text>\n                        <pre>{JSON.stringify(payload.data, null, 2)}</pre>\n                    </Text>\n                </Section>\n            )}\n\n            <Section className=\"mt-8\">\n                <Text className=\"text-base font-light \">\n                    Regards,\n                    <br/>\n                    Portabase\n                </Text>\n            </Section>\n        </EmailLayout>\n    );\n};\n\nexport default EmailNotification;\n"
  },
  {
    "path": "src/components/emails/email-settings-test.tsx",
    "content": "import { Text } from \"@react-email/components\";\nimport * as React from \"react\";\nimport EmailLayout from \"./email-layout\";\n\nexport const EmailSettingsTest = () => {\n    return (\n        <EmailLayout preview=\"Email Setup\">\n            <Text className=\"text-base font-light leading-8 \">Hi, your email settings are setup !</Text>\n            <Text className=\"text-base font-light leading-8  \">Best regard,</Text>{\" \"}\n            <Text className=\"text-base font-light leading-8  \">Portabase</Text>\n        </EmailLayout>\n    )\n};\n\nexport default EmailSettingsTest;\n"
  },
  {
    "path": "src/components/emails/email-text.tsx",
    "content": "import {Text as ReactEmailText} from \"@react-email/components\";\nimport {ComponentPropsWithoutRef} from \"react\";\n\nexport const EmailText = (props: ComponentPropsWithoutRef<typeof ReactEmailText>) => {\n    return <ReactEmailText className=\"text-base font-light leading-8 text-green-800 \" {...props} />;\n};\n"
  },
  {
    "path": "src/components/layout.tsx",
    "content": "import { twx } from \"@/lib/twx\";\nimport { cn } from \"@/lib/utils\";\n\nexport const LayoutAdmin = twx.div((props) => [`w-full h-screen flex flex-col gap-4 mx-auto `]);\nexport const Layout = twx.div((props) => [`max-w-5xl w-full flex-col flex  gap-4 mx-auto px-4 `]);\n\nexport const LayoutTitle = twx.h1((props) => [cn(`text-4xl font-bold mt-5 `, props.className)]);\n\nexport const LayoutDescription = twx.p((props) => [`text-lg text-muted-foreground`]);\n"
  },
  {
    "path": "src/components/ui/accordion.tsx",
    "content": "\"use client\"\n\nimport * as React from \"react\"\nimport * as AccordionPrimitive from \"@radix-ui/react-accordion\"\nimport { ChevronDownIcon } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction Accordion({\n  ...props\n}: React.ComponentProps<typeof AccordionPrimitive.Root>) {\n  return <AccordionPrimitive.Root data-slot=\"accordion\" {...props} />\n}\n\nfunction AccordionItem({\n  className,\n  ...props\n}: React.ComponentProps<typeof AccordionPrimitive.Item>) {\n  return (\n    <AccordionPrimitive.Item\n      data-slot=\"accordion-item\"\n      className={cn(\"border-b last:border-b-0\", className)}\n      {...props}\n    />\n  )\n}\n\nfunction AccordionTrigger({\n  className,\n  children,\n  ...props\n}: React.ComponentProps<typeof AccordionPrimitive.Trigger>) {\n  return (\n    <AccordionPrimitive.Header className=\"flex\">\n      <AccordionPrimitive.Trigger\n        data-slot=\"accordion-trigger\"\n        className={cn(\n          \"focus-visible:border-ring focus-visible:ring-ring/50 flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-180\",\n          className\n        )}\n        {...props}\n      >\n        {children}\n        <ChevronDownIcon className=\"text-muted-foreground pointer-events-none size-4 shrink-0 translate-y-0.5 transition-transform duration-200\" />\n      </AccordionPrimitive.Trigger>\n    </AccordionPrimitive.Header>\n  )\n}\n\nfunction AccordionContent({\n  className,\n  children,\n  ...props\n}: React.ComponentProps<typeof AccordionPrimitive.Content>) {\n  return (\n    <AccordionPrimitive.Content\n      data-slot=\"accordion-content\"\n      className=\"data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm\"\n      {...props}\n    >\n      <div className={cn(\"pt-0 pb-4\", className)}>{children}</div>\n    </AccordionPrimitive.Content>\n  )\n}\n\nexport { Accordion, AccordionItem, AccordionTrigger, AccordionContent }\n"
  },
  {
    "path": "src/components/ui/alert-dialog.tsx",
    "content": "\"use client\"\n\nimport * as React from \"react\"\nimport * as AlertDialogPrimitive from \"@radix-ui/react-alert-dialog\"\n\nimport { cn } from \"@/lib/utils\"\nimport { buttonVariants } from \"@/components/ui/button\"\n\nfunction AlertDialog({\n  ...props\n}: React.ComponentProps<typeof AlertDialogPrimitive.Root>) {\n  return <AlertDialogPrimitive.Root data-slot=\"alert-dialog\" {...props} />\n}\n\nfunction AlertDialogTrigger({\n  ...props\n}: React.ComponentProps<typeof AlertDialogPrimitive.Trigger>) {\n  return (\n    <AlertDialogPrimitive.Trigger data-slot=\"alert-dialog-trigger\" {...props} />\n  )\n}\n\nfunction AlertDialogPortal({\n  ...props\n}: React.ComponentProps<typeof AlertDialogPrimitive.Portal>) {\n  return (\n    <AlertDialogPrimitive.Portal data-slot=\"alert-dialog-portal\" {...props} />\n  )\n}\n\nfunction AlertDialogOverlay({\n  className,\n  ...props\n}: React.ComponentProps<typeof AlertDialogPrimitive.Overlay>) {\n  return (\n    <AlertDialogPrimitive.Overlay\n      data-slot=\"alert-dialog-overlay\"\n      className={cn(\n        \"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction AlertDialogContent({\n  className,\n  ...props\n}: React.ComponentProps<typeof AlertDialogPrimitive.Content>) {\n  return (\n    <AlertDialogPortal>\n      <AlertDialogOverlay />\n      <AlertDialogPrimitive.Content\n        data-slot=\"alert-dialog-content\"\n        className={cn(\n          \"bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg\",\n          className\n        )}\n        {...props}\n      />\n    </AlertDialogPortal>\n  )\n}\n\nfunction AlertDialogHeader({\n  className,\n  ...props\n}: React.ComponentProps<\"div\">) {\n  return (\n    <div\n      data-slot=\"alert-dialog-header\"\n      className={cn(\"flex flex-col gap-2 text-center sm:text-left\", className)}\n      {...props}\n    />\n  )\n}\n\nfunction AlertDialogFooter({\n  className,\n  ...props\n}: React.ComponentProps<\"div\">) {\n  return (\n    <div\n      data-slot=\"alert-dialog-footer\"\n      className={cn(\n        \"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction AlertDialogTitle({\n  className,\n  ...props\n}: React.ComponentProps<typeof AlertDialogPrimitive.Title>) {\n  return (\n    <AlertDialogPrimitive.Title\n      data-slot=\"alert-dialog-title\"\n      className={cn(\"text-lg font-semibold\", className)}\n      {...props}\n    />\n  )\n}\n\nfunction AlertDialogDescription({\n  className,\n  ...props\n}: React.ComponentProps<typeof AlertDialogPrimitive.Description>) {\n  return (\n    <AlertDialogPrimitive.Description\n      data-slot=\"alert-dialog-description\"\n      className={cn(\"text-muted-foreground text-sm\", className)}\n      {...props}\n    />\n  )\n}\n\nfunction AlertDialogAction({\n  className,\n  ...props\n}: React.ComponentProps<typeof AlertDialogPrimitive.Action>) {\n  return (\n    <AlertDialogPrimitive.Action\n      className={cn(buttonVariants(), className)}\n      {...props}\n    />\n  )\n}\n\nfunction AlertDialogCancel({\n  className,\n  ...props\n}: React.ComponentProps<typeof AlertDialogPrimitive.Cancel>) {\n  return (\n    <AlertDialogPrimitive.Cancel\n      className={cn(buttonVariants({ variant: \"outline\" }), className)}\n      {...props}\n    />\n  )\n}\n\nexport {\n  AlertDialog,\n  AlertDialogPortal,\n  AlertDialogOverlay,\n  AlertDialogTrigger,\n  AlertDialogContent,\n  AlertDialogHeader,\n  AlertDialogFooter,\n  AlertDialogTitle,\n  AlertDialogDescription,\n  AlertDialogAction,\n  AlertDialogCancel,\n}\n"
  },
  {
    "path": "src/components/ui/alert.tsx",
    "content": "import * as React from \"react\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst alertVariants = cva(\n  \"relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current\",\n  {\n    variants: {\n      variant: {\n        default: \"bg-card text-card-foreground\",\n        destructive:\n          \"text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90\",\n      },\n    },\n    defaultVariants: {\n      variant: \"default\",\n    },\n  }\n)\n\nfunction Alert({\n  className,\n  variant,\n  ...props\n}: React.ComponentProps<\"div\"> & VariantProps<typeof alertVariants>) {\n  return (\n    <div\n      data-slot=\"alert\"\n      role=\"alert\"\n      className={cn(alertVariants({ variant }), className)}\n      {...props}\n    />\n  )\n}\n\nfunction AlertTitle({ className, ...props }: React.ComponentProps<\"div\">) {\n  return (\n    <div\n      data-slot=\"alert-title\"\n      className={cn(\n        \"col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction AlertDescription({\n  className,\n  ...props\n}: React.ComponentProps<\"div\">) {\n  return (\n    <div\n      data-slot=\"alert-description\"\n      className={cn(\n        \"text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nexport { Alert, AlertTitle, AlertDescription }\n"
  },
  {
    "path": "src/components/ui/aspect-ratio.tsx",
    "content": "\"use client\"\n\nimport * as AspectRatioPrimitive from \"@radix-ui/react-aspect-ratio\"\n\nfunction AspectRatio({\n  ...props\n}: React.ComponentProps<typeof AspectRatioPrimitive.Root>) {\n  return <AspectRatioPrimitive.Root data-slot=\"aspect-ratio\" {...props} />\n}\n\nexport { AspectRatio }\n"
  },
  {
    "path": "src/components/ui/avatar.tsx",
    "content": "\"use client\"\n\nimport * as React from \"react\"\nimport * as AvatarPrimitive from \"@radix-ui/react-avatar\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction Avatar({\n  className,\n  ...props\n}: React.ComponentProps<typeof AvatarPrimitive.Root>) {\n  return (\n    <AvatarPrimitive.Root\n      data-slot=\"avatar\"\n      className={cn(\n        \"relative flex size-8 shrink-0 overflow-hidden rounded-full\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction AvatarImage({\n  className,\n  ...props\n}: React.ComponentProps<typeof AvatarPrimitive.Image>) {\n  return (\n    <AvatarPrimitive.Image\n      data-slot=\"avatar-image\"\n      className={cn(\"aspect-square size-full\", className)}\n      {...props}\n    />\n  )\n}\n\nfunction AvatarFallback({\n  className,\n  ...props\n}: React.ComponentProps<typeof AvatarPrimitive.Fallback>) {\n  return (\n    <AvatarPrimitive.Fallback\n      data-slot=\"avatar-fallback\"\n      className={cn(\n        \"bg-muted flex size-full items-center justify-center rounded-full\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nexport { Avatar, AvatarImage, AvatarFallback }\n"
  },
  {
    "path": "src/components/ui/badge.tsx",
    "content": "import * as React from \"react\"\nimport { Slot } from \"@radix-ui/react-slot\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst badgeVariants = cva(\n  \"inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden\",\n  {\n    variants: {\n      variant: {\n        default:\n          \"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90\",\n        secondary:\n          \"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90\",\n        destructive:\n          \"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60\",\n        outline:\n          \"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground\",\n      },\n    },\n    defaultVariants: {\n      variant: \"default\",\n    },\n  }\n)\n\nfunction Badge({\n  className,\n  variant,\n  asChild = false,\n  ...props\n}: React.ComponentProps<\"span\"> &\n  VariantProps<typeof badgeVariants> & { asChild?: boolean }) {\n  const Comp = asChild ? Slot : \"span\"\n\n  return (\n    <Comp\n      data-slot=\"badge\"\n      className={cn(badgeVariants({ variant }), className)}\n      {...props}\n    />\n  )\n}\n\nexport { Badge, badgeVariants }\n"
  },
  {
    "path": "src/components/ui/breadcrumb.tsx",
    "content": "import * as React from \"react\"\nimport { Slot } from \"@radix-ui/react-slot\"\nimport { cn } from \"@/lib/utils\"\nimport { ChevronRightIcon, DotsHorizontalIcon } from \"@radix-ui/react-icons\"\n\nfunction Breadcrumb({ ...props }: React.ComponentProps<\"nav\">) {\n  return <nav aria-label=\"breadcrumb\" data-slot=\"breadcrumb\" {...props} />\n}\n\nfunction BreadcrumbList({ className, ...props }: React.ComponentProps<\"ol\">) {\n  return (\n    <ol\n      data-slot=\"breadcrumb-list\"\n      className={cn(\n        \"text-muted-foreground flex flex-wrap items-center gap-1.5 text-sm break-words sm:gap-2.5\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction BreadcrumbItem({ className, ...props }: React.ComponentProps<\"li\">) {\n  return (\n    <li\n      data-slot=\"breadcrumb-item\"\n      className={cn(\"inline-flex items-center gap-1.5\", className)}\n      {...props}\n    />\n  )\n}\n\nfunction BreadcrumbLink({\n  asChild,\n  className,\n  ...props\n}: React.ComponentProps<\"a\"> & {\n  asChild?: boolean\n}) {\n  const Comp = asChild ? Slot : \"a\"\n\n  return (\n    <Comp\n      data-slot=\"breadcrumb-link\"\n      className={cn(\"hover:text-foreground transition-colors\", className)}\n      {...props}\n    />\n  )\n}\n\nfunction BreadcrumbPage({ className, ...props }: React.ComponentProps<\"span\">) {\n  return (\n    <span\n      data-slot=\"breadcrumb-page\"\n      role=\"link\"\n      aria-disabled=\"true\"\n      aria-current=\"page\"\n      className={cn(\"text-foreground font-normal\", className)}\n      {...props}\n    />\n  )\n}\n\nfunction BreadcrumbSeparator({\n  children,\n  className,\n  ...props\n}: React.ComponentProps<\"li\">) {\n  return (\n    <li\n      data-slot=\"breadcrumb-separator\"\n      role=\"presentation\"\n      aria-hidden=\"true\"\n      className={cn(\"[&>svg]:size-3.5\", className)}\n      {...props}\n    >\n      {children ?? <ChevronRightIcon />}\n    </li>\n  )\n}\n\nfunction BreadcrumbEllipsis({\n  className,\n  ...props\n}: React.ComponentProps<\"span\">) {\n  return (\n    <span\n      data-slot=\"breadcrumb-ellipsis\"\n      role=\"presentation\"\n      aria-hidden=\"true\"\n      className={cn(\"flex size-9 items-center justify-center\", className)}\n      {...props}\n    >\n      <DotsHorizontalIcon className=\"size-4\" />\n      <span className=\"sr-only\">More</span>\n    </span>\n  )\n}\n\nexport {\n  Breadcrumb,\n  BreadcrumbList,\n  BreadcrumbItem,\n  BreadcrumbLink,\n  BreadcrumbPage,\n  BreadcrumbSeparator,\n  BreadcrumbEllipsis,\n}\n"
  },
  {
    "path": "src/components/ui/button.tsx",
    "content": "import * as React from \"react\"\nimport { Slot } from \"@radix-ui/react-slot\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst buttonVariants = cva(\n  \"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive\",\n  {\n    variants: {\n      variant: {\n        default:\n          \"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90\",\n        destructive:\n          \"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60\",\n        outline:\n          \"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50\",\n        secondary:\n          \"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80\",\n        ghost:\n          \"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50\",\n        link: \"text-primary underline-offset-4 hover:underline\",\n      },\n      size: {\n        default: \"h-9 px-4 py-2 has-[>svg]:px-3\",\n        sm: \"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5\",\n        lg: \"h-10 rounded-md px-6 has-[>svg]:px-4\",\n        icon: \"size-9\",\n      },\n    },\n    defaultVariants: {\n      variant: \"default\",\n      size: \"default\",\n    },\n  }\n)\n\nexport type ButtonVariantsProps = VariantProps<typeof buttonVariants>;\n\nfunction Button({\n  className,\n  variant,\n  size,\n  asChild = false,\n  ...props\n}: React.ComponentProps<\"button\"> &\n  VariantProps<typeof buttonVariants> & {\n    asChild?: boolean\n  }) {\n  const Comp = asChild ? Slot : \"button\"\n\n  return (\n    <Comp\n      data-slot=\"button\"\n      className={cn(buttonVariants({ variant, size, className }))}\n      {...props}\n    />\n  )\n}\n\nexport { Button, buttonVariants }\n"
  },
  {
    "path": "src/components/ui/calendar.tsx",
    "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { DayPicker } from \"react-day-picker\";\n\nimport { cn } from \"@/lib/utils\";\nimport { buttonVariants } from \"@/components/ui/button\";\nimport { ChevronLeftIcon, ChevronRightIcon } from \"@radix-ui/react-icons\";\n\nexport type CalendarProps = React.ComponentProps<typeof DayPicker>;\n\nfunction Calendar({ className, classNames, showOutsideDays = true, ...props }: React.ComponentProps<typeof DayPicker>) {\n    return (\n        <DayPicker\n            showOutsideDays={showOutsideDays}\n            className={cn(\"p-3\", className)}\n            classNames={{\n                months: \"flex flex-col sm:flex-row gap-2\",\n                month: \"flex flex-col gap-4\",\n                caption: \"flex justify-center pt-1 relative items-center w-full\",\n                caption_label: \"text-sm font-medium\",\n                nav: \"flex items-center gap-1\",\n                nav_button: cn(buttonVariants({ variant: \"outline\" }), \"size-7 bg-transparent p-0 opacity-50 hover:opacity-100\"),\n                nav_button_previous: \"absolute left-1\",\n                nav_button_next: \"absolute right-1\",\n                table: \"w-full border-collapse space-x-1\",\n                head_row: \"flex\",\n                head_cell: \"text-muted-foreground rounded-md w-8 font-normal text-[0.8rem]\",\n                row: \"flex w-full mt-2\",\n                cell: cn(\n                    \"relative p-0 text-center text-sm focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-accent [&:has([aria-selected].day-range-end)]:rounded-r-md\",\n                    props.mode === \"range\"\n                        ? \"[&:has(>.day-range-end)]:rounded-r-md [&:has(>.day-range-start)]:rounded-l-md first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md\"\n                        : \"[&:has([aria-selected])]:rounded-md\"\n                ),\n                day: cn(buttonVariants({ variant: \"ghost\" }), \"size-8 p-0 font-normal aria-selected:opacity-100\"),\n                day_range_start: \"day-range-start aria-selected:bg-primary aria-selected:text-primary-foreground\",\n                day_range_end: \"day-range-end aria-selected:bg-primary aria-selected:text-primary-foreground\",\n                day_selected:\n                    \"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground\",\n                day_today: \"bg-accent text-accent-foreground\",\n                day_outside: \"day-outside text-muted-foreground aria-selected:text-muted-foreground\",\n                day_disabled: \"text-muted-foreground opacity-50\",\n                day_range_middle: \"aria-selected:bg-accent aria-selected:text-accent-foreground\",\n                day_hidden: \"invisible\",\n                ...classNames,\n            }}\n            components={{\n                // @ts-ignore\n                IconLeft: ({ className, children: _children, ...props }) => <ChevronLeftIcon className={cn(\"size-4\", className)} {...props} />,\n                // @ts-ignore\n                IconRight: ({ className, children: _children, ...props }) => <ChevronRightIcon className={cn(\"size-4\", className)} {...props} />,\n            }}\n            {...props}\n        />\n    );\n}\n\nexport { Calendar };\n"
  },
  {
    "path": "src/components/ui/card.tsx",
    "content": "import * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction Card({ className, ...props }: React.ComponentProps<\"div\">) {\n  return (\n    <div\n      data-slot=\"card\"\n      className={cn(\n        \"bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction CardHeader({ className, ...props }: React.ComponentProps<\"div\">) {\n  return (\n    <div\n      data-slot=\"card-header\"\n      className={cn(\n        \"@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction CardTitle({ className, ...props }: React.ComponentProps<\"div\">) {\n  return (\n    <div\n      data-slot=\"card-title\"\n      className={cn(\"leading-none font-semibold\", className)}\n      {...props}\n    />\n  )\n}\n\nfunction CardDescription({ className, ...props }: React.ComponentProps<\"div\">) {\n  return (\n    <div\n      data-slot=\"card-description\"\n      className={cn(\"text-muted-foreground text-sm\", className)}\n      {...props}\n    />\n  )\n}\n\nfunction CardAction({ className, ...props }: React.ComponentProps<\"div\">) {\n  return (\n    <div\n      data-slot=\"card-action\"\n      className={cn(\n        \"col-start-2 row-span-2 row-start-1 self-start justify-self-end\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction CardContent({ className, ...props }: React.ComponentProps<\"div\">) {\n  return (\n    <div\n      data-slot=\"card-content\"\n      className={cn(\"px-6\", className)}\n      {...props}\n    />\n  )\n}\n\nfunction CardFooter({ className, ...props }: React.ComponentProps<\"div\">) {\n  return (\n    <div\n      data-slot=\"card-footer\"\n      className={cn(\"flex items-center px-6 [.border-t]:pt-6\", className)}\n      {...props}\n    />\n  )\n}\n\nexport {\n  Card,\n  CardHeader,\n  CardFooter,\n  CardTitle,\n  CardAction,\n  CardDescription,\n  CardContent,\n}\n"
  },
  {
    "path": "src/components/ui/carousel.tsx",
    "content": "\"use client\"\n\nimport * as React from \"react\"\nimport useEmblaCarousel, {\n  type UseEmblaCarouselType,\n} from \"embla-carousel-react\"\nimport { cn } from \"@/lib/utils\"\nimport { Button } from \"@/components/ui/button\"\nimport { ArrowLeftIcon, ArrowRightIcon } from \"@radix-ui/react-icons\"\n\ntype CarouselApi = UseEmblaCarouselType[1]\ntype UseCarouselParameters = Parameters<typeof useEmblaCarousel>\ntype CarouselOptions = UseCarouselParameters[0]\ntype CarouselPlugin = UseCarouselParameters[1]\n\ntype CarouselProps = {\n  opts?: CarouselOptions\n  plugins?: CarouselPlugin\n  orientation?: \"horizontal\" | \"vertical\"\n  setApi?: (api: CarouselApi) => void\n}\n\ntype CarouselContextProps = {\n  carouselRef: ReturnType<typeof useEmblaCarousel>[0]\n  api: ReturnType<typeof useEmblaCarousel>[1]\n  scrollPrev: () => void\n  scrollNext: () => void\n  canScrollPrev: boolean\n  canScrollNext: boolean\n} & CarouselProps\n\nconst CarouselContext = React.createContext<CarouselContextProps | null>(null)\n\nfunction useCarousel() {\n  const context = React.useContext(CarouselContext)\n\n  if (!context) {\n    throw new Error(\"useCarousel must be used within a <Carousel />\")\n  }\n\n  return context\n}\n\nfunction Carousel({\n  orientation = \"horizontal\",\n  opts,\n  setApi,\n  plugins,\n  className,\n  children,\n  ...props\n}: React.ComponentProps<\"div\"> & CarouselProps) {\n  const [carouselRef, api] = useEmblaCarousel(\n    {\n      ...opts,\n      axis: orientation === \"horizontal\" ? \"x\" : \"y\",\n    },\n    plugins\n  )\n  const [canScrollPrev, setCanScrollPrev] = React.useState(false)\n  const [canScrollNext, setCanScrollNext] = React.useState(false)\n\n  const onSelect = React.useCallback((api: CarouselApi) => {\n    if (!api) return\n    setCanScrollPrev(api.canScrollPrev())\n    setCanScrollNext(api.canScrollNext())\n  }, [])\n\n  const scrollPrev = React.useCallback(() => {\n    api?.scrollPrev()\n  }, [api])\n\n  const scrollNext = React.useCallback(() => {\n    api?.scrollNext()\n  }, [api])\n\n  const handleKeyDown = React.useCallback(\n    (event: React.KeyboardEvent<HTMLDivElement>) => {\n      if (event.key === \"ArrowLeft\") {\n        event.preventDefault()\n        scrollPrev()\n      } else if (event.key === \"ArrowRight\") {\n        event.preventDefault()\n        scrollNext()\n      }\n    },\n    [scrollPrev, scrollNext]\n  )\n\n  React.useEffect(() => {\n    if (!api || !setApi) return\n    setApi(api)\n  }, [api, setApi])\n\n  React.useEffect(() => {\n    if (!api) return\n    onSelect(api)\n    api.on(\"reInit\", onSelect)\n    api.on(\"select\", onSelect)\n\n    return () => {\n      api?.off(\"select\", onSelect)\n    }\n  }, [api, onSelect])\n\n  return (\n    <CarouselContext.Provider\n      value={{\n        carouselRef,\n        api: api,\n        opts,\n        orientation:\n          orientation || (opts?.axis === \"y\" ? \"vertical\" : \"horizontal\"),\n        scrollPrev,\n        scrollNext,\n        canScrollPrev,\n        canScrollNext,\n      }}\n    >\n      <div\n        onKeyDownCapture={handleKeyDown}\n        className={cn(\"relative\", className)}\n        role=\"region\"\n        aria-roledescription=\"carousel\"\n        data-slot=\"carousel\"\n        {...props}\n      >\n        {children}\n      </div>\n    </CarouselContext.Provider>\n  )\n}\n\nfunction CarouselContent({ className, ...props }: React.ComponentProps<\"div\">) {\n  const { carouselRef, orientation } = useCarousel()\n\n  return (\n    <div\n      ref={carouselRef}\n      className=\"overflow-hidden\"\n      data-slot=\"carousel-content\"\n    >\n      <div\n        className={cn(\n          \"flex\",\n          orientation === \"horizontal\" ? \"-ml-4\" : \"-mt-4 flex-col\",\n          className\n        )}\n        {...props}\n      />\n    </div>\n  )\n}\n\nfunction CarouselItem({ className, ...props }: React.ComponentProps<\"div\">) {\n  const { orientation } = useCarousel()\n\n  return (\n    <div\n      role=\"group\"\n      aria-roledescription=\"slide\"\n      data-slot=\"carousel-item\"\n      className={cn(\n        \"min-w-0 shrink-0 grow-0 basis-full\",\n        orientation === \"horizontal\" ? \"pl-4\" : \"pt-4\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction CarouselPrevious({\n  className,\n  variant = \"outline\",\n  size = \"icon\",\n  ...props\n}: React.ComponentProps<typeof Button>) {\n  const { orientation, scrollPrev, canScrollPrev } = useCarousel()\n\n  return (\n    <Button\n      data-slot=\"carousel-previous\"\n      variant={variant}\n      size={size}\n      className={cn(\n        \"absolute size-8 rounded-full\",\n        orientation === \"horizontal\"\n          ? \"top-1/2 -left-12 -translate-y-1/2\"\n          : \"-top-12 left-1/2 -translate-x-1/2 rotate-90\",\n        className\n      )}\n      disabled={!canScrollPrev}\n      onClick={scrollPrev}\n      {...props}\n    >\n      <ArrowLeftIcon />\n      <span className=\"sr-only\">Previous slide</span>\n    </Button>\n  )\n}\n\nfunction CarouselNext({\n  className,\n  variant = \"outline\",\n  size = \"icon\",\n  ...props\n}: React.ComponentProps<typeof Button>) {\n  const { orientation, scrollNext, canScrollNext } = useCarousel()\n\n  return (\n    <Button\n      data-slot=\"carousel-next\"\n      variant={variant}\n      size={size}\n      className={cn(\n        \"absolute size-8 rounded-full\",\n        orientation === \"horizontal\"\n          ? \"top-1/2 -right-12 -translate-y-1/2\"\n          : \"-bottom-12 left-1/2 -translate-x-1/2 rotate-90\",\n        className\n      )}\n      disabled={!canScrollNext}\n      onClick={scrollNext}\n      {...props}\n    >\n      <ArrowRightIcon />\n      <span className=\"sr-only\">Next slide</span>\n    </Button>\n  )\n}\n\nexport {\n  type CarouselApi,\n  Carousel,\n  CarouselContent,\n  CarouselItem,\n  CarouselPrevious,\n  CarouselNext,\n}\n"
  },
  {
    "path": "src/components/ui/chart.tsx",
    "content": "\"use client\"\n\nimport * as React from \"react\"\nimport * as RechartsPrimitive from \"recharts\"\n\nimport { cn } from \"@/lib/utils\"\n\n// Format: { THEME_NAME: CSS_SELECTOR }\nconst THEMES = { light: \"\", dark: \".dark\" } as const\n\nexport type ChartConfig = {\n  [k in string]: {\n    label?: React.ReactNode\n    icon?: React.ComponentType\n  } & (\n    | { color?: string; theme?: never }\n    | { color?: never; theme: Record<keyof typeof THEMES, string> }\n  )\n}\n\ntype ChartContextProps = {\n  config: ChartConfig\n}\n\nconst ChartContext = React.createContext<ChartContextProps | null>(null)\n\nfunction useChart() {\n  const context = React.useContext(ChartContext)\n\n  if (!context) {\n    throw new Error(\"useChart must be used within a <ChartContainer />\")\n  }\n\n  return context\n}\n\nfunction ChartContainer({\n  id,\n  className,\n  children,\n  config,\n  ...props\n}: React.ComponentProps<\"div\"> & {\n  config: ChartConfig\n  children: React.ComponentProps<\n    typeof RechartsPrimitive.ResponsiveContainer\n  >[\"children\"]\n}) {\n  const uniqueId = React.useId()\n  const chartId = `chart-${id || uniqueId.replace(/:/g, \"\")}`\n\n  return (\n    <ChartContext.Provider value={{ config }}>\n      <div\n        data-slot=\"chart\"\n        data-chart={chartId}\n        className={cn(\n          \"[&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border flex aspect-video justify-center text-xs [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden\",\n          className\n        )}\n        {...props}\n      >\n        <ChartStyle id={chartId} config={config} />\n        <RechartsPrimitive.ResponsiveContainer>\n          {children}\n        </RechartsPrimitive.ResponsiveContainer>\n      </div>\n    </ChartContext.Provider>\n  )\n}\n\nconst ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => {\n  const colorConfig = Object.entries(config).filter(\n    ([, config]) => config.theme || config.color\n  )\n\n  if (!colorConfig.length) {\n    return null\n  }\n\n  return (\n    <style\n      dangerouslySetInnerHTML={{\n        __html: Object.entries(THEMES)\n          .map(\n            ([theme, prefix]) => `\n${prefix} [data-chart=${id}] {\n${colorConfig\n  .map(([key, itemConfig]) => {\n    const color =\n      itemConfig.theme?.[theme as keyof typeof itemConfig.theme] ||\n      itemConfig.color\n    return color ? `  --color-${key}: ${color};` : null\n  })\n  .join(\"\\n\")}\n}\n`\n          )\n          .join(\"\\n\"),\n      }}\n    />\n  )\n}\n\nconst ChartTooltip = RechartsPrimitive.Tooltip\n\nfunction ChartTooltipContent({\n  active,\n  payload,\n  className,\n  indicator = \"dot\",\n  hideLabel = false,\n  hideIndicator = false,\n  label,\n  labelFormatter,\n  labelClassName,\n  formatter,\n  color,\n  nameKey,\n  labelKey,\n}: React.ComponentProps<typeof RechartsPrimitive.Tooltip> &\n  React.ComponentProps<\"div\"> & {\n    hideLabel?: boolean\n    hideIndicator?: boolean\n    indicator?: \"line\" | \"dot\" | \"dashed\"\n    nameKey?: string\n    labelKey?: string\n  }) {\n  const { config } = useChart()\n\n  const tooltipLabel = React.useMemo(() => {\n    if (hideLabel || !payload?.length) {\n      return null\n    }\n\n    const [item] = payload\n    const key = `${labelKey || item?.dataKey || item?.name || \"value\"}`\n    const itemConfig = getPayloadConfigFromPayload(config, item, key)\n    const value =\n      !labelKey && typeof label === \"string\"\n        ? config[label as keyof typeof config]?.label || label\n        : itemConfig?.label\n\n    if (labelFormatter) {\n      return (\n        <div className={cn(\"font-medium\", labelClassName)}>\n          {labelFormatter(value, payload)}\n        </div>\n      )\n    }\n\n    if (!value) {\n      return null\n    }\n\n    return <div className={cn(\"font-medium\", labelClassName)}>{value}</div>\n  }, [\n    label,\n    labelFormatter,\n    payload,\n    hideLabel,\n    labelClassName,\n    config,\n    labelKey,\n  ])\n\n  if (!active || !payload?.length) {\n    return null\n  }\n\n  const nestLabel = payload.length === 1 && indicator !== \"dot\"\n\n  return (\n    <div\n      className={cn(\n        \"border-border/50 bg-background grid min-w-[8rem] items-start gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs shadow-xl\",\n        className\n      )}\n    >\n      {!nestLabel ? tooltipLabel : null}\n      <div className=\"grid gap-1.5\">\n        {payload.map((item, index) => {\n          const key = `${nameKey || item.name || item.dataKey || \"value\"}`\n          const itemConfig = getPayloadConfigFromPayload(config, item, key)\n          const indicatorColor = color || item.payload.fill || item.color\n\n          return (\n            <div\n              key={item.dataKey}\n              className={cn(\n                \"[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5\",\n                indicator === \"dot\" && \"items-center\"\n              )}\n            >\n              {formatter && item?.value !== undefined && item.name ? (\n                formatter(item.value, item.name, item, index, item.payload)\n              ) : (\n                <>\n                  {itemConfig?.icon ? (\n                    <itemConfig.icon />\n                  ) : (\n                    !hideIndicator && (\n                      <div\n                        className={cn(\n                          \"shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)\",\n                          {\n                            \"h-2.5 w-2.5\": indicator === \"dot\",\n                            \"w-1\": indicator === \"line\",\n                            \"w-0 border-[1.5px] border-dashed bg-transparent\":\n                              indicator === \"dashed\",\n                            \"my-0.5\": nestLabel && indicator === \"dashed\",\n                          }\n                        )}\n                        style={\n                          {\n                            \"--color-bg\": indicatorColor,\n                            \"--color-border\": indicatorColor,\n                          } as React.CSSProperties\n                        }\n                      />\n                    )\n                  )}\n                  <div\n                    className={cn(\n                      \"flex flex-1 justify-between leading-none\",\n                      nestLabel ? \"items-end\" : \"items-center\"\n                    )}\n                  >\n                    <div className=\"grid gap-1.5\">\n                      {nestLabel ? tooltipLabel : null}\n                      <span className=\"text-muted-foreground\">\n                        {itemConfig?.label || item.name}\n                      </span>\n                    </div>\n                    {item.value && (\n                      <span className=\"text-foreground font-mono font-medium tabular-nums\">\n                        {item.value.toLocaleString()}\n                      </span>\n                    )}\n                  </div>\n                </>\n              )}\n            </div>\n          )\n        })}\n      </div>\n    </div>\n  )\n}\n\nconst ChartLegend = RechartsPrimitive.Legend\n\nfunction ChartLegendContent({\n  className,\n  hideIcon = false,\n  payload,\n  verticalAlign = \"bottom\",\n  nameKey,\n}: React.ComponentProps<\"div\"> &\n  Pick<RechartsPrimitive.LegendProps, \"payload\" | \"verticalAlign\"> & {\n    hideIcon?: boolean\n    nameKey?: string\n  }) {\n  const { config } = useChart()\n\n  if (!payload?.length) {\n    return null\n  }\n\n  return (\n    <div\n      className={cn(\n        \"flex items-center justify-center gap-4\",\n        verticalAlign === \"top\" ? \"pb-3\" : \"pt-3\",\n        className\n      )}\n    >\n      {payload.map((item) => {\n        const key = `${nameKey || item.dataKey || \"value\"}`\n        const itemConfig = getPayloadConfigFromPayload(config, item, key)\n\n        return (\n          <div\n            key={item.value}\n            className={cn(\n              \"[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3\"\n            )}\n          >\n            {itemConfig?.icon && !hideIcon ? (\n              <itemConfig.icon />\n            ) : (\n              <div\n                className=\"h-2 w-2 shrink-0 rounded-[2px]\"\n                style={{\n                  backgroundColor: item.color,\n                }}\n              />\n            )}\n            {itemConfig?.label}\n          </div>\n        )\n      })}\n    </div>\n  )\n}\n\n// Helper to extract item config from a payload.\nfunction getPayloadConfigFromPayload(\n  config: ChartConfig,\n  payload: unknown,\n  key: string\n) {\n  if (typeof payload !== \"object\" || payload === null) {\n    return undefined\n  }\n\n  const payloadPayload =\n    \"payload\" in payload &&\n    typeof payload.payload === \"object\" &&\n    payload.payload !== null\n      ? payload.payload\n      : undefined\n\n  let configLabelKey: string = key\n\n  if (\n    key in payload &&\n    typeof payload[key as keyof typeof payload] === \"string\"\n  ) {\n    configLabelKey = payload[key as keyof typeof payload] as string\n  } else if (\n    payloadPayload &&\n    key in payloadPayload &&\n    typeof payloadPayload[key as keyof typeof payloadPayload] === \"string\"\n  ) {\n    configLabelKey = payloadPayload[\n      key as keyof typeof payloadPayload\n    ] as string\n  }\n\n  return configLabelKey in config\n    ? config[configLabelKey]\n    : config[key as keyof typeof config]\n}\n\nexport {\n  ChartContainer,\n  ChartTooltip,\n  ChartTooltipContent,\n  ChartLegend,\n  ChartLegendContent,\n  ChartStyle,\n}\n"
  },
  {
    "path": "src/components/ui/checkbox.tsx",
    "content": "\"use client\"\n\nimport * as React from \"react\"\nimport * as CheckboxPrimitive from \"@radix-ui/react-checkbox\"\nimport { CheckIcon } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction Checkbox({\n  className,\n  ...props\n}: React.ComponentProps<typeof CheckboxPrimitive.Root>) {\n  return (\n    <CheckboxPrimitive.Root\n      data-slot=\"checkbox\"\n      className={cn(\n        \"peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50\",\n        className\n      )}\n      {...props}\n    >\n      <CheckboxPrimitive.Indicator\n        data-slot=\"checkbox-indicator\"\n        className=\"flex items-center justify-center text-current transition-none\"\n      >\n        <CheckIcon className=\"size-3.5\" />\n      </CheckboxPrimitive.Indicator>\n    </CheckboxPrimitive.Root>\n  )\n}\n\nexport { Checkbox }\n"
  },
  {
    "path": "src/components/ui/collapsible.tsx",
    "content": "\"use client\"\n\nimport * as CollapsiblePrimitive from \"@radix-ui/react-collapsible\"\n\nfunction Collapsible({\n  ...props\n}: React.ComponentProps<typeof CollapsiblePrimitive.Root>) {\n  return <CollapsiblePrimitive.Root data-slot=\"collapsible\" {...props} />\n}\n\nfunction CollapsibleTrigger({\n  ...props\n}: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleTrigger>) {\n  return (\n    <CollapsiblePrimitive.CollapsibleTrigger\n      data-slot=\"collapsible-trigger\"\n      {...props}\n    />\n  )\n}\n\nfunction CollapsibleContent({\n  ...props\n}: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleContent>) {\n  return (\n    <CollapsiblePrimitive.CollapsibleContent\n      data-slot=\"collapsible-content\"\n      {...props}\n    />\n  )\n}\n\nexport { Collapsible, CollapsibleTrigger, CollapsibleContent }\n"
  },
  {
    "path": "src/components/ui/command.tsx",
    "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { type DialogProps } from \"@radix-ui/react-dialog\"\nimport { MagnifyingGlassIcon } from \"@radix-ui/react-icons\"\nimport { Command as CommandPrimitive } from \"cmdk\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Dialog, DialogContent } from \"@/components/ui/dialog\"\n\nconst Command = React.forwardRef<\n  React.ElementRef<typeof CommandPrimitive>,\n  React.ComponentPropsWithoutRef<typeof CommandPrimitive>\n>(({ className, ...props }, ref) => (\n  <CommandPrimitive\n    ref={ref}\n    className={cn(\n      \"flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground\",\n      className\n    )}\n    {...props}\n  />\n))\nCommand.displayName = CommandPrimitive.displayName\n\ninterface CommandDialogProps extends DialogProps {}\n\nconst CommandDialog = ({ children, ...props }: CommandDialogProps) => {\n  return (\n    <Dialog {...props}>\n      <DialogContent className=\"overflow-hidden p-0\">\n        <Command className=\"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5\">\n          {children}\n        </Command>\n      </DialogContent>\n    </Dialog>\n  )\n}\n\nconst CommandInput = React.forwardRef<\n  React.ElementRef<typeof CommandPrimitive.Input>,\n  React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>\n>(({ className, ...props }, ref) => (\n  <div className=\"flex items-center border-b px-3\" cmdk-input-wrapper=\"\">\n    <MagnifyingGlassIcon className=\"mr-2 h-4 w-4 shrink-0 opacity-50\" />\n    <CommandPrimitive.Input\n      ref={ref}\n      className={cn(\n        \"flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50\",\n        className\n      )}\n      {...props}\n    />\n  </div>\n))\n\nCommandInput.displayName = CommandPrimitive.Input.displayName\n\nconst CommandList = React.forwardRef<\n  React.ElementRef<typeof CommandPrimitive.List>,\n  React.ComponentPropsWithoutRef<typeof CommandPrimitive.List>\n>(({ className, ...props }, ref) => (\n  <CommandPrimitive.List\n    ref={ref}\n    className={cn(\"max-h-[300px] overflow-y-auto overflow-x-hidden\", className)}\n    {...props}\n  />\n))\n\nCommandList.displayName = CommandPrimitive.List.displayName\n\nconst CommandEmpty = React.forwardRef<\n  React.ElementRef<typeof CommandPrimitive.Empty>,\n  React.ComponentPropsWithoutRef<typeof CommandPrimitive.Empty>\n>((props, ref) => (\n  <CommandPrimitive.Empty\n    ref={ref}\n    className=\"py-6 text-center text-sm\"\n    {...props}\n  />\n))\n\nCommandEmpty.displayName = CommandPrimitive.Empty.displayName\n\nconst CommandGroup = React.forwardRef<\n  React.ElementRef<typeof CommandPrimitive.Group>,\n  React.ComponentPropsWithoutRef<typeof CommandPrimitive.Group>\n>(({ className, ...props }, ref) => (\n  <CommandPrimitive.Group\n    ref={ref}\n    className={cn(\n      \"overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground\",\n      className\n    )}\n    {...props}\n  />\n))\n\nCommandGroup.displayName = CommandPrimitive.Group.displayName\n\nconst CommandSeparator = React.forwardRef<\n  React.ElementRef<typeof CommandPrimitive.Separator>,\n  React.ComponentPropsWithoutRef<typeof CommandPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n  <CommandPrimitive.Separator\n    ref={ref}\n    className={cn(\"-mx-1 h-px bg-border\", className)}\n    {...props}\n  />\n))\nCommandSeparator.displayName = CommandPrimitive.Separator.displayName\n\nconst CommandItem = React.forwardRef<\n  React.ElementRef<typeof CommandPrimitive.Item>,\n  React.ComponentPropsWithoutRef<typeof CommandPrimitive.Item>\n>(({ className, ...props }, ref) => (\n  <CommandPrimitive.Item\n    ref={ref}\n    className={cn(\n      \"relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-hidden data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0\",\n      className\n    )}\n    {...props}\n  />\n))\n\nCommandItem.displayName = CommandPrimitive.Item.displayName\n\nconst CommandShortcut = ({\n  className,\n  ...props\n}: React.HTMLAttributes<HTMLSpanElement>) => {\n  return (\n    <span\n      className={cn(\n        \"ml-auto text-xs tracking-widest text-muted-foreground\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\nCommandShortcut.displayName = \"CommandShortcut\"\n\nexport {\n  Command,\n  CommandDialog,\n  CommandInput,\n  CommandList,\n  CommandEmpty,\n  CommandGroup,\n  CommandItem,\n  CommandShortcut,\n  CommandSeparator,\n}\n"
  },
  {
    "path": "src/components/ui/context-menu.tsx",
    "content": "\"use client\"\n\nimport * as React from \"react\"\nimport * as ContextMenuPrimitive from \"@radix-ui/react-context-menu\"\nimport { CheckIcon, ChevronRightIcon, CircleIcon } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction ContextMenu({\n  ...props\n}: React.ComponentProps<typeof ContextMenuPrimitive.Root>) {\n  return <ContextMenuPrimitive.Root data-slot=\"context-menu\" {...props} />\n}\n\nfunction ContextMenuTrigger({\n  ...props\n}: React.ComponentProps<typeof ContextMenuPrimitive.Trigger>) {\n  return (\n    <ContextMenuPrimitive.Trigger data-slot=\"context-menu-trigger\" {...props} />\n  )\n}\n\nfunction ContextMenuGroup({\n  ...props\n}: React.ComponentProps<typeof ContextMenuPrimitive.Group>) {\n  return (\n    <ContextMenuPrimitive.Group data-slot=\"context-menu-group\" {...props} />\n  )\n}\n\nfunction ContextMenuPortal({\n  ...props\n}: React.ComponentProps<typeof ContextMenuPrimitive.Portal>) {\n  return (\n    <ContextMenuPrimitive.Portal data-slot=\"context-menu-portal\" {...props} />\n  )\n}\n\nfunction ContextMenuSub({\n  ...props\n}: React.ComponentProps<typeof ContextMenuPrimitive.Sub>) {\n  return <ContextMenuPrimitive.Sub data-slot=\"context-menu-sub\" {...props} />\n}\n\nfunction ContextMenuRadioGroup({\n  ...props\n}: React.ComponentProps<typeof ContextMenuPrimitive.RadioGroup>) {\n  return (\n    <ContextMenuPrimitive.RadioGroup\n      data-slot=\"context-menu-radio-group\"\n      {...props}\n    />\n  )\n}\n\nfunction ContextMenuSubTrigger({\n  className,\n  inset,\n  children,\n  ...props\n}: React.ComponentProps<typeof ContextMenuPrimitive.SubTrigger> & {\n  inset?: boolean\n}) {\n  return (\n    <ContextMenuPrimitive.SubTrigger\n      data-slot=\"context-menu-sub-trigger\"\n      data-inset={inset}\n      className={cn(\n        \"focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n        className\n      )}\n      {...props}\n    >\n      {children}\n      <ChevronRightIcon className=\"ml-auto\" />\n    </ContextMenuPrimitive.SubTrigger>\n  )\n}\n\nfunction ContextMenuSubContent({\n  className,\n  ...props\n}: React.ComponentProps<typeof ContextMenuPrimitive.SubContent>) {\n  return (\n    <ContextMenuPrimitive.SubContent\n      data-slot=\"context-menu-sub-content\"\n      className={cn(\n        \"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-(--radix-context-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction ContextMenuContent({\n  className,\n  ...props\n}: React.ComponentProps<typeof ContextMenuPrimitive.Content>) {\n  return (\n    <ContextMenuPrimitive.Portal>\n      <ContextMenuPrimitive.Content\n        data-slot=\"context-menu-content\"\n        className={cn(\n          \"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-context-menu-content-available-height) min-w-[8rem] origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md\",\n          className\n        )}\n        {...props}\n      />\n    </ContextMenuPrimitive.Portal>\n  )\n}\n\nfunction ContextMenuItem({\n  className,\n  inset,\n  variant = \"default\",\n  ...props\n}: React.ComponentProps<typeof ContextMenuPrimitive.Item> & {\n  inset?: boolean\n  variant?: \"default\" | \"destructive\"\n}) {\n  return (\n    <ContextMenuPrimitive.Item\n      data-slot=\"context-menu-item\"\n      data-inset={inset}\n      data-variant={variant}\n      className={cn(\n        \"focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction ContextMenuCheckboxItem({\n  className,\n  children,\n  checked,\n  ...props\n}: React.ComponentProps<typeof ContextMenuPrimitive.CheckboxItem>) {\n  return (\n    <ContextMenuPrimitive.CheckboxItem\n      data-slot=\"context-menu-checkbox-item\"\n      className={cn(\n        \"focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n        className\n      )}\n      checked={checked}\n      {...props}\n    >\n      <span className=\"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center\">\n        <ContextMenuPrimitive.ItemIndicator>\n          <CheckIcon className=\"size-4\" />\n        </ContextMenuPrimitive.ItemIndicator>\n      </span>\n      {children}\n    </ContextMenuPrimitive.CheckboxItem>\n  )\n}\n\nfunction ContextMenuRadioItem({\n  className,\n  children,\n  ...props\n}: React.ComponentProps<typeof ContextMenuPrimitive.RadioItem>) {\n  return (\n    <ContextMenuPrimitive.RadioItem\n      data-slot=\"context-menu-radio-item\"\n      className={cn(\n        \"focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n        className\n      )}\n      {...props}\n    >\n      <span className=\"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center\">\n        <ContextMenuPrimitive.ItemIndicator>\n          <CircleIcon className=\"size-2 fill-current\" />\n        </ContextMenuPrimitive.ItemIndicator>\n      </span>\n      {children}\n    </ContextMenuPrimitive.RadioItem>\n  )\n}\n\nfunction ContextMenuLabel({\n  className,\n  inset,\n  ...props\n}: React.ComponentProps<typeof ContextMenuPrimitive.Label> & {\n  inset?: boolean\n}) {\n  return (\n    <ContextMenuPrimitive.Label\n      data-slot=\"context-menu-label\"\n      data-inset={inset}\n      className={cn(\n        \"text-foreground px-2 py-1.5 text-sm font-medium data-[inset]:pl-8\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction ContextMenuSeparator({\n  className,\n  ...props\n}: React.ComponentProps<typeof ContextMenuPrimitive.Separator>) {\n  return (\n    <ContextMenuPrimitive.Separator\n      data-slot=\"context-menu-separator\"\n      className={cn(\"bg-border -mx-1 my-1 h-px\", className)}\n      {...props}\n    />\n  )\n}\n\nfunction ContextMenuShortcut({\n  className,\n  ...props\n}: React.ComponentProps<\"span\">) {\n  return (\n    <span\n      data-slot=\"context-menu-shortcut\"\n      className={cn(\n        \"text-muted-foreground ml-auto text-xs tracking-widest\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nexport {\n  ContextMenu,\n  ContextMenuTrigger,\n  ContextMenuContent,\n  ContextMenuItem,\n  ContextMenuCheckboxItem,\n  ContextMenuRadioItem,\n  ContextMenuLabel,\n  ContextMenuSeparator,\n  ContextMenuShortcut,\n  ContextMenuGroup,\n  ContextMenuPortal,\n  ContextMenuSub,\n  ContextMenuSubContent,\n  ContextMenuSubTrigger,\n  ContextMenuRadioGroup,\n}\n"
  },
  {
    "path": "src/components/ui/dialog.tsx",
    "content": "\"use client\"\n\nimport * as React from \"react\"\nimport * as DialogPrimitive from \"@radix-ui/react-dialog\"\nimport { XIcon } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction Dialog({\n                  ...props\n                }: React.ComponentProps<typeof DialogPrimitive.Root>) {\n  return <DialogPrimitive.Root data-slot=\"dialog\" {...props} />\n}\n\nfunction DialogTrigger({\n                         ...props\n                       }: React.ComponentProps<typeof DialogPrimitive.Trigger>) {\n  return <DialogPrimitive.Trigger data-slot=\"dialog-trigger\" {...props} />\n}\n\nfunction DialogPortal({\n                        ...props\n                      }: React.ComponentProps<typeof DialogPrimitive.Portal>) {\n  return <DialogPrimitive.Portal data-slot=\"dialog-portal\" {...props} />\n}\n\nfunction DialogClose({\n                       ...props\n                     }: React.ComponentProps<typeof DialogPrimitive.Close>) {\n  return <DialogPrimitive.Close data-slot=\"dialog-close\" {...props} />\n}\n\nfunction DialogOverlay({\n                         className,\n                         ...props\n                       }: React.ComponentProps<typeof DialogPrimitive.Overlay>) {\n  return (\n      <DialogPrimitive.Overlay\n          data-slot=\"dialog-overlay\"\n          className={cn(\n              \"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50\",\n              className\n          )}\n          {...props}\n      />\n  )\n}\n\nfunction DialogContent({\n                         className,\n                         children,\n                         ...props\n                       }: React.ComponentProps<typeof DialogPrimitive.Content>) {\n  return (\n      <DialogPortal data-slot=\"dialog-portal\">\n        <DialogOverlay />\n        <DialogPrimitive.Content\n            data-slot=\"dialog-content\"\n            className={cn(\n                \"bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg\",\n                \"max-h-[90vh] overflow-y-auto overflow-x-hidden\",\n                className\n            )}\n            {...props}\n        >\n          {children}\n          <DialogPrimitive.Close className=\"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\">\n            <XIcon />\n            <span className=\"sr-only\">Close</span>\n          </DialogPrimitive.Close>\n        </DialogPrimitive.Content>\n      </DialogPortal>\n  )\n}\n\nfunction DialogHeader({ className, ...props }: React.ComponentProps<\"div\">) {\n  return (\n      <div\n          data-slot=\"dialog-header\"\n          className={cn(\"flex flex-col gap-2 text-center sm:text-left\", className)}\n          {...props}\n      />\n  )\n}\n\nfunction DialogFooter({ className, ...props }: React.ComponentProps<\"div\">) {\n  return (\n      <div\n          data-slot=\"dialog-footer\"\n          className={cn(\n              \"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end\",\n              className\n          )}\n          {...props}\n      />\n  )\n}\n\nfunction DialogTitle({\n                       className,\n                       ...props\n                     }: React.ComponentProps<typeof DialogPrimitive.Title>) {\n  return (\n      <DialogPrimitive.Title\n          data-slot=\"dialog-title\"\n          className={cn(\"text-lg leading-none font-semibold\", className)}\n          {...props}\n      />\n  )\n}\n\nfunction DialogDescription({\n                             className,\n                             ...props\n                           }: React.ComponentProps<typeof DialogPrimitive.Description>) {\n  return (\n      <DialogPrimitive.Description\n          data-slot=\"dialog-description\"\n          className={cn(\"text-muted-foreground text-sm\", className)}\n          {...props}\n      />\n  )\n}\n\nexport {\n  Dialog,\n  DialogClose,\n  DialogContent,\n  DialogDescription,\n  DialogFooter,\n  DialogHeader,\n  DialogOverlay,\n  DialogPortal,\n  DialogTitle,\n  DialogTrigger,\n}\n"
  },
  {
    "path": "src/components/ui/drawer.tsx",
    "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { Drawer as DrawerPrimitive } from \"vaul\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction Drawer({\n  ...props\n}: React.ComponentProps<typeof DrawerPrimitive.Root>) {\n  return <DrawerPrimitive.Root data-slot=\"drawer\" {...props} />\n}\n\nfunction DrawerTrigger({\n  ...props\n}: React.ComponentProps<typeof DrawerPrimitive.Trigger>) {\n  return <DrawerPrimitive.Trigger data-slot=\"drawer-trigger\" {...props} />\n}\n\nfunction DrawerPortal({\n  ...props\n}: React.ComponentProps<typeof DrawerPrimitive.Portal>) {\n  return <DrawerPrimitive.Portal data-slot=\"drawer-portal\" {...props} />\n}\n\nfunction DrawerClose({\n  ...props\n}: React.ComponentProps<typeof DrawerPrimitive.Close>) {\n  return <DrawerPrimitive.Close data-slot=\"drawer-close\" {...props} />\n}\n\nfunction DrawerOverlay({\n  className,\n  ...props\n}: React.ComponentProps<typeof DrawerPrimitive.Overlay>) {\n  return (\n    <DrawerPrimitive.Overlay\n      data-slot=\"drawer-overlay\"\n      className={cn(\n        \"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction DrawerContent({\n  className,\n  children,\n  ...props\n}: React.ComponentProps<typeof DrawerPrimitive.Content>) {\n  return (\n    <DrawerPortal data-slot=\"drawer-portal\">\n      <DrawerOverlay />\n      <DrawerPrimitive.Content\n        data-slot=\"drawer-content\"\n        className={cn(\n          \"group/drawer-content bg-background fixed z-50 flex h-auto flex-col\",\n          \"data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-lg data-[vaul-drawer-direction=top]:border-b\",\n          \"data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-lg data-[vaul-drawer-direction=bottom]:border-t\",\n          \"data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:border-l data-[vaul-drawer-direction=right]:sm:max-w-sm\",\n          \"data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:border-r data-[vaul-drawer-direction=left]:sm:max-w-sm\",\n          className\n        )}\n        {...props}\n      >\n        <div className=\"bg-muted mx-auto mt-4 hidden h-2 w-[100px] shrink-0 rounded-full group-data-[vaul-drawer-direction=bottom]/drawer-content:block\" />\n        {children}\n      </DrawerPrimitive.Content>\n    </DrawerPortal>\n  )\n}\n\nfunction DrawerHeader({ className, ...props }: React.ComponentProps<\"div\">) {\n  return (\n    <div\n      data-slot=\"drawer-header\"\n      className={cn(\"flex flex-col gap-1.5 p-4\", className)}\n      {...props}\n    />\n  )\n}\n\nfunction DrawerFooter({ className, ...props }: React.ComponentProps<\"div\">) {\n  return (\n    <div\n      data-slot=\"drawer-footer\"\n      className={cn(\"mt-auto flex flex-col gap-2 p-4\", className)}\n      {...props}\n    />\n  )\n}\n\nfunction DrawerTitle({\n  className,\n  ...props\n}: React.ComponentProps<typeof DrawerPrimitive.Title>) {\n  return (\n    <DrawerPrimitive.Title\n      data-slot=\"drawer-title\"\n      className={cn(\"text-foreground font-semibold\", className)}\n      {...props}\n    />\n  )\n}\n\nfunction DrawerDescription({\n  className,\n  ...props\n}: React.ComponentProps<typeof DrawerPrimitive.Description>) {\n  return (\n    <DrawerPrimitive.Description\n      data-slot=\"drawer-description\"\n      className={cn(\"text-muted-foreground text-sm\", className)}\n      {...props}\n    />\n  )\n}\n\nexport {\n  Drawer,\n  DrawerPortal,\n  DrawerOverlay,\n  DrawerTrigger,\n  DrawerClose,\n  DrawerContent,\n  DrawerHeader,\n  DrawerFooter,\n  DrawerTitle,\n  DrawerDescription,\n}\n"
  },
  {
    "path": "src/components/ui/dropdown-menu.tsx",
    "content": "\"use client\"\n\nimport * as React from \"react\"\nimport * as DropdownMenuPrimitive from \"@radix-ui/react-dropdown-menu\"\nimport { CheckIcon, ChevronRightIcon, CircleIcon } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction DropdownMenu({\n  ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Root>) {\n  return <DropdownMenuPrimitive.Root data-slot=\"dropdown-menu\" {...props} />\n}\n\nfunction DropdownMenuPortal({\n  ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Portal>) {\n  return (\n    <DropdownMenuPrimitive.Portal data-slot=\"dropdown-menu-portal\" {...props} />\n  )\n}\n\nfunction DropdownMenuTrigger({\n  ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Trigger>) {\n  return (\n    <DropdownMenuPrimitive.Trigger\n      data-slot=\"dropdown-menu-trigger\"\n      {...props}\n    />\n  )\n}\n\nfunction DropdownMenuContent({\n  className,\n  sideOffset = 4,\n  ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Content>) {\n  return (\n    <DropdownMenuPrimitive.Portal>\n      <DropdownMenuPrimitive.Content\n        data-slot=\"dropdown-menu-content\"\n        sideOffset={sideOffset}\n        className={cn(\n          \"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md\",\n          className\n        )}\n        {...props}\n      />\n    </DropdownMenuPrimitive.Portal>\n  )\n}\n\nfunction DropdownMenuGroup({\n  ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Group>) {\n  return (\n    <DropdownMenuPrimitive.Group data-slot=\"dropdown-menu-group\" {...props} />\n  )\n}\n\nfunction DropdownMenuItem({\n  className,\n  inset,\n  variant = \"default\",\n  ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Item> & {\n  inset?: boolean\n  variant?: \"default\" | \"destructive\"\n}) {\n  return (\n    <DropdownMenuPrimitive.Item\n      data-slot=\"dropdown-menu-item\"\n      data-inset={inset}\n      data-variant={variant}\n      className={cn(\n        \"focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction DropdownMenuCheckboxItem({\n  className,\n  children,\n  checked,\n  ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem>) {\n  return (\n    <DropdownMenuPrimitive.CheckboxItem\n      data-slot=\"dropdown-menu-checkbox-item\"\n      className={cn(\n        \"focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n        className\n      )}\n      checked={checked}\n      {...props}\n    >\n      <span className=\"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center\">\n        <DropdownMenuPrimitive.ItemIndicator>\n          <CheckIcon className=\"size-4\" />\n        </DropdownMenuPrimitive.ItemIndicator>\n      </span>\n      {children}\n    </DropdownMenuPrimitive.CheckboxItem>\n  )\n}\n\nfunction DropdownMenuRadioGroup({\n  ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.RadioGroup>) {\n  return (\n    <DropdownMenuPrimitive.RadioGroup\n      data-slot=\"dropdown-menu-radio-group\"\n      {...props}\n    />\n  )\n}\n\nfunction DropdownMenuRadioItem({\n  className,\n  children,\n  ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.RadioItem>) {\n  return (\n    <DropdownMenuPrimitive.RadioItem\n      data-slot=\"dropdown-menu-radio-item\"\n      className={cn(\n        \"focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n        className\n      )}\n      {...props}\n    >\n      <span className=\"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center\">\n        <DropdownMenuPrimitive.ItemIndicator>\n          <CircleIcon className=\"size-2 fill-current\" />\n        </DropdownMenuPrimitive.ItemIndicator>\n      </span>\n      {children}\n    </DropdownMenuPrimitive.RadioItem>\n  )\n}\n\nfunction DropdownMenuLabel({\n  className,\n  inset,\n  ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Label> & {\n  inset?: boolean\n}) {\n  return (\n    <DropdownMenuPrimitive.Label\n      data-slot=\"dropdown-menu-label\"\n      data-inset={inset}\n      className={cn(\n        \"px-2 py-1.5 text-sm font-medium data-[inset]:pl-8\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction DropdownMenuSeparator({\n  className,\n  ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Separator>) {\n  return (\n    <DropdownMenuPrimitive.Separator\n      data-slot=\"dropdown-menu-separator\"\n      className={cn(\"bg-border -mx-1 my-1 h-px\", className)}\n      {...props}\n    />\n  )\n}\n\nfunction DropdownMenuShortcut({\n  className,\n  ...props\n}: React.ComponentProps<\"span\">) {\n  return (\n    <span\n      data-slot=\"dropdown-menu-shortcut\"\n      className={cn(\n        \"text-muted-foreground ml-auto text-xs tracking-widest\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction DropdownMenuSub({\n  ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Sub>) {\n  return <DropdownMenuPrimitive.Sub data-slot=\"dropdown-menu-sub\" {...props} />\n}\n\nfunction DropdownMenuSubTrigger({\n  className,\n  inset,\n  children,\n  ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & {\n  inset?: boolean\n}) {\n  return (\n    <DropdownMenuPrimitive.SubTrigger\n      data-slot=\"dropdown-menu-sub-trigger\"\n      data-inset={inset}\n      className={cn(\n        \"focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8\",\n        className\n      )}\n      {...props}\n    >\n      {children}\n      <ChevronRightIcon className=\"ml-auto size-4\" />\n    </DropdownMenuPrimitive.SubTrigger>\n  )\n}\n\nfunction DropdownMenuSubContent({\n  className,\n  ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.SubContent>) {\n  return (\n    <DropdownMenuPrimitive.SubContent\n      data-slot=\"dropdown-menu-sub-content\"\n      className={cn(\n        \"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nexport {\n  DropdownMenu,\n  DropdownMenuPortal,\n  DropdownMenuTrigger,\n  DropdownMenuContent,\n  DropdownMenuGroup,\n  DropdownMenuLabel,\n  DropdownMenuItem,\n  DropdownMenuCheckboxItem,\n  DropdownMenuRadioGroup,\n  DropdownMenuRadioItem,\n  DropdownMenuSeparator,\n  DropdownMenuShortcut,\n  DropdownMenuSub,\n  DropdownMenuSubTrigger,\n  DropdownMenuSubContent,\n}\n"
  },
  {
    "path": "src/components/ui/dropzone.tsx",
    "content": "\"use client\"\nimport {cn} from \"@/lib/utils\";\nimport {\n    createContext,\n    forwardRef,\n    useCallback,\n    useContext,\n    useId,\n    useMemo,\n    useReducer,\n    useState,\n} from \"react\";\nimport {\n    Accept,\n    FileRejection,\n    useDropzone as rootUseDropzone,\n} from \"react-dropzone\";\nimport {Button, ButtonVariantsProps} from \"@/components/ui/button\";\n\ntype DropzoneResult<TUploadRes, TUploadError> =\n    | {\n    status: \"pending\";\n}\n    | {\n    status: \"error\";\n    error: TUploadError;\n}\n    | {\n    status: \"success\";\n    result: TUploadRes;\n};\n\nexport type FileStatus<TUploadRes, TUploadError> = {\n    id: string;\n    fileName: string;\n    file: File;\n    tries: number;\n} & (\n    | {\n    status: \"pending\";\n    result?: undefined;\n    error?: undefined;\n}\n    | {\n    status: \"error\";\n    error: TUploadError;\n    result?: undefined;\n}\n    | {\n    status: \"success\";\n    result: TUploadRes;\n    error?: undefined;\n}\n    );\n\nconst fileStatusReducer = <TUploadRes, TUploadError>(\n    state: FileStatus<TUploadRes, TUploadError>[],\n    action:\n        | {\n        type: \"add\";\n        id: string;\n        fileName: string;\n        file: File;\n    }\n        | {\n        type: \"remove\";\n        id: string;\n    }\n        | ({\n        type: \"update-status\";\n        id: string;\n    } & DropzoneResult<TUploadRes, TUploadError>),\n): FileStatus<TUploadRes, TUploadError>[] => {\n    switch (action.type) {\n        case \"add\":\n            return [\n                ...state,\n                {\n                    id: action.id,\n                    fileName: action.fileName,\n                    file: action.file,\n                    status: \"pending\",\n                    tries: 1,\n                },\n            ];\n        case \"remove\":\n            return state.filter((fileStatus) => fileStatus.id !== action.id);\n        case \"update-status\":\n            return state.map((fileStatus) => {\n                if (fileStatus.id === action.id) {\n                    // eslint-disable-next-line @typescript-eslint/no-unused-vars\n                    const {id, type, ...rest} = action;\n                    return {\n                        ...fileStatus,\n                        ...rest,\n                        tries:\n                            action.status === \"pending\"\n                                ? fileStatus.tries + 1\n                                : fileStatus.tries,\n                    } as FileStatus<TUploadRes, TUploadError>;\n                }\n                return fileStatus;\n            });\n    }\n};\ntype DropZoneErrorCode = (typeof dropZoneErrorCodes)[number];\nconst dropZoneErrorCodes = [\n    \"file-invalid-type\",\n    \"file-too-large\",\n    \"file-too-small\",\n    \"too-many-files\",\n] as const;\n\nconst getDropZoneErrorCodes = (fileRejections: FileRejection[]) => {\n    const errors = fileRejections.map((rejection) => {\n        return rejection.errors\n            .filter((error) =>\n                dropZoneErrorCodes.includes(error.code as DropZoneErrorCode),\n            )\n            .map((error) => error.code) as DropZoneErrorCode[];\n    });\n    return Array.from(new Set(errors.flat()));\n};\n\nconst getRootError = (\n    errorCodes: DropZoneErrorCode[],\n    limits: {\n        accept?: Accept;\n        maxSize?: number;\n        minSize?: number;\n        maxFiles?: number;\n    },\n) => {\n    const errors = errorCodes.map((error) => {\n        switch (error) {\n            case \"file-invalid-type\":\n                const acceptedTypes = Object.values(limits.accept ?? {})\n                    .flat()\n                    .join(\", \");\n                return `only ${acceptedTypes} are allowed`;\n            case \"file-too-large\":\n                const maxMb = limits.maxSize\n                    ? (limits.maxSize / (1024 * 1024)).toFixed(2)\n                    : \"infinite?\";\n                return `max size is ${maxMb}MB`;\n            case \"file-too-small\":\n                const roundedMinSize = limits.minSize\n                    ? (limits.minSize / (1024 * 1024)).toFixed(2)\n                    : \"negative?\";\n                return `min size is ${roundedMinSize}MB`;\n            case \"too-many-files\":\n                return `max ${limits.maxFiles} files`;\n        }\n    });\n    const joinedErrors = errors.join(\", \");\n    return joinedErrors.charAt(0).toUpperCase() + joinedErrors.slice(1);\n};\n\ntype UseDropzoneProps<TUploadRes, TUploadError> = {\n    onDropFile: (\n        file: File,\n    ) => Promise<\n        Exclude<DropzoneResult<TUploadRes, TUploadError>, { status: \"pending\" }>\n    >;\n    onRemoveFile?: (id: string) => void | Promise<void>;\n    onFileUploaded?: (result: TUploadRes) => void;\n    onFileUploadError?: (error: TUploadError) => void;\n    onAllUploaded?: () => void;\n    onRootError?: (error: string | undefined) => void;\n    maxRetryCount?: number;\n    autoRetry?: boolean;\n    validation?: {\n        accept?: Accept;\n        minSize?: number;\n        maxSize?: number;\n        maxFiles?: number;\n    };\n    shiftOnMaxFiles?: boolean;\n} & (TUploadError extends string\n    ? {\n        shapeUploadError?: (error: TUploadError) => string | void;\n    }\n    : {\n        shapeUploadError: (error: TUploadError) => string | void;\n    });\n\ninterface UseDropzoneReturn<TUploadRes, TUploadError> {\n    getRootProps: ReturnType<typeof rootUseDropzone>[\"getRootProps\"];\n    getInputProps: ReturnType<typeof rootUseDropzone>[\"getInputProps\"];\n    onRemoveFile: (id: string) => Promise<void>;\n    onRetry: (id: string) => Promise<void>;\n    canRetry: (id: string) => boolean;\n    fileStatuses: FileStatus<TUploadRes, TUploadError>[];\n    isInvalid: boolean;\n    isDragActive: boolean;\n    rootError: string | undefined;\n    inputId: string;\n    rootMessageId: string;\n    rootDescriptionId: string;\n    getFileMessageId: (id: string) => string;\n}\n\nconst useDropzone = <TUploadRes, TUploadError = string>(\n    props: UseDropzoneProps<TUploadRes, TUploadError>,\n): UseDropzoneReturn<TUploadRes, TUploadError> => {\n    const {\n        onDropFile: pOnDropFile,\n        onRemoveFile: pOnRemoveFile,\n        shapeUploadError: pShapeUploadError,\n        onFileUploaded: pOnFileUploaded,\n        onFileUploadError: pOnFileUploadError,\n        onAllUploaded: pOnAllUploaded,\n        onRootError: pOnRootError,\n        maxRetryCount,\n        autoRetry,\n        validation,\n        shiftOnMaxFiles,\n    } = props;\n\n    const inputId = useId();\n    const rootMessageId = `${inputId}-root-message`;\n    const rootDescriptionId = `${inputId}-description`;\n    const [rootError, _setRootError] = useState<string | undefined>(undefined);\n\n    const setRootError = useCallback(\n        (error: string | undefined) => {\n            _setRootError(error);\n            if (pOnRootError !== undefined) {\n                pOnRootError(error);\n            }\n        },\n        [pOnRootError, _setRootError],\n    );\n\n    const [fileStatuses, dispatch] = useReducer(fileStatusReducer, []);\n\n    const isInvalid = useMemo(() => {\n        return (\n            fileStatuses.filter((file) => file.status === \"error\").length > 0 ||\n            rootError !== undefined\n        );\n    }, [fileStatuses, rootError]);\n\n    const _uploadFile = useCallback(\n        async (file: File, id: string, tries = 0) => {\n            const result = await pOnDropFile(file);\n\n            if (result.status === \"error\") {\n                if (autoRetry === true && tries < (maxRetryCount ?? Infinity)) {\n                    dispatch({type: \"update-status\", id, status: \"pending\"});\n                    return _uploadFile(file, id, tries + 1);\n                }\n\n                dispatch({\n                    type: \"update-status\",\n                    id,\n                    status: \"error\",\n                    error:\n                        pShapeUploadError !== undefined\n                            ? pShapeUploadError(result.error)\n                            : result.error,\n                });\n                if (pOnFileUploadError !== undefined) {\n                    pOnFileUploadError(result.error);\n                }\n                return;\n            }\n            if (pOnFileUploaded !== undefined) {\n                pOnFileUploaded(result.result);\n            }\n            dispatch({\n                type: \"update-status\",\n                id,\n                ...result,\n            });\n        },\n        [\n            autoRetry,\n            maxRetryCount,\n            pOnDropFile,\n            pShapeUploadError,\n            pOnFileUploadError,\n            pOnFileUploaded,\n        ],\n    );\n\n    const onRemoveFile = useCallback(\n        async (id: string) => {\n            await pOnRemoveFile?.(id);\n            dispatch({type: \"remove\", id});\n        },\n        [pOnRemoveFile],\n    );\n\n    const canRetry = useCallback(\n        (id: string) => {\n            const fileStatus = fileStatuses.find((file) => file.id === id);\n            return (\n                fileStatus?.status === \"error\" &&\n                fileStatus.tries < (maxRetryCount ?? Infinity)\n            );\n        },\n        [fileStatuses, maxRetryCount],\n    );\n\n    const onRetry = useCallback(\n        async (id: string) => {\n            if (!canRetry(id)) {\n                return;\n            }\n            dispatch({type: \"update-status\", id, status: \"pending\"});\n            const fileStatus = fileStatuses.find((file) => file.id === id);\n            if (!fileStatus || fileStatus.status !== \"error\") {\n                return;\n            }\n            await _uploadFile(fileStatus.file, id);\n        },\n        [canRetry, fileStatuses, _uploadFile],\n    );\n\n    const getFileMessageId = (id: string) => `${inputId}-${id}-message`;\n\n    const dropzone = rootUseDropzone({\n        accept: validation?.accept,\n        minSize: validation?.minSize,\n        maxSize: validation?.maxSize,\n        onDropAccepted: async (newFiles) => {\n            setRootError(undefined);\n\n            // useDropzone hook only checks max file count per group of uploaded files, allows going over if in multiple batches\n            const fileCount = fileStatuses.length;\n            const maxNewFiles =\n                validation?.maxFiles === undefined\n                    ? Infinity\n                    : validation?.maxFiles - fileCount;\n\n            if (maxNewFiles < newFiles.length) {\n                if (shiftOnMaxFiles === true) {\n                } else {\n                    setRootError(getRootError([\"too-many-files\"], validation ?? {}));\n                }\n            }\n\n            const slicedNewFiles =\n                shiftOnMaxFiles === true ? newFiles : newFiles.slice(0, maxNewFiles);\n\n            const onDropFilePromises = slicedNewFiles.map(async (file, index) => {\n                if (fileCount + 1 > maxNewFiles) {\n                    await onRemoveFile(fileStatuses[index].id);\n                }\n\n                const id = crypto.randomUUID();\n                dispatch({type: \"add\", fileName: file.name, file, id});\n                await _uploadFile(file, id);\n            });\n\n            await Promise.all(onDropFilePromises);\n            if (pOnAllUploaded !== undefined) {\n                pOnAllUploaded();\n            }\n        },\n        onDropRejected: (fileRejections) => {\n            const errorMessage = getRootError(\n                getDropZoneErrorCodes(fileRejections),\n                validation ?? {}\n            );\n            setRootError(errorMessage);\n        },\n    });\n\n    return {\n        getRootProps: dropzone.getRootProps,\n        getInputProps: dropzone.getInputProps,\n        inputId,\n        rootMessageId,\n        rootDescriptionId,\n        getFileMessageId,\n        onRemoveFile,\n        onRetry,\n        canRetry,\n        fileStatuses: fileStatuses as FileStatus<TUploadRes, TUploadError>[],\n        isInvalid,\n        rootError,\n        isDragActive: dropzone.isDragActive,\n    };\n};\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst DropZoneContext = createContext<UseDropzoneReturn<any, any>>({\n    getRootProps: () => ({}) as never,\n    getInputProps: () => ({}) as never,\n    onRemoveFile: async () => {\n    },\n    onRetry: async () => {\n    },\n    canRetry: () => false,\n    fileStatuses: [],\n    isInvalid: false,\n    isDragActive: false,\n    rootError: undefined,\n    inputId: \"\",\n    rootMessageId: \"\",\n    rootDescriptionId: \"\",\n    getFileMessageId: () => \"\",\n});\n\nconst useDropzoneContext = <TUploadRes, TUploadError>() => {\n    return useContext(DropZoneContext) as UseDropzoneReturn<\n        TUploadRes,\n        TUploadError\n    >;\n};\n\ninterface DropzoneProps<TUploadRes, TUploadError>\n    extends UseDropzoneReturn<TUploadRes, TUploadError> {\n    children: React.ReactNode;\n}\n\nconst Dropzone = <TUploadRes, TUploadError>(\n    props: DropzoneProps<TUploadRes, TUploadError>,\n) => {\n    const {children, ...rest} = props;\n    return (\n        <DropZoneContext.Provider value={rest}>{children}</DropZoneContext.Provider>\n    );\n};\nDropzone.displayName = \"Dropzone\";\n\ninterface DropZoneAreaProps extends React.HTMLAttributes<HTMLDivElement> {\n}\n\nconst DropZoneArea = forwardRef<HTMLDivElement, DropZoneAreaProps>(\n    ({className, children, ...props}, forwardedRef) => {\n        const context = useDropzoneContext();\n\n        if (!context) {\n            throw new Error(\"DropzoneArea must be used within a Dropzone\");\n        }\n\n        const {onFocus, onBlur, onDragEnter, onDragLeave, onDrop, ref} =\n            context.getRootProps();\n\n        return (\n            // A11y behavior is handled through Trigger. All of these are only relevant to drag and drop which means this should be fine?\n            // eslint-disable-next-line jsx-a11y/no-static-element-interactions\n            <div\n                ref={(instance) => {\n                    // TODO: test if this actually works?\n                    ref.current = instance;\n                    if (typeof forwardedRef === \"function\") {\n                        forwardedRef(instance);\n                    } else if (forwardedRef) {\n                        forwardedRef.current = instance;\n                    }\n                }}\n                onFocus={onFocus}\n                onBlur={onBlur}\n                onDragEnter={onDragEnter}\n                onDragLeave={onDragLeave}\n                onDrop={onDrop}\n                {...props}\n                aria-label=\"dropzone\"\n                className={cn(\n                    \"flex items-center justify-center rounded-md border border-input bg-background px-4 py-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2\",\n                    context.isDragActive && \"animate-pulse bg-black/5\",\n                    context.isInvalid && \"border-destructive\",\n                    className,\n                )}\n            >\n                {children}\n            </div>\n        );\n    },\n);\nDropZoneArea.displayName = \"DropZoneArea\";\n\nexport interface DropzoneDescriptionProps\n    extends React.HTMLAttributes<HTMLParagraphElement> {\n}\n\nconst DropzoneDescription = forwardRef<\n    HTMLParagraphElement,\n    DropzoneDescriptionProps\n>((props, ref) => {\n    const {className, ...rest} = props;\n    const context = useDropzoneContext();\n    if (!context) {\n        throw new Error(\"DropzoneDescription must be used within a Dropzone\");\n    }\n\n    return (\n        <p\n            ref={ref}\n            id={context.rootDescriptionId}\n            {...rest}\n            className={cn(\"pb-1 text-sm text-muted-foreground\", className)}\n        />\n    );\n});\nDropzoneDescription.displayName = \"DropzoneDescription\";\n\ninterface DropzoneFileListContext<TUploadRes, TUploadError> {\n    onRemoveFile: () => Promise<void>;\n    onRetry: () => Promise<void>;\n    fileStatus: FileStatus<TUploadRes, TUploadError>;\n    canRetry: boolean;\n    dropzoneId: string;\n    messageId: string;\n}\n\nconst DropzoneFileListContext = createContext<\n    DropzoneFileListContext<unknown, unknown>\n>({\n    onRemoveFile: async () => {\n    },\n    onRetry: async () => {\n    },\n    fileStatus: {} as FileStatus<unknown, unknown>,\n    canRetry: false,\n    dropzoneId: \"\",\n    messageId: \"\",\n});\n\nconst useDropzoneFileListContext = () => {\n    return useContext(DropzoneFileListContext);\n};\n\ninterface DropZoneFileListProps\n    extends React.OlHTMLAttributes<HTMLOListElement> {\n}\n\nconst DropzoneFileList = forwardRef<HTMLOListElement, DropZoneFileListProps>(\n    (props, ref) => {\n        const context = useDropzoneContext();\n        if (!context) {\n            throw new Error(\"DropzoneFileList must be used within a Dropzone\");\n        }\n        return (\n            <ol\n                ref={ref}\n                aria-label=\"dropzone-file-list\"\n                {...props}\n                className={cn(\"flex flex-col gap-4\", props.className)}\n            >\n                {props.children}\n            </ol>\n        );\n    },\n);\nDropzoneFileList.displayName = \"DropzoneFileList\";\n\ninterface DropzoneFileListItemProps<TUploadRes, TUploadError>\n    extends React.LiHTMLAttributes<HTMLLIElement> {\n    file: FileStatus<TUploadRes, TUploadError>;\n}\n\nconst DropzoneFileListItem = forwardRef<\n    HTMLLIElement,\n    DropzoneFileListItemProps<unknown, unknown>\n>(({className, ...props}, ref) => {\n    const fileId = props.file.id;\n    const {\n        onRemoveFile: cOnRemoveFile,\n        onRetry: cOnRetry,\n        getFileMessageId: cGetFileMessageId,\n        canRetry: cCanRetry,\n        inputId: cInputId,\n    } = useDropzoneContext();\n\n    const onRemoveFile = useCallback(\n        () => cOnRemoveFile(fileId),\n        [fileId, cOnRemoveFile],\n    );\n    const onRetry = useCallback(() => cOnRetry(fileId), [fileId, cOnRetry]);\n    const messageId = cGetFileMessageId(fileId);\n    const isInvalid = props.file.status === \"error\";\n    const canRetry = useMemo(() => cCanRetry(fileId), [fileId, cCanRetry]);\n    return (\n        <DropzoneFileListContext.Provider\n            value={{\n                onRemoveFile,\n                onRetry,\n                fileStatus: props.file,\n                canRetry,\n                dropzoneId: cInputId,\n                messageId,\n            }}\n        >\n            <li\n                ref={ref}\n                aria-label=\"dropzone-file-list-item\"\n                aria-describedby={isInvalid ? messageId : undefined}\n                className={cn(\n                    \"flex flex-col justify-center gap-2 rounded-md bg-muted/40 px-4 py-2\",\n                    className,\n                )}\n            >\n                {props.children}\n            </li>\n        </DropzoneFileListContext.Provider>\n    );\n});\nDropzoneFileListItem.displayName = \"DropzoneFileListItem\";\n\ninterface DropzoneFileMessageProps\n    extends React.HTMLAttributes<HTMLParagraphElement> {\n}\n\nconst DropzoneFileMessage = forwardRef<\n    HTMLParagraphElement,\n    DropzoneFileMessageProps\n>((props, ref) => {\n    const {children, ...rest} = props;\n    const context = useDropzoneFileListContext();\n    if (!context) {\n        throw new Error(\n            \"DropzoneFileMessage must be used within a DropzoneFileListItem\",\n        );\n    }\n\n    const body =\n        context.fileStatus.status === \"error\"\n            ? String(context.fileStatus.error)\n            : children;\n    return (\n        <p\n            ref={ref}\n            id={context.messageId}\n            {...rest}\n            className={cn(\n                \"h-5 text-[0.8rem] font-medium text-destructive\",\n                rest.className,\n            )}\n        >\n            {body}\n        </p>\n    );\n});\nDropzoneFileMessage.displayName = \"DropzoneFileMessage\";\n\ninterface DropzoneMessageProps\n    extends React.HTMLAttributes<HTMLParagraphElement> {\n}\n\nconst DropzoneMessage = forwardRef<HTMLParagraphElement, DropzoneMessageProps>(\n    (props, ref) => {\n        const {children, ...rest} = props;\n        const context = useDropzoneContext();\n        if (!context) {\n            throw new Error(\"DropzoneRootMessage must be used within a Dropzone\");\n        }\n\n        const body = context.rootError ? String(context.rootError) : children;\n        return (\n            <p\n                ref={ref}\n                id={context.rootMessageId}\n                {...rest}\n                className={cn(\n                    \"h-5 text-[0.8rem] font-medium text-destructive\",\n                    rest.className,\n                )}\n            >\n                {body}\n            </p>\n        );\n    },\n);\nDropzoneMessage.displayName = \"DropzoneMessage\";\n\ninterface DropzoneRemoveFileProps extends ButtonVariantsProps {\n    className?: string;\n    children?: React.ReactNode;\n}\n\nconst DropzoneRemoveFile = forwardRef<\n    HTMLButtonElement,\n    DropzoneRemoveFileProps\n>(({className, ...props}, ref) => {\n    const context = useDropzoneFileListContext();\n    if (!context) {\n        throw new Error(\n            \"DropzoneRemoveFile must be used within a DropzoneFileListItem\",\n        );\n    }\n    return (\n        <Button\n            ref={ref}\n            onClick={context.onRemoveFile}\n            type=\"button\"\n            size=\"icon\"\n            {...props}\n            className={cn(\n                \"aria-disabled:pointer-events-none aria-disabled:opacity-50\",\n                className,\n            )}\n        >\n            {props.children}\n            <span className=\"sr-only\">Remove file</span>\n        </Button>\n    );\n});\nDropzoneRemoveFile.displayName = \"DropzoneRemoveFile\";\n\ninterface DropzoneRetryFileProps extends ButtonVariantsProps {\n    className?: string;\n    children?: React.ReactNode;\n}\n\nconst DropzoneRetryFile = forwardRef<HTMLButtonElement, DropzoneRetryFileProps>(\n    ({className, ...props}, ref) => {\n        const context = useDropzoneFileListContext();\n\n        if (!context) {\n            throw new Error(\n                \"DropzoneRetryFile must be used within a DropzoneFileListItem\",\n            );\n        }\n\n        const canRetry = context.canRetry;\n\n        return (\n            <Button\n                ref={ref}\n                aria-disabled={!canRetry}\n                aria-label=\"retry\"\n                onClick={context.onRetry}\n                type=\"button\"\n                size=\"icon\"\n                {...props}\n                className={cn(\n                    \"aria-disabled:pointer-events-none aria-disabled:opacity-50\",\n                    className,\n                )}\n            >\n                {props.children}\n                <span className=\"sr-only\">Retry</span>\n            </Button>\n        );\n    },\n);\nDropzoneRetryFile.displayName = \"DropzoneRetryFile\";\n\ninterface DropzoneTriggerProps\n    extends React.LabelHTMLAttributes<HTMLLabelElement> {\n}\n\nconst DropzoneTrigger = forwardRef<HTMLLabelElement, DropzoneTriggerProps>(\n    ({className, children, ...props}, ref) => {\n        const context = useDropzoneContext();\n        if (!context) {\n            throw new Error(\"DropzoneTrigger must be used within a Dropzone\");\n        }\n\n        const {fileStatuses, getFileMessageId} = context;\n\n        const fileMessageIds = useMemo(\n            () =>\n                fileStatuses\n                    .filter((file) => file.status === \"error\")\n                    .map((file) => getFileMessageId(file.id)),\n            [fileStatuses, getFileMessageId],\n        );\n\n        return (\n            <label\n                ref={ref}\n                {...props}\n                className={cn(\n                    \"cursor-pointer rounded-sm bg-secondary px-4 py-2 font-medium ring-offset-background transition-colors focus-within:outline-none hover:bg-secondary/80 has-[input:focus-visible]:ring-2 has-[input:focus-visible]:ring-ring has-[input:focus-visible]:ring-offset-2\",\n                    className,\n                )}\n            >\n                {children}\n                <input\n                    {...context.getInputProps({\n                        style: {\n                            display: undefined,\n                        },\n                        className: \"sr-only\",\n                        tabIndex: undefined,\n                    })}\n                    aria-describedby={\n                        context.isInvalid\n                            ? [context.rootMessageId, ...fileMessageIds].join(\" \")\n                            : undefined\n                    }\n                    aria-invalid={context.isInvalid}\n                />\n            </label>\n        );\n    },\n);\nDropzoneTrigger.displayName = \"DropzoneTrigger\";\n\ninterface InfiniteProgressProps extends React.HTMLAttributes<HTMLDivElement> {\n    status: \"pending\" | \"success\" | \"error\";\n}\n\nconst valueTextMap = {\n    pending: \"indeterminate\",\n    success: \"100%\",\n    error: \"error\",\n};\n\nconst InfiniteProgress = forwardRef<HTMLDivElement, InfiniteProgressProps>(\n    ({className, ...props}, ref) => {\n        const done = props.status === \"success\" || props.status === \"error\";\n        const error = props.status === \"error\";\n        return (\n            <div\n                ref={ref}\n                role=\"progressbar\"\n                aria-valuemin={0}\n                aria-valuemax={100}\n                aria-valuetext={valueTextMap[props.status]}\n                {...props}\n                className={cn(\n                    \"relative h-2 w-full overflow-hidden rounded-full bg-muted\",\n                    className,\n                )}\n            >\n                <div\n                    //   TODO: add proper done transition\n                    className={cn(\n                        \"h-full w-full rounded-full bg-primary\",\n                        done ? \"translate-x-0\" : \"animate-infinite-progress\",\n                        error && \"bg-destructive\",\n                    )}\n                />\n            </div>\n        );\n    },\n);\nInfiniteProgress.displayName = \"InfiniteProgress\";\n\nexport {\n    Dropzone,\n    DropZoneArea,\n    DropzoneDescription,\n    DropzoneFileList,\n    DropzoneFileListItem,\n    DropzoneFileMessage,\n    DropzoneMessage,\n    DropzoneRemoveFile,\n    DropzoneRetryFile,\n    DropzoneTrigger,\n    InfiniteProgress,\n    useDropzone,\n};\n"
  },
  {
    "path": "src/components/ui/form.tsx",
    "content": "import {cn} from \"@/lib/utils\";\nimport {zodResolver} from \"@hookform/resolvers/zod\";\nimport type * as LabelPrimitive from \"@radix-ui/react-label\";\nimport {Slot} from \"@radix-ui/react-slot\";\nimport * as React from \"react\";\nimport type {\n  ControllerProps,\n  FieldPath,\n  FieldValues,\n  SubmitHandler,\n  UseFormProps,\n  UseFormReturn,\n} from \"react-hook-form\";\nimport {\n  Controller,\n  FormProvider,\n  useForm,\n  useFormContext,\n} from \"react-hook-form\";\nimport type {TypeOf, ZodSchema} from \"zod\";\nimport {Label} from \"./label\";\n\ntype FormProps<T extends FieldValues> = Omit<\n    React.ComponentProps<\"form\">,\n    \"onSubmit\"\n> & {\n  form: UseFormReturn<T>;\n  onSubmit: SubmitHandler<T>;\n  disabled?: boolean;\n};\n\nconst Form = <T extends FieldValues>({\n                                       form,\n                                       onSubmit,\n                                       children,\n                                       className,\n                                       disabled,\n                                       ...props\n                                     }: FormProps<T>) => (\n    <FormProvider {...form}>\n      <form\n          onSubmit={form.handleSubmit(onSubmit)}\n          {...props}\n          className={className}\n      >\n        <fieldset\n            disabled={disabled || form.formState.isSubmitting}\n            className={className}\n        >\n          {children}\n        </fieldset>\n      </form>\n    </FormProvider>\n);\n\ntype FormFieldContextValue<\n    TFieldValues extends FieldValues = FieldValues,\n    TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\n> = {\n  name: TName;\n};\n\nconst FormFieldContext = React.createContext<FormFieldContextValue>(\n    {} as FormFieldContextValue\n);\n\nconst FormField = <\n    TFieldValues extends FieldValues = FieldValues,\n    TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>\n>({\n    ...props\n  }: ControllerProps<TFieldValues, TName>) => {\n  return (\n      <FormFieldContext.Provider value={{name: props.name}}>\n        <Controller {...props} />\n      </FormFieldContext.Provider>\n  );\n};\n\nconst useFormField = () => {\n  const fieldContext = React.useContext(FormFieldContext);\n  const itemContext = React.useContext(FormItemContext);\n  const {getFieldState, formState} = useFormContext();\n\n  const fieldState = getFieldState(fieldContext.name, formState);\n\n  if (!fieldContext.name) {\n    throw new Error(\"useFormField should be used within <FormField>\");\n  }\n\n  const {id} = itemContext;\n\n  return {\n    id,\n    name: fieldContext.name,\n    formItemId: `${id}-form-item`,\n    formDescriptionId: `${id}-form-item-description`,\n    formMessageId: `${id}-form-item-message`,\n    ...fieldState,\n  };\n};\n\ntype FormItemContextValue = {\n  id: string;\n};\n\nconst FormItemContext = React.createContext<FormItemContextValue>(\n    {} as FormItemContextValue\n);\n\nconst FormItem = React.forwardRef<\n    HTMLDivElement,\n    React.HTMLAttributes<HTMLDivElement>\n>(({className, ...props}, ref) => {\n  const id = React.useId();\n\n  return (\n      <FormItemContext.Provider value={{id}}>\n        <div ref={ref} className={cn(\"space-y-2\", className)} {...props} />\n      </FormItemContext.Provider>\n  );\n});\nFormItem.displayName = \"FormItem\";\n\nconst FormLabel = React.forwardRef<\n    React.ElementRef<typeof LabelPrimitive.Root>,\n    React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>\n>(({className, ...props}, ref) => {\n  const {error, formItemId} = useFormField();\n\n  return (\n      <Label\n          ref={ref}\n          className={cn(error && \"text-destructive\", className)}\n          htmlFor={formItemId}\n          {...props}\n      />\n  );\n});\nFormLabel.displayName = \"FormLabel\";\n\nconst FormControl = React.forwardRef<\n    React.ElementRef<typeof Slot>,\n    React.ComponentPropsWithoutRef<typeof Slot>\n>(({...props}, ref) => {\n  const {error, formItemId, formDescriptionId, formMessageId} =\n      useFormField();\n\n  return (\n      <Slot\n          ref={ref}\n          id={formItemId}\n          aria-describedby={\n            error ? `${formDescriptionId} ${formMessageId}` : `${formDescriptionId}`\n          }\n          aria-invalid={!!error}\n          {...props}\n      />\n  );\n});\nFormControl.displayName = \"FormControl\";\n\nconst FormDescription = React.forwardRef<\n    HTMLParagraphElement,\n    React.HTMLAttributes<HTMLParagraphElement>\n>(({className, ...props}, ref) => {\n  const {formDescriptionId} = useFormField();\n\n  return (\n      <p\n          ref={ref}\n          id={formDescriptionId}\n          className={cn(\"text-sm text-muted-foreground\", className)}\n          {...props}\n      />\n  );\n});\nFormDescription.displayName = \"FormDescription\";\n\nconst FormMessage = React.forwardRef<\n    HTMLParagraphElement,\n    React.HTMLAttributes<HTMLParagraphElement>\n>(({className, children, ...props}, ref) => {\n  const {error, formMessageId} = useFormField();\n  const body = error ? String(error.message) : children;\n\n  if (!body) {\n    return null;\n  }\n\n  return (\n      <p\n          ref={ref}\n          id={formMessageId}\n          className={cn(\"text-sm font-medium text-destructive\", className)}\n          {...props}\n      >\n        {body}\n      </p>\n  );\n});\nFormMessage.displayName = \"FormMessage\";\n\ntype UseZodFormProps<Z extends ZodSchema> = Exclude<\n    UseFormProps<TypeOf<Z>>,\n    \"resolver\"\n> & {\n  schema: Z;\n};\n\n\n// const useZodForm = <Z extends ZodSchema>({\n//                                            schema,\n//                                            ...formProps\n//                                          }: UseZodFormProps<Z>) =>\n//     useForm({\n//       ...formProps,\n//         // @ts-ignore\n//       resolver: zodResolver(schema),\n//     });\n\n\nconst useZodForm = <Z extends ZodSchema>({\n                                             schema,\n                                             ...formProps\n                                         }: UseZodFormProps<Z>): UseFormReturn<TypeOf<Z>> =>\n    useForm<TypeOf<Z>>({\n        ...formProps,\n        // @ts-ignore\n        resolver: zodResolver(schema),\n    });\n\nexport {\n  Form,\n  FormControl,\n  FormDescription,\n  FormField,\n  FormItem,\n  FormLabel,\n  FormMessage,\n  useFormField,\n  useZodForm,\n};"
  },
  {
    "path": "src/components/ui/github-button.tsx",
    "content": "'use client';\n\nimport React, { useCallback, useEffect, useState } from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { Star } from 'lucide-react';\nimport { motion, useInView, type SpringOptions, type UseInViewOptions } from 'motion/react';\nimport { cn } from '@/lib/utils';\n\nconst githubButtonVariants = cva(\n  'cursor-pointer relative overflow-hidden will-change-transform backface-visibility-hidden transform-gpu group whitespace-nowrap focus-visible:outline-hidden inline-flex items-center justify-center whitespace-nowrap font-medium ring-offset-background disabled:pointer-events-none disabled:opacity-60 [&_svg]:shrink-0',\n  {\n    variants: {\n      variant: {\n        default:\n          'bg-zinc-950 hover:bg-zinc-900 text-white border-gray-700 dark:bg-zinc-50 dark:border-gray-300 dark:text-zinc-950 dark:hover:bg-zinc-50',\n        outline: 'bg-background text-accent-foreground border border-input hover:bg-accent',\n      },\n      size: {\n        default: 'h-8.5 rounded-md px-3 gap-2 text-[0.8125rem] leading-none [&_svg]:size-4 gap-2',\n        sm: 'h-7 rounded-md px-2.5 gap-1.5 text-xs leading-none [&_svg]:size-3.5 gap-1.5',\n        lg: 'h-10 rounded-md px-4 gap-2.5 text-sm leading-none [&_svg]:size-5 gap-2.5',\n      },\n    },\n    defaultVariants: {\n      variant: 'default',\n      size: 'default',\n    },\n  },\n);\n\ninterface GithubButtonProps extends React.ComponentProps<'button'>, VariantProps<typeof githubButtonVariants> {\n  /** Whether to round stars */\n  roundStars?: boolean;\n  /** Whether to show Github icon */\n  fixedWidth?: boolean;\n  /** Initial number of stars */\n  initialStars?: number;\n  /** Class for stars */\n  starsClass?: string;\n  /** Target number of stars to animate to */\n  targetStars?: number;\n  /** Animation duration in seconds */\n  animationDuration?: number;\n  /** Animation delay in seconds */\n  animationDelay?: number;\n  /** Whether to start animation automatically */\n  autoAnimate?: boolean;\n  /** Callback when animation completes */\n  onAnimationComplete?: () => void;\n  /** Whether to show Github icon */\n  showGithubIcon?: boolean;\n  /** Whether to show star icon */\n  showStarIcon?: boolean;\n  /** Whether to show separator */\n  separator?: boolean;\n  /** Whether stars should be filled */\n  filled?: boolean;\n  /** Repository URL for actual Github integration */\n  repoUrl?: string;\n  /** Button text label */\n  label?: string;\n  /** Use in-view detection to trigger animation */\n  useInViewTrigger?: boolean;\n  /** In-view options */\n  inViewOptions?: UseInViewOptions;\n  /** Spring transition options */\n  transition?: SpringOptions;\n}\n\nfunction GithubButton({\n  initialStars = 0,\n  targetStars = 0,\n  starsClass = '',\n  fixedWidth = true,\n  animationDuration = 2,\n  animationDelay = 0,\n  autoAnimate = true,\n  className,\n  variant = 'default',\n  size = 'default',\n  showGithubIcon = true,\n  showStarIcon = true,\n  roundStars = false,\n  separator = false,\n  filled = false,\n  repoUrl,\n  onClick,\n  label = '',\n  useInViewTrigger = false,\n  inViewOptions = { once: true },\n  transition,\n  ...props\n}: GithubButtonProps) {\n  const [currentStars, setCurrentStars] = useState(initialStars);\n  const [isAnimating, setIsAnimating] = useState(false);\n  const [starProgress, setStarProgress] = useState(filled ? 100 : 0);\n  const [hasAnimated, setHasAnimated] = useState(false);\n\n  // Format number with units\n  const formatNumber = (num: number) => {\n    const units = ['k', 'M', 'B', 'T'];\n\n    if (roundStars && num >= 1000) {\n      let unitIndex = -1;\n      let value = num;\n\n      while (value >= 1000 && unitIndex < units.length - 1) {\n        value /= 1000;\n        unitIndex++;\n      }\n\n      // Format to 1 decimal place if needed, otherwise show whole number\n      const formatted = value % 1 === 0 ? value.toString() : value.toFixed(1);\n      return `${formatted}${units[unitIndex]}`;\n    }\n\n    return num.toString().replace(/\\B(?=(\\d{3})+(?!\\d))/g, ',');\n  };\n\n  // Start animation\n  const startAnimation = useCallback(() => {\n    if (isAnimating || hasAnimated) return;\n\n    setIsAnimating(true);\n    const startTime = Date.now();\n    const startValue = 0; // Always start from 0 for number animation\n    const endValue = targetStars;\n    const duration = animationDuration * 1000;\n\n    const animate = () => {\n      const elapsed = Date.now() - startTime;\n      const progress = Math.min(elapsed / duration, 1);\n\n      // Easing function for smooth animation\n      const easeOutQuart = 1 - Math.pow(1 - progress, 4);\n\n      // Update star count from 0 to target with more frequent updates\n      const newStars = Math.round(startValue + (endValue - startValue) * easeOutQuart);\n      setCurrentStars(newStars);\n\n      // Update star fill progress (0 to 100)\n      setStarProgress(progress * 100);\n\n      if (progress < 1) {\n        requestAnimationFrame(animate);\n      } else {\n        setCurrentStars(endValue);\n        setStarProgress(100);\n        setIsAnimating(false);\n        setHasAnimated(true);\n      }\n    };\n\n    setTimeout(() => {\n      requestAnimationFrame(animate);\n    }, animationDelay * 1000);\n  }, [isAnimating, hasAnimated, targetStars, animationDuration, animationDelay]);\n\n  // Use in-view detection if enabled\n  const ref = React.useRef(null);\n  const isInView = useInView(ref, inViewOptions);\n\n  // Reset animation state when targetStars changes\n  useEffect(() => {\n    setHasAnimated(false);\n    setCurrentStars(initialStars);\n  }, [targetStars, initialStars]);\n\n  // Auto-start animation or use in-view trigger\n  useEffect(() => {\n    if (useInViewTrigger) {\n      if (isInView && !hasAnimated) {\n        startAnimation();\n      }\n    } else if (autoAnimate && !hasAnimated) {\n      startAnimation();\n    }\n  }, [autoAnimate, useInViewTrigger, isInView, hasAnimated, startAnimation]);\n\n  const navigateToRepo = () => {\n    if (!repoUrl) {\n      return;\n    }\n\n    // Next.js compatible navigation approach\n    try {\n      // Create a temporary anchor element for reliable navigation\n      const link = document.createElement('a');\n      link.href = repoUrl;\n      link.target = '_blank';\n      link.rel = 'noopener noreferrer';\n\n      // Temporarily add to DOM and click\n      document.body.appendChild(link);\n      link.click();\n      document.body.removeChild(link);\n    } catch {\n      // Fallback to window.open\n      try {\n        window.open(repoUrl, '_blank', 'noopener,noreferrer');\n      } catch {\n        // Final fallback\n        window.location.href = repoUrl;\n      }\n    }\n  };\n\n  const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {\n    if (onClick) {\n      onClick(event);\n      return;\n    }\n\n    if (repoUrl) {\n      navigateToRepo();\n    } else if (!hasAnimated) {\n      startAnimation();\n    }\n  };\n\n  const handleKeyDown = (event: React.KeyboardEvent<HTMLButtonElement>) => {\n    // Handle Enter and Space key presses for accessibility\n    if (event.key === 'Enter' || event.key === ' ') {\n      event.preventDefault();\n\n      if (repoUrl) {\n        navigateToRepo();\n      } else if (!hasAnimated) {\n        startAnimation();\n      }\n    }\n  };\n\n  return (\n    <button\n      ref={ref}\n      className={cn(githubButtonVariants({ variant, size, className }), separator && 'ps-0')}\n      onClick={handleClick}\n      onKeyDown={handleKeyDown}\n      role=\"button\"\n      tabIndex={0}\n      aria-label={repoUrl ? `Star ${label} on GitHub` : label}\n      {...props}\n    >\n      {showGithubIcon && (\n        <div\n          className={cn(\n            'h-full relative flex items-center justify-center',\n            separator && 'w-9 bg-muted/60 border-e border-input',\n          )}\n        >\n          <svg role=\"img\" viewBox=\"0 0 24 24\" fill=\"currentColor\">\n            <path d=\"M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12\" />\n          </svg>\n        </div>\n      )}\n\n      {label && <span>{label}</span>}\n\n      {/* Animated Star Icon */}\n      {showStarIcon && (\n        <div className=\"relative inline-flex shrink-0\">\n          <Star className=\"fill-muted-foreground text-muted-foreground\" aria-hidden=\"true\" />\n          <Star\n            className=\"absolute top-0 start-0 text-yellow-400 fill-yellow-400\"\n            size={18}\n            aria-hidden=\"true\"\n            style={{\n              clipPath: `inset(${100 - starProgress}% 0 0 0)`,\n            }}\n          />\n        </div>\n      )}\n\n      {/* Animated Number Counter with Ticker Effect */}\n      <div className={cn('flex flex-col font-semibold relative overflow-hidden', starsClass)}>\n        <motion.div\n          animate={{ opacity: 1 }}\n          transition={{\n            type: 'spring',\n            stiffness: 300,\n            damping: 30,\n            ...transition,\n          }}\n          className=\"tabular-nums\"\n        >\n          <span>{currentStars > 0 && formatNumber(currentStars)}</span>\n        </motion.div>\n        {fixedWidth && <span className=\"opacity-0 h-0 overflow-hidden tabular-nums\">{formatNumber(targetStars)}</span>}\n      </div>\n    </button>\n  );\n}\n\nexport { GithubButton, githubButtonVariants };\nexport type { GithubButtonProps };\n"
  },
  {
    "path": "src/components/ui/hover-card.tsx",
    "content": "\"use client\"\n\nimport * as React from \"react\"\nimport * as HoverCardPrimitive from \"@radix-ui/react-hover-card\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction HoverCard({\n  ...props\n}: React.ComponentProps<typeof HoverCardPrimitive.Root>) {\n  return <HoverCardPrimitive.Root data-slot=\"hover-card\" {...props} />\n}\n\nfunction HoverCardTrigger({\n  ...props\n}: React.ComponentProps<typeof HoverCardPrimitive.Trigger>) {\n  return (\n    <HoverCardPrimitive.Trigger data-slot=\"hover-card-trigger\" {...props} />\n  )\n}\n\nfunction HoverCardContent({\n  className,\n  align = \"center\",\n  sideOffset = 4,\n  ...props\n}: React.ComponentProps<typeof HoverCardPrimitive.Content>) {\n  return (\n    <HoverCardPrimitive.Portal data-slot=\"hover-card-portal\">\n      <HoverCardPrimitive.Content\n        data-slot=\"hover-card-content\"\n        align={align}\n        sideOffset={sideOffset}\n        className={cn(\n          \"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-64 origin-(--radix-hover-card-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden\",\n          className\n        )}\n        {...props}\n      />\n    </HoverCardPrimitive.Portal>\n  )\n}\n\nexport { HoverCard, HoverCardTrigger, HoverCardContent }\n"
  },
  {
    "path": "src/components/ui/input-otp.tsx",
    "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { OTPInput, OTPInputContext } from \"input-otp\"\nimport { MinusIcon } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction InputOTP({\n  className,\n  containerClassName,\n  ...props\n}: React.ComponentProps<typeof OTPInput> & {\n  containerClassName?: string\n}) {\n  return (\n    <OTPInput\n      data-slot=\"input-otp\"\n      containerClassName={cn(\n        \"flex items-center gap-2 has-disabled:opacity-50\",\n        containerClassName\n      )}\n      className={cn(\"disabled:cursor-not-allowed\", className)}\n      {...props}\n    />\n  )\n}\n\nfunction InputOTPGroup({ className, ...props }: React.ComponentProps<\"div\">) {\n  return (\n    <div\n      data-slot=\"input-otp-group\"\n      className={cn(\"flex items-center\", className)}\n      {...props}\n    />\n  )\n}\n\nfunction InputOTPSlot({\n  index,\n  className,\n  ...props\n}: React.ComponentProps<\"div\"> & {\n  index: number\n}) {\n  const inputOTPContext = React.useContext(OTPInputContext)\n  const { char, hasFakeCaret, isActive } = inputOTPContext?.slots[index] ?? {}\n\n  return (\n    <div\n      data-slot=\"input-otp-slot\"\n      data-active={isActive}\n      className={cn(\n        \"data-[active=true]:border-ring data-[active=true]:ring-ring/50 data-[active=true]:aria-invalid:ring-destructive/20 dark:data-[active=true]:aria-invalid:ring-destructive/40 aria-invalid:border-destructive data-[active=true]:aria-invalid:border-destructive dark:bg-input/30 border-input relative flex h-9 w-9 items-center justify-center border-y border-r text-sm shadow-xs transition-all outline-none first:rounded-l-md first:border-l last:rounded-r-md data-[active=true]:z-10 data-[active=true]:ring-[3px]\",\n        className\n      )}\n      {...props}\n    >\n      {char}\n      {hasFakeCaret && (\n        <div className=\"pointer-events-none absolute inset-0 flex items-center justify-center\">\n          <div className=\"animate-caret-blink bg-foreground h-4 w-px duration-1000\" />\n        </div>\n      )}\n    </div>\n  )\n}\n\nfunction InputOTPSeparator({ ...props }: React.ComponentProps<\"div\">) {\n  return (\n    <div data-slot=\"input-otp-separator\" role=\"separator\" {...props}>\n      <MinusIcon />\n    </div>\n  )\n}\n\nexport { InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator }\n"
  },
  {
    "path": "src/components/ui/input.tsx",
    "content": "import * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction Input({ className, type, ...props }: React.ComponentProps<\"input\">) {\n  return (\n    <input\n      type={type}\n      data-slot=\"input\"\n      className={cn(\n        \"file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex w-full min-w-0 rounded-md border bg-transparent px-4 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm\",\n        \"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]\",\n        \"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nexport { Input }\n"
  },
  {
    "path": "src/components/ui/label.tsx",
    "content": "\"use client\"\n\nimport * as React from \"react\"\nimport * as LabelPrimitive from \"@radix-ui/react-label\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction Label({\n  className,\n  ...props\n}: React.ComponentProps<typeof LabelPrimitive.Root>) {\n  return (\n    <LabelPrimitive.Root\n      data-slot=\"label\"\n      className={cn(\n        \"flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nexport { Label }\n"
  },
  {
    "path": "src/components/ui/menubar.tsx",
    "content": "\"use client\"\n\nimport * as React from \"react\"\nimport * as MenubarPrimitive from \"@radix-ui/react-menubar\"\nimport { CheckIcon, ChevronRightIcon, CircleIcon } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction Menubar({\n  className,\n  ...props\n}: React.ComponentProps<typeof MenubarPrimitive.Root>) {\n  return (\n    <MenubarPrimitive.Root\n      data-slot=\"menubar\"\n      className={cn(\n        \"bg-background flex h-9 items-center gap-1 rounded-md border p-1 shadow-xs\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction MenubarMenu({\n  ...props\n}: React.ComponentProps<typeof MenubarPrimitive.Menu>) {\n  return <MenubarPrimitive.Menu data-slot=\"menubar-menu\" {...props} />\n}\n\nfunction MenubarGroup({\n  ...props\n}: React.ComponentProps<typeof MenubarPrimitive.Group>) {\n  return <MenubarPrimitive.Group data-slot=\"menubar-group\" {...props} />\n}\n\nfunction MenubarPortal({\n  ...props\n}: React.ComponentProps<typeof MenubarPrimitive.Portal>) {\n  return <MenubarPrimitive.Portal data-slot=\"menubar-portal\" {...props} />\n}\n\nfunction MenubarRadioGroup({\n  ...props\n}: React.ComponentProps<typeof MenubarPrimitive.RadioGroup>) {\n  return (\n    <MenubarPrimitive.RadioGroup data-slot=\"menubar-radio-group\" {...props} />\n  )\n}\n\nfunction MenubarTrigger({\n  className,\n  ...props\n}: React.ComponentProps<typeof MenubarPrimitive.Trigger>) {\n  return (\n    <MenubarPrimitive.Trigger\n      data-slot=\"menubar-trigger\"\n      className={cn(\n        \"focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex items-center rounded-sm px-2 py-1 text-sm font-medium outline-hidden select-none\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction MenubarContent({\n  className,\n  align = \"start\",\n  alignOffset = -4,\n  sideOffset = 8,\n  ...props\n}: React.ComponentProps<typeof MenubarPrimitive.Content>) {\n  return (\n    <MenubarPortal>\n      <MenubarPrimitive.Content\n        data-slot=\"menubar-content\"\n        align={align}\n        alignOffset={alignOffset}\n        sideOffset={sideOffset}\n        className={cn(\n          \"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[12rem] origin-(--radix-menubar-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-md\",\n          className\n        )}\n        {...props}\n      />\n    </MenubarPortal>\n  )\n}\n\nfunction MenubarItem({\n  className,\n  inset,\n  variant = \"default\",\n  ...props\n}: React.ComponentProps<typeof MenubarPrimitive.Item> & {\n  inset?: boolean\n  variant?: \"default\" | \"destructive\"\n}) {\n  return (\n    <MenubarPrimitive.Item\n      data-slot=\"menubar-item\"\n      data-inset={inset}\n      data-variant={variant}\n      className={cn(\n        \"focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction MenubarCheckboxItem({\n  className,\n  children,\n  checked,\n  ...props\n}: React.ComponentProps<typeof MenubarPrimitive.CheckboxItem>) {\n  return (\n    <MenubarPrimitive.CheckboxItem\n      data-slot=\"menubar-checkbox-item\"\n      className={cn(\n        \"focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-xs py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n        className\n      )}\n      checked={checked}\n      {...props}\n    >\n      <span className=\"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center\">\n        <MenubarPrimitive.ItemIndicator>\n          <CheckIcon className=\"size-4\" />\n        </MenubarPrimitive.ItemIndicator>\n      </span>\n      {children}\n    </MenubarPrimitive.CheckboxItem>\n  )\n}\n\nfunction MenubarRadioItem({\n  className,\n  children,\n  ...props\n}: React.ComponentProps<typeof MenubarPrimitive.RadioItem>) {\n  return (\n    <MenubarPrimitive.RadioItem\n      data-slot=\"menubar-radio-item\"\n      className={cn(\n        \"focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-xs py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n        className\n      )}\n      {...props}\n    >\n      <span className=\"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center\">\n        <MenubarPrimitive.ItemIndicator>\n          <CircleIcon className=\"size-2 fill-current\" />\n        </MenubarPrimitive.ItemIndicator>\n      </span>\n      {children}\n    </MenubarPrimitive.RadioItem>\n  )\n}\n\nfunction MenubarLabel({\n  className,\n  inset,\n  ...props\n}: React.ComponentProps<typeof MenubarPrimitive.Label> & {\n  inset?: boolean\n}) {\n  return (\n    <MenubarPrimitive.Label\n      data-slot=\"menubar-label\"\n      data-inset={inset}\n      className={cn(\n        \"px-2 py-1.5 text-sm font-medium data-[inset]:pl-8\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction MenubarSeparator({\n  className,\n  ...props\n}: React.ComponentProps<typeof MenubarPrimitive.Separator>) {\n  return (\n    <MenubarPrimitive.Separator\n      data-slot=\"menubar-separator\"\n      className={cn(\"bg-border -mx-1 my-1 h-px\", className)}\n      {...props}\n    />\n  )\n}\n\nfunction MenubarShortcut({\n  className,\n  ...props\n}: React.ComponentProps<\"span\">) {\n  return (\n    <span\n      data-slot=\"menubar-shortcut\"\n      className={cn(\n        \"text-muted-foreground ml-auto text-xs tracking-widest\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction MenubarSub({\n  ...props\n}: React.ComponentProps<typeof MenubarPrimitive.Sub>) {\n  return <MenubarPrimitive.Sub data-slot=\"menubar-sub\" {...props} />\n}\n\nfunction MenubarSubTrigger({\n  className,\n  inset,\n  children,\n  ...props\n}: React.ComponentProps<typeof MenubarPrimitive.SubTrigger> & {\n  inset?: boolean\n}) {\n  return (\n    <MenubarPrimitive.SubTrigger\n      data-slot=\"menubar-sub-trigger\"\n      data-inset={inset}\n      className={cn(\n        \"focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-none select-none data-[inset]:pl-8\",\n        className\n      )}\n      {...props}\n    >\n      {children}\n      <ChevronRightIcon className=\"ml-auto h-4 w-4\" />\n    </MenubarPrimitive.SubTrigger>\n  )\n}\n\nfunction MenubarSubContent({\n  className,\n  ...props\n}: React.ComponentProps<typeof MenubarPrimitive.SubContent>) {\n  return (\n    <MenubarPrimitive.SubContent\n      data-slot=\"menubar-sub-content\"\n      className={cn(\n        \"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-(--radix-menubar-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nexport {\n  Menubar,\n  MenubarPortal,\n  MenubarMenu,\n  MenubarTrigger,\n  MenubarContent,\n  MenubarGroup,\n  MenubarSeparator,\n  MenubarLabel,\n  MenubarItem,\n  MenubarShortcut,\n  MenubarCheckboxItem,\n  MenubarRadioGroup,\n  MenubarRadioItem,\n  MenubarSub,\n  MenubarSubTrigger,\n  MenubarSubContent,\n}\n"
  },
  {
    "path": "src/components/ui/navigation-menu.tsx",
    "content": "import * as React from \"react\"\nimport * as NavigationMenuPrimitive from \"@radix-ui/react-navigation-menu\"\nimport { cva } from \"class-variance-authority\"\nimport { ChevronDownIcon } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction NavigationMenu({\n  className,\n  children,\n  viewport = true,\n  ...props\n}: React.ComponentProps<typeof NavigationMenuPrimitive.Root> & {\n  viewport?: boolean\n}) {\n  return (\n    <NavigationMenuPrimitive.Root\n      data-slot=\"navigation-menu\"\n      data-viewport={viewport}\n      className={cn(\n        \"group/navigation-menu relative flex max-w-max flex-1 items-center justify-center\",\n        className\n      )}\n      {...props}\n    >\n      {children}\n      {viewport && <NavigationMenuViewport />}\n    </NavigationMenuPrimitive.Root>\n  )\n}\n\nfunction NavigationMenuList({\n  className,\n  ...props\n}: React.ComponentProps<typeof NavigationMenuPrimitive.List>) {\n  return (\n    <NavigationMenuPrimitive.List\n      data-slot=\"navigation-menu-list\"\n      className={cn(\n        \"group flex flex-1 list-none items-center justify-center gap-1\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction NavigationMenuItem({\n  className,\n  ...props\n}: React.ComponentProps<typeof NavigationMenuPrimitive.Item>) {\n  return (\n    <NavigationMenuPrimitive.Item\n      data-slot=\"navigation-menu-item\"\n      className={cn(\"relative\", className)}\n      {...props}\n    />\n  )\n}\n\nconst navigationMenuTriggerStyle = cva(\n  \"group inline-flex h-9 w-max items-center justify-center rounded-md bg-background px-4 py-2 text-sm font-medium hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=open]:hover:bg-accent data-[state=open]:text-accent-foreground data-[state=open]:focus:bg-accent data-[state=open]:bg-accent/50 focus-visible:ring-ring/50 outline-none transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1\"\n)\n\nfunction NavigationMenuTrigger({\n  className,\n  children,\n  ...props\n}: React.ComponentProps<typeof NavigationMenuPrimitive.Trigger>) {\n  return (\n    <NavigationMenuPrimitive.Trigger\n      data-slot=\"navigation-menu-trigger\"\n      className={cn(navigationMenuTriggerStyle(), \"group\", className)}\n      {...props}\n    >\n      {children}{\" \"}\n      <ChevronDownIcon\n        className=\"relative top-[1px] ml-1 size-3 transition duration-300 group-data-[state=open]:rotate-180\"\n        aria-hidden=\"true\"\n      />\n    </NavigationMenuPrimitive.Trigger>\n  )\n}\n\nfunction NavigationMenuContent({\n  className,\n  ...props\n}: React.ComponentProps<typeof NavigationMenuPrimitive.Content>) {\n  return (\n    <NavigationMenuPrimitive.Content\n      data-slot=\"navigation-menu-content\"\n      className={cn(\n        \"data-[motion^=from-]:animate-in data-[motion^=to-]:animate-out data-[motion^=from-]:fade-in data-[motion^=to-]:fade-out data-[motion=from-end]:slide-in-from-right-52 data-[motion=from-start]:slide-in-from-left-52 data-[motion=to-end]:slide-out-to-right-52 data-[motion=to-start]:slide-out-to-left-52 top-0 left-0 w-full p-2 pr-2.5 md:absolute md:w-auto\",\n        \"group-data-[viewport=false]/navigation-menu:bg-popover group-data-[viewport=false]/navigation-menu:text-popover-foreground group-data-[viewport=false]/navigation-menu:data-[state=open]:animate-in group-data-[viewport=false]/navigation-menu:data-[state=closed]:animate-out group-data-[viewport=false]/navigation-menu:data-[state=closed]:zoom-out-95 group-data-[viewport=false]/navigation-menu:data-[state=open]:zoom-in-95 group-data-[viewport=false]/navigation-menu:data-[state=open]:fade-in-0 group-data-[viewport=false]/navigation-menu:data-[state=closed]:fade-out-0 group-data-[viewport=false]/navigation-menu:top-full group-data-[viewport=false]/navigation-menu:mt-1.5 group-data-[viewport=false]/navigation-menu:overflow-hidden group-data-[viewport=false]/navigation-menu:rounded-md group-data-[viewport=false]/navigation-menu:border group-data-[viewport=false]/navigation-menu:shadow group-data-[viewport=false]/navigation-menu:duration-200 **:data-[slot=navigation-menu-link]:focus:ring-0 **:data-[slot=navigation-menu-link]:focus:outline-none\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction NavigationMenuViewport({\n  className,\n  ...props\n}: React.ComponentProps<typeof NavigationMenuPrimitive.Viewport>) {\n  return (\n    <div\n      className={cn(\n        \"absolute top-full left-0 isolate z-50 flex justify-center\"\n      )}\n    >\n      <NavigationMenuPrimitive.Viewport\n        data-slot=\"navigation-menu-viewport\"\n        className={cn(\n          \"origin-top-center bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-90 relative mt-1.5 h-[var(--radix-navigation-menu-viewport-height)] w-full overflow-hidden rounded-md border shadow md:w-[var(--radix-navigation-menu-viewport-width)]\",\n          className\n        )}\n        {...props}\n      />\n    </div>\n  )\n}\n\nfunction NavigationMenuLink({\n  className,\n  ...props\n}: React.ComponentProps<typeof NavigationMenuPrimitive.Link>) {\n  return (\n    <NavigationMenuPrimitive.Link\n      data-slot=\"navigation-menu-link\"\n      className={cn(\n        \"data-[active=true]:focus:bg-accent data-[active=true]:hover:bg-accent data-[active=true]:bg-accent/50 data-[active=true]:text-accent-foreground hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus-visible:ring-ring/50 [&_svg:not([class*='text-'])]:text-muted-foreground flex flex-col gap-1 rounded-sm p-2 text-sm transition-all outline-none focus-visible:ring-[3px] focus-visible:outline-1 [&_svg:not([class*='size-'])]:size-4\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction NavigationMenuIndicator({\n  className,\n  ...props\n}: React.ComponentProps<typeof NavigationMenuPrimitive.Indicator>) {\n  return (\n    <NavigationMenuPrimitive.Indicator\n      data-slot=\"navigation-menu-indicator\"\n      className={cn(\n        \"data-[state=visible]:animate-in data-[state=hidden]:animate-out data-[state=hidden]:fade-out data-[state=visible]:fade-in top-full z-[1] flex h-1.5 items-end justify-center overflow-hidden\",\n        className\n      )}\n      {...props}\n    >\n      <div className=\"bg-border relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm shadow-md\" />\n    </NavigationMenuPrimitive.Indicator>\n  )\n}\n\nexport {\n  NavigationMenu,\n  NavigationMenuList,\n  NavigationMenuItem,\n  NavigationMenuContent,\n  NavigationMenuTrigger,\n  NavigationMenuLink,\n  NavigationMenuIndicator,\n  NavigationMenuViewport,\n  navigationMenuTriggerStyle,\n}\n"
  },
  {
    "path": "src/components/ui/pagination.tsx",
    "content": "import * as React from \"react\"\nimport {\n  ChevronLeftIcon,\n  ChevronRightIcon,\n  MoreHorizontalIcon,\n} from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Button, buttonVariants } from \"@/components/ui/button\"\n\nfunction Pagination({ className, ...props }: React.ComponentProps<\"nav\">) {\n  return (\n    <nav\n      role=\"navigation\"\n      aria-label=\"pagination\"\n      data-slot=\"pagination\"\n      className={cn(\"mx-auto flex w-full justify-center\", className)}\n      {...props}\n    />\n  )\n}\n\nfunction PaginationContent({\n  className,\n  ...props\n}: React.ComponentProps<\"ul\">) {\n  return (\n    <ul\n      data-slot=\"pagination-content\"\n      className={cn(\"flex flex-row items-center gap-1\", className)}\n      {...props}\n    />\n  )\n}\n\nfunction PaginationItem({ ...props }: React.ComponentProps<\"li\">) {\n  return <li data-slot=\"pagination-item\" {...props} />\n}\n\ntype PaginationLinkProps = {\n  isActive?: boolean\n} & Pick<React.ComponentProps<typeof Button>, \"size\"> &\n  React.ComponentProps<\"a\">\n\nfunction PaginationLink({\n  className,\n  isActive,\n  size = \"icon\",\n  ...props\n}: PaginationLinkProps) {\n  return (\n    <a\n      aria-current={isActive ? \"page\" : undefined}\n      data-slot=\"pagination-link\"\n      data-active={isActive}\n      className={cn(\n        buttonVariants({\n          variant: isActive ? \"outline\" : \"ghost\",\n          size,\n        }),\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction PaginationPrevious({\n  className,\n  ...props\n}: React.ComponentProps<typeof PaginationLink>) {\n  return (\n    <PaginationLink\n      aria-label=\"Go to previous page\"\n      size=\"default\"\n      className={cn(\"gap-1 px-2.5 sm:pl-2.5\", className)}\n      {...props}\n    >\n      <ChevronLeftIcon />\n      <span className=\"hidden sm:block\">Previous</span>\n    </PaginationLink>\n  )\n}\n\nfunction PaginationNext({\n  className,\n  ...props\n}: React.ComponentProps<typeof PaginationLink>) {\n  return (\n    <PaginationLink\n      aria-label=\"Go to next page\"\n      size=\"default\"\n      className={cn(\"gap-1 px-2.5 sm:pr-2.5\", className)}\n      {...props}\n    >\n      <span className=\"hidden sm:block\">Next</span>\n      <ChevronRightIcon />\n    </PaginationLink>\n  )\n}\n\nfunction PaginationEllipsis({\n  className,\n  ...props\n}: React.ComponentProps<\"span\">) {\n  return (\n    <span\n      aria-hidden\n      data-slot=\"pagination-ellipsis\"\n      className={cn(\"flex size-9 items-center justify-center\", className)}\n      {...props}\n    >\n      <MoreHorizontalIcon className=\"size-4\" />\n      <span className=\"sr-only\">More pages</span>\n    </span>\n  )\n}\n\nexport {\n  Pagination,\n  PaginationContent,\n  PaginationLink,\n  PaginationItem,\n  PaginationPrevious,\n  PaginationNext,\n  PaginationEllipsis,\n}\n"
  },
  {
    "path": "src/components/ui/password-input-indicator.tsx",
    "content": "\"use client\";\n\nimport {Ref, useEffect, useState} from \"react\";\nimport {Check, X} from \"lucide-react\";\nimport {motion, AnimatePresence} from \"framer-motion\";\nimport {\n    FormControl,\n    FormDescription,\n    FormItem,\n    FormLabel,\n    FormMessage,\n} from \"@/components/ui/form\";\nimport {PasswordInput} from \"@/components/ui/password-input\";\n\ninterface PasswordStrengthInputProps {\n    field: {\n        name: string;\n        value: string;\n        onChange: (value: string) => void;\n        onBlur: () => void;\n        ref: Ref<HTMLInputElement>;\n    };\n    label?: string;\n    description?: string;\n    disabled?: boolean;\n    onValidChange?: (isValid: boolean) => void;\n\n}\n\nconst passwordTextsFields = {\n    label: \"Password\",\n    placeholder: \"Enter password\",\n    strength: {\n        enter: \"Enter a password\",\n        weak: \"Weak password\",\n        medium: \"Medium password\",\n        strong: \"Strong password\"\n    },\n    requirementsIntro: \"Must contain:\",\n    requirements: {\n        minLength: \"At least 8 characters\",\n        number: \"At least 1 number\",\n        lowercase: \"At least 1 lowercase letter\",\n        uppercase: \"At least 1 uppercase letter\",\n        specialChar: \"At least 1 special character\"\n    }\n}\n\n\nexport function PasswordStrengthInput({\n                                          field,\n                                          label,\n                                          description,\n                                          disabled, onValidChange\n                                      }: PasswordStrengthInputProps) {\n    const text = passwordTextsFields\n    const [isVisible, setIsVisible] = useState(false);\n    const password = field.value ?? \"\";\n\n    const requirements = [\n        {regex: /.{8,}/, text: text.requirements.minLength},\n        {regex: /[0-9]/, text: text.requirements.number},\n        {regex: /[a-z]/, text: text.requirements.lowercase},\n        {regex: /[A-Z]/, text: text.requirements.uppercase},\n        {regex: /[^a-zA-Z0-9]/, text: text.requirements.specialChar},\n    ];\n\n    const strength = requirements.map((req) => ({\n        met: req.regex.test(password),\n        text: req.text,\n    }));\n\n    const strengthScore = strength.filter((req) => req.met).length;\n\n    const getStrengthColor = (score: number) => {\n        if (score === 0) return \"bg-border\";\n        if (score <= 2) return \"bg-red-500\";\n        if (score === 3) return \"bg-orange-500\";\n        if (score === 4) return \"bg-amber-500\";\n        return \"bg-emerald-500\";\n    };\n\n    const getStrengthText = (score: number) => {\n        if (score === 0) return text.strength.enter;\n        if (score <= 2) return text.strength.weak;\n        if (score === 3 || score === 4) return text.strength.medium;\n        return text.strength.strong;\n    };\n\n    useEffect(() => {\n        if (strengthScore === requirements.length) {\n            onValidChange?.(true);\n        } else {\n            onValidChange?.(false);\n        }\n    }, [strengthScore, onValidChange]);\n\n    return (\n        <FormItem>\n            <FormLabel>{label ?? text.label}</FormLabel>\n            <div className=\"relative\">\n                <FormControl>\n                    <PasswordInput\n                        placeholder={text.placeholder}\n                        value={field.value ?? \"\"}\n                        onChange={(e) => field.onChange(e.target.value)}\n                        onFocus={() => setIsVisible(true)}\n                        onBlur={(e) => {\n                            field.onBlur();\n                            setIsVisible(false);\n                        }}\n                        ref={field.ref}\n                        name={field.name}\n                        disabled={disabled}\n\n                    />\n                </FormControl>\n            </div>\n\n            <AnimatePresence>\n                {isVisible && (\n                    <motion.div\n                        initial={{opacity: 0, height: 0, y: -5}}\n                        animate={{opacity: 1, height: \"auto\", y: 0}}\n                        exit={{opacity: 0, height: 0, y: -5}}\n                        transition={{duration: 0.35, ease: \"easeInOut\"}}\n                        className=\"overflow-hidden\"\n                    >\n                        <FormDescription>\n                            {description ??\n                                `${getStrengthText(strengthScore)}. ${text.requirementsIntro}`}\n                        </FormDescription>\n                        <FormMessage/>\n\n                        <div\n                            className=\"mb-2 h-1 w-full overflow-hidden rounded-full bg-border mt-2\"\n                            role=\"progressbar\"\n                            aria-valuenow={strengthScore}\n                            aria-valuemin={0}\n                            aria-valuemax={requirements.length}\n                        >\n                            <motion.div\n                                key={strengthScore}\n                                className={`h-full ${getStrengthColor(\n                                    strengthScore\n                                )}`}\n                                initial={{width: 0}}\n                                animate={{\n                                    width: `${(strengthScore / requirements.length) * 100}%`,\n                                }}\n                                transition={{duration: 0.5}}\n                            />\n                        </div>\n\n                        <ul className=\"space-y-1.5\" aria-label=\"Password requirements\">\n                            {strength.map((req, i) => (\n                                <li key={i} className=\"flex items-center gap-2\">\n                                    {req.met ? (\n                                        <Check className=\"h-4 w-4 text-emerald-500\"/>\n                                    ) : (\n                                        <X className=\"h-4 w-4 text-muted-foreground\"/>\n                                    )}\n                                    <span\n                                        className={`text-xs ${\n                                            req.met ? \"text-emerald-600\" : \"text-muted-foreground\"\n                                        }`}\n                                    >\n                    {req.text}\n                  </span>\n                                </li>\n                            ))}\n                        </ul>\n                    </motion.div>\n                )}\n            </AnimatePresence>\n        </FormItem>\n    );\n}\n"
  },
  {
    "path": "src/components/ui/password-input.tsx",
    "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { EyeIcon, EyeOffIcon } from \"lucide-react\";\nimport { Button } from \"@/components/ui/button\";\nimport { Input } from \"@/components/ui/input\";\nimport type { InputHTMLAttributes } from \"react\";\n\ntype InputProps = InputHTMLAttributes<HTMLInputElement>;\nimport { cn } from \"@/lib/utils\";\n\nconst PasswordInput = React.forwardRef<HTMLInputElement, InputProps>(({ className, ...props }, ref) => {\n    const [showPassword, setShowPassword] = React.useState(false);\n    const disabled = props.value === \"\" || props.value === undefined || props.disabled;\n\n    return (\n        <div className=\"relative\">\n            <Input type={showPassword ? \"text\" : \"password\"} className={cn(\"hide-password-toggle pr-10\", className)} ref={ref} {...props} />\n            <Button\n                type=\"button\"\n                variant=\"ghost\"\n                size=\"sm\"\n                className=\"absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent\"\n                onClick={() => setShowPassword((prev) => !prev)}\n                disabled={disabled}\n            >\n                {showPassword && !disabled ? <EyeIcon className=\"h-4 w-4\" aria-hidden=\"true\" /> : <EyeOffIcon className=\"h-4 w-4\" aria-hidden=\"true\" />}\n                <span className=\"sr-only\">{showPassword ? \"Hide password\" : \"Show password\"}</span>\n            </Button>\n            <style>{`\n\t\t\t\t\t.hide-password-toggle::-ms-reveal,\n\t\t\t\t\t.hide-password-toggle::-ms-clear {\n\t\t\t\t\t\tvisibility: hidden;\n\t\t\t\t\t\tpointer-events: none;\n\t\t\t\t\t\tdisplay: none;\n\t\t\t\t\t}\n\t\t\t\t`}</style>\n        </div>\n    );\n});\nPasswordInput.displayName = \"PasswordInput\";\n\nexport { PasswordInput };\n"
  },
  {
    "path": "src/components/ui/popover.tsx",
    "content": "\"use client\"\n\nimport * as React from \"react\"\nimport * as PopoverPrimitive from \"@radix-ui/react-popover\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction Popover({\n  ...props\n}: React.ComponentProps<typeof PopoverPrimitive.Root>) {\n  return <PopoverPrimitive.Root data-slot=\"popover\" {...props} />\n}\n\nfunction PopoverTrigger({\n  ...props\n}: React.ComponentProps<typeof PopoverPrimitive.Trigger>) {\n  return <PopoverPrimitive.Trigger data-slot=\"popover-trigger\" {...props} />\n}\n\nfunction PopoverContent({\n  className,\n  align = \"center\",\n  sideOffset = 4,\n  ...props\n}: React.ComponentProps<typeof PopoverPrimitive.Content>) {\n  return (\n    <PopoverPrimitive.Portal>\n      <PopoverPrimitive.Content\n        data-slot=\"popover-content\"\n        align={align}\n        sideOffset={sideOffset}\n        className={cn(\n          \"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden\",\n          className\n        )}\n        {...props}\n      />\n    </PopoverPrimitive.Portal>\n  )\n}\n\nfunction PopoverAnchor({\n  ...props\n}: React.ComponentProps<typeof PopoverPrimitive.Anchor>) {\n  return <PopoverPrimitive.Anchor data-slot=\"popover-anchor\" {...props} />\n}\n\nexport { Popover, PopoverTrigger, PopoverContent, PopoverAnchor }\n"
  },
  {
    "path": "src/components/ui/progress.tsx",
    "content": "\"use client\"\n\nimport * as React from \"react\"\nimport * as ProgressPrimitive from \"@radix-ui/react-progress\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction Progress({\n  className,\n  value,\n  ...props\n}: React.ComponentProps<typeof ProgressPrimitive.Root>) {\n  return (\n    <ProgressPrimitive.Root\n      data-slot=\"progress\"\n      className={cn(\n        \"bg-primary/20 relative h-2 w-full overflow-hidden rounded-full\",\n        className\n      )}\n      {...props}\n    >\n      <ProgressPrimitive.Indicator\n        data-slot=\"progress-indicator\"\n        className=\"bg-primary h-full w-full flex-1 transition-all\"\n        style={{ transform: `translateX(-${100 - (value || 0)}%)` }}\n      />\n    </ProgressPrimitive.Root>\n  )\n}\n\nexport { Progress }\n"
  },
  {
    "path": "src/components/ui/radio-group.tsx",
    "content": "\"use client\"\n\nimport * as React from \"react\"\nimport * as RadioGroupPrimitive from \"@radix-ui/react-radio-group\"\nimport { CircleIcon } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction RadioGroup({\n  className,\n  ...props\n}: React.ComponentProps<typeof RadioGroupPrimitive.Root>) {\n  return (\n    <RadioGroupPrimitive.Root\n      data-slot=\"radio-group\"\n      className={cn(\"grid gap-3\", className)}\n      {...props}\n    />\n  )\n}\n\nfunction RadioGroupItem({\n  className,\n  ...props\n}: React.ComponentProps<typeof RadioGroupPrimitive.Item>) {\n  return (\n    <RadioGroupPrimitive.Item\n      data-slot=\"radio-group-item\"\n      className={cn(\n        \"border-input text-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 aspect-square size-4 shrink-0 rounded-full border shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50\",\n        className\n      )}\n      {...props}\n    >\n      <RadioGroupPrimitive.Indicator\n        data-slot=\"radio-group-indicator\"\n        className=\"relative flex items-center justify-center\"\n      >\n        <CircleIcon className=\"fill-primary absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2\" />\n      </RadioGroupPrimitive.Indicator>\n    </RadioGroupPrimitive.Item>\n  )\n}\n\nexport { RadioGroup, RadioGroupItem }\n"
  },
  {
    "path": "src/components/ui/resizable.tsx",
    "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { GripVerticalIcon } from \"lucide-react\"\nimport * as ResizablePrimitive from \"react-resizable-panels\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction ResizablePanelGroup({\n  className,\n  ...props\n}: React.ComponentProps<typeof ResizablePrimitive.PanelGroup>) {\n  return (\n    <ResizablePrimitive.PanelGroup\n      data-slot=\"resizable-panel-group\"\n      className={cn(\n        \"flex h-full w-full data-[panel-group-direction=vertical]:flex-col\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction ResizablePanel({\n  ...props\n}: React.ComponentProps<typeof ResizablePrimitive.Panel>) {\n  return <ResizablePrimitive.Panel data-slot=\"resizable-panel\" {...props} />\n}\n\nfunction ResizableHandle({\n  withHandle,\n  className,\n  ...props\n}: React.ComponentProps<typeof ResizablePrimitive.PanelResizeHandle> & {\n  withHandle?: boolean\n}) {\n  return (\n    <ResizablePrimitive.PanelResizeHandle\n      data-slot=\"resizable-handle\"\n      className={cn(\n        \"bg-border focus-visible:ring-ring relative flex w-px items-center justify-center after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-offset-1 focus-visible:outline-hidden data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90\",\n        className\n      )}\n      {...props}\n    >\n      {withHandle && (\n        <div className=\"bg-border z-10 flex h-4 w-3 items-center justify-center rounded-xs border\">\n          <GripVerticalIcon className=\"size-2.5\" />\n        </div>\n      )}\n    </ResizablePrimitive.PanelResizeHandle>\n  )\n}\n\nexport { ResizablePanelGroup, ResizablePanel, ResizableHandle }\n"
  },
  {
    "path": "src/components/ui/scroll-area.tsx",
    "content": "\"use client\"\n\nimport * as React from \"react\"\nimport * as ScrollAreaPrimitive from \"@radix-ui/react-scroll-area\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction ScrollArea({\n  className,\n  children,\n  ...props\n}: React.ComponentProps<typeof ScrollAreaPrimitive.Root>) {\n  return (\n    <ScrollAreaPrimitive.Root\n      data-slot=\"scroll-area\"\n      className={cn(\"relative\", className)}\n      {...props}\n    >\n      <ScrollAreaPrimitive.Viewport\n        data-slot=\"scroll-area-viewport\"\n        className=\"focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1\"\n      >\n        {children}\n      </ScrollAreaPrimitive.Viewport>\n      <ScrollBar />\n      <ScrollAreaPrimitive.Corner />\n    </ScrollAreaPrimitive.Root>\n  )\n}\n\nfunction ScrollBar({\n  className,\n  orientation = \"vertical\",\n  ...props\n}: React.ComponentProps<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>) {\n  return (\n    <ScrollAreaPrimitive.ScrollAreaScrollbar\n      data-slot=\"scroll-area-scrollbar\"\n      orientation={orientation}\n      className={cn(\n        \"flex touch-none p-px transition-colors select-none\",\n        orientation === \"vertical\" &&\n          \"h-full w-2.5 border-l border-l-transparent\",\n        orientation === \"horizontal\" &&\n          \"h-2.5 flex-col border-t border-t-transparent\",\n        className\n      )}\n      {...props}\n    >\n      <ScrollAreaPrimitive.ScrollAreaThumb\n        data-slot=\"scroll-area-thumb\"\n        className=\"bg-border relative flex-1 rounded-full\"\n      />\n    </ScrollAreaPrimitive.ScrollAreaScrollbar>\n  )\n}\n\nexport { ScrollArea, ScrollBar }\n"
  },
  {
    "path": "src/components/ui/search-input.tsx",
    "content": "\"use client\"\n\nimport type React from \"react\"\nimport { useState, useRef, useEffect, forwardRef } from \"react\"\nimport { Search, X } from \"lucide-react\"\nimport { Input } from \"@/components/ui/input\"\nimport { Button } from \"@/components/ui/button\"\nimport { cn } from \"@/lib/utils\"\n\nexport interface IEntry {\n    value: string\n    label: string\n}\n\ninterface SearchInputProps {\n    value?: IEntry\n    onChange?: (value: IEntry) => void\n    onSelect?: (value: IEntry) => void\n    name?: string\n    placeholder?: string\n    entries?: IEntry[]\n    disabled?: boolean\n    className?: string\n}\n\nexport const SearchInput = forwardRef<HTMLInputElement, SearchInputProps>(\n    (\n        {\n            value: controlledValue,\n            onChange,\n            onSelect,\n            name,\n            placeholder = \"Search entries...\",\n            entries = [],\n            disabled = false,\n            className,\n            ...props\n        },\n        ref,\n    ) => {\n        const [internalValue, setInternalValue] = useState<IEntry | null>(null)\n        const [isOpen, setIsOpen] = useState(false)\n        const [filteredEntries, setFilteredEntries] = useState<IEntry[]>([])\n        const [selectedIndex, setSelectedIndex] = useState(-1)\n        const internalRef = useRef<HTMLInputElement>(null)\n        const listRef = useRef<HTMLUListElement>(null)\n\n        const query = controlledValue?.label ?? internalValue?.label ?? \"\"\n        const inputRef = (ref as React.RefObject<HTMLInputElement>) || internalRef\n\n        // Filter entries based on query\n        useEffect(() => {\n            if (query.trim()) {\n                const filtered = entries.filter((entry) =>\n                    entry.label.toLowerCase().includes(query.toLowerCase()),\n                )\n                setFilteredEntries(filtered)\n                setSelectedIndex(-1)\n            } else {\n                setFilteredEntries([])\n            }\n        }, [query, entries])\n\n        const handleValueChange = (newValue: IEntry | null) => {\n            if (controlledValue === undefined) {\n                setInternalValue(newValue)\n            }\n            if (newValue) {\n                onChange?.(newValue)\n            }\n        }\n\n        // Handle keyboard navigation\n        const handleKeyDown = (e: React.KeyboardEvent) => {\n            if (!isOpen || filteredEntries.length === 0) return\n\n            switch (e.key) {\n                case \"ArrowDown\":\n                    e.preventDefault()\n                    setSelectedIndex((prev) =>\n                        prev < filteredEntries.length - 1 ? prev + 1 : 0,\n                    )\n                    break\n                case \"ArrowUp\":\n                    e.preventDefault()\n                    setSelectedIndex((prev) =>\n                        prev > 0 ? prev - 1 : filteredEntries.length - 1,\n                    )\n                    break\n                case \"Enter\":\n                    e.preventDefault()\n                    if (selectedIndex >= 0) {\n                        handleSelect(filteredEntries[selectedIndex])\n                    }\n                    break\n                case \"Escape\":\n                    setIsOpen(false)\n                    setSelectedIndex(-1)\n                    inputRef.current?.blur()\n                    break\n            }\n        }\n\n        const handleSelect = (entry: IEntry) => {\n            handleValueChange(entry)\n            onSelect?.(entry)\n            setIsOpen(false)\n            setSelectedIndex(-1)\n            inputRef.current?.blur()\n        }\n\n        const clearSearch = () => {\n            handleValueChange(null)\n            setIsOpen(false)\n            setSelectedIndex(-1)\n            inputRef.current?.focus()\n        }\n\n        return (\n            <div className={cn(\"relative w-full\", className)}>\n                <div className=\"relative\">\n                    <Search className=\"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground\" />\n                    <Input\n                        {...props}\n                        ref={inputRef}\n                        type=\"text\"\n                        name={name}\n                        placeholder={placeholder}\n                        value={query}\n                        disabled={disabled}\n                        onChange={(e) => {\n                            const newLabel = e.target.value\n                            handleValueChange({ value: newLabel, label: newLabel })\n                        }}\n                        onFocus={() => !disabled && setIsOpen(true)}\n                        onBlur={() => {\n                            // Delay closing to allow clicking on entries\n                            setTimeout(() => setIsOpen(false), 150)\n                        }}\n                        onKeyDown={handleKeyDown}\n                        className=\"pl-10 pr-10\"\n                    />\n                    {query && !disabled && (\n                        <Button\n                            variant=\"ghost\"\n                            size=\"sm\"\n                            onClick={clearSearch}\n                            className=\"absolute right-1 top-1/2 h-7 w-7 -translate-y-1/2 p-0 hover:bg-muted\"\n                        >\n                            <X className=\"h-4 w-4\" />\n                        </Button>\n                    )}\n                </div>\n\n                {/* Results dropdown */}\n                {isOpen && !disabled && filteredEntries.length > 0 && (\n                    <div className=\"absolute top-full z-50 w-full mt-1 bg-popover border rounded-md shadow-md\">\n                        <ul ref={listRef} className=\"max-h-60 overflow-auto py-1\" role=\"listbox\">\n                            {filteredEntries.map((entry, index) => (\n                                <li\n                                    key={entry.value}\n                                    role=\"option\"\n                                    aria-selected={index === selectedIndex}\n                                    className={cn(\n                                        \"px-3 py-2 text-sm cursor-pointer transition-colors\",\n                                        \"hover:bg-accent hover:text-accent-foreground\",\n                                        index === selectedIndex && \"bg-accent text-accent-foreground\",\n                                    )}\n                                    onClick={() => handleSelect(entry)}\n                                >\n                                    {entry.label}\n                                </li>\n                            ))}\n                        </ul>\n                    </div>\n                )}\n\n                {/* No results message */}\n                {isOpen && !disabled && query && filteredEntries.length === 0 && (\n                    <div className=\"absolute top-full z-50 w-full mt-1 bg-popover border rounded-md shadow-md\">\n                        <div className=\"px-3 py-2 text-sm text-muted-foreground\">\n                            No results found for \"{query}\"\n                        </div>\n                    </div>\n                )}\n            </div>\n        )\n    },\n)\n\nSearchInput.displayName = \"SearchInput\"\n"
  },
  {
    "path": "src/components/ui/select.tsx",
    "content": "\"use client\"\n\nimport * as React from \"react\"\nimport * as SelectPrimitive from \"@radix-ui/react-select\"\nimport { CheckIcon, ChevronDownIcon, ChevronUpIcon } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction Select({\n  ...props\n}: React.ComponentProps<typeof SelectPrimitive.Root>) {\n  return <SelectPrimitive.Root data-slot=\"select\" {...props} />\n}\n\nfunction SelectGroup({\n  ...props\n}: React.ComponentProps<typeof SelectPrimitive.Group>) {\n  return <SelectPrimitive.Group data-slot=\"select-group\" {...props} />\n}\n\nfunction SelectValue({\n  ...props\n}: React.ComponentProps<typeof SelectPrimitive.Value>) {\n  return <SelectPrimitive.Value data-slot=\"select-value\" {...props} />\n}\n\nfunction SelectTrigger({\n  className,\n  size = \"default\",\n  children,\n  ...props\n}: React.ComponentProps<typeof SelectPrimitive.Trigger> & {\n  size?: \"sm\" | \"default\"\n}) {\n  return (\n    <SelectPrimitive.Trigger\n      data-slot=\"select-trigger\"\n      data-size={size}\n      className={cn(\n        \"border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n        className\n      )}\n      {...props}\n    >\n      {children}\n      <SelectPrimitive.Icon asChild>\n        <ChevronDownIcon className=\"size-4 opacity-50\" />\n      </SelectPrimitive.Icon>\n    </SelectPrimitive.Trigger>\n  )\n}\n\nfunction SelectContent({\n  className,\n  children,\n  position = \"popper\",\n  ...props\n}: React.ComponentProps<typeof SelectPrimitive.Content>) {\n  return (\n    <SelectPrimitive.Portal>\n      <SelectPrimitive.Content\n        data-slot=\"select-content\"\n        className={cn(\n          \"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md\",\n          position === \"popper\" &&\n            \"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1\",\n          className\n        )}\n        position={position}\n        {...props}\n      >\n        <SelectScrollUpButton />\n        <SelectPrimitive.Viewport\n          className={cn(\n            \"p-1\",\n            position === \"popper\" &&\n              \"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1\"\n          )}\n        >\n          {children}\n        </SelectPrimitive.Viewport>\n        <SelectScrollDownButton />\n      </SelectPrimitive.Content>\n    </SelectPrimitive.Portal>\n  )\n}\n\nfunction SelectLabel({\n  className,\n  ...props\n}: React.ComponentProps<typeof SelectPrimitive.Label>) {\n  return (\n    <SelectPrimitive.Label\n      data-slot=\"select-label\"\n      className={cn(\"text-muted-foreground px-2 py-1.5 text-xs\", className)}\n      {...props}\n    />\n  )\n}\n\nfunction SelectItem({\n  className,\n  children,\n  ...props\n}: React.ComponentProps<typeof SelectPrimitive.Item>) {\n  return (\n    <SelectPrimitive.Item\n      data-slot=\"select-item\"\n      className={cn(\n        \"focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2\",\n        className\n      )}\n      {...props}\n    >\n      <span className=\"absolute right-2 flex size-3.5 items-center justify-center\">\n        <SelectPrimitive.ItemIndicator>\n          <CheckIcon className=\"size-4\" />\n        </SelectPrimitive.ItemIndicator>\n      </span>\n      <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n    </SelectPrimitive.Item>\n  )\n}\n\nfunction SelectSeparator({\n  className,\n  ...props\n}: React.ComponentProps<typeof SelectPrimitive.Separator>) {\n  return (\n    <SelectPrimitive.Separator\n      data-slot=\"select-separator\"\n      className={cn(\"bg-border pointer-events-none -mx-1 my-1 h-px\", className)}\n      {...props}\n    />\n  )\n}\n\nfunction SelectScrollUpButton({\n  className,\n  ...props\n}: React.ComponentProps<typeof SelectPrimitive.ScrollUpButton>) {\n  return (\n    <SelectPrimitive.ScrollUpButton\n      data-slot=\"select-scroll-up-button\"\n      className={cn(\n        \"flex cursor-default items-center justify-center py-1\",\n        className\n      )}\n      {...props}\n    >\n      <ChevronUpIcon className=\"size-4\" />\n    </SelectPrimitive.ScrollUpButton>\n  )\n}\n\nfunction SelectScrollDownButton({\n  className,\n  ...props\n}: React.ComponentProps<typeof SelectPrimitive.ScrollDownButton>) {\n  return (\n    <SelectPrimitive.ScrollDownButton\n      data-slot=\"select-scroll-down-button\"\n      className={cn(\n        \"flex cursor-default items-center justify-center py-1\",\n        className\n      )}\n      {...props}\n    >\n      <ChevronDownIcon className=\"size-4\" />\n    </SelectPrimitive.ScrollDownButton>\n  )\n}\n\nexport {\n  Select,\n  SelectContent,\n  SelectGroup,\n  SelectItem,\n  SelectLabel,\n  SelectScrollDownButton,\n  SelectScrollUpButton,\n  SelectSeparator,\n  SelectTrigger,\n  SelectValue,\n}\n"
  },
  {
    "path": "src/components/ui/separator.tsx",
    "content": "\"use client\"\n\nimport * as React from \"react\"\nimport * as SeparatorPrimitive from \"@radix-ui/react-separator\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction Separator({\n  className,\n  orientation = \"horizontal\",\n  decorative = true,\n  ...props\n}: React.ComponentProps<typeof SeparatorPrimitive.Root>) {\n  return (\n    <SeparatorPrimitive.Root\n      data-slot=\"separator-root\"\n      decorative={decorative}\n      orientation={orientation}\n      className={cn(\n        \"bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nexport { Separator }\n"
  },
  {
    "path": "src/components/ui/sheet.tsx",
    "content": "\"use client\"\n\nimport * as React from \"react\"\nimport * as SheetPrimitive from \"@radix-ui/react-dialog\"\nimport { XIcon } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction Sheet({ ...props }: React.ComponentProps<typeof SheetPrimitive.Root>) {\n  return <SheetPrimitive.Root data-slot=\"sheet\" {...props} />\n}\n\nfunction SheetTrigger({\n                        ...props\n                      }: React.ComponentProps<typeof SheetPrimitive.Trigger>) {\n  return <SheetPrimitive.Trigger data-slot=\"sheet-trigger\" {...props} />\n}\n\nfunction SheetClose({\n                      ...props\n                    }: React.ComponentProps<typeof SheetPrimitive.Close>) {\n  return <SheetPrimitive.Close data-slot=\"sheet-close\" {...props} />\n}\n\nfunction SheetPortal({\n                       ...props\n                     }: React.ComponentProps<typeof SheetPrimitive.Portal>) {\n  return <SheetPrimitive.Portal data-slot=\"sheet-portal\" {...props} />\n}\n\nfunction SheetOverlay({\n                        className,\n                        ...props\n                      }: React.ComponentProps<typeof SheetPrimitive.Overlay>) {\n  return (\n      <SheetPrimitive.Overlay\n          data-slot=\"sheet-overlay\"\n          className={cn(\n              \"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50\",\n              className\n          )}\n          {...props}\n      />\n  )\n}\n\nfunction SheetContent({\n                        className,\n                        children,\n                        side = \"right\",\n                        ...props\n                      }: React.ComponentProps<typeof SheetPrimitive.Content> & {\n  side?: \"top\" | \"right\" | \"bottom\" | \"left\"\n}) {\n  return (\n      <SheetPortal>\n        <SheetOverlay />\n        <SheetPrimitive.Content\n            data-slot=\"sheet-content\"\n            className={cn(\n                \"bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500\",\n                side === \"right\" &&\n                \"data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l\",\n                // \"data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm\",\n                side === \"left\" &&\n                \"data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r\",\n                // \"data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm\",\n                side === \"top\" &&\n                \"data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b\",\n                side === \"bottom\" &&\n                \"data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t\",\n                className\n            )}\n            {...props}\n        >\n          {children}\n          <SheetPrimitive.Close className=\"ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none\">\n            <XIcon className=\"size-4\" />\n            <span className=\"sr-only\">Close</span>\n          </SheetPrimitive.Close>\n        </SheetPrimitive.Content>\n      </SheetPortal>\n  )\n}\n\nfunction SheetHeader({ className, ...props }: React.ComponentProps<\"div\">) {\n  return (\n      <div\n          data-slot=\"sheet-header\"\n          className={cn(\"flex flex-col gap-1.5 p-4\", className)}\n          {...props}\n      />\n  )\n}\n\nfunction SheetFooter({ className, ...props }: React.ComponentProps<\"div\">) {\n  return (\n      <div\n          data-slot=\"sheet-footer\"\n          className={cn(\"mt-auto flex flex-col gap-2 p-4\", className)}\n          {...props}\n      />\n  )\n}\n\nfunction SheetTitle({\n                      className,\n                      ...props\n                    }: React.ComponentProps<typeof SheetPrimitive.Title>) {\n  return (\n      <SheetPrimitive.Title\n          data-slot=\"sheet-title\"\n          className={cn(\"text-foreground font-semibold\", className)}\n          {...props}\n      />\n  )\n}\n\nfunction SheetDescription({\n                            className,\n                            ...props\n                          }: React.ComponentProps<typeof SheetPrimitive.Description>) {\n  return (\n      <SheetPrimitive.Description\n          data-slot=\"sheet-description\"\n          className={cn(\"text-muted-foreground text-sm\", className)}\n          {...props}\n      />\n  )\n}\n\nexport {\n  Sheet,\n  SheetTrigger,\n  SheetClose,\n  SheetContent,\n  SheetHeader,\n  SheetFooter,\n  SheetTitle,\n  SheetDescription,\n}\n"
  },
  {
    "path": "src/components/ui/sidebar.tsx",
    "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { Slot } from \"@radix-ui/react-slot\"\nimport { VariantProps, cva } from \"class-variance-authority\"\nimport { PanelLeftIcon } from \"lucide-react\"\n\nimport { useIsMobile } from \"@/hooks/use-mobile\"\nimport { cn } from \"@/lib/utils\"\nimport { Button } from \"@/components/ui/button\"\nimport { Input } from \"@/components/ui/input\"\nimport { Separator } from \"@/components/ui/separator\"\nimport {\n  Sheet,\n  SheetContent,\n  SheetDescription,\n  SheetHeader,\n  SheetTitle,\n} from \"@/components/ui/sheet\"\nimport { Skeleton } from \"@/components/ui/skeleton\"\nimport {\n  Tooltip,\n  TooltipContent,\n  TooltipProvider,\n  TooltipTrigger,\n} from \"@/components/ui/tooltip\"\n\nconst SIDEBAR_COOKIE_NAME = \"sidebar_state\"\nconst SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7\nconst SIDEBAR_WIDTH = \"16rem\"\nconst SIDEBAR_WIDTH_MOBILE = \"18rem\"\nconst SIDEBAR_WIDTH_ICON = \"3rem\"\nconst SIDEBAR_KEYBOARD_SHORTCUT = \"b\"\n\ntype SidebarContextProps = {\n  state: \"expanded\" | \"collapsed\"\n  open: boolean\n  setOpen: (open: boolean) => void\n  openMobile: boolean\n  setOpenMobile: (open: boolean) => void\n  isMobile: boolean\n  toggleSidebar: () => void\n}\n\nconst SidebarContext = React.createContext<SidebarContextProps | null>(null)\n\nfunction useSidebar() {\n  const context = React.useContext(SidebarContext)\n  if (!context) {\n    throw new Error(\"useSidebar must be used within a SidebarProvider.\")\n  }\n\n  return context\n}\n\nfunction SidebarProvider({\n  defaultOpen = true,\n  open: openProp,\n  onOpenChange: setOpenProp,\n  className,\n  style,\n  children,\n  ...props\n}: React.ComponentProps<\"div\"> & {\n  defaultOpen?: boolean\n  open?: boolean\n  onOpenChange?: (open: boolean) => void\n}) {\n  const isMobile = useIsMobile()\n  const [openMobile, setOpenMobile] = React.useState(false)\n\n  // This is the internal state of the sidebar.\n  // We use openProp and setOpenProp for control from outside the component.\n  const [_open, _setOpen] = React.useState(defaultOpen)\n  const open = openProp ?? _open\n  const setOpen = React.useCallback(\n    (value: boolean | ((value: boolean) => boolean)) => {\n      const openState = typeof value === \"function\" ? value(open) : value\n      if (setOpenProp) {\n        setOpenProp(openState)\n      } else {\n        _setOpen(openState)\n      }\n\n      // This sets the cookie to keep the sidebar state.\n      document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`\n    },\n    [setOpenProp, open]\n  )\n\n  // Helper to toggle the sidebar.\n  const toggleSidebar = React.useCallback(() => {\n    return isMobile ? setOpenMobile((open) => !open) : setOpen((open) => !open)\n  }, [isMobile, setOpen, setOpenMobile])\n\n  // Adds a keyboard shortcut to toggle the sidebar.\n  React.useEffect(() => {\n    const handleKeyDown = (event: KeyboardEvent) => {\n      if (\n        event.key === SIDEBAR_KEYBOARD_SHORTCUT &&\n        (event.metaKey || event.ctrlKey)\n      ) {\n        event.preventDefault()\n        toggleSidebar()\n      }\n    }\n\n    window.addEventListener(\"keydown\", handleKeyDown)\n    return () => window.removeEventListener(\"keydown\", handleKeyDown)\n  }, [toggleSidebar])\n\n  // We add a state so that we can do data-state=\"expanded\" or \"collapsed\".\n  // This makes it easier to style the sidebar with Tailwind classes.\n  const state = open ? \"expanded\" : \"collapsed\"\n\n  const contextValue = React.useMemo<SidebarContextProps>(\n    () => ({\n      state,\n      open,\n      setOpen,\n      isMobile,\n      openMobile,\n      setOpenMobile,\n      toggleSidebar,\n    }),\n    [state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar]\n  )\n\n  return (\n    <SidebarContext.Provider value={contextValue}>\n      <TooltipProvider delayDuration={0}>\n        <div\n          data-slot=\"sidebar-wrapper\"\n          style={\n            {\n              \"--sidebar-width\": SIDEBAR_WIDTH,\n              \"--sidebar-width-icon\": SIDEBAR_WIDTH_ICON,\n              ...style,\n            } as React.CSSProperties\n          }\n          className={cn(\n            \"group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full\",\n            className\n          )}\n          {...props}\n        >\n          {children}\n        </div>\n      </TooltipProvider>\n    </SidebarContext.Provider>\n  )\n}\n\nfunction Sidebar({\n  side = \"left\",\n  variant = \"sidebar\",\n  collapsible = \"offcanvas\",\n  className,\n  children,\n  ...props\n}: React.ComponentProps<\"div\"> & {\n  side?: \"left\" | \"right\"\n  variant?: \"sidebar\" | \"floating\" | \"inset\"\n  collapsible?: \"offcanvas\" | \"icon\" | \"none\"\n}) {\n  const { isMobile, state, openMobile, setOpenMobile } = useSidebar()\n\n  if (collapsible === \"none\") {\n    return (\n      <div\n        data-slot=\"sidebar\"\n        className={cn(\n          \"bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col\",\n          className\n        )}\n        {...props}\n      >\n        {children}\n      </div>\n    )\n  }\n\n  if (isMobile) {\n    return (\n      <Sheet open={openMobile} onOpenChange={setOpenMobile} {...props}>\n        <SheetContent\n          data-sidebar=\"sidebar\"\n          data-slot=\"sidebar\"\n          data-mobile=\"true\"\n          className=\"bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden\"\n          style={\n            {\n              \"--sidebar-width\": SIDEBAR_WIDTH_MOBILE,\n            } as React.CSSProperties\n          }\n          side={side}\n        >\n          <SheetHeader className=\"sr-only\">\n            <SheetTitle>Sidebar</SheetTitle>\n            <SheetDescription>Displays the mobile sidebar.</SheetDescription>\n          </SheetHeader>\n          <div className=\"flex h-full w-full flex-col\">{children}</div>\n        </SheetContent>\n      </Sheet>\n    )\n  }\n\n  return (\n    <div\n      className=\"group peer text-sidebar-foreground hidden md:block\"\n      data-state={state}\n      data-collapsible={state === \"collapsed\" ? collapsible : \"\"}\n      data-variant={variant}\n      data-side={side}\n      data-slot=\"sidebar\"\n    >\n      {/* This is what handles the sidebar gap on desktop */}\n      <div\n        data-slot=\"sidebar-gap\"\n        className={cn(\n          \"relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear\",\n          \"group-data-[collapsible=offcanvas]:w-0\",\n          \"group-data-[side=right]:rotate-180\",\n          variant === \"floating\" || variant === \"inset\"\n            ? \"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]\"\n            : \"group-data-[collapsible=icon]:w-(--sidebar-width-icon)\"\n        )}\n      />\n      <div\n        data-slot=\"sidebar-container\"\n        className={cn(\n          \"fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex\",\n          side === \"left\"\n            ? \"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]\"\n            : \"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]\",\n          // Adjust the padding for floating and inset variants.\n          variant === \"floating\" || variant === \"inset\"\n            ? \"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]\"\n            : \"group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l\",\n          className\n        )}\n        {...props}\n      >\n        <div\n          data-sidebar=\"sidebar\"\n          data-slot=\"sidebar-inner\"\n          className=\"bg-sidebar group-data-[variant=floating]:border-sidebar-border flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:shadow-sm\"\n        >\n          {children}\n        </div>\n      </div>\n    </div>\n  )\n}\n\nfunction SidebarTrigger({\n  className,\n  onClick,\n  ...props\n}: React.ComponentProps<typeof Button>) {\n  const { toggleSidebar } = useSidebar()\n\n  return (\n    <Button\n      data-sidebar=\"trigger\"\n      data-slot=\"sidebar-trigger\"\n      variant=\"ghost\"\n      size=\"icon\"\n      className={cn(\"size-7\", className)}\n      onClick={(event) => {\n        onClick?.(event)\n        toggleSidebar()\n      }}\n      {...props}\n    >\n      <PanelLeftIcon />\n      <span className=\"sr-only\">Toggle Sidebar</span>\n    </Button>\n  )\n}\n\nfunction SidebarRail({ className, ...props }: React.ComponentProps<\"button\">) {\n  const { toggleSidebar } = useSidebar()\n\n  return (\n    <button\n      data-sidebar=\"rail\"\n      data-slot=\"sidebar-rail\"\n      aria-label=\"Toggle Sidebar\"\n      tabIndex={-1}\n      onClick={toggleSidebar}\n      title=\"Toggle Sidebar\"\n      className={cn(\n        \"hover:after:bg-sidebar-border absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] sm:flex\",\n        \"in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize\",\n        \"[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize\",\n        \"hover:group-data-[collapsible=offcanvas]:bg-sidebar group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full\",\n        \"[[data-side=left][data-collapsible=offcanvas]_&]:-right-2\",\n        \"[[data-side=right][data-collapsible=offcanvas]_&]:-left-2\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction SidebarInset({ className, ...props }: React.ComponentProps<\"main\">) {\n  return (\n    <main\n      data-slot=\"sidebar-inset\"\n      className={cn(\n        \"bg-background relative flex w-full flex-1 flex-col\",\n        \"md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction SidebarInput({\n  className,\n  ...props\n}: React.ComponentProps<typeof Input>) {\n  return (\n    <Input\n      data-slot=\"sidebar-input\"\n      data-sidebar=\"input\"\n      className={cn(\"bg-background h-8 w-full shadow-none\", className)}\n      {...props}\n    />\n  )\n}\n\nfunction SidebarHeader({ className, ...props }: React.ComponentProps<\"div\">) {\n  return (\n    <div\n      data-slot=\"sidebar-header\"\n      data-sidebar=\"header\"\n      className={cn(\"flex flex-col gap-2 p-2\", className)}\n      {...props}\n    />\n  )\n}\n\nfunction SidebarFooter({ className, ...props }: React.ComponentProps<\"div\">) {\n  return (\n    <div\n      data-slot=\"sidebar-footer\"\n      data-sidebar=\"footer\"\n      className={cn(\"flex flex-col gap-2 p-2\", className)}\n      {...props}\n    />\n  )\n}\n\nfunction SidebarSeparator({\n  className,\n  ...props\n}: React.ComponentProps<typeof Separator>) {\n  return (\n    <Separator\n      data-slot=\"sidebar-separator\"\n      data-sidebar=\"separator\"\n      className={cn(\"bg-sidebar-border mx-2 w-auto\", className)}\n      {...props}\n    />\n  )\n}\n\nfunction SidebarContent({ className, ...props }: React.ComponentProps<\"div\">) {\n  return (\n    <div\n      data-slot=\"sidebar-content\"\n      data-sidebar=\"content\"\n      className={cn(\n        \"flex min-h-0 flex-1 flex-col gap-2 overflow-auto scrollbar-hide group-data-[collapsible=icon]:overflow-hidden\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction SidebarGroup({ className, ...props }: React.ComponentProps<\"div\">) {\n  return (\n    <div\n      data-slot=\"sidebar-group\"\n      data-sidebar=\"group\"\n      className={cn(\"relative flex w-full min-w-0 flex-col p-2\", className)}\n      {...props}\n    />\n  )\n}\n\nfunction SidebarGroupLabel({\n  className,\n  asChild = false,\n  ...props\n}: React.ComponentProps<\"div\"> & { asChild?: boolean }) {\n  const Comp = asChild ? Slot : \"div\"\n\n  return (\n    <Comp\n      data-slot=\"sidebar-group-label\"\n      data-sidebar=\"group-label\"\n      className={cn(\n        \"text-sidebar-foreground/70 ring-sidebar-ring flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium outline-hidden transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0\",\n        \"group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction SidebarGroupAction({\n  className,\n  asChild = false,\n  ...props\n}: React.ComponentProps<\"button\"> & { asChild?: boolean }) {\n  const Comp = asChild ? Slot : \"button\"\n\n  return (\n    <Comp\n      data-slot=\"sidebar-group-action\"\n      data-sidebar=\"group-action\"\n      className={cn(\n        \"text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 outline-hidden transition-transform focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0\",\n        // Increases the hit area of the button on mobile.\n        \"after:absolute after:-inset-2 md:after:hidden\",\n        \"group-data-[collapsible=icon]:hidden\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction SidebarGroupContent({\n  className,\n  ...props\n}: React.ComponentProps<\"div\">) {\n  return (\n    <div\n      data-slot=\"sidebar-group-content\"\n      data-sidebar=\"group-content\"\n      className={cn(\"w-full text-sm\", className)}\n      {...props}\n    />\n  )\n}\n\nfunction SidebarMenu({ className, ...props }: React.ComponentProps<\"ul\">) {\n  return (\n    <ul\n      data-slot=\"sidebar-menu\"\n      data-sidebar=\"menu\"\n      className={cn(\"flex w-full min-w-0 flex-col gap-1\", className)}\n      {...props}\n    />\n  )\n}\n\nfunction SidebarMenuItem({ className, ...props }: React.ComponentProps<\"li\">) {\n  return (\n    <li\n      data-slot=\"sidebar-menu-item\"\n      data-sidebar=\"menu-item\"\n      className={cn(\"group/menu-item relative\", className)}\n      {...props}\n    />\n  )\n}\n\nconst sidebarMenuButtonVariants = cva(\n  \"peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0\",\n  {\n    variants: {\n      variant: {\n        default: \"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground\",\n        outline:\n          \"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]\",\n      },\n      size: {\n        default: \"h-8 text-sm\",\n        sm: \"h-7 text-xs\",\n        lg: \"h-12 text-sm group-data-[collapsible=icon]:p-0!\",\n      },\n    },\n    defaultVariants: {\n      variant: \"default\",\n      size: \"default\",\n    },\n  }\n)\n\nfunction SidebarMenuButton({\n  asChild = false,\n  isActive = false,\n  variant = \"default\",\n  size = \"default\",\n  tooltip,\n  className,\n  ...props\n}: React.ComponentProps<\"button\"> & {\n  asChild?: boolean\n  isActive?: boolean\n  tooltip?: string | React.ComponentProps<typeof TooltipContent>\n} & VariantProps<typeof sidebarMenuButtonVariants>) {\n  const Comp = asChild ? Slot : \"button\"\n  const { isMobile, state } = useSidebar()\n\n  const button = (\n    <Comp\n      data-slot=\"sidebar-menu-button\"\n      data-sidebar=\"menu-button\"\n      data-size={size}\n      data-active={isActive}\n      className={cn(sidebarMenuButtonVariants({ variant, size }), className)}\n      {...props}\n    />\n  )\n\n  if (!tooltip) {\n    return button\n  }\n\n  if (typeof tooltip === \"string\") {\n    tooltip = {\n      children: tooltip,\n    }\n  }\n\n  return (\n    <Tooltip>\n      <TooltipTrigger asChild>{button}</TooltipTrigger>\n      <TooltipContent\n        side=\"right\"\n        align=\"center\"\n        hidden={state !== \"collapsed\" || isMobile}\n        {...tooltip}\n      />\n    </Tooltip>\n  )\n}\n\nfunction SidebarMenuAction({\n  className,\n  asChild = false,\n  showOnHover = false,\n  ...props\n}: React.ComponentProps<\"button\"> & {\n  asChild?: boolean\n  showOnHover?: boolean\n}) {\n  const Comp = asChild ? Slot : \"button\"\n\n  return (\n    <Comp\n      data-slot=\"sidebar-menu-action\"\n      data-sidebar=\"menu-action\"\n      className={cn(\n        \"text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground peer-hover/menu-button:text-sidebar-accent-foreground absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 outline-hidden transition-transform focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0\",\n        // Increases the hit area of the button on mobile.\n        \"after:absolute after:-inset-2 md:after:hidden\",\n        \"peer-data-[size=sm]/menu-button:top-1\",\n        \"peer-data-[size=default]/menu-button:top-1.5\",\n        \"peer-data-[size=lg]/menu-button:top-2.5\",\n        \"group-data-[collapsible=icon]:hidden\",\n        showOnHover &&\n          \"peer-data-[active=true]/menu-button:text-sidebar-accent-foreground group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 md:opacity-0\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction SidebarMenuBadge({\n  className,\n  ...props\n}: React.ComponentProps<\"div\">) {\n  return (\n    <div\n      data-slot=\"sidebar-menu-badge\"\n      data-sidebar=\"menu-badge\"\n      className={cn(\n        \"text-sidebar-foreground pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums select-none\",\n        \"peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground\",\n        \"peer-data-[size=sm]/menu-button:top-1\",\n        \"peer-data-[size=default]/menu-button:top-1.5\",\n        \"peer-data-[size=lg]/menu-button:top-2.5\",\n        \"group-data-[collapsible=icon]:hidden\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction SidebarMenuSkeleton({\n  className,\n  showIcon = false,\n  ...props\n}: React.ComponentProps<\"div\"> & {\n  showIcon?: boolean\n}) {\n  // Random width between 50 to 90%.\n  const width = React.useMemo(() => {\n    return `${Math.floor(Math.random() * 40) + 50}%`\n  }, [])\n\n  return (\n    <div\n      data-slot=\"sidebar-menu-skeleton\"\n      data-sidebar=\"menu-skeleton\"\n      className={cn(\"flex h-8 items-center gap-2 rounded-md px-2\", className)}\n      {...props}\n    >\n      {showIcon && (\n        <Skeleton\n          className=\"size-4 rounded-md\"\n          data-sidebar=\"menu-skeleton-icon\"\n        />\n      )}\n      <Skeleton\n        className=\"h-4 max-w-(--skeleton-width) flex-1\"\n        data-sidebar=\"menu-skeleton-text\"\n        style={\n          {\n            \"--skeleton-width\": width,\n          } as React.CSSProperties\n        }\n      />\n    </div>\n  )\n}\n\nfunction SidebarMenuSub({ className, ...props }: React.ComponentProps<\"ul\">) {\n  return (\n    <ul\n      data-slot=\"sidebar-menu-sub\"\n      data-sidebar=\"menu-sub\"\n      className={cn(\n        \"border-sidebar-border mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l px-2.5 py-0.5\",\n        \"group-data-[collapsible=icon]:hidden\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction SidebarMenuSubItem({\n  className,\n  ...props\n}: React.ComponentProps<\"li\">) {\n  return (\n    <li\n      data-slot=\"sidebar-menu-sub-item\"\n      data-sidebar=\"menu-sub-item\"\n      className={cn(\"group/menu-sub-item relative\", className)}\n      {...props}\n    />\n  )\n}\n\nfunction SidebarMenuSubButton({\n  asChild = false,\n  size = \"md\",\n  isActive = false,\n  className,\n  ...props\n}: React.ComponentProps<\"a\"> & {\n  asChild?: boolean\n  size?: \"sm\" | \"md\"\n  isActive?: boolean\n}) {\n  const Comp = asChild ? Slot : \"a\"\n\n  return (\n    <Comp\n      data-slot=\"sidebar-menu-sub-button\"\n      data-sidebar=\"menu-sub-button\"\n      data-size={size}\n      data-active={isActive}\n      className={cn(\n        \"text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground [&>svg]:text-sidebar-accent-foreground flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 outline-hidden focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0\",\n        \"data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground\",\n        size === \"sm\" && \"text-xs\",\n        size === \"md\" && \"text-sm\",\n        \"group-data-[collapsible=icon]:hidden\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nexport {\n  Sidebar,\n  SidebarContent,\n  SidebarFooter,\n  SidebarGroup,\n  SidebarGroupAction,\n  SidebarGroupContent,\n  SidebarGroupLabel,\n  SidebarHeader,\n  SidebarInput,\n  SidebarInset,\n  SidebarMenu,\n  SidebarMenuAction,\n  SidebarMenuBadge,\n  SidebarMenuButton,\n  SidebarMenuItem,\n  SidebarMenuSkeleton,\n  SidebarMenuSub,\n  SidebarMenuSubButton,\n  SidebarMenuSubItem,\n  SidebarProvider,\n  SidebarRail,\n  SidebarSeparator,\n  SidebarTrigger,\n  useSidebar,\n}\n"
  },
  {
    "path": "src/components/ui/skeleton.tsx",
    "content": "import { cn } from \"@/lib/utils\"\n\nfunction Skeleton({ className, ...props }: React.ComponentProps<\"div\">) {\n  return (\n    <div\n      data-slot=\"skeleton\"\n      className={cn(\"bg-accent animate-pulse rounded-md\", className)}\n      {...props}\n    />\n  )\n}\n\nexport { Skeleton }\n"
  },
  {
    "path": "src/components/ui/slider.tsx",
    "content": "\"use client\"\n\nimport * as React from \"react\"\nimport * as SliderPrimitive from \"@radix-ui/react-slider\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction Slider({\n  className,\n  defaultValue,\n  value,\n  min = 0,\n  max = 100,\n  ...props\n}: React.ComponentProps<typeof SliderPrimitive.Root>) {\n  const _values = React.useMemo(\n    () =>\n      Array.isArray(value)\n        ? value\n        : Array.isArray(defaultValue)\n          ? defaultValue\n          : [min, max],\n    [value, defaultValue, min, max]\n  )\n\n  return (\n    <SliderPrimitive.Root\n      data-slot=\"slider\"\n      defaultValue={defaultValue}\n      value={value}\n      min={min}\n      max={max}\n      className={cn(\n        \"relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col\",\n        className\n      )}\n      {...props}\n    >\n      <SliderPrimitive.Track\n        data-slot=\"slider-track\"\n        className={cn(\n          \"bg-muted relative grow overflow-hidden rounded-full data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5\"\n        )}\n      >\n        <SliderPrimitive.Range\n          data-slot=\"slider-range\"\n          className={cn(\n            \"bg-primary absolute data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full\"\n          )}\n        />\n      </SliderPrimitive.Track>\n      {Array.from({ length: _values.length }, (_, index) => (\n        <SliderPrimitive.Thumb\n          data-slot=\"slider-thumb\"\n          key={index}\n          className=\"border-primary bg-background ring-ring/50 block size-4 shrink-0 rounded-full border shadow-sm transition-[color,box-shadow] hover:ring-4 focus-visible:ring-4 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50\"\n        />\n      ))}\n    </SliderPrimitive.Root>\n  )\n}\n\nexport { Slider }\n"
  },
  {
    "path": "src/components/ui/sliding-number.tsx",
    "content": "'use client';\n\nimport * as React from 'react';\nimport {\n    useSpring,\n    useTransform,\n    motion,\n    useInView,\n    type MotionValue,\n    type SpringOptions,\n    type UseInViewOptions,\n} from 'motion/react';\nimport useMeasure from 'react-use-measure';\nimport {cn} from \"@/lib/utils\";\n\n\ntype SlidingNumberRollerProps = {\n    prevValue: number;\n    value: number;\n    place: number;\n    transition: SpringOptions;\n};\n\nfunction SlidingNumberRoller({\n                                 prevValue,\n                                 value,\n                                 place,\n                                 transition,\n                             }: SlidingNumberRollerProps) {\n    const startNumber = Math.floor(prevValue / place) % 10;\n    const targetNumber = Math.floor(value / place) % 10;\n    const animatedValue = useSpring(startNumber, transition);\n\n    React.useEffect(() => {\n        animatedValue.set(targetNumber);\n    }, [targetNumber, animatedValue]);\n\n    const [measureRef, { height }] = useMeasure();\n\n    return (\n        <span\n            ref={measureRef}\n            data-slot=\"sliding-number-roller\"\n            className=\"relative inline-block w-[1ch] overflow-x-visible overflow-y-clip leading-none tabular-nums\"\n        >\n      <span className=\"invisible\">0</span>\n            {Array.from({ length: 10 }, (_, i) => (\n                <SlidingNumberDisplay\n                    key={i}\n                    motionValue={animatedValue}\n                    number={i}\n                    height={height}\n                    transition={transition}\n                />\n            ))}\n    </span>\n    );\n}\n\ntype SlidingNumberDisplayProps = {\n    motionValue: MotionValue<number>;\n    number: number;\n    height: number;\n    transition: SpringOptions;\n};\n\nfunction SlidingNumberDisplay({\n                                  motionValue,\n                                  number,\n                                  height,\n                                  transition,\n                              }: SlidingNumberDisplayProps) {\n    const y = useTransform(motionValue, (latest) => {\n        if (!height) return 0;\n        const currentNumber = latest % 10;\n        const offset = (10 + number - currentNumber) % 10;\n        let translateY = offset * height;\n        if (offset > 5) translateY -= 10 * height;\n        return translateY;\n    });\n\n    if (!height) {\n        return <span className=\"invisible absolute\">{number}</span>;\n    }\n\n    return (\n        <motion.span\n            data-slot=\"sliding-number-display\"\n            style={{ y }}\n            className=\"absolute inset-0 flex items-center justify-center\"\n            transition={{ ...transition, type: 'spring' }}\n        >\n            {number}\n        </motion.span>\n    );\n}\n\ntype SlidingNumberProps = React.ComponentProps<'span'> & {\n    number: number | string;\n    inView?: boolean;\n    inViewMargin?: UseInViewOptions['margin'];\n    inViewOnce?: boolean;\n    padStart?: boolean;\n    decimalSeparator?: string;\n    decimalPlaces?: number;\n    transition?: SpringOptions;\n};\n\nfunction SlidingNumber({\n                           ref,\n                           number,\n                           className,\n                           inView = false,\n                           inViewMargin = '0px',\n                           inViewOnce = true,\n                           padStart = false,\n                           decimalSeparator = '.',\n                           decimalPlaces = 0,\n                           transition = {\n                               stiffness: 200,\n                               damping: 20,\n                               mass: 0.4,\n                           },\n                           ...props\n                       }: SlidingNumberProps) {\n    const localRef = React.useRef<HTMLSpanElement>(null);\n    React.useImperativeHandle(ref, () => localRef.current!);\n\n    const inViewResult = useInView(localRef, {\n        once: inViewOnce,\n        margin: inViewMargin,\n    });\n    const isInView = !inView || inViewResult;\n\n    const prevNumberRef = React.useRef<number>(0);\n\n    const effectiveNumber = React.useMemo(\n        () => (!isInView ? 0 : Math.abs(Number(number))),\n        [number, isInView],\n    );\n\n    const formatNumber = React.useCallback(\n        (num: number) =>\n            decimalPlaces != null ? num.toFixed(decimalPlaces) : num.toString(),\n        [decimalPlaces],\n    );\n\n    const numberStr = formatNumber(effectiveNumber);\n    const [newIntStrRaw, newDecStrRaw = ''] = numberStr.split('.');\n    const newIntStr =\n        padStart && newIntStrRaw?.length === 1 ? '0' + newIntStrRaw : newIntStrRaw;\n\n    const prevFormatted = formatNumber(prevNumberRef.current);\n    const [prevIntStrRaw = '', prevDecStrRaw = ''] = prevFormatted.split('.');\n    const prevIntStr =\n        padStart && prevIntStrRaw.length === 1\n            ? '0' + prevIntStrRaw\n            : prevIntStrRaw;\n\n    const adjustedPrevInt = React.useMemo(() => {\n        return prevIntStr.length > (newIntStr?.length ?? 0)\n            ? prevIntStr.slice(-(newIntStr?.length ?? 0))\n            : prevIntStr.padStart(newIntStr?.length ?? 0, '0');\n    }, [prevIntStr, newIntStr]);\n\n    const adjustedPrevDec = React.useMemo(() => {\n        if (!newDecStrRaw) return '';\n        return prevDecStrRaw.length > newDecStrRaw.length\n            ? prevDecStrRaw.slice(0, newDecStrRaw.length)\n            : prevDecStrRaw.padEnd(newDecStrRaw.length, '0');\n    }, [prevDecStrRaw, newDecStrRaw]);\n\n    React.useEffect(() => {\n        if (isInView) prevNumberRef.current = effectiveNumber;\n    }, [effectiveNumber, isInView]);\n\n    const intDigitCount = newIntStr?.length ?? 0;\n    const intPlaces = React.useMemo(\n        () =>\n            Array.from({ length: intDigitCount }, (_, i) =>\n                Math.pow(10, intDigitCount - i - 1),\n            ),\n        [intDigitCount],\n    );\n    const decPlaces = React.useMemo(\n        () =>\n            newDecStrRaw\n                ? Array.from({ length: newDecStrRaw.length }, (_, i) =>\n                    Math.pow(10, newDecStrRaw.length - i - 1),\n                )\n                : [],\n        [newDecStrRaw],\n    );\n\n    const newDecValue = newDecStrRaw ? parseInt(newDecStrRaw, 10) : 0;\n    const prevDecValue = adjustedPrevDec ? parseInt(adjustedPrevDec, 10) : 0;\n\n    return (\n        <span\n            ref={localRef}\n            data-slot=\"sliding-number\"\n            className={cn('flex items-center', className)}\n            {...props}\n        >\n      {isInView && Number(number) < 0 && <span className=\"mr-1\">-</span>}\n\n            {intPlaces.map((place) => (\n                <SlidingNumberRoller\n                    key={`int-${place}`}\n                    prevValue={parseInt(adjustedPrevInt, 10)}\n                    value={parseInt(newIntStr ?? '0', 10)}\n                    place={place}\n                    transition={transition}\n                />\n            ))}\n\n            {newDecStrRaw && (\n                <>\n                    <span>{decimalSeparator}</span>\n                    {decPlaces.map((place) => (\n                        <SlidingNumberRoller\n                            key={`dec-${place}`}\n                            prevValue={prevDecValue}\n                            value={newDecValue}\n                            place={place}\n                            transition={transition}\n                        />\n                    ))}\n                </>\n            )}\n    </span>\n    );\n}\n\nexport { SlidingNumber, type SlidingNumberProps };"
  },
  {
    "path": "src/components/ui/sonner.tsx",
    "content": "\"use client\"\n\nimport { useTheme } from \"next-themes\"\nimport { Toaster as Sonner, ToasterProps } from \"sonner\"\n\nconst Toaster = ({ ...props }: ToasterProps) => {\n  const { theme = \"system\" } = useTheme()\n\n  return (\n    <Sonner\n      theme={theme as ToasterProps[\"theme\"]}\n      className=\"toaster group\"\n      style={\n        {\n          \"--normal-bg\": \"var(--popover)\",\n          \"--normal-text\": \"var(--popover-foreground)\",\n          \"--normal-border\": \"var(--border)\",\n        } as React.CSSProperties\n      }\n      {...props}\n    />\n  )\n}\n\nexport { Toaster }\n"
  },
  {
    "path": "src/components/ui/switch.tsx",
    "content": "\"use client\"\n\nimport * as React from \"react\"\nimport * as SwitchPrimitive from \"@radix-ui/react-switch\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction Switch({\n  className,\n  ...props\n}: React.ComponentProps<typeof SwitchPrimitive.Root>) {\n  return (\n    <SwitchPrimitive.Root\n      data-slot=\"switch\"\n      className={cn(\n        \"peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50\",\n        className\n      )}\n      {...props}\n    >\n      <SwitchPrimitive.Thumb\n        data-slot=\"switch-thumb\"\n        className={cn(\n          \"bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0\"\n        )}\n      />\n    </SwitchPrimitive.Root>\n  )\n}\n\nexport { Switch }\n"
  },
  {
    "path": "src/components/ui/table.tsx",
    "content": "\"use client\"\n\nimport * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction Table({ className, ...props }: React.ComponentProps<\"table\">) {\n  return (\n    <div\n      data-slot=\"table-container\"\n      className=\"relative w-full overflow-x-auto\"\n    >\n      <table\n        data-slot=\"table\"\n        className={cn(\"w-full caption-bottom text-sm\", className)}\n        {...props}\n      />\n    </div>\n  )\n}\n\nfunction TableHeader({ className, ...props }: React.ComponentProps<\"thead\">) {\n  return (\n    <thead\n      data-slot=\"table-header\"\n      className={cn(\"[&_tr]:border-b\", className)}\n      {...props}\n    />\n  )\n}\n\nfunction TableBody({ className, ...props }: React.ComponentProps<\"tbody\">) {\n  return (\n    <tbody\n      data-slot=\"table-body\"\n      className={cn(\"[&_tr:last-child]:border-0\", className)}\n      {...props}\n    />\n  )\n}\n\nfunction TableFooter({ className, ...props }: React.ComponentProps<\"tfoot\">) {\n  return (\n    <tfoot\n      data-slot=\"table-footer\"\n      className={cn(\n        \"bg-muted/50 border-t font-medium [&>tr]:last:border-b-0\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction TableRow({ className, ...props }: React.ComponentProps<\"tr\">) {\n  return (\n    <tr\n      data-slot=\"table-row\"\n      className={cn(\n        \"hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction TableHead({ className, ...props }: React.ComponentProps<\"th\">) {\n  return (\n    <th\n      data-slot=\"table-head\"\n      className={cn(\n        \"text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction TableCell({ className, ...props }: React.ComponentProps<\"td\">) {\n  return (\n    <td\n      data-slot=\"table-cell\"\n      className={cn(\n        \"p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction TableCaption({\n  className,\n  ...props\n}: React.ComponentProps<\"caption\">) {\n  return (\n    <caption\n      data-slot=\"table-caption\"\n      className={cn(\"text-muted-foreground mt-4 text-sm\", className)}\n      {...props}\n    />\n  )\n}\n\nexport {\n  Table,\n  TableHeader,\n  TableBody,\n  TableFooter,\n  TableHead,\n  TableRow,\n  TableCell,\n  TableCaption,\n}\n"
  },
  {
    "path": "src/components/ui/tabs.tsx",
    "content": "\"use client\"\n\nimport * as React from \"react\"\nimport * as TabsPrimitive from \"@radix-ui/react-tabs\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction Tabs({\n  className,\n  ...props\n}: React.ComponentProps<typeof TabsPrimitive.Root>) {\n  return (\n    <TabsPrimitive.Root\n      data-slot=\"tabs\"\n      className={cn(\"flex flex-col gap-2\", className)}\n      {...props}\n    />\n  )\n}\n\nfunction TabsList({\n  className,\n  ...props\n}: React.ComponentProps<typeof TabsPrimitive.List>) {\n  return (\n    <TabsPrimitive.List\n      data-slot=\"tabs-list\"\n      className={cn(\n        \"bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction TabsTrigger({\n  className,\n  ...props\n}: React.ComponentProps<typeof TabsPrimitive.Trigger>) {\n  return (\n    <TabsPrimitive.Trigger\n      data-slot=\"tabs-trigger\"\n      className={cn(\n        \"data-[state=active]:bg-background dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction TabsContent({\n  className,\n  ...props\n}: React.ComponentProps<typeof TabsPrimitive.Content>) {\n  return (\n    <TabsPrimitive.Content\n      data-slot=\"tabs-content\"\n      className={cn(\"flex-1 outline-none\", className)}\n      {...props}\n    />\n  )\n}\n\nexport { Tabs, TabsList, TabsTrigger, TabsContent }\n"
  },
  {
    "path": "src/components/ui/textarea.tsx",
    "content": "import * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction Textarea({ className, ...props }: React.ComponentProps<\"textarea\">) {\n  return (\n    <textarea\n      data-slot=\"textarea\"\n      className={cn(\n        \"border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nexport { Textarea }\n"
  },
  {
    "path": "src/components/ui/toast.tsx",
    "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { Cross2Icon } from \"@radix-ui/react-icons\"\nimport * as ToastPrimitives from \"@radix-ui/react-toast\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst ToastProvider = ToastPrimitives.Provider\n\nconst ToastViewport = React.forwardRef<\n  React.ElementRef<typeof ToastPrimitives.Viewport>,\n  React.ComponentPropsWithoutRef<typeof ToastPrimitives.Viewport>\n>(({ className, ...props }, ref) => (\n  <ToastPrimitives.Viewport\n    ref={ref}\n    className={cn(\n      \"fixed top-0 z-100 flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]\",\n      className\n    )}\n    {...props}\n  />\n))\nToastViewport.displayName = ToastPrimitives.Viewport.displayName\n\nconst toastVariants = cva(\n  \"group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full sm:data-[state=open]:slide-in-from-bottom-full\",\n  {\n    variants: {\n      variant: {\n        default: \"border bg-background text-foreground\",\n        destructive:\n          \"destructive group border-destructive bg-destructive text-destructive-foreground\",\n      },\n    },\n    defaultVariants: {\n      variant: \"default\",\n    },\n  }\n)\n\nconst Toast = React.forwardRef<\n  React.ElementRef<typeof ToastPrimitives.Root>,\n  React.ComponentPropsWithoutRef<typeof ToastPrimitives.Root> &\n    VariantProps<typeof toastVariants>\n>(({ className, variant, ...props }, ref) => {\n  return (\n    <ToastPrimitives.Root\n      ref={ref}\n      className={cn(toastVariants({ variant }), className)}\n      {...props}\n    />\n  )\n})\nToast.displayName = ToastPrimitives.Root.displayName\n\nconst ToastAction = React.forwardRef<\n  React.ElementRef<typeof ToastPrimitives.Action>,\n  React.ComponentPropsWithoutRef<typeof ToastPrimitives.Action>\n>(({ className, ...props }, ref) => (\n  <ToastPrimitives.Action\n    ref={ref}\n    className={cn(\n      \"inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-hidden focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 hover:group-[.destructive]:border-destructive/30 hover:group-[.destructive]:bg-destructive hover:group-[.destructive]:text-destructive-foreground focus:group-[.destructive]:ring-destructive\",\n      className\n    )}\n    {...props}\n  />\n))\nToastAction.displayName = ToastPrimitives.Action.displayName\n\nconst ToastClose = React.forwardRef<\n  React.ElementRef<typeof ToastPrimitives.Close>,\n  React.ComponentPropsWithoutRef<typeof ToastPrimitives.Close>\n>(({ className, ...props }, ref) => (\n  <ToastPrimitives.Close\n    ref={ref}\n    className={cn(\n      \"absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-hidden focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 hover:group-[.destructive]:text-red-50 focus:group-[.destructive]:ring-red-400 focus:group-[.destructive]:ring-offset-red-600\",\n      className\n    )}\n    toast-close=\"\"\n    {...props}\n  >\n    <Cross2Icon className=\"h-4 w-4\" />\n  </ToastPrimitives.Close>\n))\nToastClose.displayName = ToastPrimitives.Close.displayName\n\nconst ToastTitle = React.forwardRef<\n  React.ElementRef<typeof ToastPrimitives.Title>,\n  React.ComponentPropsWithoutRef<typeof ToastPrimitives.Title>\n>(({ className, ...props }, ref) => (\n  <ToastPrimitives.Title\n    ref={ref}\n    className={cn(\"text-sm font-semibold [&+div]:text-xs\", className)}\n    {...props}\n  />\n))\nToastTitle.displayName = ToastPrimitives.Title.displayName\n\nconst ToastDescription = React.forwardRef<\n  React.ElementRef<typeof ToastPrimitives.Description>,\n  React.ComponentPropsWithoutRef<typeof ToastPrimitives.Description>\n>(({ className, ...props }, ref) => (\n  <ToastPrimitives.Description\n    ref={ref}\n    className={cn(\"text-sm opacity-90\", className)}\n    {...props}\n  />\n))\nToastDescription.displayName = ToastPrimitives.Description.displayName\n\ntype ToastProps = React.ComponentPropsWithoutRef<typeof Toast>\n\ntype ToastActionElement = React.ReactElement<typeof ToastAction>\n\nexport {\n  type ToastProps,\n  type ToastActionElement,\n  ToastProvider,\n  ToastViewport,\n  Toast,\n  ToastTitle,\n  ToastDescription,\n  ToastClose,\n  ToastAction,\n}\n"
  },
  {
    "path": "src/components/ui/toaster.tsx",
    "content": "\"use client\"\n\nimport { useToast } from \"@/hooks/use-toast\"\nimport {\n  Toast,\n  ToastClose,\n  ToastDescription,\n  ToastProvider,\n  ToastTitle,\n  ToastViewport,\n} from \"@/components/ui/toast\"\n\nexport function Toaster() {\n  const { toasts } = useToast()\n\n  return (\n    <ToastProvider>\n      {toasts.map(function ({ id, title, description, action, ...props }) {\n        return (\n          <Toast key={id} {...props}>\n            <div className=\"grid gap-1\">\n              {title && <ToastTitle>{title}</ToastTitle>}\n              {description && (\n                <ToastDescription>{description}</ToastDescription>\n              )}\n            </div>\n            {action}\n            <ToastClose />\n          </Toast>\n        )\n      })}\n      <ToastViewport />\n    </ToastProvider>\n  )\n}\n"
  },
  {
    "path": "src/components/ui/toggle-group.tsx",
    "content": "\"use client\"\n\nimport * as React from \"react\"\nimport * as ToggleGroupPrimitive from \"@radix-ui/react-toggle-group\"\nimport { type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"@/lib/utils\"\nimport { toggleVariants } from \"@/components/ui/toggle\"\n\nconst ToggleGroupContext = React.createContext<\n  VariantProps<typeof toggleVariants>\n>({\n  size: \"default\",\n  variant: \"default\",\n})\n\nfunction ToggleGroup({\n  className,\n  variant,\n  size,\n  children,\n  ...props\n}: React.ComponentProps<typeof ToggleGroupPrimitive.Root> &\n  VariantProps<typeof toggleVariants>) {\n  return (\n    <ToggleGroupPrimitive.Root\n      data-slot=\"toggle-group\"\n      data-variant={variant}\n      data-size={size}\n      className={cn(\n        \"group/toggle-group flex w-fit items-center rounded-md data-[variant=outline]:shadow-xs\",\n        className\n      )}\n      {...props}\n    >\n      <ToggleGroupContext.Provider value={{ variant, size }}>\n        {children}\n      </ToggleGroupContext.Provider>\n    </ToggleGroupPrimitive.Root>\n  )\n}\n\nfunction ToggleGroupItem({\n  className,\n  children,\n  variant,\n  size,\n  ...props\n}: React.ComponentProps<typeof ToggleGroupPrimitive.Item> &\n  VariantProps<typeof toggleVariants>) {\n  const context = React.useContext(ToggleGroupContext)\n\n  return (\n    <ToggleGroupPrimitive.Item\n      data-slot=\"toggle-group-item\"\n      data-variant={context.variant || variant}\n      data-size={context.size || size}\n      className={cn(\n        toggleVariants({\n          variant: context.variant || variant,\n          size: context.size || size,\n        }),\n        \"min-w-0 flex-1 shrink-0 rounded-none shadow-none first:rounded-l-md last:rounded-r-md focus:z-10 focus-visible:z-10 data-[variant=outline]:border-l-0 data-[variant=outline]:first:border-l\",\n        className\n      )}\n      {...props}\n    >\n      {children}\n    </ToggleGroupPrimitive.Item>\n  )\n}\n\nexport { ToggleGroup, ToggleGroupItem }\n"
  },
  {
    "path": "src/components/ui/toggle.tsx",
    "content": "\"use client\"\n\nimport * as React from \"react\"\nimport * as TogglePrimitive from \"@radix-ui/react-toggle\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst toggleVariants = cva(\n  \"inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium hover:bg-muted hover:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none transition-[color,box-shadow] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive whitespace-nowrap\",\n  {\n    variants: {\n      variant: {\n        default: \"bg-transparent\",\n        outline:\n          \"border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground\",\n      },\n      size: {\n        default: \"h-9 px-2 min-w-9\",\n        sm: \"h-8 px-1.5 min-w-8\",\n        lg: \"h-10 px-2.5 min-w-10\",\n      },\n    },\n    defaultVariants: {\n      variant: \"default\",\n      size: \"default\",\n    },\n  }\n)\n\nfunction Toggle({\n  className,\n  variant,\n  size,\n  ...props\n}: React.ComponentProps<typeof TogglePrimitive.Root> &\n  VariantProps<typeof toggleVariants>) {\n  return (\n    <TogglePrimitive.Root\n      data-slot=\"toggle\"\n      className={cn(toggleVariants({ variant, size, className }))}\n      {...props}\n    />\n  )\n}\n\nexport { Toggle, toggleVariants }\n"
  },
  {
    "path": "src/components/ui/tooltip.tsx",
    "content": "\"use client\"\n\nimport * as React from \"react\"\nimport * as TooltipPrimitive from \"@radix-ui/react-tooltip\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction TooltipProvider({\n  delayDuration = 0,\n  ...props\n}: React.ComponentProps<typeof TooltipPrimitive.Provider>) {\n  return (\n    <TooltipPrimitive.Provider\n      data-slot=\"tooltip-provider\"\n      delayDuration={delayDuration}\n      {...props}\n    />\n  )\n}\n\nfunction Tooltip({\n  ...props\n}: React.ComponentProps<typeof TooltipPrimitive.Root>) {\n  return (\n    <TooltipProvider>\n      <TooltipPrimitive.Root data-slot=\"tooltip\" {...props} />\n    </TooltipProvider>\n  )\n}\n\nfunction TooltipTrigger({\n  ...props\n}: React.ComponentProps<typeof TooltipPrimitive.Trigger>) {\n  return <TooltipPrimitive.Trigger data-slot=\"tooltip-trigger\" {...props} />\n}\n\nfunction TooltipContent({\n  className,\n  sideOffset = 0,\n  children,\n  ...props\n}: React.ComponentProps<typeof TooltipPrimitive.Content>) {\n  return (\n    <TooltipPrimitive.Portal>\n      <TooltipPrimitive.Content\n        data-slot=\"tooltip-content\"\n        sideOffset={sideOffset}\n        className={cn(\n          \"bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance\",\n          className\n        )}\n        {...props}\n      >\n        {children}\n        <TooltipPrimitive.Arrow className=\"bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]\" />\n      </TooltipPrimitive.Content>\n    </TooltipPrimitive.Portal>\n  )\n}\n\nexport { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }\n"
  },
  {
    "path": "src/components/wrappers/auth/auth-logo-section.tsx",
    "content": "\"use client\";\n\nimport {env} from \"@/env.mjs\";\nimport {useTheme} from \"next-themes\";\nimport Image from \"next/image\";\nimport {useEffect, useState} from \"react\";\n\nexport const AuthLogoSection = () => {\n    const {resolvedTheme} = useTheme();\n    const [mounted, setMounted] = useState(false);\n    const [loaded, setLoaded] = useState(false);\n\n    useEffect(() => {\n        setMounted(true);\n    }, []);\n\n    const imageTheme =\n        resolvedTheme === \"dark\"\n            ? \"/images/logo-dark.png\"\n            : \"/images/logo-light.png\";\n\n    const handleLoad = () => setLoaded(true);\n\n    const style = {\n        transition: \"opacity 0.3s ease-in-out\",\n        opacity: loaded ? 1 : 0,\n    };\n\n\n    return (\n        <div className=\"sm:mx-auto sm:w-full sm:max-w-md relative flex items-center justify-center h-[160px]\">\n            {mounted && (\n                <Image\n                    src={imageTheme}\n                    alt=\"Logo\"\n                    fill\n                    priority\n                    className=\"object-contain p-10\"\n                    onLoad={handleLoad}\n                    style={style}\n\n                />\n            )}\n        </div>\n    );\n};\n"
  },
  {
    "path": "src/components/wrappers/auth/guard/guard-form.tsx",
    "content": "\"use client\";\n\nimport { toast } from \"sonner\";\nimport { useRouter, useSearchParams } from \"next/navigation\";\nimport TwoFactorForm from \"@/components/wrappers/dashboard/profile/form/2fa-form\";\n\nexport const GuardForm = () => {\n    const router = useRouter();\n    const searchParams = useSearchParams();\n    const callbackUrl = searchParams.get(\"redirect\") || \"/dashboard\";\n\n    return (\n        <TwoFactorForm\n            onSuccess={(success) => {\n                if (success) {\n                    toast.success(\"Successfully logged in!\");\n                    //@ts-ignore\n                    router.push(callbackUrl);\n                    router.refresh();\n                }\n            }}\n        />\n    );\n};\n"
  },
  {
    "path": "src/components/wrappers/auth/login/forgot-password-form/forgot-password-form.schema.ts",
    "content": "\"use client\";\n\nimport { z } from \"zod\";\nimport { zEmail } from \"@/lib/zod\";\n\nexport const ForgotPasswordSchema = z.object({\n    email: zEmail(),\n});\n\nexport type ForgotPasswordType = z.infer<typeof ForgotPasswordSchema>;\n"
  },
  {
    "path": "src/components/wrappers/auth/login/forgot-password-form/forgot-password-form.tsx",
    "content": "\"use client\";\n\nimport { useMutation } from \"@tanstack/react-query\";\nimport { toast } from \"sonner\";\n\nimport { FormControl, FormField, FormItem, FormLabel, FormMessage, useZodForm } from \"@/components/ui/form\";\nimport { Input } from \"@/components/ui/input\";\nimport { Form } from \"@/components/ui/form\";\nimport { requestPasswordReset } from \"@/lib/auth/auth-client\";\nimport { ButtonWithLoading } from \"@/components/wrappers/common/button/button-with-loading\";\nimport Link from \"next/link\";\nimport { ForgotPasswordSchema, ForgotPasswordType } from \"./forgot-password-form.schema\";\nimport { ArrowLeft } from \"lucide-react\";\n\nexport type ForgotPasswordFormProps = {\n    defaultValues?: ForgotPasswordType;\n};\n\nexport const ForgotPasswordForm = (props: ForgotPasswordFormProps) => {\n\n    const form = useZodForm({\n        schema: ForgotPasswordSchema,\n    });\n\n    const mutation = useMutation({\n        mutationFn: async (values: ForgotPasswordType) => {\n            await requestPasswordReset(\n                {\n                    email: values.email,\n                },\n                {\n                    onSuccess: () => {\n                        toast.success(\"If an account with this email address exists, you will receive an email with instructions to reset your password.\");\n                    },\n                    onError: (error) => {\n                        toast.error(error.error.message);\n                    },\n                }\n            );\n        },\n    });\n\n\n\n    return (\n        <Form\n            form={form}\n            className=\"flex flex-col gap-4 mb-1\"\n            onSubmit={async (values) => {\n                await mutation.mutateAsync(values);\n            }}\n        >\n            <FormField\n                control={form.control}\n                name=\"email\"\n                defaultValue=\"\"\n                render={({ field }) => (\n                    <FormItem>\n                        <FormLabel>Email Address</FormLabel>\n                        <FormControl>\n                            <Input autoComplete=\"email\" autoFocus\n                                   placeholder=\"example@portabase.io\"\n                                   {...field} />\n                        </FormControl>\n                        <FormMessage />\n                    </FormItem>\n                )}\n            />\n\n            <div className=\"flex flex-col items-center gap-y-6 w-full\">\n                <ButtonWithLoading className=\"mt-2 w-full h-11\" isPending={mutation.isPending}>\n                    Send reset link\n                </ButtonWithLoading>\n                <Link href=\"/login\" className=\"group flex items-center text-sm hover:underline\">\n                    <ArrowLeft className=\"mr-1 size-4 text-muted-foreground transition-transform group-hover:-translate-x-1\" />\n                    Back to login\n                </Link>\n            </div>\n        </Form>\n    );\n};\n"
  },
  {
    "path": "src/components/wrappers/auth/login/forgot-password-form/forgot-password.actions.ts",
    "content": "\"use server\";\nimport { ServerActionResult } from \"@/types/action-type\";\nimport { auth } from \"@/lib/auth/auth\";\nimport { zString } from \"@/lib/zod\";\nimport z from \"zod\";\nimport { db } from \"@/db\";\nimport {action} from \"@/lib/safe-actions/actions\";\n\n//TODO: to be continued...\nexport const forgotPasswordAction = action\n    .schema(\n        z.object({\n            schema: z.object({\n                email: zString(),\n            }),\n            redirectTo: zString().optional(),\n        })\n    )\n    .action(async ({ parsedInput }): Promise<ServerActionResult<null>> => {\n        try {\n            const user = await (await auth.$context).internalAdapter.findUserByEmail(parsedInput.schema.email);\n\n            if (!user) {\n                return {\n                    success: false,\n                    actionError: {\n                        message: \"password_reset\",\n                        cause: \"user_not_found\",\n                    },\n                };\n            }\n\n            const existingToken = await db.query.verification.findFirst({\n                where: (verifications, { eq, and, gte }) =>\n                    and(eq(verifications.value, user.user.id), gte(verifications.expiresAt, new Date(Date.now() + 15 * 60 * 1000))),\n            });\n\n            if (existingToken) {\n                return {\n                    success: false,\n                    actionError: {\n                        message: \"password_reset\",\n                        cause: \"reset_already_requested\",\n                    },\n                };\n            }\n\n            // await (\n            //     await auth.$context\n            // ).options.emailAndPassword\n            //     .sendResetPassword(\n            //         {\n            //             user: user.user,\n            //             url,\n            //             token: verificationToken,\n            //         },\n            //         ctx.request\n            //     )\n            //     .catch((e) => {\n            //         ctx.context.logger.error(\"Failed to send reset password email\", e);\n            //     });\n\n            return {\n                success: true,\n            };\n        } catch (error) {\n            return {\n                success: false,\n                actionError: {\n                    message: \"password_reset\",\n                    cause: error instanceof Error ? error.message : \"Unknown error\",\n                },\n            };\n        }\n    });\n"
  },
  {
    "path": "src/components/wrappers/auth/login/login-form/login-form.schema.ts",
    "content": "\"use client\";\n\nimport { z } from \"zod\";\nimport { zEmail, zString } from \"@/lib/zod\";\n\nexport const LoginSchema = z.object({\n    email: zEmail(),\n    password: zString().nonempty(),\n});\n\nexport type LoginType = z.infer<typeof LoginSchema>;\n"
  },
  {
    "path": "src/components/wrappers/auth/login/login-form/login-form.tsx",
    "content": "\"use client\";\n\nimport { useMutation } from \"@tanstack/react-query\";\nimport Link from \"next/link\";\nimport { useRouter, useSearchParams } from \"next/navigation\";\nimport { useEffect } from \"react\";\nimport { toast } from \"sonner\";\nimport {\n  Form,\n  FormControl,\n  FormField,\n  FormItem,\n  FormLabel,\n  FormMessage,\n  useZodForm,\n} from \"@/components/ui/form\";\nimport { Input } from \"@/components/ui/input\";\nimport { PasswordInput } from \"@/components/ui/password-input\";\nimport {\n  LoginSchema,\n  type LoginType,\n} from \"@/components/wrappers/auth/login/login-form/login-form.schema\";\nimport { ButtonWithLoading } from \"@/components/wrappers/common/button/button-with-loading\";\nimport { signIn } from \"@/lib/auth/auth-client\";\n\nexport type loginFormProps = {\n  defaultValues?: LoginType;\n  isPasskeyEnabled?: boolean;\n};\n\nexport const LoginForm = (props: loginFormProps) => {\n  const { isPasskeyEnabled = false } = props;\n\n  const url = useSearchParams();\n\n  const form = useZodForm({\n    schema: LoginSchema,\n  });\n\n  const router = useRouter();\n\n  const mutation = useMutation({\n    mutationFn: async (values: LoginType) => {\n      await signIn.email(\n        {\n          password: values.password,\n          email: values.email,\n          callbackURL: url?.get(\"redirect\") ?? \"/dashboard\",\n        },\n        {\n          onSuccess: (context) => {\n            if (context.data.twoFactorRedirect) {\n              router.push(\n                \"/guard?redirect=\" +\n                  encodeURIComponent(context.data.callbackURL || \"/dashboard\"),\n              );\n            }\n\n            toast.success(\"Login success\");\n          },\n          onError: (error) => {\n            toast.error(error.error.message);\n          },\n        },\n      );\n    },\n  });\n\n  return (\n    <Form\n      form={form}\n      className=\"flex flex-col gap-4 mb-1\"\n      onSubmit={async (values) => {\n        await mutation.mutateAsync(values);\n      }}\n    >\n      <FormField\n        control={form.control}\n        name=\"email\"\n        defaultValue=\"\"\n        render={({ field }) => (\n          <FormItem>\n            <FormLabel>Email Address</FormLabel>\n            <FormControl>\n              <Input\n                autoComplete=\"email\"\n                autoFocus\n                placeholder=\"example@portabase.io\"\n                {...field}\n              />\n            </FormControl>\n            <FormMessage />\n          </FormItem>\n        )}\n      />\n      <FormField\n        control={form.control}\n        name=\"password\"\n        defaultValue=\"\"\n        render={({ field }) => (\n          <FormItem>\n            <div className=\"flex items-center justify-between\">\n              <FormLabel>Password</FormLabel>\n              <div className=\"text-center text-sm\">\n                <Link\n                  href={\"/forgot-password\"}\n                  className=\"hover:underline ml-1\"\n                >\n                  Forgot your password ?\n                </Link>\n              </div>\n            </div>\n            <FormControl>\n              <PasswordInput\n                autoComplete={\n                  isPasskeyEnabled\n                    ? \"current-password webauthn\"\n                    : \"current-password\"\n                }\n                placeholder={\"Enter your password\"}\n                {...field}\n              />\n            </FormControl>\n            <FormMessage />\n          </FormItem>\n        )}\n      />\n      <ButtonWithLoading className=\"mt-2 h-11\" isPending={mutation.isPending}>\n        Login\n      </ButtonWithLoading>\n    </Form>\n  );\n};\n"
  },
  {
    "path": "src/components/wrappers/auth/login/reset-password-form/reset-password-form.action.ts",
    "content": "\"use server\";\nimport { ServerActionResult } from \"@/types/action-type\";\nimport { auth } from \"@/lib/auth/auth\";\nimport { zPassword, zString } from \"@/lib/zod\";\nimport z from \"zod\";\nimport {action} from \"@/lib/safe-actions/actions\";\n\nexport const resetPasswordAction = action\n    .schema(\n        z.object({\n            schema: z.object({\n                password: zPassword(),\n            }),\n            token: zString(),\n        })\n    )\n    .action(async ({ parsedInput }): Promise<ServerActionResult<null>> => {\n        try {\n            const verification = await (await auth.$context).internalAdapter.findVerificationValue(`reset-password:${parsedInput.token}`);\n            if (!verification || verification.expiresAt < new Date()) {\n                return {\n                    success: false,\n                    actionError: {\n                        message: \"password_reset\",\n                        cause: \"invalid_or_expired_token\",\n                    },\n                };\n            }\n\n            const user = await (await auth.$context).internalAdapter.findUserById(verification.value);\n            if (!user) {\n                return {\n                    success: false,\n                    actionError: {\n                        message: \"password_reset\",\n                        cause: \"user_not_found\",\n                    },\n                };\n            }\n\n            await (\n                await auth.$context\n            ).internalAdapter.updateUser(user.id, {\n                isDefaultPassword: false,\n            });\n\n            return {\n                success: true,\n                actionSuccess: {\n                    message: \"password_reset\",\n                },\n            };\n        } catch (error) {\n            return {\n                success: false,\n                actionError: {\n                    message: \"password_reset\",\n                    cause: error instanceof Error ? error.message : \"Unknown error\",\n                },\n            };\n        }\n    });\n"
  },
  {
    "path": "src/components/wrappers/auth/login/reset-password-form/reset-password-form.schema.ts",
    "content": "\"use client\";\n\nimport {z} from \"zod\";\nimport {zPassword} from \"@/lib/zod\";\n\nexport const ResetPasswordSchema = z\n    .object({\n        password: zPassword(),\n        confirmPassword: zPassword(),\n    })\n    .superRefine(({confirmPassword, password}, ctx) => {\n        if (confirmPassword !== password) {\n            ctx.addIssue({\n                code: \"custom\",\n                message: \"Confirmation password does not match\",\n                path: [\"confirmPassword\"],\n            });\n        }\n    });\n\nexport type ResetPasswordType = z.infer<typeof ResetPasswordSchema>;\n"
  },
  {
    "path": "src/components/wrappers/auth/login/reset-password-form/reset-password-form.tsx",
    "content": "\"use client\";\n\nimport {useMutation} from \"@tanstack/react-query\";\nimport {toast} from \"sonner\";\n\nimport {FormControl, FormField, FormItem, FormLabel, useZodForm} from \"@/components/ui/form\";\nimport {Form} from \"@/components/ui/form\";\nimport {ButtonWithLoading} from \"@/components/wrappers/common/button/button-with-loading\";\nimport Link from \"next/link\";\nimport {ResetPasswordSchema, ResetPasswordType} from \"./reset-password-form.schema\";\nimport {PasswordStrengthInput} from \"@/components/ui/password-input-indicator\";\nimport {useRouter, useSearchParams} from \"next/navigation\";\nimport {ArrowLeft} from \"lucide-react\";\nimport {authClient} from \"@/lib/auth/auth-client\";\nimport {BetterAuthError} from \"@/types/auth\";\nimport {PasswordInput} from \"@/components/ui/password-input\";\n\nexport type ResetPasswordFormProps = {\n    defaultValues?: ResetPasswordType;\n};\n\nexport const ResetPasswordForm = (props: ResetPasswordFormProps) => {\n    const searchParams = useSearchParams();\n\n    const form = useZodForm({\n        schema: ResetPasswordSchema,\n    });\n\n    const router = useRouter();\n\n\n    const mutation = useMutation({\n        mutationFn: async (values: ResetPasswordType) => {\n\n            const {data, error} = await authClient.resetPassword({\n                newPassword: values.password,\n                token: searchParams.get(\"token\") || \"\",\n            });\n\n            if (error) throw error;\n        },\n        onSuccess: () => {\n            toast.success(\"Password successfully reset!\");\n            setTimeout(() => router.push(\"/\"), 1400);\n        },\n        onError: (error: BetterAuthError) => {\n            toast.error(\"An error occurred while resetting password\");\n        },\n    });\n\n\n    return (\n        <Form\n            form={form}\n            className=\"flex flex-col gap-4 mb-1\"\n            onSubmit={async (values) => {\n                await mutation.mutateAsync(values);\n            }}\n        >\n            <FormField\n                control={form.control}\n                name=\"password\"\n                defaultValue=\"\"\n                render={({field}) => (\n                    <FormItem>\n                        <PasswordStrengthInput label={\"New password\"} field={field}/>\n                    </FormItem>\n                )}\n            />\n            <FormField\n                control={form.control}\n                name=\"confirmPassword\"\n                defaultValue=\"\"\n                render={({field}) => (\n                    <FormItem>\n                        <FormLabel>Confirmation password</FormLabel>\n                        <FormControl>\n                            <PasswordInput placeholder={\"Enter your conformation password\"} {...field} />\n                        </FormControl>\n                    </FormItem>\n                )}\n            />\n\n            <div className=\"flex flex-col items-center gap-y-6 w-full\">\n                <ButtonWithLoading className=\"mt-2 w-full h-11\" isPending={mutation.isPending}>\n                    Reset\n                </ButtonWithLoading>\n                <Link href=\"/login\" className=\"group flex items-center text-sm hover:underline\">\n                    <ArrowLeft\n                        className=\"mr-1 size-4 text-muted-foreground transition-transform group-hover:-translate-x-1\"/>\n                    Back to login\n                </Link>\n            </div>\n        </Form>\n    );\n};\n"
  },
  {
    "path": "src/components/wrappers/auth/register/register-form/register-form.schema.ts",
    "content": "import { z } from \"zod\";\n\n// Minimum 8 characters, at least one uppercase letter, one lowercase letter, one number and one special character\nconst passwordValidation = new RegExp(/^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@$%^&*-]).{8,}$/);\n\nexport const RegisterSchema = z\n    .object({\n        name: z.string(),\n        email: z.string(),\n        password: z.string().min(8, { message: \"Must have at least 8 character\" }).regex(passwordValidation, {\n            message: \"Your password must contain at least one uppercase letter, one lowercase letter, one number, and one special character.\",\n        }),\n        confirmPassword: z.string(),\n    })\n    .superRefine(({ confirmPassword, password }, ctx) => {\n        if (confirmPassword !== password) {\n            ctx.addIssue({\n                code: \"custom\",\n                message: \"The passwords did not match\",\n                path: [\"confirmPassword\"],\n            });\n        }\n    });\n\nexport type RegisterType = z.infer<typeof RegisterSchema>;\n"
  },
  {
    "path": "src/components/wrappers/auth/register/register-form/register-form.tsx",
    "content": "\"use client\";\n\nimport { useRouter } from \"next/navigation\";\nimport { useMutation } from \"@tanstack/react-query\";\nimport { toast } from \"sonner\";\nimport { CardContent, CardHeader } from \"@/components/ui/card\";\nimport { Form } from \"@/components/ui/form\";\nimport {\n  TooltipProvider,\n  TooltipTrigger,\n  Tooltip,\n  TooltipContent,\n} from \"@/components/ui/tooltip\";\nimport {\n  RegisterSchema,\n  RegisterType,\n} from \"@/components/wrappers/auth/register/register-form/register-form.schema\";\nimport { signUp } from \"@/lib/auth/auth-client\";\nimport { useZodForm } from \"@/components/ui/form\";\nimport { CardAuth } from \"@/features/layout/card-auth\";\nimport { FormField } from \"@/components/ui/form\";\nimport { FormItem } from \"@/components/ui/form\";\nimport { FormLabel } from \"@/components/ui/form\";\nimport { FormControl } from \"@/components/ui/form\";\nimport { FormMessage } from \"@/components/ui/form\";\nimport { Input } from \"@/components/ui/input\";\nimport { PasswordInput } from \"@/components/ui/password-input\";\nimport { Button } from \"@/components/ui/button\";\nimport Link from \"next/link\";\nimport { Info } from \"lucide-react\";\n\nexport type registerFormProps = {\n  defaultValues?: RegisterType;\n};\n\nexport const RegisterForm = (props: registerFormProps) => {\n  const form = useZodForm({\n    schema: RegisterSchema,\n  });\n\n  const router = useRouter();\n  const mutation = useMutation({\n    mutationFn: async (values: RegisterType) => {\n      await signUp.email(values, {\n        onSuccess: () => {\n          toast.success(`Account successfully created`);\n          router.refresh();\n          router.push(`/login`);\n        },\n        onError: (error) => {\n          toast.error(error.error.message);\n        },\n      });\n    },\n  });\n\n  return (\n    <TooltipProvider>\n      <CardAuth>\n        <CardHeader>\n          <div className=\"grid gap-2 text-center mb-2\">\n            <h1 className=\"text-3xl font-bold\">Create an account</h1>\n            <p className=\"text-balance text-muted-foreground\">\n              Enter your informations below to register\n            </p>\n          </div>\n        </CardHeader>\n        <CardContent>\n          <Form\n            form={form}\n            className=\"flex flex-col gap-4\"\n            onSubmit={async (values) => {\n              await mutation.mutateAsync(values);\n            }}\n          >\n            <FormField\n              control={form.control}\n              name=\"name\"\n              defaultValue=\"\"\n              render={({ field }) => (\n                <FormItem>\n                  <FormLabel>Name</FormLabel>\n                  <FormControl>\n                    <Input placeholder=\"Your name\" {...field} />\n                  </FormControl>\n                  <FormMessage />\n                </FormItem>\n              )}\n            />\n            <FormField\n              control={form.control}\n              name=\"email\"\n              defaultValue=\"\"\n              render={({ field }) => (\n                <FormItem>\n                  <FormLabel>Email</FormLabel>\n                  <FormControl>\n                    <Input placeholder=\"example@portabase.io\" {...field} />\n                  </FormControl>\n                  <FormMessage />\n                </FormItem>\n              )}\n            />\n            <FormField\n              control={form.control}\n              name=\"password\"\n              defaultValue=\"\"\n              render={({ field }) => (\n                <FormItem>\n                  <FormLabel className=\"flex\">\n                    Password\n                    <TooltipProvider>\n                      <Tooltip>\n                        <TooltipTrigger asChild>\n                          <Info size=\"15\" />\n                        </TooltipTrigger>\n                        <TooltipContent>\n                          <p>\n                            Min. 8 characters, 1 uppercase (A-Z), 1 lowercase\n                            (a-z), 1 number (0-9), 1 special character (!, @,\n                            etc.)\n                          </p>\n                        </TooltipContent>\n                      </Tooltip>\n                    </TooltipProvider>\n                  </FormLabel>\n                  <FormControl>\n                    <PasswordInput placeholder=\"Your password\" {...field} />\n                  </FormControl>\n                  <FormMessage />\n                </FormItem>\n              )}\n            />\n            <FormField\n              control={form.control}\n              name=\"confirmPassword\"\n              defaultValue=\"\"\n              render={({ field }) => (\n                <FormItem>\n                  <FormLabel>Password Confirmation</FormLabel>\n                  <FormControl>\n                    <PasswordInput\n                      placeholder=\"Conform your password\"\n                      {...field}\n                    />\n                  </FormControl>\n                  <FormMessage />\n                </FormItem>\n              )}\n            />\n            <Button\n              type=\"submit\"\n              className=\"h-11\"\n              disabled={mutation.isPending}\n            >\n              Sign up\n            </Button>\n            <div className=\"mt-4 text-center text-sm\">\n              Already have an account ?{\" \"}\n              <Link href=\"/login\" className=\"underline\">\n                Sign in\n              </Link>\n            </div>\n          </Form>\n        </CardContent>\n      </CardAuth>\n    </TooltipProvider>\n  );\n};\n"
  },
  {
    "path": "src/components/wrappers/auth/reset-password/reset-password-form.tsx",
    "content": "\"use client\";\n\nimport {useRouter} from \"next/navigation\";\nimport {useMutation} from \"@tanstack/react-query\";\nimport {Form, FormControl, FormField, FormItem, FormLabel, useZodForm} from \"@/components/ui/form\";\nimport {PasswordStrengthInput} from \"@/components/ui/password-input-indicator\";\nimport {ResetPasswordSchema, ResetPasswordType} from \"@/components/wrappers/auth/reset-password/reset-password-schema\";\nimport {PasswordInput} from \"@/components/ui/password-input\";\nimport {CardContent, CardHeader} from \"@/components/ui/card\";\nimport {ButtonWithLoading} from \"@/components/wrappers/common/button/button-with-loading\";\nimport {authClient} from \"@/lib/auth/auth-client\";\nimport {toast} from \"sonner\";\nimport {CardAuth} from \"@/features/layout/card-auth\";\n\ntype ResetPasswordFormProps = {\n    token: string;\n};\n\nexport const ResetPasswordForm = ({token}: ResetPasswordFormProps) => {\n\n    const router = useRouter();\n    const form = useZodForm({\n        schema: ResetPasswordSchema,\n    });\n\n    const mutationResetPassword = useMutation({\n        mutationFn: async (data: ResetPasswordType) => {\n\n            await authClient.resetPassword({\n                newPassword: data.password,\n                token,\n            }, {\n                onSuccess: (response) => {\n                    toast.success(\"Password changed successfully.\");\n                    setTimeout(() => router.push(\"/\"), 1000);\n                },\n                onError: (error) => {\n                    console.error(error);\n                    toast.error(error.error.message);\n                },\n            });\n        },\n    });\n\n    return (\n        <CardAuth>\n            <CardHeader>\n                <div className=\"grid gap-2 text-center mb-2\">\n                    <h1 className=\"text-3xl font-bold\">Reset Password</h1>\n                    <p className=\"text-balance text-muted-foreground\">Fill information below to change your\n                        password</p>\n                </div>\n            </CardHeader>\n            <CardContent>\n                <Form\n                    form={form}\n                    className=\"flex flex-col gap-4\"\n                    onSubmit={async (values) => {\n                        await mutationResetPassword.mutateAsync(values);\n                    }}\n                >\n                    <FormField\n                        control={form.control}\n                        name=\"password\"\n                        defaultValue=\"\"\n                        render={({field}) => (\n                            <FormItem>\n                                <PasswordStrengthInput label={\"Enter new password\"} field={field}/>\n                            </FormItem>\n                        )}\n                    />\n                    <FormField\n                        control={form.control}\n                        name=\"confirmPassword\"\n                        defaultValue=\"\"\n                        render={({field}) => (\n                            <FormItem>\n                                <FormLabel>Confirmation Password</FormLabel>\n                                <FormControl>\n                                    <PasswordInput placeholder={\"Confirm password\"} {...field}\n                                                   value={field.value ?? \"\"}/>\n                                </FormControl>\n                            </FormItem>\n                        )}\n                    />\n\n                    <ButtonWithLoading type=\"submit\" isPending={mutationResetPassword.isPending}>\n                        Validate\n                    </ButtonWithLoading>\n                </Form>\n            </CardContent>\n        </CardAuth>\n    );\n};\n"
  },
  {
    "path": "src/components/wrappers/auth/reset-password/reset-password-schema.ts",
    "content": "import {z} from \"zod\";\n\nconst passwordRegex = /^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@$%^&*-])/;\n\nconst zPassword = () => z.string().min(8, {message: \"New Password too short\"}).regex(passwordRegex, {message: \"New Password too weak\"});\n\nexport const ResetPasswordSchema = z\n    .object({\n        password: zPassword(),\n        confirmPassword: zPassword(),\n    })\n    .superRefine(({confirmPassword, password}, ctx) => {\n        if (confirmPassword !== password) {\n            ctx.addIssue({\n                code: \"custom\",\n                message: \"Passwords don't match.\",\n                path: [\"confirmPassword\"],\n            });\n        }\n    });\n\nexport type ResetPasswordType = z.infer<typeof ResetPasswordSchema>;\n"
  },
  {
    "path": "src/components/wrappers/auth/reset-password/reset-password-section.tsx",
    "content": "\"use client\"\n\nimport {useRouter, useSearchParams} from \"next/navigation\";\nimport {ResetPasswordForm} from \"@/components/wrappers/auth/reset-password/reset-password-form\";\nimport {toast} from \"sonner\";\nimport {useEffect} from \"react\";\nimport {LoadingSpinner} from \"@/components/wrappers/common/loading/loading-spinner\";\n\nexport const ResetPasswordSection = () => {\n    const router = useRouter();\n    const searchParams = useSearchParams();\n\n    const token = searchParams.get(\"token\");\n    const error = searchParams.get(\"error\");\n\n    useEffect(() => {\n        if (error || !token) {\n            if (error == \"INVALID_TOKEN\") {\n                toast.error(\"Invalid reset token\");\n            } else {\n                toast.error(\"An error occurred.\");\n            }\n            setTimeout(() => router.push(\"/\"), 1000);\n        }\n    }, [error, token, router]);\n\n\n    if (!token) return (\n        <div className=\"w-full h-full flex flex-col items-center justify-center\">\n            <LoadingSpinner size={50}/>\n        </div>\n    );\n\n    return (\n        <ResetPasswordForm token={token}/>\n    )\n}"
  },
  {
    "path": "src/components/wrappers/auth/social-buttons.tsx",
    "content": "\"use client\";\n\nimport { useState } from \"react\";\nimport { Button } from \"@/components/ui/button\";\nimport { authClient, passkey } from \"@/lib/auth/auth-client\";\nimport { Loader2 } from \"lucide-react\";\nimport { toast } from \"sonner\";\nimport { Icon } from \"@iconify/react\";\nimport { AuthProviderConfig } from \"@/lib/auth/config\";\nimport Image from \"next/image\";\nimport { useRouter } from \"next/navigation\";\n\nexport function SocialAuthButtons({ providers }: { providers: AuthProviderConfig[] }) {\n    const socialProviders = providers.filter((p) => p.isActive && p.type !== \"credential\");\n    const router = useRouter();\n\n    const [isLoading, setIsLoading] = useState<string | null>(null);\n\n    const handleSocialSignIn = async (provider: AuthProviderConfig) => {\n        setIsLoading(provider.id);\n        try {\n            let result;\n            if (provider.id === \"passkey\") {\n                result = await authClient.signIn.passkey({\n                    fetchOptions: {\n                        onSuccess() {\n                            router.push(\"/dashboard\");\n                        },\n                        onError() {\n                            toast.error(\"An error occurred during passkey authentication. Please try again.\");\n                        },\n                    },\n                });\n            } else if (provider.type === \"sso\") {\n                result = await authClient.signIn.sso({\n                    providerId: provider.id,\n                    providerType: \"oidc\",\n                    callbackURL: \"/dashboard\",\n                });\n                console.log(result);\n            } else {\n                result = await authClient.signIn.social({\n                    // eslint-disable-next-line @typescript-eslint/no-explicit-any\n                    provider: provider.id as any,\n                    callbackURL: \"/dashboard\",\n                });\n            }\n\n            if (result?.error) {\n                toast.error(\"An error occurred while signing in with the provider. Please try again.\");\n            } else if (provider.id !== \"passkey\") {\n                toast.success(\"Redirecting to provider...\");\n            }\n        } catch (err) {\n            toast.error(\"An error occurred while signing in with the provider. Please try again.\");\n        } finally {\n            setIsLoading(null);\n        }\n    };\n\n    if (socialProviders.length === 0) return null;\n\n    return (\n        <div className=\"flex flex-col gap-2 w-full\">\n            {socialProviders.map((provider) => (\n                <Button key={provider.id} variant=\"outline\" className=\"w-full gap-2\" onClick={() => handleSocialSignIn(provider)} disabled={!!isLoading}>\n                    {isLoading === provider.id ? (\n                        <Loader2 className=\"h-4 w-4 animate-spin\" />\n                    ) : provider.icon.startsWith(\"/\") || provider.icon.startsWith(\"http\") ? (\n                        <Image\n                            src={provider.icon}\n                            alt={provider.id || \"icon\"}\n                            width={16}\n                            height={16}\n                            className=\"h-4 w-4\"\n                            unoptimized={provider.icon.startsWith(\"http\")}\n                        />\n                    ) : (\n                        <Icon icon={provider.icon} className=\"h-4 w-4\" />\n                    )}\n                    <span>{provider.title || provider.name}</span>\n                </Button>\n            ))}\n        </div>\n    );\n}\n"
  },
  {
    "path": "src/components/wrappers/common/bread-crumbs/bread-crumbs.tsx",
    "content": "\"use client\"\nimport {\n    Breadcrumb,\n    BreadcrumbItem, BreadcrumbLink,\n    BreadcrumbList,\n    BreadcrumbPage,\n    BreadcrumbSeparator,\n} from \"@/components/ui/breadcrumb\";\nimport {usePathname} from \"next/navigation\";\nimport Link from \"next/link\";\nimport {useIsMobile} from \"@/hooks/use-mobile\";\nimport {capitalizeFirstLetter, isUUID} from \"@/utils/text\";\n\n\nexport function useBreadCrumbs() {\n    const pathname = usePathname();\n\n    const route_history = pathname\n        .split(\"/\")\n        .filter((x: any) => x && x.length > 0);\n\n    const breadcrumb_routes = route_history.reduce(\n        (acc: { name: string; path: string }[], route) => {\n            const prev_path = acc[acc.length - 1]?.path ?? \"\";\n            acc.push({name: route, path: `${prev_path}/${route}`});\n            return acc;\n        },\n        [],\n    );\n    return {breadcrumb_routes};\n}\n\n\ninterface BreadCrumbsProps {\n}\n\n\nexport function BreadCrumbsWrapper() {\n    const isMobile = useIsMobile()\n    return (\n        <>\n            {!isMobile ? <BreadCrumbs/> : null}\n        </>\n    )\n}\n\nconst FORBIDDEN_LINKS = [\"organization\", \"dashboard\", \"database\", \"admin\", \"notifications\", \"storages\"];\n\n\nexport function BreadCrumbs({}: BreadCrumbsProps) {\n    const {breadcrumb_routes} = useBreadCrumbs();\n    if (breadcrumb_routes.length < 2) return null;\n    return (\n        <div className=\"flex w-full flex-wrap px-3 md:justify-end\">\n            <Breadcrumb>\n                <BreadcrumbList>\n                    {breadcrumb_routes.map((crumb: any) => {\n                        const label = isUUID(crumb.name) ? \"details\" : crumb.name;\n\n                        const isLast = breadcrumb_routes.length - 1 === breadcrumb_routes.indexOf(crumb);\n                        const isForbidden = FORBIDDEN_LINKS.includes(crumb.name.toLowerCase());\n\n                        return (\n                            <div className=\"flex items-center gap-2\" key={crumb.path}>\n                                <BreadcrumbItem key={crumb.path}>\n                                    {isLast ? (\n                                        <BreadcrumbPage>{capitalizeFirstLetter(label)}</BreadcrumbPage>\n                                    ) : (\n                                        <> {isForbidden ?\n                                            <BreadcrumbLink asChild>\n                                                <Link\n                                                    href={crumb.path}\n                                                    onClick={(e) => e.preventDefault()}\n                                                    className=\"cursor-not-allowed \"\n                                                >\n                                                    {capitalizeFirstLetter(label)}\n                                                </Link>\n                                            </BreadcrumbLink>\n                                            :\n                                            <BreadcrumbLink asChild>\n                                                <Link href={crumb.path}>{capitalizeFirstLetter(label)}</Link>\n                                            </BreadcrumbLink>\n                                        }\n                                        </>\n                                    )}\n                                </BreadcrumbItem>\n                                {!isLast && <BreadcrumbSeparator className=\"hidden md:block\"/>}\n                            </div>\n                        );\n                    })}\n                </BreadcrumbList>\n            </Breadcrumb>\n        </div>\n    );\n}"
  },
  {
    "path": "src/components/wrappers/common/button/back-button.tsx",
    "content": "\"use client\";\nimport React from \"react\";\nimport { useRouter } from \"next/navigation\";\nimport { Button } from \"@/components/ui/button\";\n\ntype BackButtonProps = React.ComponentProps<typeof Button> & {\n    children: React.ReactNode;\n};\n\nexport default function BackButton({ children, ...props }: BackButtonProps) {\n    const router = useRouter();\n\n    return (\n        <Button onClick={() => router.back()} aria-label={children?.toString()} {...props}>\n            {children}\n        </Button>\n    );\n}\n"
  },
  {
    "path": "src/components/wrappers/common/button/button-with-confirm.tsx",
    "content": "\"use client\";\nimport { Button, ButtonVariantsProps } from \"@/components/ui/button\";\nimport { ReactNode, useState } from \"react\";\nimport { Loader2 } from \"lucide-react\";\nimport {\n  Popover,\n  PopoverContent,\n  PopoverTrigger,\n} from \"@/components/ui/popover\";\nimport { cn } from \"@/lib/utils\";\nimport {\n  Tooltip,\n  TooltipContent,\n  TooltipProvider,\n  TooltipTrigger,\n} from \"@/components/ui/tooltip\";\n\nexport type ButtonWithConfirmProps = {\n  title: string;\n  description: string;\n  button?: {\n    main: {\n      className?: string;\n      type?: \"button\" | \"submit\" | \"reset\" | undefined;\n      text?: string;\n      icon?: any;\n      variant?: ButtonVariantsProps[\"variant\"];\n      size?: ButtonVariantsProps[\"size\"];\n      disabled?: boolean;\n      tooltipText?: string;\n    };\n    confirm: {\n      className?: string;\n      text: string;\n      icon?: any;\n      variant?: ButtonVariantsProps[\"variant\"];\n      size?: ButtonVariantsProps[\"size\"];\n      onClick?: () => void;\n    };\n    cancel: {\n      className?: string;\n      text: string;\n      icon?: any;\n      variant?: ButtonVariantsProps[\"variant\"];\n      size?: ButtonVariantsProps[\"size\"];\n      onClick?: () => void;\n    };\n  };\n  children?: ReactNode;\n  onConfirm?: (e: React.MouseEvent) => void;\n  onCancel?: (e: React.MouseEvent) => void;\n  confirmButtonText?: string;\n  cancelButtonText?: string;\n  isPending?: boolean;\n};\n\nexport const ButtonWithConfirm = (props: ButtonWithConfirmProps) => {\n  const [isConfirming, setIsConfirming] = useState(false);\n\n  const isLegacy = !!props.button;\n  const isDisabled = isLegacy ? !!props.button?.main.disabled : false;\n\n  const handleConfirm = (e: React.MouseEvent) => {\n    e.preventDefault();\n    e.stopPropagation();\n    if (isLegacy) {\n      props.button?.confirm.onClick?.();\n    } else {\n      props.onConfirm?.(e);\n    }\n    setIsConfirming(false);\n  };\n\n  const handleCancel = (e: React.MouseEvent) => {\n    e.preventDefault();\n    e.stopPropagation();\n    if (isLegacy) {\n      props.button?.cancel.onClick?.();\n    } else {\n      props.onCancel?.(e);\n    }\n    setIsConfirming(false);\n  };\n\n  const triggerContent = isLegacy ? (\n    <Button\n      type={props.button?.main.type}\n      disabled={isDisabled}\n      variant={props.button?.main.variant ?? \"default\"}\n      size={props.button?.main.size ?? \"default\"}\n      className={props.button?.main.className}\n      onClick={(e) => {\n        e.preventDefault();\n        e.stopPropagation();\n        if (!isDisabled) setIsConfirming(true);\n      }}\n    >\n      {props.isPending && <Loader2 className=\"animate-spin mr-4\" size={16} />}\n      {props.button?.main.icon}\n      {props.button?.main.text && <span>{props.button.main.text}</span>}\n    </Button>\n  ) : (\n    <div\n      onClick={(e) => {\n        e.preventDefault();\n        e.stopPropagation();\n        setIsConfirming(true);\n      }}\n    >\n      {props.children}\n    </div>\n  );\n\n  const withTooltip =\n    isLegacy && props.button?.main.tooltipText && isDisabled ? (\n      <TooltipProvider>\n        <Tooltip>\n          <TooltipTrigger asChild>\n            <div>{triggerContent}</div>\n          </TooltipTrigger>\n          <TooltipContent>\n            <p>{props.button?.main.tooltipText}</p>\n          </TooltipContent>\n        </Tooltip>\n      </TooltipProvider>\n    ) : (\n      triggerContent\n    );\n\n  return (\n    <Popover open={isConfirming} onOpenChange={setIsConfirming}>\n      <PopoverTrigger asChild>{withTooltip}</PopoverTrigger>\n      <PopoverContent\n        className=\"w-80\"\n        onPointerDownOutside={(e) => e.preventDefault()}\n        onInteractOutside={(e) => e.preventDefault()}\n        onClick={(e) => e.stopPropagation()}\n        onMouseMove={(e) => e.stopPropagation()}\n        onMouseEnter={(e) => e.stopPropagation()}\n        onMouseLeave={(e) => e.stopPropagation()}\n        onOpenAutoFocus={(e) => e.preventDefault()}\n      >\n        <div className=\"grid gap-4\">\n          <div className=\"space-y-2\">\n            <h4 className=\"font-medium leading-none\">{props.title}</h4>\n            <p className=\"text-sm text-muted-foreground\">{props.description}</p>\n          </div>\n          <div className=\"grid gap-2\">\n            <Button\n              onClick={handleConfirm}\n              variant={\n                isLegacy\n                  ? (props.button?.confirm.variant ?? \"default\")\n                  : \"default\"\n              }\n              size={\n                isLegacy ? (props.button?.confirm.size ?? \"default\") : \"default\"\n              }\n              className={cn(\n                isLegacy ? props.button?.confirm.className : \"\",\n                \"w-full\",\n              )}\n            >\n              {props.isPending && (\n                <Loader2 className=\"animate-spin mr-4\" size={16} />\n              )}\n              {isLegacy && props.button?.confirm.icon}\n              <span>\n                {isLegacy\n                  ? props.button?.confirm.text\n                  : (props.confirmButtonText ?? \"Confirm\")}\n              </span>\n            </Button>\n            <Button\n              variant={\n                isLegacy\n                  ? (props.button?.cancel.variant ?? \"outline\")\n                  : \"outline\"\n              }\n              onClick={handleCancel}\n              className={cn(\n                isLegacy ? props.button?.cancel.className : \"\",\n                \"w-full\",\n              )}\n              size={\n                isLegacy ? (props.button?.cancel.size ?? \"default\") : \"default\"\n              }\n            >\n              {isLegacy\n                ? (props.button?.cancel.text ?? \"Cancel\")\n                : (props.cancelButtonText ?? \"Cancel\")}\n            </Button>\n          </div>\n        </div>\n      </PopoverContent>\n    </Popover>\n  );\n};\n"
  },
  {
    "path": "src/components/wrappers/common/button/button-with-loading.tsx",
    "content": "// \"use client\";\n//\n// import { Button } from \"@/components/ui/button\";\n// import { ButtonHTMLAttributes } from \"react\";\n// import { Loader2 } from \"lucide-react\";\n//\n// export type VariantButton = {\n//     secondary: string;\n//     default: string;\n//     outline: string;\n//     ghost: string;\n//     link: string;\n//     destructive: string;\n// };\n// export type sizeButton = {\n//     default: string;\n//     icon: string;\n//     sm: string;\n//     lg: string;\n// };\n//\n// export type ButtonWithConfirmProps = {\n//     icon?: any;\n//     text: string;\n//     variant?: keyof VariantButton;\n//     className?: string;\n//     onClick: () => void;\n//     isPending?: boolean;\n//     size: keyof sizeButton;\n// };\n//\n// export const ButtonWithLoading = ({\n//     icon,\n//     text,\n//     variant,\n//     className,\n//     onClick,\n//     isPending,\n//     size,\n//     ...props // catch all remaining props\n// }: ButtonWithConfirmProps & ButtonHTMLAttributes<HTMLButtonElement>) => {\n//     return (\n//         <Button\n//             onClick={() => {\n//                 onClick();\n//             }}\n//             variant={variant ? variant : \"default\"}\n//             className={className}\n//             {...props} // forward the remaining props to the Button component\n//             size={size || \"default\"}\n//         >\n//             {isPending && <Loader2 className=\"animate-spin mr-4\" size={16} />}\n//             {text}\n//             <>{icon ? icon : null}</>\n//         </Button>\n//     );\n// };\n\n'use client'\n\nimport { ButtonHTMLAttributes, ReactNode } from \"react\";\nimport { Loader2 } from \"lucide-react\";\nimport { Button } from \"@/components/ui/button\";\n\nexport type VariantButton = {\n    secondary: string;\n    default: string;\n    outline: string;\n    ghost: string;\n    link: string;\n    destructive: string;\n};\n\nexport type SizeButton = {\n    default: string;\n    icon: string;\n    sm: string;\n    lg: string;\n};\n\nexport type ButtonWithLoadingProps = {\n    children?: string | ReactNode;\n    icon?: ReactNode;\n    variant?: keyof VariantButton;\n    className?: string;\n    onClick?: (e: React.MouseEvent<HTMLButtonElement>) => void;\n    isPending?: boolean;\n    size?: keyof SizeButton;\n} & ButtonHTMLAttributes<HTMLButtonElement>;\n\nexport const ButtonWithLoading = ({\n                                      icon,\n                                      children,\n                                      variant = \"default\",\n                                      className,\n                                      onClick,\n                                      isPending,\n                                      size = \"default\",\n                                      ...rest\n                                  }: ButtonWithLoadingProps) => {\n    return (\n        <Button\n            onClick={(e) => onClick?.(e)}\n            variant={variant}\n            className={className}\n            size={size}\n            {...rest}\n        >\n            {isPending && <Loader2 className=\"mr-2 animate-spin\" size={16} />}\n            {children && children}\n            <>{icon ? icon : null}</>\n        </Button>\n    );\n};\n"
  },
  {
    "path": "src/components/wrappers/common/button/copy-button.tsx",
    "content": "\"use client\";\n\nimport { useEffect, useState } from \"react\";\nimport { CheckIcon, Copy } from \"lucide-react\";\nimport { Button } from \"@/components/ui/button\";\n\nexport async function copyToClipboardWithMeta(value: string) {\n    navigator.clipboard.writeText(value);\n}\n\nexport type CopyButtonProps = {\n    value: string;\n    className?: string;\n};\n\nexport const CopyButton = (props: CopyButtonProps) => {\n    const { value } = props;\n\n    const [hasCopied, setHasCopied] = useState(false);\n\n    useEffect(() => {\n        setTimeout(() => {\n            setHasCopied(false);\n        }, 2000);\n    }, [hasCopied]);\n\n    return (\n        <Button\n            onClick={() => {\n                copyToClipboardWithMeta(value);\n                setHasCopied(true);\n            }}\n            {...props}\n        >\n            <span className=\"mr-2\">Copy</span>\n            {hasCopied ? <CheckIcon /> : <Copy size=\"18\" />}\n        </Button>\n    );\n};\n"
  },
  {
    "path": "src/components/wrappers/common/cards-with-pagination.tsx",
    "content": "\"use client\";\n\nimport React, { ComponentType, useState } from \"react\";\nimport { cn } from \"@/lib/utils\";\n\nimport { PaginationNavigation } from \"@/components/wrappers/common/pagination/pagination-navigation\";\nimport { PaginationSize } from \"@/components/wrappers/common/pagination/pagination-size\";\n\ninterface CardsWithPaginationProps<T> {\n    className?: string;\n    data: any[];\n    organizationSlug?: string;\n    cardItem: ComponentType<{ data: T } & Record<string, any>>;\n    cardsPerPage?: number;\n    numberOfColumns?: number;\n    maxVisiblePages?: number;\n    pageSizeOptions?: number[];\n    [key: string]: any;\n}\n\nexport function CardsWithPagination<T>(props: CardsWithPaginationProps<T>) {\n    const { className, organizationSlug, data, cardItem, cardsPerPage = 5, numberOfColumns = 1, maxVisiblePages = 3, pageSizeOptions, ...rest } = props;\n\n    const CardItem = cardItem;\n\n    const [pageSize, setPageSize] = useState(cardsPerPage);\n    const [currentPage, setCurrentPage] = useState(1);\n    const totalPages = Math.ceil(data.length / pageSize);\n\n    const indexOfLastCard = currentPage * pageSize;\n    const indexOfFirstCard = indexOfLastCard - pageSize;\n    const currentCards = data.slice(indexOfFirstCard, indexOfLastCard);\n\n    const goToPage = (pageNumber: number) => {\n        setCurrentPage(pageNumber);\n    };\n\n    const goToPrevPage = () => {\n        goToPage(Math.max(1, currentPage - 1));\n    };\n\n    const goToNextPage = () => {\n        goToPage(Math.min(totalPages, currentPage + 1));\n    };\n\n    const handlePageSizeChange = (newSize: number) => {\n        if (!Number.isFinite(newSize) || newSize < 1) return;\n        setPageSize(newSize);\n        setCurrentPage(1);\n    };\n\n    const showSizeSelector = pageSizeOptions && pageSizeOptions.length > 0;\n\n    return (\n        <div className={cn(\"flex flex-col h-full justify-between\", className)}>\n            <div className={cn(`grid h-max auto-rows-min gap-4 md:grid-cols-${numberOfColumns}`)}>\n                {currentCards.map((card, key) => (\n                    <CardItem key={key} data={card} organizationSlug={organizationSlug}  {...rest} />\n                ))}\n            </div>\n            <div className=\"flex items-center justify-end mt-4 gap-4\">\n                {showSizeSelector && (\n                    <PaginationSize\n                        pageSize={pageSize}\n                        onPageSizeChange={handlePageSizeChange}\n                        pageSizeOptions={pageSizeOptions}\n                    />\n                )}\n                <PaginationNavigation\n                    className=\"justify-end\"\n                    totalPages={totalPages}\n                    currentPage={currentPage}\n                    goToPage={goToPage}\n                    goToPrevPage={goToPrevPage}\n                    goToNextPage={goToNextPage}\n                    maxVisiblePages={maxVisiblePages}\n                />\n            </div>\n        </div>\n    );\n}\n"
  },
  {
    "path": "src/components/wrappers/common/code-snippet.tsx",
    "content": "\"use client\";\n\nimport {PropsWithChildren, useState} from \"react\";\nimport {Button} from \"@/components/ui/button\";\nimport {Check, Copy, Terminal} from \"lucide-react\";\nimport {copyToClipboardWithMeta} from \"@/components/wrappers/common/button/copy-button\";\nimport {cn} from \"@/lib/utils\";\n\nexport type CodeSnippetProps = PropsWithChildren<{\n    code: string;\n    title?: string;\n    className?: string;\n}>;\n\nexport const CodeSnippet = (props: CodeSnippetProps) => {\n    const [isCopied, setIsCopied] = useState(false);\n\n    const handleCopy = async () => {\n        await copyToClipboardWithMeta(props.code);\n        setIsCopied(true);\n        setTimeout(() => setIsCopied(false), 2000);\n    };\n\n    return (\n        <div className={cn(\"relative group rounded-md bg-muted/50 border overflow-hidden\", props.className)}>\n            {props.title && (\n                <div className=\"flex items-center px-4 py-2 text-xs font-medium text-muted-foreground border-b bg-muted/30\">\n                    {props.title}\n                </div>\n            )}\n            <div className=\"flex items-center p-4\">\n                 <pre className=\"flex-1 overflow-x-auto font-mono text-sm leading-relaxed\">\n                    <code className=\"break-all whitespace-pre-wrap\">{props.code}</code>\n                </pre>\n                <Button\n                    variant=\"ghost\"\n                    size=\"icon\"\n                    className=\"ml-2 h-8 w-8 shrink-0 text-muted-foreground hover:text-foreground opacity-100 sm:opacity-0 sm:group-hover:opacity-100 transition-opacity\"\n                    onClick={handleCopy}\n                >\n                    {isCopied ? <Check size={14} className=\"text-green-500\" /> : <Copy size={14} />}\n                    <span className=\"sr-only\">Copy code</span>\n                </Button>\n            </div>\n        </div>\n    );\n};\n"
  },
  {
    "path": "src/components/wrappers/common/combobox.tsx",
    "content": "\"use client\";\n\nimport {useEffect, useState} from \"react\";\nimport {Check, ChevronDown} from \"lucide-react\";\nimport {cn} from \"@/lib/utils\";\nimport {Button} from \"@/components/ui/button\";\nimport {Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList} from \"@/components/ui/command\";\nimport {Popover, PopoverContent, PopoverTrigger} from \"@/components/ui/popover\";\nimport {SidebarMenuButton} from \"@/components/ui/sidebar\";\nimport {Separator} from \"@/components/ui/separator\";\n\nexport type ComboBoxProps<T = string> = {\n    values: Array<{ value: T; label: string }>;\n    defaultValue?: T;\n    onValueChangeAction?: (value: T) => void;\n    searchField?: boolean;\n    sideBar?: boolean;\n    onAddItemAction?: () => void;\n    addItemLabel?: string;\n};\n\nexport function ComboBox<T = string>(props: ComboBoxProps<T>) {\n    const {\n        values: choices,\n        defaultValue,\n        onValueChangeAction,\n        searchField = false,\n        sideBar = false,\n        onAddItemAction,\n        addItemLabel = \"Add item\",\n    } = props;\n\n    const [value, setValue] = useState<T | undefined>(defaultValue);\n    const [open, setOpen] = useState(false);\n\n    useEffect(() => {\n        setValue(defaultValue);\n    }, [defaultValue]);\n\n    return (\n        <div>\n            <Popover open={open} onOpenChange={setOpen}>\n                <PopoverTrigger asChild>\n                    {sideBar ? (\n                        <SidebarMenuButton>\n                            <label className=\"max-w-[170px] truncate\">\n                            {value ? choices.find((c) => c.value === value)?.label : \"Select choice...\"}\n                            </label>\n                                <ChevronDown className=\"ml-auto\"/>\n                        </SidebarMenuButton>\n                    ) : (\n                        <Button variant=\"outline\" role=\"combobox\" aria-expanded={open}\n                                className=\"w-full justify-between\">\n                            <label className=\"max-w-[170px] truncate\">\n                                {value ? choices.find((c) => c.value === value)?.label : \"Select choice...\"}\n                            </label>\n                            <ChevronDown className=\"opacity-50\"/>\n                        </Button>\n                    )}\n                </PopoverTrigger>\n\n                <PopoverContent\n                    className=\"p-0\"\n                    align=\"start\"\n                    sideOffset={4}\n                    style={{width: 'var(--radix-popover-trigger-width)'}}\n\n                >\n                    <Command>\n                        {searchField && <CommandInput placeholder=\"Search choice...\" className=\"h-9\"/>}\n                        <CommandList>\n                            <CommandEmpty>No choice found.</CommandEmpty>\n                            <CommandGroup>\n                                {choices.map((choice) => (\n                                    <CommandItem\n                                        key={String(choice.value)}\n                                        value={String(choice.value)}\n                                        onSelect={(currentValue) => {\n                                            const v = choices.find(c => String(c.value) === currentValue)?.value;\n                                            if (v !== undefined) {\n                                                setValue(v);\n                                                onValueChangeAction?.(v);\n                                                setOpen(false);\n                                            }\n                                        }}\n                                    >\n                                        <label className=\"max-w-[170px] truncate\">\n                                            {choice.label}\n                                        </label>\n                                        <Check\n                                            className={cn(\"ml-auto\", value === choice.value ? \"opacity-100\" : \"opacity-0\")}/>\n                                    </CommandItem>\n                                ))}\n                            </CommandGroup>\n                        </CommandList>\n                    </Command>\n                    {onAddItemAction && (\n                        <>\n                            <Separator/>\n                            {sideBar ? (\n                                <SidebarMenuButton onClick={() => {\n                                    setOpen(false);\n                                    onAddItemAction();\n                                }}>\n                                    + {addItemLabel}\n                                </SidebarMenuButton>\n                            ) : (\n                                <Button variant=\"outline\" className=\"w-full\" onClick={onAddItemAction}>\n                                    + {addItemLabel}\n                                </Button>\n                            )}\n                        </>\n                    )}\n                </PopoverContent>\n            </Popover>\n        </div>\n    );\n}\n\n"
  },
  {
    "path": "src/components/wrappers/common/connection-indicator.tsx",
    "content": "import {cn} from \"@/lib/utils\";\n\nexport type ConnectionIndicatorProps = {\n    date?: Date | null;\n};\n\nexport const ConnectionIndicator = ({date}: ConnectionIndicatorProps) => {\n    let style = \"bg-gray-300\";\n\n    if (date instanceof Date && !isNaN(date.getTime())) {\n        const intervalSeconds = (Date.now() - date.getTime()) / 1000;\n\n        if (intervalSeconds < 55) {\n            style = \"bg-green-500\";\n        } else if (intervalSeconds <= 60) {\n            style = \"bg-orange-400\";\n        } else {\n            style = \"bg-red-500\";\n        }\n    }\n\n    return (\n        <div className=\"relative w-3 h-3\">\n\n                <span\n                    className={cn(\n                        \"absolute -inset-0.25 rounded-full opacity-60 animate-ping\",\n                        style\n                    )}\n                    style={{\n                        animationDuration: \"2s\",\n                    }}\n                />\n\n            <div\n                className={cn(\n                    \"relative w-3 h-3 rounded-full shadow-sm animate-pulse\",\n                    style\n                )}\n                style={{\n                    animationDuration: \"2s\",\n                }}\n            />\n        </div>\n    );\n};\n"
  },
  {
    "path": "src/components/wrappers/common/console-silencer.tsx",
    "content": "\"use client\";\n\nimport { useEffect } from \"react\";\n\nexport function ConsoleSilencer() {\n    useEffect(() => {\n        if (process.env.NODE_ENV === \"production\") {\n            for (const method of [\"log\", \"debug\", \"info\", \"warn\", \"error\"] as const) {\n                console[method] = () => {};\n            }\n        }\n    }, []);\n\n    return null;\n}"
  },
  {
    "path": "src/components/wrappers/common/day-time-picker.tsx",
    "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { format } from \"date-fns\";\nimport { useFormContext } from \"react-hook-form\";\n\nimport { Button } from \"@/components/ui/button\";\nimport { Calendar } from \"@/components/ui/calendar\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"@/components/ui/popover\";\nimport { ScrollArea, ScrollBar } from \"@/components/ui/scroll-area\";\nimport { CalendarIcon } from \"lucide-react\";\nimport { cn } from \"@/lib/utils\";\n\ninterface DateTimePickerProps {\n    name: string;\n    label?: string;\n}\n\nexport function DateTimePicker({ name }: DateTimePickerProps) {\n    const form = useFormContext();\n    const value: Date | null = form.watch(name);\n\n    const handleDateSelect = (date: Date | undefined) => {\n        if (date) {\n            const current = form.getValues(name) ?? new Date();\n            date.setHours(current.getHours());\n            date.setMinutes(current.getMinutes());\n            form.setValue(name, date);\n        }\n    };\n\n    const handleTimeChange = (type: \"hour\" | \"minute\" | \"ampm\", val: string) => {\n        const currentDate = form.getValues(name) ?? new Date();\n        const newDate = new Date(currentDate);\n\n        if (type === \"hour\") {\n            const hour = parseInt(val, 10);\n            const isPM = newDate.getHours() >= 12;\n            newDate.setHours((isPM ? 12 : 0) + (hour % 12));\n        } else if (type === \"minute\") {\n            newDate.setMinutes(parseInt(val, 10));\n        } else if (type === \"ampm\") {\n            const hours = newDate.getHours();\n            if (val === \"AM\" && hours >= 12) {\n                newDate.setHours(hours - 12);\n            } else if (val === \"PM\" && hours < 12) {\n                newDate.setHours(hours + 12);\n            }\n        }\n\n        form.setValue(name, newDate);\n    };\n\n    return (\n        <Popover>\n            <PopoverTrigger asChild>\n                <Button variant=\"outline\" className={cn(\"w-full pl-3 text-left font-normal\", !value && \"text-muted-foreground\")}>\n                    {value ? format(value, \"MM/dd/yyyy hh:mm aa\") : <span>MM/DD/YYYY hh:mm aa</span>}\n                    <CalendarIcon className=\"ml-auto h-4 w-4 opacity-50\" />\n                </Button>\n            </PopoverTrigger>\n            <PopoverContent className=\"w-auto p-0\">\n                <div className=\"sm:flex\">\n                    <Calendar mode=\"single\" selected={value ?? undefined} onSelect={handleDateSelect} initialFocus />\n                    <div className=\"flex flex-col sm:flex-row sm:h-[300px] divide-y sm:divide-y-0 sm:divide-x\">\n                        {/* Hours */}\n                        <ScrollArea className=\"w-64 sm:w-auto\">\n                            <div className=\"flex sm:flex-col p-2\">\n                                {Array.from({ length: 12 }, (_, i) => i + 1)\n                                    .reverse()\n                                    .map((hour) => (\n                                        <Button\n                                            key={hour}\n                                            size=\"icon\"\n                                            variant={value && value.getHours() % 12 === hour % 12 ? \"default\" : \"ghost\"}\n                                            className=\"sm:w-full shrink-0 aspect-square\"\n                                            onClick={() => handleTimeChange(\"hour\", hour.toString())}\n                                        >\n                                            {hour}\n                                        </Button>\n                                    ))}\n                            </div>\n                            <ScrollBar orientation=\"horizontal\" className=\"sm:hidden\" />\n                        </ScrollArea>\n\n                        {/* Minutes */}\n                        <ScrollArea className=\"w-64 sm:w-auto\">\n                            <div className=\"flex sm:flex-col p-2\">\n                                {Array.from({ length: 12 }, (_, i) => i * 5).map((minute) => (\n                                    <Button\n                                        key={minute}\n                                        size=\"icon\"\n                                        variant={value && value.getMinutes() === minute ? \"default\" : \"ghost\"}\n                                        className=\"sm:w-full shrink-0 aspect-square\"\n                                        onClick={() => handleTimeChange(\"minute\", minute.toString())}\n                                    >\n                                        {minute.toString().padStart(2, \"0\")}\n                                    </Button>\n                                ))}\n                            </div>\n                            <ScrollBar orientation=\"horizontal\" className=\"sm:hidden\" />\n                        </ScrollArea>\n\n                        {/* AM/PM */}\n                        <ScrollArea>\n                            <div className=\"flex sm:flex-col p-2\">\n                                {[\"AM\", \"PM\"].map((ampm) => (\n                                    <Button\n                                        key={ampm}\n                                        size=\"icon\"\n                                        variant={\n                                            value && ((ampm === \"AM\" && value.getHours() < 12) || (ampm === \"PM\" && value.getHours() >= 12))\n                                                ? \"default\"\n                                                : \"ghost\"\n                                        }\n                                        className=\"sm:w-full shrink-0 aspect-square\"\n                                        onClick={() => handleTimeChange(\"ampm\", ampm)}\n                                    >\n                                        {ampm}\n                                    </Button>\n                                ))}\n                            </div>\n                        </ScrollArea>\n                    </div>\n                </div>\n            </PopoverContent>\n        </Popover>\n    );\n}\n"
  },
  {
    "path": "src/components/wrappers/common/dialog.tsx",
    "content": "\"use client\";\n\nimport { Button } from \"@/components/ui/button\";\nimport { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle } from \"@/components/ui/dialog\";\nimport { Input } from \"@/components/ui/input\";\nimport { Label } from \"@/components/ui/label\";\n\nexport type agentRegistrationDialogProps = {\n    open: boolean;\n    setOpen: (open: boolean) => void;\n};\n\nexport const AgentRegistrationDialog = (props: agentRegistrationDialogProps) => {\n    const { open, setOpen } = props;\n\n    return (\n        <Dialog open={open} onOpenChange={setOpen}>\n            <DialogContent className=\"sm:max-w-[425px]\">\n                <DialogHeader>\n                    <DialogTitle>New agent registered!</DialogTitle>\n                </DialogHeader>\n\n                <div className=\"grid gap-4 py-4\">\n                    <div className=\"grid grid-cols-4 items-center gap-4\">\n                        <Label htmlFor=\"name\" className=\"text-right\">\n                            CONNECTION KEY\n                        </Label>\n                        <Input id=\"name\" value=\"Pedro Duarte\" readOnly className=\"col-span-3\" />\n                    </div>\n                </div>\n                <DialogFooter>\n                    <Button type=\"submit\">Close</Button>\n                </DialogFooter>\n            </DialogContent>\n        </Dialog>\n    );\n};\n"
  },
  {
    "path": "src/components/wrappers/common/dropzone/dropzone-file.tsx",
    "content": "\"use client\";\n\nimport {\n    CircleCheck,\n    CircleX,\n    CloudUploadIcon,\n    Loader2,\n    Trash2Icon,\n} from \"lucide-react\";\nimport {\n    DropZoneArea,\n    DropzoneDescription,\n    DropzoneFileList,\n    DropzoneFileListItem,\n    DropzoneMessage,\n    DropzoneRemoveFile,\n    DropzoneTrigger,\n    useDropzone,\n    Dropzone,\n} from \"@/components/ui/dropzone\";\n\ntype DropZoneFileProps = {\n    onFileDropAction?: (file: File) => Promise<void> | void;\n    onFileRemoveAction?: (file: File) => void;\n    accept?: Record<string, string[]>;\n    maxSize?: number;\n    maxFiles?: number;\n    description?: string;\n    fileKind?: string;\n    dragMessage?: string;\n    fileList?: boolean;\n};\n\n\nexport const DropZoneFile = ({\n                                 onFileDropAction,\n                                 onFileRemoveAction,\n                                 accept = {\"application/pdf\": [\".pdf\"]},\n                                 maxSize = 50 * 1024 * 1024,\n                                 maxFiles = 1,\n                                 description = \"Please select a file\",\n                                 fileKind = \"Upload files (.pdf)\",\n                                 dragMessage = \"Click here or drag & drop to upload\",\n                                 fileList = true\n                             }: DropZoneFileProps) => {\n    const dropzone = useDropzone({\n        onDropFile: async (file: File) => {\n            onFileDropAction?.(file);\n\n            return {\n                status: \"success\",\n                result: URL.createObjectURL(file),\n            };\n        },\n        validation: {\n            accept,\n            maxSize,\n            maxFiles,\n        },\n    });\n\n    const handleRemove = (file: any) => {\n        dropzone.onRemoveFile(file.id);\n        onFileRemoveAction?.(file.file);\n    };\n\n    return (\n        <div className=\"not-prose flex flex-col gap-4 h-full\">\n            <Dropzone {...dropzone}>\n                <div className=\"h-full\">\n                    {dropzone.fileStatuses.length < maxFiles && (\n                        <div className=\"flex flex-col h-full\">\n                            <div className=\"flex justify-between\">\n                                <DropzoneDescription>{description}</DropzoneDescription>\n                                <DropzoneMessage/>\n                            </div>\n                            <DropZoneArea className=\"flex-1 px-0 py-0 mt-2\">\n                                <DropzoneTrigger\n                                    className=\"flex h-full w-full flex-col items-center justify-center gap-4 bg-transparent p-10 text-center text-sm\">\n                                    <CloudUploadIcon className=\"size-8\"/>\n                                    <div>\n                                        <p className=\"font-semibold\">{fileKind}</p>\n                                        <p className=\"text-sm text-muted-foreground\">\n                                            {dragMessage}\n                                        </p>\n                                    </div>\n                                </DropzoneTrigger>\n                            </DropZoneArea>\n                        </div>\n                    )}\n                </div>\n                {fileList && (\n                    <DropzoneFileList className=\"grid gap-3 p-0\">\n                        {dropzone.fileStatuses.map((file) => (\n                            <DropzoneFileListItem\n                                key={file.id}\n                                file={file}\n                                className=\"overflow-hidden rounded-md bg-secondary p-0 shadow-sm\"\n                            >\n                                <div className=\"flex items-center justify-between p-2 pl-4\">\n                                    <div className=\"flex overflow-hidden items-center gap-3\">\n                                        <div>\n                                            {file.status === \"pending\" ? (\n                                                <Loader2 className=\"animate-spin\" size={16}/>\n                                            ) : file.status === \"error\" ? (\n                                                <CircleX className=\"text-red-600\" size={16}/>\n                                            ) : (\n                                                <CircleCheck className=\"text-green-700\" size={16}/>\n                                            )}\n                                        </div>\n                                        <div className=\"min-w-0\">\n                                            <div className=\"truncate text-sm flex\">\n                                                <span>{file.fileName}</span>\n                                            </div>\n                                            <p className=\"text-xs text-muted-foreground\">\n                                                {(file.file.size / (1024 * 1024)).toFixed(2)} MB\n                                            </p>\n                                        </div>\n                                    </div>\n                                    <DropzoneRemoveFile\n                                        variant=\"ghost\"\n                                        className=\"shrink-0 hover:outline\"\n                                        // @ts-ignore\n                                        onClick={() => handleRemove(file)}\n                                    >\n                                        <Trash2Icon className=\"size-4\"/>\n                                    </DropzoneRemoveFile>\n                                </div>\n                            </DropzoneFileListItem>\n                        ))}\n                    </DropzoneFileList>\n                )}\n\n            </Dropzone>\n        </div>\n    );\n};\n"
  },
  {
    "path": "src/components/wrappers/common/empty-state-placeholder.tsx",
    "content": "import Link from \"next/link\";\nimport {cn} from \"@/lib/utils\";\nimport {CircleSlash2, Plus} from \"lucide-react\";\nimport {forwardRef, HTMLAttributes} from \"react\";\n\ntype EmptyStatePlaceholderProps = {\n    url?: string;\n    onClick?: () => void;\n    text: string;\n    className?: string;\n    state?: string\n} & HTMLAttributes<HTMLDivElement>;\n\nexport const EmptyStatePlaceholder = forwardRef<HTMLDivElement, EmptyStatePlaceholderProps>(({\n                                                                                                 url,\n                                                                                                 onClick,\n                                                                                                 text,\n                                                                                                 state,\n                                                                                                 className,\n                                                                                                 ...props\n                                                                                             }, ref) => {\n    const Container = (\n        <div\n            className={cn(\n                \"flex h-full flex-col items-center justify-center w-full rounded-2xl border border-dashed border-muted p-6 lg:p-10\",\n                \"transition-colors text-muted-foreground text-center space-y-4\",\n                state != \"empty\" && \"hover:bg-muted/50 hover:text-primary\",\n                (onClick || url) && \"cursor-pointer\"\n            )}\n            onClick={onClick}\n        >\n            {state == \"empty\" ?\n                <CircleSlash2 className=\"w-5 h-5 lg:w-6 lg:h-6\"/>\n                :\n                <Plus className=\"w-5 h-5 lg:w-6 lg:h-6\"/>\n            }\n            <p className=\"text-sm\">{text}</p>\n        </div>\n    );\n\n    if (url) {\n        return (\n            <div className={cn(className)}>\n                <Link href={url}>{Container}</Link>\n            </div>\n        );\n    }\n\n    return <div className={cn(className)} ref={ref} {...props}>{Container}</div>;\n});\n\nEmptyStatePlaceholder.displayName = \"EmptyStatePlaceholder\";"
  },
  {
    "path": "src/components/wrappers/common/error-layout.tsx",
    "content": "\"use client\";\n\nimport { useSearchParams } from \"next/navigation\";\nimport type React from \"react\";\nimport { useEffect } from \"react\";\nimport { toast } from \"sonner\";\nexport const ErrorLayout = ({ children }: { children: React.ReactNode }) => {\n  const url = useSearchParams();\n\n  useEffect(() => {\n    const error = url.get(\"error\");\n\n    if (!error) return;\n\n    const errorMessages: Record<string, string> = {\n      pending: \"Your account is not active.\",\n      invalid_or_expired_token: \"Password reset invalid token.\",\n      account_already_linked_to_different_user:\n        \"An account already exists with the same email address but different sign-in credentials. Sign in using a provider associated with this email address.\",\n      USER_NOT_FOUND: \"User not found\",\n      FAILED_TO_CREATE_USER: \"Failed to create user\",\n      FAILED_TO_CREATE_SESSION: \"Failed to create session\",\n      FAILED_TO_UPDATE_USER: \"Failed to update user\",\n      FAILED_TO_GET_SESSION: \"Failed to get session\",\n      INVALID_PASSWORD: \"Invalid password\",\n      INVALID_EMAIL: \"Invalid email\",\n      INVALID_EMAIL_OR_PASSWORD: \"Invalid email or password\",\n      INVALID_USER: \"Invalid user\",\n      SOCIAL_ACCOUNT_ALREADY_LINKED: \"Social account already linked\",\n      PROVIDER_NOT_FOUND: \"Provider not found\",\n      INVALID_TOKEN: \"Invalid token\",\n      TOKEN_EXPIRED: \"Token expired\",\n      ID_TOKEN_NOT_SUPPORTED: \"id_token not supported\",\n      FAILED_TO_GET_USER_INFO: \"Failed to get user info\",\n      USER_EMAIL_NOT_FOUND: \"User email not found\",\n      EMAIL_NOT_VERIFIED: \"Email not verified\",\n      PASSWORD_TOO_SHORT: \"Password too short\",\n      PASSWORD_TOO_LONG: \"Password too long\",\n      USER_ALREADY_EXISTS: \"User already exists.\",\n      USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL:\n        \"User already exists. Use another email.\",\n      EMAIL_CAN_NOT_BE_UPDATED: \"Email can not be updated\",\n      CREDENTIAL_ACCOUNT_NOT_FOUND: \"Credential account not found\",\n      SESSION_EXPIRED:\n        \"Session expired. Re-authenticate to perform this action.\",\n      FAILED_TO_UNLINK_LAST_ACCOUNT: \"You can't unlink your last account\",\n      ACCOUNT_NOT_FOUND: \"Account not found\",\n      USER_ALREADY_HAS_PASSWORD:\n        \"User already has a password. Provide that to delete the account.\",\n      CROSS_SITE_NAVIGATION_LOGIN_BLOCKED:\n        \"Cross-site navigation login blocked. This request appears to be a CSRF attack.\",\n      VERIFICATION_EMAIL_NOT_ENABLED: \"Verification email isn't enabled\",\n      EMAIL_ALREADY_VERIFIED: \"Email is already verified\",\n      EMAIL_MISMATCH: \"Email mismatch\",\n      SESSION_NOT_FRESH: \"Session is not fresh\",\n      LINKED_ACCOUNT_ALREADY_EXISTS: \"Linked account already exists\",\n      INVALID_ORIGIN: \"Invalid origin\",\n      INVALID_CALLBACK_URL: \"Invalid callbackURL\",\n      INVALID_REDIRECT_URL: \"Invalid redirectURL\",\n      INVALID_ERROR_CALLBACK_URL: \"Invalid errorCallbackURL\",\n      INVALID_NEW_USER_CALLBACK_URL: \"Invalid newUserCallbackURL\",\n      MISSING_OR_NULL_ORIGIN: \"Missing or null Origin\",\n      CALLBACK_URL_REQUIRED: \"callbackURL is required\",\n      FAILED_TO_CREATE_VERIFICATION: \"Unable to create verification\",\n      FIELD_NOT_ALLOWED: \"Field not allowed to be set\",\n      ASYNC_VALIDATION_NOT_SUPPORTED: \"Async validation is not supported\",\n      VALIDATION_ERROR: \"Validation Error\",\n      MISSING_FIELD: \"Field is required\",\n      METHOD_NOT_ALLOWED_DEFER_SESSION_REQUIRED:\n        \"POST method requires deferSessionRefresh to be enabled in session config\",\n      BODY_MUST_BE_AN_OBJECT: \"Body must be an object\",\n      PASSWORD_ALREADY_SET: \"User already has a password set\",\n      Sign_up_is_disabled: \"Sign up is disabled by the administrator\",\n    };\n\n    const match = Object.entries(errorMessages).find(([key]) =>\n      error.includes(key),\n    );\n\n    if (!match) return;\n\n    toast.error(match[1]);\n\n    const params = new URLSearchParams(url.toString());\n    params.delete(\"error\");\n    const newUrl =\n      window.location.pathname +\n      (params.toString() ? `?${params.toString()}` : \"\");\n\n    window.history.replaceState({}, document.title, newUrl);\n  }, [url]);\n\n  return <>{children}</>;\n};\n"
  },
  {
    "path": "src/components/wrappers/common/file-uploader.tsx",
    "content": "\"use client\";\n\nimport { Input } from \"@/components/ui/input\";\nimport { cn } from \"@/lib/utils\";\nimport { Dispatch, SetStateAction, createContext, forwardRef, useCallback, useContext, useEffect, useRef, useState } from \"react\";\nimport { useDropzone, DropzoneState, FileRejection, DropzoneOptions } from \"react-dropzone\";\nimport { toast } from \"sonner\";\nimport { Trash2 as RemoveIcon } from \"lucide-react\";\n\ntype DirectionOptions = \"rtl\" | \"ltr\" | undefined;\n\ntype FileUploaderContextType = {\n    dropzoneState: DropzoneState;\n    isLOF: boolean;\n    isFileTooBig: boolean;\n    removeFileFromSet: (index: number) => void;\n    activeIndex: number;\n    setActiveIndex: Dispatch<SetStateAction<number>>;\n    orientation: \"horizontal\" | \"vertical\";\n    direction: DirectionOptions;\n};\n\nconst FileUploaderContext = createContext<FileUploaderContextType | null>(null);\n\nexport const useFileUpload = () => {\n    const context = useContext(FileUploaderContext);\n    if (!context) {\n        throw new Error(\"useFileUpload must be used within a FileUploaderProvider\");\n    }\n    return context;\n};\n\ntype FileUploaderProps = {\n    value: File[] | null;\n    reSelect?: boolean;\n    onValueChange: (value: File[] | null) => void;\n    dropzoneOptions: DropzoneOptions;\n    orientation?: \"horizontal\" | \"vertical\";\n};\n\n/**\n * File upload Docs: {@link: https://localhost:3000/docs/file-upload}\n */\n\nexport const FileUploader = forwardRef<HTMLDivElement, FileUploaderProps & React.HTMLAttributes<HTMLDivElement>>(\n    ({ className, dropzoneOptions, value, onValueChange, reSelect, orientation = \"vertical\", children, dir, ...props }, ref) => {\n        const [isFileTooBig, setIsFileTooBig] = useState(false);\n        const [isLOF, setIsLOF] = useState(false);\n        const [activeIndex, setActiveIndex] = useState(-1);\n        const {\n            accept = {\n                \"image/*\": [\".jpg\", \".jpeg\", \".png\", \".gif\"],\n            },\n            maxFiles = 1,\n            maxSize = 4 * 1024 * 1024,\n            multiple = true,\n        } = dropzoneOptions;\n\n        const reSelectAll = maxFiles === 1 ? true : reSelect;\n        const direction: DirectionOptions = dir === \"rtl\" ? \"rtl\" : \"ltr\";\n\n        const removeFileFromSet = useCallback(\n            (i: number) => {\n                if (!value) return;\n                const newFiles = value.filter((_, index) => index !== i);\n                onValueChange(newFiles);\n            },\n            [value, onValueChange]\n        );\n\n        const handleKeyDown = useCallback(\n            (e: React.KeyboardEvent<HTMLDivElement>) => {\n                e.preventDefault();\n                e.stopPropagation();\n\n                if (!value) return;\n\n                const moveNext = () => {\n                    const nextIndex = activeIndex + 1;\n                    setActiveIndex(nextIndex > value.length - 1 ? 0 : nextIndex);\n                };\n\n                const movePrev = () => {\n                    const nextIndex = activeIndex - 1;\n                    setActiveIndex(nextIndex < 0 ? value.length - 1 : nextIndex);\n                };\n\n                const prevKey = orientation === \"horizontal\" ? (direction === \"ltr\" ? \"ArrowLeft\" : \"ArrowRight\") : \"ArrowUp\";\n\n                const nextKey = orientation === \"horizontal\" ? (direction === \"ltr\" ? \"ArrowRight\" : \"ArrowLeft\") : \"ArrowDown\";\n\n                if (e.key === nextKey) {\n                    moveNext();\n                } else if (e.key === prevKey) {\n                    movePrev();\n                } else if (e.key === \"Enter\" || e.key === \"Space\") {\n                    if (activeIndex === -1) {\n                        dropzoneState.inputRef.current?.click();\n                    }\n                } else if (e.key === \"Delete\" || e.key === \"Backspace\") {\n                    if (activeIndex !== -1) {\n                        removeFileFromSet(activeIndex);\n                        if (value.length - 1 === 0) {\n                            setActiveIndex(-1);\n                            return;\n                        }\n                        movePrev();\n                    }\n                } else if (e.key === \"Escape\") {\n                    setActiveIndex(-1);\n                }\n            },\n            // eslint-disable-next-line react-hooks/exhaustive-deps\n            [value, activeIndex, removeFileFromSet]\n        );\n\n        const onDrop = useCallback(\n            (acceptedFiles: File[], rejectedFiles: FileRejection[]) => {\n                const files = acceptedFiles;\n\n                if (!files) {\n                    toast.error(\"file error , probably too big\");\n                    return;\n                }\n\n                const newValues: File[] = value ? [...value] : [];\n\n                if (reSelectAll) {\n                    newValues.splice(0, newValues.length);\n                }\n\n                files.forEach((file) => {\n                    if (newValues.length < maxFiles) {\n                        newValues.push(file);\n                    }\n                });\n\n                onValueChange(newValues);\n\n                if (rejectedFiles.length > 0) {\n                    for (let i = 0; i < rejectedFiles.length; i++) {\n                        if (rejectedFiles[i].errors[0]?.code === \"file-too-large\") {\n                            toast.error(`File is too large. Max size is ${maxSize / 1024 / 1024}MB`);\n                            break;\n                        }\n                        if (rejectedFiles[i].errors[0]?.message) {\n                            toast.error(rejectedFiles[i].errors[0].message);\n                            break;\n                        }\n                    }\n                }\n            },\n            // eslint-disable-next-line react-hooks/exhaustive-deps\n            [reSelectAll, value]\n        );\n\n        useEffect(() => {\n            if (!value) return;\n            if (value.length === maxFiles) {\n                setIsLOF(true);\n                return;\n            }\n            setIsLOF(false);\n        }, [value, maxFiles]);\n\n        const opts = dropzoneOptions ? dropzoneOptions : { accept, maxFiles, maxSize, multiple };\n\n        const dropzoneState = useDropzone({\n            ...opts,\n            onDrop,\n            onDropRejected: () => setIsFileTooBig(true),\n            onDropAccepted: () => setIsFileTooBig(false),\n        });\n\n        return (\n            <FileUploaderContext.Provider\n                value={{\n                    dropzoneState,\n                    isLOF,\n                    isFileTooBig,\n                    removeFileFromSet,\n                    activeIndex,\n                    setActiveIndex,\n                    orientation,\n                    direction,\n                }}\n            >\n                <div\n                    ref={ref}\n                    tabIndex={0}\n                    onKeyDownCapture={handleKeyDown}\n                    className={cn(\"grid w-full focus:outline-none\", className, {\n                        \"gap-2\": value && value.length > 0,\n                    })}\n                    dir={dir}\n                    {...props}\n                >\n                    {children}\n                </div>\n            </FileUploaderContext.Provider>\n        );\n    }\n);\n\nFileUploader.displayName = \"FileUploader\";\n\nexport const FileUploaderContent = forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(({ children, className, ...props }, ref) => {\n    const { orientation } = useFileUpload();\n    const containerRef = useRef<HTMLDivElement>(null);\n\n    return (\n        <div ref={containerRef} aria-description=\"content file holder\">\n            <div\n                {...props}\n                ref={ref}\n                className={cn(\n                    \"grid gap-4\",\n                    orientation === \"horizontal\" ? \"grid-rows-1 sm:grid-rows-2 lg:grid-rows-3\" : \"grid-cols-1 sm:grid-cols-2 lg:grid-cols-3\",\n                    className\n                )}\n            >\n                {children}\n            </div>\n        </div>\n    );\n});\n\nFileUploaderContent.displayName = \"FileUploaderContent\";\n\nexport const FileUploaderItem = forwardRef<HTMLDivElement, { index: number } & React.HTMLAttributes<HTMLDivElement>>(\n    ({ className, index, children, ...props }, ref) => {\n        const { removeFileFromSet, activeIndex, direction } = useFileUpload();\n        const isSelected = index === activeIndex;\n        return (\n            <div ref={ref} className={cn(\"p-1 justify-between cursor-pointer relative\", className, isSelected ? \"bg-muted\" : \"\")} {...props}>\n                <div className=\"font-medium leading-none tracking-tight flex items-center gap-1.5 h-full w-full\">{children}</div>\n                <button\n                    type=\"button\"\n                    className={cn(\"absolute\", direction === \"rtl\" ? \"top-1 left-1\" : \"top-1 right-1\")}\n                    onClick={() => removeFileFromSet(index)}\n                >\n                    <span className=\"sr-only\">remove item {index}</span>\n                    <RemoveIcon className=\"w-4 h-4 hover:stroke-destructive duration-200 ease-in-out\" />\n                </button>\n            </div>\n        );\n    }\n);\n\nFileUploaderItem.displayName = \"FileUploaderItem\";\n\nexport const FileInput = forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(({ className, children, ...props }, ref) => {\n    const { dropzoneState, isFileTooBig, isLOF } = useFileUpload();\n    const rootProps = isLOF ? {} : dropzoneState.getRootProps();\n    return (\n        <div ref={ref} {...props} className={`relative w-full ${isLOF ? \"opacity-50 cursor-not-allowed \" : \"cursor-pointer \"}`}>\n            <div\n                className={cn(\n                    `w-full rounded-lg duration-300 ease-in-out\n         ${dropzoneState.isDragAccept ? \"border-green-500\" : dropzoneState.isDragReject || isFileTooBig ? \"border-red-500\" : \"border-gray-300\"}`,\n                    className\n                )}\n                {...rootProps}\n            >\n                {children}\n            </div>\n            <Input ref={dropzoneState.inputRef} disabled={isLOF} {...dropzoneState.getInputProps()} className={`${isLOF ? \"cursor-not-allowed\" : \"\"}`} />\n        </div>\n    );\n});\n\nFileInput.displayName = \"FileInput\";\n"
  },
  {
    "path": "src/components/wrappers/common/github/github-button.tsx",
    "content": "'use client';\n\nimport {GithubButton} from \"@/components/ui/github-button\";\nimport * as React from \"react\";\nimport {useEffect} from \"react\";\n\nexport const GitHubStarsButtonCustom = () => {\n\n    const [stars, setStars] = React.useState(0);\n    const [isLoading, setIsLoading] = React.useState(true);\n\n    const username = \"Portabase\"\n    const repo = \"portabase\"\n\n\n    useEffect(() => {\n        fetch(`https://api.github.com/repos/${username}/${repo}`)\n            .then((response) => response.json())\n            .then((data) => {\n                if (data && typeof data.stargazers_count === 'number') {\n                    setStars(data.stargazers_count);\n                }\n            })\n            .catch(console.error)\n            .finally(() => setIsLoading(false));\n    }, [username, repo]);\n\n    if (isLoading) return null;\n\n\n\n    return (\n        <div className=\" gap-4 flex-wrap hidden md:block\">\n            <GithubButton\n                initialStars={0}\n                targetStars={stars}\n                label=\"\"\n                size=\"sm\"\n                separator={true}\n                roundStars={true}\n                repoUrl={`https://github.com/${username}/${repo}`}\n                variant=\"outline\"\n            />\n        </div>\n    );\n};\nexport default GitHubStarsButtonCustom;"
  },
  {
    "path": "src/components/wrappers/common/loading/loading-spinner.tsx",
    "content": "import React from \"react\";\nimport { cn } from \"@/lib/utils\";\n\nexport interface ISVGProps extends React.SVGProps<SVGSVGElement> {\n    size?: number;\n    className?: string;\n}\n\nexport const LoadingSpinner = ({ size = 24, className, ...props }: ISVGProps) => {\n    return (\n        <svg\n            xmlns=\"http://www.w3.org/2000/svg\"\n            width={size}\n            height={size}\n            {...props}\n            viewBox=\"0 0 24 24\"\n            fill=\"none\"\n            stroke=\"currentColor\"\n            strokeWidth=\"2\"\n            strokeLinecap=\"round\"\n            strokeLinejoin=\"round\"\n            className={cn(\"animate-spin\", className)}\n        >\n            <path d=\"M21 12a9 9 0 1 1-6.219-8.56\" />\n        </svg>\n    );\n};\n"
  },
  {
    "path": "src/components/wrappers/common/multiselect/multi-select.tsx",
    "content": "//https://github.com/sersavan/shadcn-multi-select-component\n\nimport * as React from \"react\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { CheckIcon, XCircle, ChevronDown, XIcon, WandSparkles } from \"lucide-react\";\n\nimport { cn } from \"@/lib/utils\";\nimport { Separator } from \"@/components/ui/separator\";\nimport { Button } from \"@/components/ui/button\";\nimport { Badge } from \"@/components/ui/badge\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"@/components/ui/popover\";\nimport { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator } from \"@/components/ui/command\";\n\n/**\n * Variants for the multi-select component to handle different styles.\n * Uses class-variance-authority (cva) to define different styles based on \"variant\" prop.\n */\nconst multiSelectVariants = cva(\"m-1 transition ease-in-out duration-300\", {\n    variants: {\n        variant: {\n            default: \"border-foreground/10 text-foreground bg-card hover:bg-card/80\",\n            secondary: \"border-foreground/10 bg-secondary text-secondary-foreground hover:bg-secondary/80\",\n            destructive: \"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80\",\n            inverted: \"inverted\",\n        },\n    },\n    defaultVariants: {\n        variant: \"default\",\n    },\n});\n\n/**\n * Props for MultiSelect component\n */\ninterface MultiSelectProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof multiSelectVariants> {\n    /**\n     * An array of option objects to be displayed in the multi-select component.\n     * Each option object has a label, value, and an optional icon.\n     */\n    options: {\n        /** The text to display for the option. */\n        label: string;\n        /** The unique value associated with the option. */\n        value: string;\n        /** Optional icon component to display alongside the option. */\n        icon?: React.ComponentType<{ className?: string }>;\n    }[];\n\n    /**\n     * Callback function triggered when the selected values change.\n     * Receives an array of the new selected values.\n     */\n    onValueChange: (value: string[]) => void;\n\n    /** The default selected values when the component mounts. */\n    defaultValue?: string[];\n\n    /**\n     * Placeholder text to be displayed when no values are selected.\n     * Optional, defaults to \"Select options\".\n     */\n    placeholder?: string;\n\n    /**\n     * Animation duration in seconds for the visual effects (e.g., bouncing badges).\n     * Optional, defaults to 0 (no animation).\n     */\n    animation?: number;\n\n    /**\n     * Maximum number of items to display. Extra selected items will be summarized.\n     * Optional, defaults to 3.\n     */\n    maxCount?: number;\n\n    /**\n     * The modality of the popover. When set to true, interaction with outside elements\n     * will be disabled and only popover content will be visible to screen readers.\n     * Optional, defaults to false.\n     */\n    modalPopover?: boolean;\n\n    /**\n     * If true, renders the multi-select component as a child of another component.\n     * Optional, defaults to false.\n     */\n    asChild?: boolean;\n\n    /**\n     * Additional class names to apply custom styles to the multi-select component.\n     * Optional, can be used to add custom styles.\n     */\n    className?: string;\n}\n\nexport const MultiSelect = React.forwardRef<HTMLButtonElement, MultiSelectProps>(\n    (\n        {\n            options,\n            onValueChange,\n            variant,\n            defaultValue = [],\n            placeholder = \"Select options\",\n            animation = 0,\n            maxCount = 3,\n            modalPopover = false,\n            asChild = false,\n            className,\n            ...props\n        },\n        ref\n    ) => {\n        const [selectedValues, setSelectedValues] = React.useState<string[]>(defaultValue);\n        const [isPopoverOpen, setIsPopoverOpen] = React.useState(false);\n        const [isAnimating, setIsAnimating] = React.useState(false);\n\n        const handleInputKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n            if (event.key === \"Enter\") {\n                setIsPopoverOpen(true);\n            } else if (event.key === \"Backspace\" && !event.currentTarget.value) {\n                const newSelectedValues = [...selectedValues];\n                newSelectedValues.pop();\n                setSelectedValues(newSelectedValues);\n                onValueChange(newSelectedValues);\n            }\n        };\n\n        const toggleOption = (option: string) => {\n            const newSelectedValues = selectedValues.includes(option) ? selectedValues.filter((value) => value !== option) : [...selectedValues, option];\n            setSelectedValues(newSelectedValues);\n            onValueChange(newSelectedValues);\n        };\n\n        const handleClear = () => {\n            setSelectedValues([]);\n            onValueChange([]);\n        };\n\n        const handleTogglePopover = () => {\n            setIsPopoverOpen((prev) => !prev);\n        };\n\n        const clearExtraOptions = () => {\n            const newSelectedValues = selectedValues.slice(0, maxCount);\n            setSelectedValues(newSelectedValues);\n            onValueChange(newSelectedValues);\n        };\n\n        const toggleAll = () => {\n            if (selectedValues.length === options.length) {\n                handleClear();\n            } else {\n                const allValues = options.map((option) => option.value);\n                setSelectedValues(allValues);\n                onValueChange(allValues);\n            }\n        };\n\n        return (\n            <Popover open={isPopoverOpen} onOpenChange={setIsPopoverOpen} modal={modalPopover}>\n                <PopoverTrigger asChild>\n                    <Button\n                        ref={ref}\n                        {...props}\n                        onClick={handleTogglePopover}\n                        className={cn(\n                            \"flex w-full p-1 rounded-md border min-h-10 h-auto items-center justify-between bg-inherit hover:bg-inherit [&_svg]:pointer-events-auto\",\n                            className\n                        )}\n                    >\n                        {selectedValues.length > 0 ? (\n                            <div className=\"flex justify-between items-center w-full\">\n                                <div className=\"flex flex-wrap items-center\">\n                                    {selectedValues.slice(0, maxCount).map((value) => {\n                                        const option = options.find((o) => o.value === value);\n                                        const IconComponent = option?.icon;\n                                        return (\n                                            <Badge\n                                                key={value}\n                                                className={cn(isAnimating ? \"animate-bounce\" : \"\", \"max-w-full\", multiSelectVariants({ variant }))}\n                                                style={{ animationDuration: `${animation}s` }}\n                                            >\n                                                {IconComponent && <IconComponent className=\"h-4 w-4 mr-2\" />}\n                                                <span className=\"truncate\">{option?.label}</span>\n                                                <XCircle\n                                                    className=\"ml-2 h-4 w-4 cursor-pointer shrink-0\"\n                                                    onClick={(event) => {\n                                                        event.stopPropagation();\n                                                        toggleOption(value);\n                                                    }}\n                                                />\n                                            </Badge>\n                                        );\n                                    })}\n                                    {selectedValues.length > maxCount && (\n                                        <Badge\n                                            className={cn(\n                                                \"bg-transparent text-foreground border-foreground/1 hover:bg-transparent\",\n                                                \"max-w-full\",\n                                                isAnimating ? \"animate-bounce\" : \"\",\n                                                multiSelectVariants({ variant })\n                                            )}\n                                            style={{ animationDuration: `${animation}s` }}\n                                        >\n                                            {`+ ${selectedValues.length - maxCount} more`}\n                                            <XCircle\n                                                className=\"ml-2 h-4 w-4 cursor-pointer shrink-0\"\n                                                onClick={(event) => {\n                                                    event.stopPropagation();\n                                                    clearExtraOptions();\n                                                }}\n                                            />\n                                        </Badge>\n                                    )}\n                                </div>\n                                <div className=\"flex items-center justify-between\">\n                                    <XIcon\n                                        className=\"h-4 mx-2 cursor-pointer text-muted-foreground\"\n                                        onClick={(event) => {\n                                            event.stopPropagation();\n                                            handleClear();\n                                        }}\n                                    />\n                                    <Separator orientation=\"vertical\" className=\"flex min-h-6 h-full\" />\n                                    <ChevronDown className=\"h-4 mx-2 cursor-pointer text-muted-foreground\" />\n                                </div>\n                            </div>\n                        ) : (\n                            <div className=\"flex items-center justify-between w-full mx-auto\">\n                                <span className=\"text-sm text-muted-foreground mx-3\">{placeholder}</span>\n                                <ChevronDown className=\"h-4 cursor-pointer text-muted-foreground mx-2\" />\n                            </div>\n                        )}\n                    </Button>\n                </PopoverTrigger>\n                <PopoverContent className=\"w-auto p-0\" align=\"start\" onEscapeKeyDown={() => setIsPopoverOpen(false)}>\n                    <Command>\n                        <CommandInput placeholder=\"Search...\" onKeyDown={handleInputKeyDown} />\n                        <CommandList>\n                            <CommandEmpty>No results found.</CommandEmpty>\n                            <CommandGroup>\n                                <CommandItem key=\"all\" onSelect={toggleAll} className=\"cursor-pointer\">\n                                    <div\n                                        className={cn(\n                                            \"mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary\",\n                                            selectedValues.length === options.length ? \"bg-primary text-primary-foreground\" : \"opacity-50 [&_svg]:invisible\"\n                                        )}\n                                    >\n                                        <CheckIcon className=\"h-4 w-4\" />\n                                    </div>\n                                    <span>(Select All)</span>\n                                </CommandItem>\n                                {options.map((option) => {\n                                    const isSelected = selectedValues.includes(option.value);\n                                    return (\n                                        <CommandItem key={option.value} onSelect={() => toggleOption(option.value)} className=\"cursor-pointer\">\n                                            <div\n                                                className={cn(\n                                                    \"mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary\",\n                                                    isSelected ? \"bg-primary text-primary-foreground\" : \"opacity-50 [&_svg]:invisible\"\n                                                )}\n                                            >\n                                                <CheckIcon className=\"h-4 w-4\" />\n                                            </div>\n                                            {option.icon && <option.icon className=\"mr-2 h-4 w-4 text-muted-foreground\" />}\n                                            <span>{option.label}</span>\n                                        </CommandItem>\n                                    );\n                                })}\n                            </CommandGroup>\n                            <CommandSeparator />\n                            <CommandGroup>\n                                <div className=\"flex items-center justify-between\">\n                                    {selectedValues.length > 0 && (\n                                        <>\n                                            <CommandItem onSelect={handleClear} className=\"flex-1 justify-center cursor-pointer\">\n                                                Clear\n                                            </CommandItem>\n                                            <Separator orientation=\"vertical\" className=\"flex min-h-6 h-full\" />\n                                        </>\n                                    )}\n                                    <CommandItem onSelect={() => setIsPopoverOpen(false)} className=\"flex-1 justify-center cursor-pointer max-w-full\">\n                                        Close\n                                    </CommandItem>\n                                </div>\n                            </CommandGroup>\n                        </CommandList>\n                    </Command>\n                </PopoverContent>\n                {animation > 0 && selectedValues.length > 0 && (\n                    <WandSparkles\n                        className={cn(\"cursor-pointer my-2 text-foreground bg-background w-3 h-3\", isAnimating ? \"\" : \"text-muted-foreground\")}\n                        onClick={() => setIsAnimating(!isAnimating)}\n                    />\n                )}\n            </Popover>\n        );\n    }\n);\n\nMultiSelect.displayName = \"MultiSelect\";\n"
  },
  {
    "path": "src/components/wrappers/common/pagination/pagination-indexes.tsx",
    "content": "import { PaginationEllipsis, PaginationItem, PaginationLink } from \"@/components/ui/pagination\";\n\nexport type paginationItemsProps = {\n    totalPages: number;\n    currentPage: number;\n    handlePageChange: (page: number) => void;\n    maxVisiblePages?: number;\n};\n\nexport const PaginationIndexes = (props: paginationItemsProps) => {\n    const { totalPages, currentPage, handlePageChange, maxVisiblePages = 3 } = props;\n\n    const items = [];\n\n    if (totalPages <= maxVisiblePages) {\n        for (let i = 1; i <= totalPages; i++) {\n            items.push(\n                <PaginationItem key={i}>\n                    <PaginationLink onClick={() => handlePageChange(i)} isActive={currentPage === i}>\n                        {i}\n                    </PaginationLink>\n                </PaginationItem>\n            );\n        }\n    } else {\n        if (currentPage <= 2) {\n            for (let i = 1; i <= maxVisiblePages; i++) {\n                items.push(\n                    <PaginationItem key={i}>\n                        <PaginationLink onClick={() => handlePageChange(i)} isActive={currentPage === i}>\n                            {i}\n                        </PaginationLink>\n                    </PaginationItem>\n                );\n            }\n            items.push(\n                <PaginationItem key=\"ellipsis1\">\n                    <PaginationEllipsis />\n                </PaginationItem>\n            );\n        } else if (currentPage >= totalPages - 1) {\n            items.push(\n                <PaginationItem key=\"ellipsis2\">\n                    <PaginationEllipsis />\n                </PaginationItem>\n            );\n            for (let i = totalPages - 2; i <= totalPages; i++) {\n                items.push(\n                    <PaginationItem key={i}>\n                        <PaginationLink onClick={() => handlePageChange(i)} isActive={currentPage === i}>\n                            {i}\n                        </PaginationLink>\n                    </PaginationItem>\n                );\n            }\n        } else {\n            items.push(\n                <PaginationItem key=\"ellipsis3\">\n                    <PaginationEllipsis />\n                </PaginationItem>\n            );\n            for (let i = currentPage - 1; i <= currentPage + 1; i++) {\n                items.push(\n                    <PaginationItem key={i}>\n                        <PaginationLink onClick={() => handlePageChange(i)} isActive={currentPage === i}>\n                            {i}\n                        </PaginationLink>\n                    </PaginationItem>\n                );\n            }\n            items.push(\n                <PaginationItem key=\"ellipsis4\">\n                    <PaginationEllipsis />\n                </PaginationItem>\n            );\n        }\n    }\n\n    return items;\n};\n"
  },
  {
    "path": "src/components/wrappers/common/pagination/pagination-navigation.tsx",
    "content": "import { Pagination, PaginationContent, PaginationItem, PaginationNext, PaginationPrevious } from \"@/components/ui/pagination\";\nimport { PaginationIndexes } from \"@/components/wrappers/common/pagination/pagination-indexes\";\nimport { cn } from \"@/lib/utils\";\n\nexport type paginationNavigationProps = {\n    className?: string;\n    totalPages: number;\n    currentPage: number;\n    goToPage: (page: number) => void;\n    goToPrevPage: () => void;\n    goToNextPage: () => void;\n    maxVisiblePages?: number;\n};\n\nexport const PaginationNavigation = (props: paginationNavigationProps) => {\n    const { className, totalPages, currentPage, goToPage, goToPrevPage, goToNextPage, maxVisiblePages = 3 } = props;\n\n    if (totalPages <= 1) return null;\n\n    return (\n        <Pagination className={cn(\"\", className)}>\n            <PaginationContent>\n                <PaginationItem>\n                    <PaginationPrevious onClick={goToPrevPage} />\n                </PaginationItem>\n                <PaginationIndexes totalPages={totalPages} currentPage={currentPage} handlePageChange={goToPage} maxVisiblePages={maxVisiblePages} />\n                <PaginationItem>\n                    <PaginationNext onClick={goToNextPage} />\n                </PaginationItem>\n            </PaginationContent>\n        </Pagination>\n    );\n};\n"
  },
  {
    "path": "src/components/wrappers/common/pagination/pagination-size.tsx",
    "content": "import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from \"@/components/ui/select\";\nimport { cn } from \"@/lib/utils\";\n\nexport type PaginationSizeProps = {\n    className?: string;\n    pageSize: number;\n    onPageSizeChange: (size: number) => void;\n    pageSizeOptions?: number[];\n};\n\nexport const PaginationSize = (props: PaginationSizeProps) => {\n    const { className, onPageSizeChange, pageSizeOptions = [10, 20, 30, 40, 50] } = props;\n    const effectivePageSize = pageSizeOptions.includes(props.pageSize) ? props.pageSize : pageSizeOptions[0];\n\n    return (\n        <div className={cn(\"flex items-center justify-end sm:justify-center space-x-2\", className)}>\n            <p className=\"whitespace-nowrap text-sm font-medium hidden md:block\">Cards per page</p>\n            <Select\n                value={`${effectivePageSize}`}\n                onValueChange={(value) => onPageSizeChange(Number(value))}\n            >\n                <SelectTrigger className=\"h-8 w-[4.5rem]\" aria-label=\"Cards per page\">\n                    <SelectValue placeholder={effectivePageSize} />\n                </SelectTrigger>\n                <SelectContent side=\"top\">\n                    {pageSizeOptions.map((size) => (\n                        <SelectItem key={size} value={`${size}`}>\n                            {size}\n                        </SelectItem>\n                    ))}\n                </SelectContent>\n            </Select>\n        </div>\n    );\n};\n"
  },
  {
    "path": "src/components/wrappers/common/provider-switch.tsx",
    "content": "import {Icon} from \"@iconify/react\";\nimport {CircleHelp, KeyRound} from \"lucide-react\";\nimport {cn} from \"@/lib/utils\";\n\n\nexport const providerSwitch = (provider: string, small?: boolean) => {\n    switch (provider) {\n        case \"google\":\n            return (\n                <div className={cn(small ? \"p-0\" : \"p-4\")}>\n                    {small ?\n                        <Icon icon={\"flat-color-icons:google\"} height=\"24\"/>\n                        :\n                        <Icon icon={\"logos:google\"} height=\"24\"/>\n                    }\n                </div>\n            );\n        case \"credential\":\n            return (\n                <div className={cn(\"flex flex-row gap-x-2 items-center\", small ? \"p-0\" : \"p-4\")}>\n                    <KeyRound height=\"24\"/>\n                    {!small && (<span>Email and Password</span>)}\n                </div>\n            );\n        default:\n            return (\n                <div className={cn(\"flex flex-row gap-x-2 items-center\", small ? \"p-0\" : \"p-4\")}>\n                    <CircleHelp height=\"24\"/>\n                    {!small && (<span>No credentials</span>)}\n                </div>\n            );\n    }\n}\n\n\n\n"
  },
  {
    "path": "src/components/wrappers/common/status-badge.tsx",
    "content": "import {Badge} from \"@/components/ui/badge\";\nimport {cn} from \"@/lib/utils\";\n\nexport type statusBadgeProps = {\n    status: \"pending\" | \"ongoing\" | \"success\" | \"failed\"\n}\n\n\nexport const StatusBadge = ({status}: statusBadgeProps) => {\n\n    let style = \"\";\n\n    switch (status) {\n        case 'pending':\n            style = \"text-yellow-500 border-yellow-500\"\n            break\n        case 'ongoing':\n            style = \"text-orange-500 border-orange-500\"\n            break\n        case 'failed':\n            style = \"text-red-500 border-red-500\"\n            break\n        case 'success':\n            style = \"text-green-500 border-green-500\"\n            break\n        default:\n            style = \"text-yellow-500 border-yellow-500\"\n    }\n\n    return (\n        <Badge variant=\"outline\" className={cn(\"w-20 border-2 justify-center\")}>{status}</Badge>\n    )\n}"
  },
  {
    "path": "src/components/wrappers/common/table/data-table.tsx",
    "content": "\"use client\"\nimport {\n    ColumnDef,\n    flexRender,\n    getCoreRowModel,\n    useReactTable,\n    getPaginationRowModel,\n    getSortedRowModel,\n    SortingState,\n    ColumnFiltersState,\n    getFilteredRowModel,\n} from \"@tanstack/react-table\";\n\nimport {Table, TableBody, TableCell, TableHead, TableHeader, TableRow} from \"@/components/ui/table\";\nimport {Input} from \"@/components/ui/input\";\n\nimport {ReactNode, useMemo, useState} from \"react\";\nimport {TablePagination} from \"./table-pagination\";\nimport {Checkbox} from \"@/components/ui/checkbox\";\nimport {Button} from \"@/components/ui/button\";\nimport {useRouter} from \"next/navigation\";\n\ninterface DataTableProps<TData, TValue> {\n    columns: ColumnDef<TData, TValue>[];\n    data: TData[];\n    enableFilter?: boolean;\n    enableSelect?: boolean;\n    enablePagination?: boolean;\n    paginationOptions?: {\n        pageSize: number[];\n        pageVisible: number;\n        className?: string;\n    };\n    filterOptions?: {\n        title?: string;\n        key: string;\n    };\n    emptyButton?: {\n        text: string;\n        variant: \"link\" | \"default\" | \"destructive\" | \"outline\" | \"secondary\" | \"ghost\" | null | undefined;\n        path: string;\n    };\n    highlightRow?: (row: TData) => boolean;\n    selectedActions?: (rows: TData[]) => ReactNode;\n\n}\n\nexport function DataTable<TData, TValue>({\n                                             columns,\n                                             data,\n                                             enableFilter = false,\n                                             enablePagination = true,\n                                             enableSelect = true,\n                                             paginationOptions = {pageSize: [10, 20, 30, 40, 50, 100], pageVisible: 3},\n                                             filterOptions = {key: \"id\", title: \"Filter by ID\"},\n                                             emptyButton,\n                                             highlightRow,\n                                             selectedActions,\n\n\n                                         }: DataTableProps<TData, TValue>) {\n    const [sorting, setSorting] = useState<SortingState>([]);\n    const [columnFilters, setColumnFilters] = useState<ColumnFiltersState>([]);\n    const [rowSelection, setRowSelection] = useState({});\n\n    const finalColumns = useMemo(() => {\n        const selectColumnExists = columns.some((column) => column.id === \"select\");\n        if (enableSelect && data.length > 0 && !selectColumnExists) {\n            return [\n                {\n                    id: \"select\",\n                    header: ({table}: {table: any}) => (\n                        <Checkbox\n                            checked={table.getIsAllPageRowsSelected() || (table.getIsSomePageRowsSelected() && \"indeterminate\")}\n                            onCheckedChange={(value) => table.toggleAllPageRowsSelected(!!value)}\n                            aria-label=\"Select all\"\n                        />\n                    ),\n                    cell: ({row}: {row: any}) => (\n                        <Checkbox\n                            checked={row.getIsSelected()}\n                            onCheckedChange={(value) => row.toggleSelected(!!value)}\n                            aria-label=\"Select row\"\n                        />\n                    ),\n                    enableSorting: false,\n                    enableHiding: false,\n                },\n                ...columns,\n            ];\n        }\n        return columns;\n    }, [columns, enableSelect, data.length]);\n\n    const table = useReactTable({\n        data,\n        columns: finalColumns,\n        getCoreRowModel: getCoreRowModel(),\n        getPaginationRowModel: getPaginationRowModel(),\n        onSortingChange: setSorting,\n        getSortedRowModel: getSortedRowModel(),\n        onColumnFiltersChange: setColumnFilters,\n        getFilteredRowModel: getFilteredRowModel(),\n        onRowSelectionChange: setRowSelection,\n        getRowId: (row: any) => row.id || row.uuid,\n        autoResetPageIndex: false,\n        autoResetExpanded: false,\n        enableRowSelection: true,\n        state: {\n            sorting,\n            columnFilters,\n            rowSelection,\n        },\n    });\n    const router = useRouter();\n    return (\n        <div\n            className=\"flex flex-col h-full\"\n        >\n            {enableFilter || selectedActions  && (\n                <div className=\"flex items-center py-4\">\n                    {enableFilter && (\n                        <Input\n                            placeholder={`${filterOptions.title ?? `Filter by ${filterOptions.key}`}`}\n                            value={(table.getColumn(filterOptions.key)?.getFilterValue() as string) ?? \"\"}\n                            onChange={(event) => table.getColumn(filterOptions.key)?.setFilterValue(event.target.value)}\n                            className=\"max-w-sm\"\n                        />\n                    )}\n                    {/*{selectedActions && table.getSelectedRowModel().rows.length > 0 && (*/}\n                    {selectedActions && (\n                        selectedActions(table.getSelectedRowModel().rows.map(row => row.original))\n                    )}\n                </div>\n            )}\n            <div className=\"flex flex-col justify-between h-full\">\n                <div className=\"rounded-md border w-full\">\n                    <Table className=\"w-full\">\n                        <TableHeader>\n                            {table.getHeaderGroups().map((headerGroup) => (\n                                <TableRow key={headerGroup.id}>\n                                    {headerGroup.headers.map((header) => {\n                                        return (\n                                            <TableHead key={header.id}>\n                                                {header.isPlaceholder ? null : flexRender(header.column.columnDef.header, header.getContext())}\n\n                                            </TableHead>\n                                        );\n                                    })}\n                                </TableRow>\n                            ))}\n                        </TableHeader>\n                        <TableBody>\n                            {table.getRowModel().rows?.length ? (\n                                table.getRowModel().rows.map((row) => (\n                                    <TableRow key={row.id}\n                                              className={highlightRow && highlightRow(row.original) ? \"bg-gray-100 pointer-events-none\" : \"\"}\n                                              data-state={row.getIsSelected() && \"selected\"}\n                                    >\n                                        {row.getVisibleCells().map((cell) => (\n                                            <TableCell\n                                                key={cell.id}>{flexRender(cell.column.columnDef.cell, cell.getContext())}</TableCell>\n                                        ))}\n                                    </TableRow>\n                                ))\n                            ) : (\n                                <TableRow>\n                                    <TableCell colSpan={columns.length} className=\"p-0\">\n                                        {emptyButton ? (\n                                            <Button\n                                                variant={emptyButton.variant}\n                                                className=\"btn btn-primary cursor-pointer w-full rounded-tr-none rounded-tl-none py-12 text-lg font-bold\"\n                                                onClick={() => {\n                                                    router.push(emptyButton.path)\n                                                }}\n                                            >\n                                                <span>{emptyButton.text}</span>\n                                            </Button>\n                                        ) : (\n                                            <div className=\"flex items-center justify-center py-12 text-lg font-bold\">\n                                                <span className=\"text-lg font-bold\">No data available</span>\n                                            </div>\n                                        )}\n                                    </TableCell>\n                                </TableRow>\n                            )}\n                        </TableBody>\n                    </Table>\n                </div>\n                <div className=\"flex items-center justify-end space-x-2 py-4 mt-6\">\n                    {enableSelect && table.getFilteredRowModel().rows.length >= 1 && (\n                        <div className=\"flex-1 text-sm text-muted-foreground\">\n                            {table.getFilteredSelectedRowModel().rows.length} of {table.getFilteredRowModel().rows.length} row(s)\n                            selected.\n                        </div>\n                    )}\n                    {enablePagination && table.getFilteredRowModel().rows.length >= 1 && (\n                        <TablePagination\n                            table={table}\n                            maxVisiblePages={paginationOptions?.pageVisible}\n                            pageSizeOptions={(() => {\n                                const rowCount = table.getFilteredRowModel().rows.length;\n                                const allSizes = paginationOptions.pageSize.sort((a, b) => a - b);\n                                const validSizes = allSizes.filter((size) => size <= rowCount);\n                                const nextSize = allSizes.find((size) => size > rowCount);\n                                if (nextSize) validSizes.push(nextSize);\n                                return validSizes;\n                            })()}\n                            className={paginationOptions.className}\n                        />\n                    )}\n                </div>\n            </div>\n        </div>\n    );\n}\n\n"
  },
  {
    "path": "src/components/wrappers/common/table/filters.tsx",
    "content": "import {DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger} from \"@/components/ui/dropdown-menu\";\nimport {Toggle} from \"@/components/ui/toggle\";\nimport {CheckIcon, Filter, RefreshCcw} from \"lucide-react\";\nimport {Badge} from \"@/components/ui/badge\";\n\nexport type FilterItem = {\n    label: string,\n    value: string\n}\n\ntype FiltersDropdownProps = {\n    items: FilterItem[];\n    selectedItems: FilterItem[];\n    onSelect: (item: FilterItem) => void;\n    clearFilters: () => void;\n}\n\nexport const FiltersDropdown = ({items, selectedItems, onSelect, clearFilters}: FiltersDropdownProps) => {\n\n    return (\n        <DropdownMenu>\n            <DropdownMenuTrigger asChild>\n\n                <div className=\"relative\">\n                    <Toggle variant=\"outline\" size=\"sm\" className=\"cursor-pointer w-fit\">\n                        <Filter className=\"h-4 w-4\"/>\n                    </Toggle>\n                    {selectedItems.length > 0 && (\n                        <Badge className=\"absolute -top-2 -right-2 h-4 w-4 rounded-full p-0 flex items-center justify-center text-[10px]\">\n                            {selectedItems.length}\n                        </Badge>\n                    )}\n                </div>\n            </DropdownMenuTrigger>\n            <DropdownMenuContent align=\"end\" className=\"w-[150px]\">\n                {items.map((item, index) => {\n                    const isSelected = selectedItems.some(f => f.value === item.value);\n                    return (\n                        <DropdownMenuItem\n                            key={index}\n                            className=\"flex items-center justify-between cursor-pointer\"\n                            onClick={(e) => {\n                                e.preventDefault();\n                                onSelect(item);\n                            }}\n                        >\n                            <span>{item.label}</span>\n                            {isSelected && <CheckIcon className=\"h-4 w-4 text-blue-500\"/>}\n                        </DropdownMenuItem>\n                    )\n                })}\n                <DropdownMenuItem\n                    disabled={selectedItems.length === 0}\n                    className=\"flex gap-2 cursor-pointer\"\n                    onClick={(e) => {\n                        e.preventDefault();\n                        clearFilters();\n                    }}\n                >\n                    <RefreshCcw className='h-4 w-4'/>\n                    Clear filters\n                </DropdownMenuItem>\n            </DropdownMenuContent>\n        </DropdownMenu>\n    )\n}"
  },
  {
    "path": "src/components/wrappers/common/table/table-pagination-navigation.tsx",
    "content": "import { PaginationNavigation } from \"@/components/wrappers/common/pagination/pagination-navigation\";\n\nexport type paginationNavigationProps = {\n    className?: string;\n    table: any;\n    maxVisiblePages?: number;\n};\n\nexport const TablePaginationNavigation = (props: paginationNavigationProps) => {\n    const { className, table, maxVisiblePages = 3 } = props;\n\n    const totalPages = table.getPageCount();\n    const currentPage = table.getState().pagination.pageIndex + 1;\n\n    const goToPage = (page: number) => {\n        table.setPageIndex(page - 1);\n    };\n\n    const goToPrevPage = () => {\n        if (table.getCanPreviousPage()) table.previousPage();\n    };\n\n    const goToNextPage = () => {\n        if (table.getCanNextPage()) table.nextPage();\n    };\n\n    return (\n        <PaginationNavigation\n            className={className}\n            totalPages={totalPages}\n            currentPage={currentPage}\n            goToPage={goToPage}\n            goToPrevPage={goToPrevPage}\n            goToNextPage={goToNextPage}\n            maxVisiblePages={maxVisiblePages}\n        />\n    );\n};\n"
  },
  {
    "path": "src/components/wrappers/common/table/table-pagination-size.tsx",
    "content": "import { useEffect } from \"react\";\nimport { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from \"@/components/ui/select\";\nimport { cn } from \"@/lib/utils\";\n\nexport type tablePaginationSizeProps = {\n    className?: string;\n    table: any;\n    pageSizeOptions?: number[];\n};\n\nexport const TablePaginationSize = (props: tablePaginationSizeProps) => {\n    const { className, table, pageSizeOptions = [10, 20, 30, 40, 50] } = props;\n\n    useEffect(() => {\n        table.setPageSize(Number(pageSizeOptions[0]));\n    }, []);\n\n    return (\n        <div className={cn(\"flex items-center justify-end sm:justify-center space-x-2\", className)}>\n            <p className=\"whitespace-nowrap text-sm font-medium hidden md:block\">Rows per page</p>\n            <Select\n                value={`${table.getState().pagination.pageSize}`}\n                onValueChange={(value) => {\n                    table.setPageSize(Number(value));\n                }}\n            >\n                <SelectTrigger className=\"h-8 w-[4.5rem]\">\n                    <SelectValue placeholder={table.getState().pagination.pageSize} />\n                </SelectTrigger>\n                <SelectContent side=\"top\">\n                    {pageSizeOptions.map((pageSize) => (\n                        <SelectItem key={pageSize} value={`${pageSize}`}>\n                            {pageSize}\n                        </SelectItem>\n                    ))}\n                </SelectContent>\n            </Select>\n        </div>\n    );\n};\n"
  },
  {
    "path": "src/components/wrappers/common/table/table-pagination.tsx",
    "content": "\"use client\";\n\nimport {TablePaginationNavigation} from \"@/components/wrappers/common/table/table-pagination-navigation\";\nimport {TablePaginationSize} from \"@/components/wrappers/common/table/table-pagination-size\";\nimport {cn} from \"@/lib/utils\";\n\ninterface tablePaginationProps {\n    className?: string;\n    table: any;\n    maxVisiblePages?: number;\n    pageSizeOptions?: number[];\n}\n\nexport function TablePagination(props: tablePaginationProps) {\n    const {className, table, maxVisiblePages = 3, pageSizeOptions = [10, 20, 30, 40, 50]} = props;\n\n    const totalPages = table.getPageCount();\n\n    if (totalPages <= 1) return null;\n\n    return (\n        <div\n            className={cn(\"flex gap-x-4\", className)}\n        >\n            <TablePaginationSize table={table} pageSizeOptions={pageSizeOptions}/>\n            <TablePaginationNavigation table={table} maxVisiblePages={maxVisiblePages} className=\"justify-end mt-0\"/>\n        </div>\n    );\n}\n"
  },
  {
    "path": "src/components/wrappers/common/table/table-sort-button.tsx",
    "content": "import { Button } from \"@/components/ui/button\";\nimport { Column } from \"@tanstack/react-table\";\nimport { ArrowDown, ArrowUp } from \"lucide-react\";\n\ninterface tableSortButtonProps<TData, TValue> {\n    title?: string;\n    defaultOrder: \"asc\" | \"desc\";\n    column: Column<TData, TValue>;\n}\n\nexport default function TableSortButton<TData, TValue>(props: tableSortButtonProps<TData, TValue>) {\n    return (\n        <Button variant=\"ghost\" onClick={() => props.column.toggleSorting(props.column.getIsSorted() === \"asc\")}>\n            {props.title ?? \"Please define a title\"}\n            {props.column.getIsSorted() === props.defaultOrder ? <ArrowUp className=\"ml-2 h-4 w-4\" /> : <ArrowDown className=\"ml-2 h-4 w-4\" />}\n        </Button>\n    );\n}\n"
  },
  {
    "path": "src/components/wrappers/common/tooltip-custom.tsx",
    "content": "import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from \"@/components/ui/tooltip\";\nimport { PropsWithChildren } from \"react\";\n\nexport type TooltipCustomProps = PropsWithChildren<{\n    text: string;\n    disabled?: any;\n}>;\n\nexport function TooltipCustom(props: TooltipCustomProps) {\n    return (\n        <>\n            {props.disabled ? (\n                <TooltipProvider>\n                    <Tooltip>\n                        <TooltipTrigger className=\"w-full\">{props.children}</TooltipTrigger>\n                        <TooltipContent>\n                            <p>{props.text}</p>\n                        </TooltipContent>\n                    </Tooltip>\n                </TooltipProvider>\n            ) : (\n                props.children\n            )}\n        </>\n    );\n}\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/channels/channel/channel-add-edit-modal.tsx",
    "content": "\"use client\"\n\nimport {Pencil, Plus} from \"lucide-react\";\n\nimport {\n    Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, DialogTrigger\n} from \"@/components/ui/dialog\";\nimport {Button} from \"@/components/ui/button\";\nimport {OrganizationWithMembers} from \"@/db/schema/03_organization\";\nimport {NotificationChannelWith} from \"@/db/schema/09_notification-channel\";\nimport {useIsMobile} from \"@/hooks/use-mobile\";\nimport {useEffect, useState} from \"react\";\nimport {Tabs, TabsContent, TabsList, TabsTrigger} from \"@/components/ui/tabs\";\nimport {StorageChannelWith} from \"@/db/schema/12_storage-channel\";\nimport {ChannelForm} from \"@/components/wrappers/dashboard/admin/channels/channel/channel-form/channel-form\";\nimport {ChannelKind, getChannelTextBasedOnKind} from \"@/components/wrappers/dashboard/admin/channels/helpers/common\";\nimport {\n    ChannelOrganisationForm\n} from \"@/components/wrappers/dashboard/admin/channels/organization/channels-organization-form\";\n\n\ntype ChannelAddModalProps = {\n    channel?: NotificationChannelWith | StorageChannelWith\n    organization?: OrganizationWithMembers;\n    open?: boolean;\n    onOpenChangeAction?: (open: boolean) => void;\n    adminView?: boolean;\n    organizations?: OrganizationWithMembers[]\n    trigger?: boolean;\n    kind: ChannelKind;\n}\n\n\nexport const ChannelAddEditModal = ({\n                                        organization,\n                                        channel,\n                                        open = false,\n                                        onOpenChangeAction,\n                                        adminView,\n                                        organizations,\n                                        trigger = true,\n                                        kind\n                                    }: ChannelAddModalProps) => {\n    const isMobile = useIsMobile();\n    const [openInternal, setOpen] = useState(open);\n    const isLocalSystem = channel?.provider == \"local\";\n\n    const isCreate = !Boolean(channel);\n\n    useEffect(() => {\n        setOpen(open);\n    }, [open])\n\n\n    const channelText = getChannelTextBasedOnKind(kind)\n\n\n    return (\n        <Dialog open={openInternal} onOpenChange={(state) => {\n            onOpenChangeAction?.(state);\n            setOpen(state);\n        }}>\n            {trigger && (\n                <DialogTrigger asChild>\n                    {isCreate ?\n                        <Button>\n                            <Plus/>{!isMobile && `Add ${channelText} channel`}\n                        </Button>\n                        :\n                        <Button\n                            variant=\"ghost\"\n                            size=\"icon\"\n                        >\n                            <Pencil className=\"h-4 w-4\"/>\n                        </Button>\n                    }\n                </DialogTrigger>\n            )}\n            <DialogContent onOpenAutoFocus={(e) => e.preventDefault()}>\n                <DialogHeader>\n                    <DialogTitle> {isCreate ? \"Add\" : \"Edit\"} {channelText} Channel</DialogTitle>\n                    <DialogDescription>\n                        Configure your {channelText.toLowerCase()} channel preferences.\n                    </DialogDescription>\n                </DialogHeader>\n                <div>\n                    <>\n                        {!isLocalSystem ? (\n                                <>\n                                    {adminView ?\n                                        <Tabs className=\"flex flex-col flex-1\" defaultValue=\"configuration\">\n                                            <TabsList className=\"grid w-full grid-cols-2\">\n                                                <TabsTrigger value=\"configuration\">Configuration</TabsTrigger>\n                                                <TabsTrigger value=\"organizations\">Organizations</TabsTrigger>\n                                            </TabsList>\n                                            <TabsContent className=\"h-full justify-between\" value=\"configuration\">\n                                                <ChannelForm\n                                                    kind={kind}\n                                                    adminView={adminView}\n                                                    defaultValues={channel}\n                                                    organization={organization}\n                                                    onSuccessAction={() => {\n                                                        onOpenChangeAction?.(false)\n                                                        setOpen(false);\n                                                    }}\n                                                />\n                                            </TabsContent>\n                                            <TabsContent className=\"h-full justify-between\" value=\"organizations\">\n                                                <ChannelOrganisationForm\n                                                    defaultValues={channel}\n                                                    kind={kind}\n                                                    organizations={organizations}\n                                                />\n                                            </TabsContent>\n                                        </Tabs>\n                                        :\n                                        <>\n                                            <ChannelForm\n                                                kind={kind}\n                                                adminView={adminView}\n                                                defaultValues={channel}\n                                                organization={organization}\n                                                onSuccessAction={() => {\n                                                    onOpenChangeAction?.(false)\n                                                    setOpen(false);\n                                                }}\n                                            />\n                                        </>\n                                    }\n                                </>\n                            )\n\n                            :\n\n                            <>\n                                <ChannelOrganisationForm\n                                    defaultValues={channel}\n                                    kind={kind}\n                                    organizations={organizations}\n                                />\n                            </>\n                        }\n\n\n                    </>\n                </div>\n            </DialogContent>\n        </Dialog>\n    )\n}\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/channels/channel/channel-card/button-delete-channel.tsx",
    "content": "\"use client\";\nimport {ButtonWithConfirm} from \"@/components/wrappers/common/button/button-with-confirm\";\nimport {useMutation} from \"@tanstack/react-query\";\nimport {useRouter} from \"next/navigation\";\nimport {Trash2} from \"lucide-react\";\nimport {\n    removeNotificationChannelAction,\n} from \"@/components/wrappers/dashboard/admin/channels/channel/channel-form/providers/notifications/action\";\nimport {toast} from \"sonner\";\nimport {ChannelKind, getChannelTextBasedOnKind} from \"@/components/wrappers/dashboard/admin/channels/helpers/common\";\nimport {\n    removeStorageChannelAction\n} from \"@/components/wrappers/dashboard/admin/channels/channel/channel-form/providers/storages/action\";\n\nexport type DeleteChannelButtonProps = {\n    channelId: string;\n    kind: ChannelKind;\n    organizationId?: string;\n};\n\nexport const DeleteChannelButton = ({channelId, organizationId, kind}: DeleteChannelButtonProps) => {\n    const router = useRouter();\n    const channelText = getChannelTextBasedOnKind(kind)\n\n\n    const mutation = useMutation({\n        mutationFn: async () => {\n\n            const result = kind === \"notification\" ? await removeNotificationChannelAction({\n                organizationId,\n                notificationChannelId: channelId\n            }) : await removeStorageChannelAction({organizationId, id: channelId})\n            const inner = result?.data;\n\n            if (inner?.success) {\n                toast.success(inner.actionSuccess?.message);\n                router.refresh();\n            } else {\n                toast.error(inner?.actionError?.message);\n            }\n        },\n    });\n\n    return (\n        <ButtonWithConfirm\n            title={`Delete ${channelText.toLowerCase()} channel`}\n            description={`Are you sure you want to remove this ${channelText.toLowerCase()} channel ? This action cannot be undone and will delete all alert policies related to this channel !`}\n            button={{\n                main: {\n                    size: \"icon\",\n                    variant: \"ghost\",\n                    icon: <Trash2 color=\"red\"/>,\n                },\n                confirm: {\n                    className: \"w-full\",\n                    text: \"Delete\",\n                    icon: <Trash2/>,\n                    variant: \"destructive\",\n                    onClick: () => {\n                        mutation.mutate();\n                    },\n                },\n                cancel: {\n                    className: \"w-full\",\n                    text: \"Cancel\",\n                    icon: <Trash2/>,\n                    variant: \"outline\",\n                },\n            }}\n            isPending={mutation.isPending}\n        />\n    );\n};\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/channels/channel/channel-card/button-edit-channel.tsx",
    "content": "\"use client\";\nimport {useMutation} from \"@tanstack/react-query\";\nimport {useRouter} from \"next/navigation\";\nimport {NotificationChannelWith} from \"@/db/schema/09_notification-channel\";\nimport {Switch} from \"@/components/ui/switch\";\nimport {toast} from \"sonner\";\nimport {useState} from \"react\";\nimport {OrganizationWithMembers} from \"@/db/schema/03_organization\";\nimport {StorageChannelWith} from \"@/db/schema/12_storage-channel\";\nimport {ChannelKind} from \"@/components/wrappers/dashboard/admin/channels/helpers/common\";\nimport {\n    updateNotificationChannelAction\n} from \"@/components/wrappers/dashboard/admin/channels/channel/channel-form/providers/notifications/action\";\nimport {ChannelAddEditModal} from \"@/components/wrappers/dashboard/admin/channels/channel/channel-add-edit-modal\";\nimport {\n    updateStorageChannelAction\n} from \"@/components/wrappers/dashboard/admin/channels/channel/channel-form/providers/storages/action\";\n\nexport type EditChannelButtonProps = {\n    channel: NotificationChannelWith | StorageChannelWith;\n    organization?: OrganizationWithMembers;\n    organizations?: OrganizationWithMembers[];\n    adminView?: boolean;\n    kind: ChannelKind;\n};\n\nexport const EditChannelButton = ({\n                                      organizations,\n                                      adminView = false,\n                                      channel,\n                                      organization,\n                                      kind\n                                  }: EditChannelButtonProps) => {\n    const router = useRouter();\n    const [isAddModalOpen, setIsAddModalOpen] = useState(false);\n    const isLocalSystem = channel.provider == \"local\";\n\n\n    const mutation = useMutation({\n        mutationFn: async (value: boolean) => {\n\n\n            const payload = {\n                data: {\n                    name: channel.name,\n                    provider: channel.provider,\n                    config: channel.config as Record<string, any>,\n                    enabled: value\n                },\n                id: channel.id\n            };\n\n            let result: any;\n            if (kind == \"notification\") {\n                // @ts-ignore\n                result = await updateNotificationChannelAction(payload)\n            } else if (kind == \"storage\") {\n                // @ts-ignore\n                result = await updateStorageChannelAction(payload)\n            } else {\n                toast.error(\"An error occurred while updating storage channel\")\n                return;\n            }\n            const inner = result?.data;\n\n            if (inner?.success) {\n                toast.success(inner.actionSuccess?.message);\n                router.refresh();\n            } else {\n                toast.error(inner?.actionError?.message);\n            }\n        },\n    });\n\n    return (\n        <>\n\n            {!isLocalSystem && (\n                <Switch checked={channel.enabled} onCheckedChange={async () => {\n                    await mutation.mutateAsync(!channel.enabled)\n                }}/>\n            )}\n            <ChannelAddEditModal\n                kind={kind}\n                organizations={organizations}\n                adminView={adminView}\n                organization={organization}\n                channel={channel}\n                open={isAddModalOpen}\n                onOpenChangeAction={setIsAddModalOpen}\n            />\n        </>\n    );\n};\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/channels/channel/channel-card/channel-card.tsx",
    "content": "\"use client\";\n\nimport {Card} from \"@/components/ui/card\";\nimport {NotificationChannelWith} from \"@/db/schema/09_notification-channel\";\nimport {Badge} from \"@/components/ui/badge\";\nimport {OrganizationWithMembers} from \"@/db/schema/03_organization\";\nimport {truncateWords} from \"@/utils/text\";\nimport {useIsMobile} from \"@/hooks/use-mobile\";\nimport {StorageChannelWith} from \"@/db/schema/12_storage-channel\";\nimport {\n    EditChannelButton\n} from \"@/components/wrappers/dashboard/admin/channels/channel/channel-card/button-edit-channel\";\nimport {ChannelKind, getChannelIcon} from \"@/components/wrappers/dashboard/admin/channels/helpers/common\";\nimport {\n    DeleteChannelButton\n} from \"@/components/wrappers/dashboard/admin/channels/channel/channel-card/button-delete-channel\";\n\nexport type ChannelCardProps = {\n    data: NotificationChannelWith | StorageChannelWith;\n    organization?: OrganizationWithMembers;\n    organizations?: OrganizationWithMembers[];\n    adminView?: boolean;\n    kind?: ChannelKind;\n    defaultStorageChannelId?: string | null | undefined\n\n};\n\n\nexport const ChannelCard = (props: ChannelCardProps) => {\n    const {data, organization, kind, adminView, defaultStorageChannelId} = props;\n    const isMobile = useIsMobile()\n\n    const isDefaultSystemStorage = defaultStorageChannelId === data.id;\n\n    const isOwned = data.organizationId ? true : !organization;\n    const isLocalSystem = data.provider == \"local\";\n\n    return (\n        <div className=\"block transition-all duration-200 rounded-xl\">\n            <Card className=\"flex flex-row justify-between p-4\">\n                <div className=\"flex items-center gap-3\">\n                    <div\n                        className=\"flex h-10 w-10 items-center justify-center rounded-md bg-secondary border border-border\">\n                        {getChannelIcon(data.provider)}\n                    </div>\n                    <div className={`h-2 w-2 rounded-full ${data.enabled ? \"bg-green-600\" : \"bg-muted\"}`}/>\n                </div>\n                <div className=\"flex justify-start w-full\">\n                    <div className=\"flex flex-col items-start md:flex-row md:items-center gap-2 \">\n                        <h3 className=\"font-medium text-foreground\">{isMobile ? truncateWords(data.name, 2) : data.name}</h3>\n                        <Badge variant=\"secondary\" className=\"text-xs font-mono\">\n                            {data.provider}\n                        </Badge>\n                        {isDefaultSystemStorage && (\n                            <Badge variant=\"secondary\" className=\"text-xs font-mono\">\n                                default\n                            </Badge>\n                        )}\n                    </div>\n                </div>\n                {kind && (\n                    <div className=\"flex items-center gap-2\">\n                        {(isOwned) && (\n                            <>\n                                <EditChannelButton\n                                    organizations={props.organizations}\n                                    adminView={props.adminView}\n                                    organization={organization}\n                                    channel={data}\n                                    kind={kind}\n                                />\n                                {!isLocalSystem && (\n                                    <DeleteChannelButton\n                                        kind={kind}\n                                        organizationId={organization?.id}\n                                        channelId={data.id}\n                                    />\n                                )}\n                            </>\n                        )}\n                    </div>\n                )}\n            </Card>\n        </div>\n    );\n};\n\n\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/channels/channel/channel-form/channel-form.schema.ts",
    "content": "import {z} from \"zod\";\nimport {SlackChannelConfigSchema} from \"./providers/notifications/forms/slack.schema\";\nimport {SmtpChannelConfigSchema} from \"./providers/notifications/forms/smtp.schema\";\nimport {DiscordChannelConfigSchema} from \"./providers/notifications/forms/discord.schema\";\nimport {TelegramChannelConfigSchema} from \"./providers/notifications/forms/telegram.schema\";\nimport {GotifyChannelConfigSchema} from \"./providers/notifications/forms/gotify.schema\";\nimport {NtfyChannelConfigSchema} from \"./providers/notifications/forms/ntfy.schema\";\nimport {WebhookChannelConfigSchema} from \"./providers/notifications/forms/webhook.schema\";\nimport {S3ChannelConfigSchema} from \"./providers/storages/forms/s3.schema\";\nimport {GoogleDriveChannelConfigSchema} from \"./providers/storages/forms/google-drive.schema\";\nimport {LocalChannelConfigSchema} from \"./providers/storages/forms/local.schema\";\n\n\nconst BaseChannelFormSchema = z.object({\n    name: z\n        .string()\n        .min(5, \"Name must be at least 5 characters long\")\n        .max(40, \"Name must be at most 40 characters long\"),\n    enabled: z.boolean().default(true),\n});\n\nexport const NotificationChannelFormSchema = z.discriminatedUnion(\"provider\", [\n    BaseChannelFormSchema.extend({\n        provider: z.literal(\"slack\"),\n        config: SlackChannelConfigSchema,\n    }),\n    BaseChannelFormSchema.extend({\n        provider: z.literal(\"smtp\"),\n        config: SmtpChannelConfigSchema,\n    }),\n    BaseChannelFormSchema.extend({\n        provider: z.literal(\"discord\"),\n        config: DiscordChannelConfigSchema,\n    }),\n    BaseChannelFormSchema.extend({\n        provider: z.literal(\"telegram\"),\n        config: TelegramChannelConfigSchema,\n    }),\n    BaseChannelFormSchema.extend({\n        provider: z.literal(\"gotify\"),\n        config: GotifyChannelConfigSchema,\n    }),\n    BaseChannelFormSchema.extend({\n        provider: z.literal(\"ntfy\"),\n        config: NtfyChannelConfigSchema,\n    }),\n    BaseChannelFormSchema.extend({\n        provider: z.literal(\"webhook\"),\n        config: WebhookChannelConfigSchema,\n    }),\n]);\n\nexport const StorageChannelFormSchema = z.discriminatedUnion(\"provider\", [\n    BaseChannelFormSchema.extend({\n        provider: z.literal(\"s3\"),\n        config: S3ChannelConfigSchema,\n    }),\n    BaseChannelFormSchema.extend({\n        provider: z.literal(\"google-drive\"),\n        config: GoogleDriveChannelConfigSchema,\n    }),\n    BaseChannelFormSchema.extend({\n        provider: z.literal(\"local\"),\n        config: LocalChannelConfigSchema\n    })\n]);\n\n\nexport type NotificationChannelFormType = z.infer<typeof NotificationChannelFormSchema>;\nexport type StorageChannelFormType = z.infer<typeof StorageChannelFormSchema>;\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/channels/channel/channel-form/channel-form.tsx",
    "content": "\"use client\";\n\nimport {useRouter} from \"next/navigation\";\nimport {useMutation} from \"@tanstack/react-query\";\nimport {Form, FormControl, FormField, FormItem, FormLabel, FormMessage, useZodForm} from \"@/components/ui/form\";\nimport {ButtonWithLoading} from \"@/components/wrappers/common/button/button-with-loading\";\nimport {Input} from \"@/components/ui/input\";\n\nimport {\n    addStorageChannelAction, updateStorageChannelAction\n} from \"@/components/wrappers/dashboard/admin/channels/channel/channel-form/providers/storages/action\";\nimport {toast} from \"sonner\";\nimport {OrganizationWithMembers} from \"@/db/schema/03_organization\";\nimport {Button} from \"@/components/ui/button\";\nimport {NotificationChannelWith} from \"@/db/schema/09_notification-channel\";\nimport {useEffect} from \"react\";\nimport {cn} from \"@/lib/utils\";\nimport {Card} from \"@/components/ui/card\";\nimport {ArrowLeft} from \"lucide-react\";\nimport {StorageChannelWith} from \"@/db/schema/12_storage-channel\";\nimport {\n    NotificationChannelFormSchema, NotificationChannelFormType, StorageChannelFormSchema, StorageChannelFormType\n} from \"@/components/wrappers/dashboard/admin/channels/channel/channel-form/channel-form.schema\";\nimport {\n    ChannelKind,\n    renderChannelForm\n} from \"@/components/wrappers/dashboard/admin/channels/helpers/common\";\nimport {storageProviders} from \"@/components/wrappers/dashboard/admin/channels/helpers/storage\";\nimport {notificationProviders} from \"@/components/wrappers/dashboard/admin/channels/helpers/notification\";\nimport {\n    ChannelTestButton\n} from \"@/components/wrappers/dashboard/admin/channels/channel/channel-form/channel-test-button\";\nimport {\n    addNotificationChannelAction, updateNotificationChannelAction\n} from \"@/components/wrappers/dashboard/admin/channels/channel/channel-form/providers/notifications/action\";\n\n\ntype NotifierFormProps = {\n    onSuccessAction?: () => void;\n    organization?: OrganizationWithMembers;\n    defaultValues?: NotificationChannelWith | StorageChannelWith\n    adminView?: boolean\n    kind: ChannelKind\n};\n\nexport const ChannelForm = ({onSuccessAction, organization, defaultValues, kind}: NotifierFormProps) => {\n\n    const router = useRouter();\n    const isCreate = !Boolean(defaultValues);\n\n    const form = useZodForm({\n        schema: kind == \"notification\" ? NotificationChannelFormSchema : StorageChannelFormSchema,\n        // @ts-ignore\n        defaultValues: {...defaultValues},\n    });\n\n    useEffect(() => {\n        form.reset(defaultValues ? {...defaultValues} : {enabled: true});\n    }, [defaultValues]);\n\n    const mutationAddNotificationChannel = useMutation({\n        mutationFn: async (values: NotificationChannelFormType | StorageChannelFormType) => {\n\n            const payload = {\n                data: values,\n                ...(organization && {organizationId: organization.id}),\n                ...((defaultValues && {id: defaultValues.id}))\n            };\n\n\n            let result: any;\n\n            if (kind === \"notification\") {\n                // @ts-ignore\n                result = isCreate ? await addNotificationChannelAction(payload) : await updateNotificationChannelAction(payload);\n            } else if (kind === \"storage\") {\n                // @ts-ignore\n                result = isCreate ? await addStorageChannelAction(payload) : await updateStorageChannelAction(payload);\n            } else {\n                toast.error(\"An error occurred\");\n                return;\n            }\n\n            const inner = result?.data;\n\n            if (inner?.success) {\n                toast.success(inner.actionSuccess?.message);\n                isCreate && onSuccessAction?.();\n                router.refresh();\n            } else {\n                toast.error(inner?.actionError?.message);\n                isCreate && onSuccessAction?.();\n            }\n        }\n    });\n\n    const provider = form.watch(\"provider\");\n    const channelTypes = kind == \"notification\" ? notificationProviders : storageProviders\n    const selectedProviderDetails = channelTypes.find(t => t.value === provider);\n\n    if (isCreate && !provider) {\n        return (\n            <div className=\"grid grid-cols-2 sm:grid-cols-3 gap-4 py-4\">\n                {channelTypes.filter(p => p.value != \"local\").map((type) => {\n                    const Icon = type.icon;\n                    return (\n                        <Card\n                            key={type.value}\n                            className={cn(\n                                \"relative flex flex-col items-center justify-center gap-3 p-4 transition-all border\",\n                                type.preview\n                                    ? \"cursor-not-allowed bg-muted/60 border-border text-muted-foreground\"\n                                    : \"cursor-pointer bg-background hover:bg-accent/40 hover:border-primary/50\"\n                            )}\n                            onClick={() => {\n                                if (type.preview) return;\n                                form.setValue(\"provider\", type.value as any);\n                                form.setValue(\"config\", {});\n                            }}\n                        >\n\n                            {type.preview && (\n                                <div\n                                    className=\"absolute bottom-0 right-0 overflow-hidden w-20 h-20 pointer-events-none\">\n                                    <div\n                                        className=\"absolute bottom-0 right-0 w-38 h-5 flex items-center justify-center\n                                            transform -rotate-45 translate-x-14 -translate-y-4\"\n                                        style={{backgroundColor: \"#FE6702\"}}\n                                    >\n                                        <span className=\"text-white text-[7px] pr-3 font-medium text-center w-full\">COMING SOON</span>\n                                    </div>\n                                </div>\n                            )}\n                            <div\n                                className={cn(\n                                    \"h-10 w-10 rounded-full flex items-center justify-center transition-colors\",\n                                    type.preview\n                                        ? \"bg-muted\"\n                                        : \"bg-accent text-accent-foreground\"\n                                )}\n                            >\n                                <Icon\n                                    className={cn(\n                                        \"h-6 w-6\",\n                                        type.preview ? \"text-muted-foreground\" : \"text-foreground\"\n                                    )}\n                                />\n                            </div>\n                            <span\n                                className={cn(\n                                    \"font-medium text-sm text-center leading-tight\",\n                                    type.preview ? \"text-muted-foreground\" : \"text-foreground\"\n                                )}\n                            >\n                                {type.label}\n                            </span>\n                        </Card>\n\n                    );\n                })}\n            </div>\n        );\n    }\n\n    return (\n        <Form\n            form={form}\n            className=\"flex flex-col gap-4\"\n            onSubmit={async (values) => {\n                await mutationAddNotificationChannel.mutateAsync(values);\n            }}\n        >\n            <div className=\"flex items-center gap-3 mb-2 p-3 bg-secondary/30 rounded-lg border border-border\">\n                {selectedProviderDetails && (\n                    <div\n                        className=\"h-10 w-10 bg-background rounded-full flex items-center justify-center border border-border shadow-sm\">\n                        <selectedProviderDetails.icon className=\"h-5 w-5\"/>\n                    </div>\n                )}\n                <div className=\"flex-1\">\n                    <p className=\"text-sm font-medium\">Configuring {selectedProviderDetails?.label}</p>\n                    <p className=\"text-xs text-muted-foreground\">{isCreate ? \"New Channel\" : \"Edit Channel\"}</p>\n                </div>\n                {isCreate && (\n                    <Button\n                        type=\"button\"\n                        variant=\"ghost\"\n                        size=\"sm\"\n                        onClick={() => {\n                            form.setValue(\"provider\", undefined as any);\n                            form.setValue(\"config\", undefined);\n                        }}\n                    >\n                        <ArrowLeft className=\"h-4 w-4 mr-2\"/>\n                        Change\n                    </Button>\n                )}\n            </div>\n\n            <FormField\n                control={form.control}\n                name=\"name\"\n                render={({field}) => (\n                    <FormItem>\n                        <FormLabel>Channel Name *</FormLabel>\n                        <FormControl>\n                            <Input {...field} placeholder={`e.g. ${selectedProviderDetails?.label} Channel`}\n                                   value={field.value ?? \"\"}/>\n                        </FormControl>\n                        <FormMessage/>\n                    </FormItem>\n                )}\n            />\n\n            <FormField\n                control={form.control}\n                name=\"provider\"\n                render={({field}) => (\n                    <input type=\"hidden\" {...field} value={field.value || \"\"}/>\n                )}\n            />\n\n            {renderChannelForm(provider, form)}\n\n            <div className=\"flex justify-between mt-4\">\n                <div>\n                    {(!isCreate || kind == \"storage\") && (\n                        <ChannelTestButton\n                            kind={kind}\n                            organizationId={organization?.id}\n                            channel={form.getValues()}\n                        />\n                    )}\n                </div>\n                <div className=\"flex gap-2\">\n                    <Button\n                        type=\"button\"\n                        variant=\"outline\"\n                        onClick={() => {\n                            onSuccessAction?.();\n                            form.reset();\n                        }}\n                    >\n                        Cancel\n                    </Button>\n                    <ButtonWithLoading isPending={mutationAddNotificationChannel.isPending}>\n                        {isCreate ? \"Add\" : \"Save\"} Channel\n                    </ButtonWithLoading>\n                </div>\n\n            </div>\n        </Form>\n    );\n};\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/channels/channel/channel-form/channel-test-button.tsx",
    "content": "\"use client\"\n\nimport {useMutation} from \"@tanstack/react-query\";\nimport {Send, ShieldCheck} from \"lucide-react\";\nimport {toast} from \"sonner\";\n\nimport {Button} from \"@/components/ui/button\";\nimport {NotificationChannel} from \"@/db/schema/09_notification-channel\";\nimport {dispatchNotification} from \"@/features/notifications/dispatch\";\nimport {EventPayload} from \"@/features/notifications/types\";\nimport {useIsMobile} from \"@/hooks/use-mobile\";\nimport {cn} from \"@/lib/utils\";\nimport {StorageChannel} from \"@/db/schema/12_storage-channel\";\nimport {ChannelKind} from \"@/components/wrappers/dashboard/admin/channels/helpers/common\";\nimport type {StorageInput} from \"@/features/storages/types\";\nimport {dispatchStorage} from \"@/features/storages/dispatch\";\n\n\ntype NotifierTestChannelButtonProps = {\n    channel: NotificationChannel | StorageChannel;\n    organizationId?: string;\n    kind: ChannelKind;\n}\n\nexport const ChannelTestButton = ({channel, organizationId, kind}: NotifierTestChannelButtonProps) => {\n\n    const isMobile = useIsMobile()\n\n    const mutation = useMutation({\n        mutationFn: async () => {\n            if (kind === \"notification\") {\n                const payload: EventPayload = {\n                    title: 'Test Channel',\n                    message: `We are testing channel ${channel.name}`,\n                    level: 'info',\n                };\n                const result = await dispatchNotification(payload, undefined, channel.id, organizationId);\n\n                if (result.success) {\n                    toast.success(result.message);\n                } else {\n                    toast.error(\"An error occurred while testing the notification channel, check your configuration\");\n                }\n            } else if (kind === \"storage\") {\n                const input: StorageInput = {\n                    action: \"ping\",\n                };\n                const result = await dispatchStorage(input, undefined, undefined, channel);\n\n                if (result.success) {\n                    toast.success(\"Successfully connected to storage channel\");\n                } else {\n                    console.error(result);\n                    const responseText = result.response ? `(${result.response})` : \"\";\n                    toast.error(`An error occurred while testing the storage channel, check your configuration ${responseText}`);\n                }\n            } else {\n                toast.error(\"Not yet supported\");\n            }\n\n        },\n    });\n\n    return (\n        <Button\n            type=\"button\"\n            variant=\"default\"\n            onClick={() => mutation.mutateAsync()}\n            disabled={mutation.isPending}\n            className=\"bg-green-600 hover:bg-green-700 text-white font-medium shadow-sm transition-all\"\n        >\n            {mutation.isPending ? (\n                <>\n                    <div\n                        className={cn(\" h-4 w-4 animate-spin rounded-full border-2 border-white/30 border-t-white\", !isMobile && \"mr-2\")}/>\n                    {!isMobile && `Sending...`}\n                </>\n            ) : (\n                <div className=\"flex flex-row justify-center items-center\">\n                    {kind === \"notification\" ?\n                        <>\n                            <Send className={cn(\"h-4 w-4\", !isMobile && \"mr-2\")}/>{!isMobile && ` Test Channel`}\n                        </>\n                        :\n                        <>\n                            <ShieldCheck className={cn(\"h-4 w-4\", !isMobile && \"mr-2\")}/>{!isMobile && ` Test Storage`}\n                        </>\n                    }\n                </div>\n            )}\n        </Button>\n    )\n}"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/channels/channel/channel-form/providers/notifications/action.ts",
    "content": "\"use server\";\n\nimport {z} from \"zod\";\nimport {ServerActionResult} from \"@/types/action-type\";\nimport * as drizzleDb from \"@/db\";\nimport {userAction} from \"@/lib/safe-actions/actions\";\nimport {NotificationChannel} from \"@/db/schema/09_notification-channel\";\nimport {db} from \"@/db\";\nimport {and, eq} from \"drizzle-orm\";\nimport {withUpdatedAt} from \"@/db/utils\";\nimport {\n    NotificationChannelFormSchema\n} from \"@/components/wrappers/dashboard/admin/channels/channel/channel-form/channel-form.schema\";\n\n\nexport const addNotificationChannelAction = userAction.schema(\n    z.object({\n        organizationId: z.string().optional(),\n        data: NotificationChannelFormSchema\n    })\n).action(async ({parsedInput}): Promise<ServerActionResult<NotificationChannel>> => {\n    const {organizationId, data} = parsedInput;\n    try {\n        const [channel] = await db\n            .insert(drizzleDb.schemas.notificationChannel)\n            .values({\n                provider: data.provider,\n                name: data.name,\n                config: data.config,\n                enabled: data.enabled ?? true,\n                organizationId: organizationId ?? null,\n            })\n            .returning();\n\n        if (organizationId) {\n            await db.insert(drizzleDb.schemas.organizationNotificationChannel).values({\n                organizationId,\n                notificationChannelId: channel.id,\n            });\n        }\n\n        return {\n            success: true,\n            value: {\n                ...channel,\n                config: channel.config as JSON\n            },\n            actionSuccess: {\n                message: \"Notification channel has been successfully created.\",\n                messageParams: {notificationChannelId: channel.id},\n            },\n        };\n    } catch (error) {\n        console.error(\"Error:\", error);\n        return {\n            success: false,\n            actionError: {\n                message: \"Failed to create notification channel.\",\n                status: 500,\n                cause: error instanceof Error ? error.message : \"Unknown error\",\n                messageParams: {notificationChannelId: \"\"},\n            },\n        };\n    }\n});\n\nexport const removeNotificationChannelAction = userAction.schema(\n    z.object({\n        organizationId: z.string().optional(),\n        notificationChannelId: z.string(),\n    })\n).action(async ({parsedInput}): Promise<ServerActionResult<NotificationChannel>> => {\n    const {organizationId, notificationChannelId} = parsedInput;\n\n    try {\n        if (organizationId) {\n            await db\n                .delete(drizzleDb.schemas.organizationNotificationChannel)\n                .where(\n                    and(\n                        eq(drizzleDb.schemas.organizationNotificationChannel.organizationId, organizationId),\n                        eq(drizzleDb.schemas.organizationNotificationChannel.notificationChannelId, notificationChannelId)\n                    )\n                );\n        }\n\n        const [deletedChannel] = await db\n            .delete(drizzleDb.schemas.notificationChannel)\n            .where(eq(drizzleDb.schemas.notificationChannel.id, notificationChannelId))\n            .returning();\n\n        if (!deletedChannel) {\n            return {\n                success: false,\n                actionError: {\n                    message: \"Notification channel not found.\",\n                    status: 404,\n                    messageParams: {notificationChannelId: notificationChannelId},\n                },\n            };\n        }\n\n        return {\n            success: true,\n            value: {\n                ...deletedChannel,\n                config: deletedChannel.config as JSON\n            },\n            actionSuccess: {\n                message: \"Notification channel has been successfully removed.\",\n                messageParams: {notificationChannelId: notificationChannelId},\n            },\n        };\n    } catch (error) {\n        console.error(\"Error:\", error);\n        return {\n            success: false,\n            actionError: {\n                message: \"Failed to remove notification channel.\",\n                status: 500,\n                cause: error instanceof Error ? error.message : \"Unknown error\",\n                messageParams: {notificationChannelId: notificationChannelId},\n            },\n        };\n    }\n});\n\n\nexport const updateNotificationChannelAction = userAction.schema(\n    z.object({\n        id: z.string(),\n        data: NotificationChannelFormSchema\n    })\n).action(async ({parsedInput}): Promise<ServerActionResult<NotificationChannel>> => {\n    const {id, data} = parsedInput;\n\n    try {\n        const [channel] = await db\n            .update(drizzleDb.schemas.notificationChannel)\n            .set(withUpdatedAt({\n                provider: data.provider,\n                name: data.name,\n                config: data.config,\n                enabled: data.enabled ?? true,\n            }))\n            .where(eq(drizzleDb.schemas.notificationChannel.id, id))\n            .returning();\n\n        return {\n            success: true,\n            value: {\n                ...channel,\n                config: channel.config as JSON\n            },\n            actionSuccess: {\n                message: `Notification channel \"${channel.name}\" has been successfully updated.`,\n                messageParams: {id: channel.id},\n            },\n        };\n    } catch (error) {\n        console.error(\"Error:\", error);\n        return {\n            success: false,\n            actionError: {\n                message: \"Failed to update notification channel.\",\n                status: 500,\n                cause: error instanceof Error ? error.message : \"Unknown error\",\n                messageParams: {id: \"\"},\n            },\n        };\n    }\n});\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/channels/channel/channel-form/providers/notifications/forms/discord.form.tsx",
    "content": "import { UseFormReturn } from \"react-hook-form\";\nimport {\n  FormControl,\n  FormField,\n  FormItem,\n  FormLabel,\n  FormMessage,\n} from \"@/components/ui/form\";\nimport { Separator } from \"@/components/ui/separator\";\nimport { PasswordInput } from \"@/components/ui/password-input\";\n\ntype NotifierDiscordFormProps = {\n  form: UseFormReturn<any, any, any>;\n};\n\nexport const NotifierDiscordForm = ({ form }: NotifierDiscordFormProps) => {\n  return (\n    <>\n      <Separator className=\"my-1\" />\n      <FormField\n        control={form.control}\n        name=\"config.discordWebhook\"\n        render={({ field }) => (\n          <FormItem>\n            <FormLabel>Discord Webhook URL *</FormLabel>\n            <FormControl>\n              <PasswordInput\n                {...field}\n                placeholder=\"e.g. https://discord.com/api/webhooks/...\"\n              />\n            </FormControl>\n            <FormMessage />\n          </FormItem>\n        )}\n      />\n    </>\n  );\n};\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/channels/channel/channel-form/providers/notifications/forms/discord.schema.ts",
    "content": "import {z} from \"zod\";\n\nexport const DiscordChannelConfigSchema = z.object({\n    discordWebhook: z.string().url(\"Must be a valid URL\"),\n});\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/channels/channel/channel-form/providers/notifications/forms/gotify.form.tsx",
    "content": "import type { UseFormReturn } from \"react-hook-form\";\nimport {\n  FormControl,\n  FormField,\n  FormItem,\n  FormLabel,\n  FormMessage,\n} from \"@/components/ui/form\";\nimport { Input } from \"@/components/ui/input\";\nimport { Separator } from \"@/components/ui/separator\";\nimport { PasswordInput } from \"@/components/ui/password-input\";\n\ntype NotifierGotifyFormProps = {\n  form: UseFormReturn<any, any, any>;\n};\n\nexport const NotifierGotifyForm = ({ form }: NotifierGotifyFormProps) => {\n  return (\n    <>\n      <Separator className=\"my-1\" />\n      <FormField\n        control={form.control}\n        name=\"config.gotifyServerUrl\"\n        render={({ field }) => (\n          <FormItem>\n            <FormLabel>Gotify Server URL *</FormLabel>\n            <FormControl>\n              <Input {...field} placeholder=\"e.g. https://gotify.example.com\" />\n            </FormControl>\n            <FormMessage />\n          </FormItem>\n        )}\n      />\n      <FormField\n        control={form.control}\n        name=\"config.gotifyAppToken\"\n        render={({ field }) => (\n          <FormItem>\n            <FormLabel>Application Token *</FormLabel>\n            <FormControl>\n              <PasswordInput {...field} placeholder=\"e.g. gotify-app-token\" />\n            </FormControl>\n            <FormMessage />\n          </FormItem>\n        )}\n      />\n    </>\n  );\n};\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/channels/channel/channel-form/providers/notifications/forms/gotify.schema.ts",
    "content": "import {z} from \"zod\";\n\nexport const GotifyChannelConfigSchema = z.object({\n    gotifyServerUrl: z.string().url(\"Must be a valid URL\"),\n    gotifyAppToken: z.string().min(1, \"App token is required\"),\n});\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/channels/channel/channel-form/providers/notifications/forms/ntfy.form.tsx",
    "content": "import {UseFormReturn} from \"react-hook-form\";\nimport {FormControl, FormField, FormItem, FormLabel, FormMessage} from \"@/components/ui/form\";\nimport {Input} from \"@/components/ui/input\";\nimport {Separator} from \"@/components/ui/separator\";\nimport {PasswordInput} from \"@/components/ui/password-input\";\n\ntype NotifierNtfyFormProps = {\n    form: UseFormReturn<any, any, any>\n}\n\nexport const NotifierNtfyForm = ({form}: NotifierNtfyFormProps) => {\n    return (\n        <>\n            <Separator className=\"my-1\"/>\n\n            <FormField\n                control={form.control}\n                name=\"config.ntfyTopic\"\n                render={({field}) => (\n                    <FormItem>\n                        <FormLabel>Topic Name *</FormLabel>\n                        <FormControl>\n                            <Input {...field} placeholder=\"e.g. team-alerts\"/>\n                        </FormControl>\n                        <FormMessage/>\n                    </FormItem>\n                )}\n            />\n\n            <FormField\n                control={form.control}\n                name=\"config.ntfyServerUrl\"\n                render={({field}) => (\n                    <FormItem>\n                        <FormLabel>Server URL</FormLabel>\n                        <FormControl>\n                            <Input {...field} placeholder=\"e.g. https://ntfy.example.com\"/>\n                        </FormControl>\n                        <p className=\"text-xs text-muted-foreground\">Leave empty to use the official ntfy.sh server.</p>\n                        <FormMessage/>\n                    </FormItem>\n                )}\n            />\n\n            <FormField\n                control={form.control}\n                name=\"config.ntfyToken\"\n                render={({field}) => (\n                    <FormItem>\n                        <FormLabel>Access Token</FormLabel>\n                        <FormControl>\n                            <PasswordInput {...field} placeholder=\"e.g. tk_xxxxx\"/>\n                        </FormControl>\n                        <p className=\"text-xs text-muted-foreground\">Only required for protected topics or self-hosted instances with auth.</p>\n                        <FormMessage/>\n                    </FormItem>\n                )}\n            />\n\n            <Separator className=\"my-1\"/>\n\n            <FormField\n                control={form.control}\n                name=\"config.ntfyUsername\"\n                render={({field}) => (\n                    <FormItem>\n                        <FormLabel>Basic Auth Username</FormLabel>\n                        <FormControl>\n                            <Input {...field} placeholder=\"e.g. notifier-user\"/>\n                        </FormControl>\n                        <FormMessage/>\n                    </FormItem>\n                )}\n            />\n\n            <FormField\n                control={form.control}\n                name=\"config.ntfyPassword\"\n                render={({field}) => (\n                    <FormItem>\n                        <FormLabel>Basic Auth Password</FormLabel>\n                        <FormControl>\n                            <PasswordInput placeholder=\"e.g. notifier-password\" {...field} />\n                        </FormControl>\n                        <FormMessage/>\n                    </FormItem>\n                )}\n            />\n        </>\n    )\n}\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/channels/channel/channel-form/providers/notifications/forms/ntfy.schema.ts",
    "content": "import {z} from \"zod\";\n\nexport const NtfyChannelConfigSchema = z.object({\n    ntfyTopic: z.string().min(1, \"Topic is required\"),\n    ntfyServerUrl: z.string().url(\"Must be a valid URL\").optional().or(z.literal('')),\n    ntfyToken: z.string().optional(),\n    ntfyUsername: z.string().optional(),\n    ntfyPassword: z.string().optional(),\n});\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/channels/channel/channel-form/providers/notifications/forms/slack.form.tsx",
    "content": "import { UseFormReturn } from \"react-hook-form\";\nimport {\n  FormControl,\n  FormField,\n  FormItem,\n  FormLabel,\n  FormMessage,\n} from \"@/components/ui/form\";\nimport { Separator } from \"@/components/ui/separator\";\nimport { PasswordInput } from \"@/components/ui/password-input\";\n\ntype NotifierSmtpFormProps = {\n  form: UseFormReturn<any, any, any>;\n};\n\nexport const NotifierSlackForm = ({ form }: NotifierSmtpFormProps) => {\n  return (\n    <>\n      <Separator className=\"my-1\" />\n      <FormField\n        control={form.control}\n        name=\"config.slackWebhook\"\n        render={({ field }) => (\n          <FormItem>\n            <FormLabel>Slack Webhook URL *</FormLabel>\n            <FormControl>\n              <PasswordInput\n                {...field}\n                placeholder=\"e.g. https://hooks.slack.com/services/...\"\n              />\n            </FormControl>\n            <FormMessage />\n          </FormItem>\n        )}\n      />\n    </>\n  );\n};\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/channels/channel/channel-form/providers/notifications/forms/slack.schema.ts",
    "content": "import {z} from \"zod\";\n\nexport const SlackChannelConfigSchema = z.object({\n    slackWebhook: z.string().url(\"Must be a valid URL\"),\n});\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/channels/channel/channel-form/providers/notifications/forms/smtp.form.tsx",
    "content": "import {FormControl, FormField, FormItem, FormLabel, FormMessage} from \"@/components/ui/form\";\nimport {Input} from \"@/components/ui/input\";\nimport {UseFormReturn} from \"react-hook-form\";\nimport {Separator} from \"@/components/ui/separator\";\nimport {PasswordInput} from \"@/components/ui/password-input\";\n\n\ntype NotifierSmtpFormProps = {\n    form: UseFormReturn<any, any, any>\n}\n\n\nexport const NotifierSmtpForm = ({form}: NotifierSmtpFormProps) => {\n    return (\n        <>\n            <Separator className=\"my-1\"/>\n            <FormField\n                control={form.control}\n                name=\"config.host\"\n                render={({field}) => (\n                    <FormItem>\n                        <FormLabel>SMTP Host *</FormLabel>\n                        <FormControl>\n                            <Input placeholder=\"e.g. smtp.example.com\" {...field} value={field.value ?? \"\"}/>\n                        </FormControl>\n                        <FormMessage/>\n                    </FormItem>\n                )}\n            />\n            <FormField\n                control={form.control}\n                name=\"config.port\"\n                render={({field}) => (\n                    <FormItem>\n                        <FormLabel>SMTP Port *</FormLabel>\n                        <FormControl>\n                            <Input placeholder=\"e.g. 587\" type=\"number\" {...field} value={field.value ?? \"\"}/>\n                        </FormControl>\n                        <FormMessage/>\n                    </FormItem>\n                )}\n            />\n            <FormField\n                control={form.control}\n                name=\"config.user\"\n                render={({field}) => (\n                    <FormItem>\n                        <FormLabel>Username *</FormLabel>\n                        <FormControl>\n                            <Input placeholder=\"e.g. noreply@example.com\" {...field} value={field.value ?? \"\"}/>\n                        </FormControl>\n                        <FormMessage/>\n                    </FormItem>\n                )}\n            />\n            <FormField\n                control={form.control}\n                name=\"config.password\"\n                render={({field}) => (\n                    <FormItem>\n                        <FormLabel>Password *</FormLabel>\n                        <FormControl>\n                            <PasswordInput\n                                {...field}\n                                value={field.value ?? \"\"}\n                            />\n                        </FormControl>\n                        <FormMessage/>\n                    </FormItem>\n                )}\n            />\n\n            <FormField\n                control={form.control}\n                name=\"config.from\"\n                render={({field}) => (\n                    <FormItem>\n                        <FormLabel>From Email *</FormLabel>\n                        <FormControl>\n                            <Input placeholder={`e.g. \"Portabase\" <noreply@example.com>`} {...field}\n                                   value={field.value ?? \"\"}/>\n                        </FormControl>\n                        <FormMessage/>\n                    </FormItem>\n                )}\n            />\n\n            <FormField\n                control={form.control}\n                name=\"config.to\"\n                render={({field}) => (\n                    <FormItem>\n                        <FormLabel>To Email *</FormLabel>\n                        <FormControl>\n                            <Input placeholder={\"e.g. alerts@example.com, team@example.com\"} {...field}\n                                   value={field.value ?? \"\"}/>\n                        </FormControl>\n                        <FormMessage/>\n                    </FormItem>\n                )}\n            />\n\n        </>\n    )\n}\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/channels/channel/channel-form/providers/notifications/forms/smtp.schema.ts",
    "content": "import {z} from \"zod\";\n\nexport const SmtpChannelConfigSchema = z.object({\n    host: z.string().min(1, \"Host is required\"),\n    port: z.coerce.number().min(1, \"Port is required\"),\n    user: z.string().min(1, \"User is required\"),\n    password: z.string().min(1, \"Password is required\"),\n    from: z.string().min(1, \"From is required\"),\n    to: z.string().min(1, \"To is required\"),\n});\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/channels/channel/channel-form/providers/notifications/forms/telegram.form.tsx",
    "content": "import { UseFormReturn } from \"react-hook-form\";\nimport {\n  FormControl,\n  FormField,\n  FormItem,\n  FormLabel,\n  FormMessage,\n} from \"@/components/ui/form\";\nimport { Input } from \"@/components/ui/input\";\nimport { Separator } from \"@/components/ui/separator\";\nimport { PasswordInput } from \"@/components/ui/password-input\";\n\ntype NotifierTelegramFormProps = {\n  form: UseFormReturn<any, any, any>;\n};\n\nexport const NotifierTelegramForm = ({ form }: NotifierTelegramFormProps) => {\n  return (\n    <>\n      <Separator className=\"my-1\" />\n      <FormField\n        control={form.control}\n        name=\"config.telegramBotToken\"\n        render={({ field }) => (\n          <FormItem>\n            <FormLabel>Telegram Bot Token *</FormLabel>\n            <FormControl>\n              <PasswordInput\n                {...field}\n                placeholder=\"e.g. 123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11\"\n              />\n            </FormControl>\n            <FormMessage />\n          </FormItem>\n        )}\n      />\n      <FormField\n        control={form.control}\n        name=\"config.telegramChatId\"\n        render={({ field }) => (\n          <FormItem>\n            <FormLabel>Telegram Chat ID *</FormLabel>\n            <FormControl>\n              <Input {...field} placeholder=\"e.g. -100123456789 or 123456789\" />\n            </FormControl>\n            <p className=\"text-xs text-muted-foreground\">\n              You must start the conversation with the bot first (\n              <strong>/start</strong>). <br />\n              For groups, add the bot to the group. <br />\n              You can use{\" \"}\n              <a\n                href=\"https://t.me/userinfobot\"\n                target=\"_blank\"\n                rel=\"noopener noreferrer\"\n                className=\"underline\"\n              >\n                @userinfobot\n              </a>{\" \"}\n              to find your ID.\n            </p>\n            <FormMessage />\n          </FormItem>\n        )}\n      />\n      <FormField\n        control={form.control}\n        name=\"config.telegramTopicId\"\n        render={({ field }) => (\n          <FormItem>\n            <FormLabel>Telegram Topic ID</FormLabel>\n            <FormControl>\n              <Input {...field} placeholder=\"e.g. 123456\" />\n            </FormControl>\n            <p className=\"text-xs text-muted-foreground\">\n              Unique identifier for the target message thread (topic) of the\n              forum; for forum supergroups only\n            </p>\n            <FormMessage />\n          </FormItem>\n        )}\n      />\n    </>\n  );\n};\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/channels/channel/channel-form/providers/notifications/forms/telegram.schema.ts",
    "content": "import { z } from \"zod\";\n\nexport const TelegramChannelConfigSchema = z\n  .object({\n    telegramBotToken: z.string().min(1, \"Bot token is required\"),\n    telegramChatId: z.string().min(1, \"Chat ID is required\"),\n    telegramTopicId: z.string().optional(),\n  })\n  .refine(\n    (data) => {\n      if (data.telegramTopicId && !data.telegramChatId) {\n        return false;\n      }\n      return true;\n    },\n    {\n      message: \"Chat ID is required when a Topic ID is provided\",\n      path: [\"telegramChatId\"],\n    },\n  );\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/channels/channel/channel-form/providers/notifications/forms/webhook.form.tsx",
    "content": "import { UseFormReturn } from \"react-hook-form\";\nimport {\n  FormControl,\n  FormField,\n  FormItem,\n  FormLabel,\n  FormMessage,\n} from \"@/components/ui/form\";\nimport { Input } from \"@/components/ui/input\";\nimport { Separator } from \"@/components/ui/separator\";\nimport { PasswordInput } from \"@/components/ui/password-input\";\n\ntype NotifierWebhookFormProps = {\n  form: UseFormReturn<any, any, any>;\n};\n\nexport const NotifierWebhookForm = ({ form }: NotifierWebhookFormProps) => {\n  return (\n    <>\n      <Separator className=\"my-1\" />\n      <FormField\n        control={form.control}\n        name=\"config.webhookUrl\"\n        render={({ field }) => (\n          <FormItem>\n            <FormLabel>Webhook URL *</FormLabel>\n            <FormControl>\n              <Input {...field} placeholder=\"e.g. https://example.com/api/webhook\" />\n            </FormControl>\n            <FormMessage />\n          </FormItem>\n        )}\n      />\n      <div className=\"flex gap-4\">\n        <div className=\"flex-1\">\n          <FormField\n            control={form.control}\n            name=\"config.webhookSecretHeader\"\n            render={({ field }) => (\n              <FormItem>\n                <FormLabel>Header Name</FormLabel>\n                <FormControl>\n                  <Input {...field} placeholder=\"e.g. X-Webhook-Secret\" />\n                </FormControl>\n                <FormMessage />\n              </FormItem>\n            )}\n          />\n        </div>\n        <div className=\"flex-1\">\n          <FormField\n            control={form.control}\n            name=\"config.webhookSecret\"\n            render={({ field }) => (\n              <FormItem>\n                <FormLabel>Secret Value</FormLabel>\n                <FormControl>\n                  <PasswordInput {...field} placeholder=\"e.g. webhook-secret\" />\n                </FormControl>\n                <FormMessage />\n              </FormItem>\n            )}\n          />\n        </div>\n      </div>\n      <p className=\"text-xs text-muted-foreground mt-2\">\n        If provided, the secret will be sent in the specified header (defaults\n        to <code>X-Webhook-Secret</code>).\n      </p>\n    </>\n  );\n};\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/channels/channel/channel-form/providers/notifications/forms/webhook.schema.ts",
    "content": "import {z} from \"zod\";\n\nexport const WebhookChannelConfigSchema = z.object({\n    webhookUrl: z.string().url(\"Must be a valid URL\"),\n    webhookSecretHeader: z.string().optional(),\n    webhookSecret: z.string().optional(),\n});\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/channels/channel/channel-form/providers/storages/action.ts",
    "content": "\"use server\";\n\nimport {z} from \"zod\";\nimport {ServerActionResult} from \"@/types/action-type\";\nimport * as drizzleDb from \"@/db\";\nimport {userAction} from \"@/lib/safe-actions/actions\";\nimport {db} from \"@/db\";\nimport {and, eq} from \"drizzle-orm\";\nimport {withUpdatedAt} from \"@/db/utils\";\nimport {\n    StorageChannelFormSchema\n} from \"@/components/wrappers/dashboard/admin/channels/channel/channel-form/channel-form.schema\";\nimport {StorageChannel} from \"@/db/schema/12_storage-channel\";\n\n\nexport const addStorageChannelAction = userAction.schema(\n    z.object({\n        organizationId: z.string().optional(),\n        data: StorageChannelFormSchema\n    })\n).action(async ({parsedInput}): Promise<ServerActionResult<StorageChannel>> => {\n    const {organizationId, data} = parsedInput;\n\n    try {\n        const [channel] = await db\n            .insert(drizzleDb.schemas.storageChannel)\n            .values({\n                provider: data.provider,\n                name: data.name,\n                config: data.config,\n                enabled: data.enabled ?? true,\n                organizationId: organizationId ?? null\n            })\n            .returning();\n\n        if (organizationId) {\n            await db.insert(drizzleDb.schemas.organizationStorageChannel).values({\n                organizationId,\n                storageChannelId: channel.id,\n            });\n        }\n\n        return {\n            success: true,\n            value: {\n                ...channel,\n                config: channel.config as JSON\n            },\n            actionSuccess: {\n                message: \"Storage channel has been successfully created.\",\n                messageParams: {id: channel.id},\n            },\n        };\n    } catch (error) {\n        console.error(\"Error:\", error);\n        return {\n            success: false,\n            actionError: {\n                message: \"Failed to create storage channel.\",\n                status: 500,\n                cause: error instanceof Error ? error.message : \"Unknown error\",\n                messageParams: {id: \"\"},\n            },\n        };\n    }\n});\n\nexport const removeStorageChannelAction = userAction.schema(\n    z.object({\n        organizationId: z.string().optional(),\n        id: z.string(),\n    })\n).action(async ({parsedInput}): Promise<ServerActionResult<StorageChannel>> => {\n    const {organizationId, id} = parsedInput;\n\n    try {\n        if (organizationId) {\n            await db\n                .delete(drizzleDb.schemas.organizationStorageChannel)\n                .where(\n                    and(\n                        eq(drizzleDb.schemas.organizationStorageChannel.organizationId, organizationId),\n                        eq(drizzleDb.schemas.organizationStorageChannel.storageChannelId, id)\n                    )\n                );\n        }\n\n        const [deletedChannel] = await db\n            .delete(drizzleDb.schemas.storageChannel)\n            .where(eq(drizzleDb.schemas.storageChannel.id, id))\n            .returning();\n\n        if (!deletedChannel) {\n            return {\n                success: false,\n                actionError: {\n                    message: \"Storage channel not found.\",\n                    status: 404,\n                    messageParams: {id: id},\n                },\n            };\n        }\n\n        return {\n            success: true,\n            value: {\n                ...deletedChannel,\n                config: deletedChannel.config as JSON\n            },\n            actionSuccess: {\n                message: \"Storage channel has been successfully removed.\",\n                messageParams: {id: id},\n            },\n        };\n    } catch (error) {\n        console.error(\"Error:\", error);\n        return {\n            success: false,\n            actionError: {\n                message: \"Failed to remove storage channel.\",\n                status: 500,\n                cause: error instanceof Error ? error.message : \"Unknown error\",\n                messageParams: {id: id},\n            },\n        };\n    }\n});\n\n\nexport const updateStorageChannelAction = userAction.schema(\n    z.object({\n        id: z.string(),\n        data: StorageChannelFormSchema\n    })\n).action(async ({parsedInput}): Promise<ServerActionResult<StorageChannel>> => {\n    const {id, data} = parsedInput;\n\n    try {\n        const [channel] = await db\n            .update(drizzleDb.schemas.storageChannel)\n            .set(withUpdatedAt({\n                provider: data.provider,\n                name: data.name,\n                config: data.config,\n                enabled: data.enabled ?? true,\n            }))\n            .where(eq(drizzleDb.schemas.storageChannel.id, id))\n            .returning();\n\n        return {\n            success: true,\n            value: {\n                ...channel,\n                config: channel.config as JSON\n            },\n            actionSuccess: {\n                message: `Storage channel \"${channel.name}\" has been successfully updated.`,\n                messageParams: {id: channel.id},\n            },\n        };\n    } catch (error) {\n        console.error(\"Error:\", error);\n        return {\n            success: false,\n            actionError: {\n                message: \"Failed to update storage channel.\",\n                status: 500,\n                cause: error instanceof Error ? error.message : \"Unknown error\",\n                messageParams: {id: \"\"},\n            },\n        };\n    }\n});\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/channels/channel/channel-form/providers/storages/forms/google-drive/helpers.ts",
    "content": "\"use server\"\nimport {userAction} from \"@/lib/safe-actions/actions\";\nimport {z} from \"zod\";\nimport {ServerActionResult} from \"@/types/action-type\";\n\n\nexport const googleDriveRefreshTokenAction = userAction.schema(\n    z.object({\n        code: z.string(),\n        clientId: z.string(),\n        clientSecret: z.string(),\n        redirectUri: z.string(),\n    })).action(async ({parsedInput}): Promise<ServerActionResult<string>> => {\n        const {code, clientId, clientSecret, redirectUri} = parsedInput;\n\n        try {\n\n            const tokenRes = await fetch(\"https://oauth2.googleapis.com/token\", {\n                method: \"POST\",\n                headers: { \"Content-Type\": \"application/x-www-form-urlencoded\" },\n                body: new URLSearchParams({\n                    client_id: clientId,\n                    client_secret: clientSecret,\n                    code: code,\n                    grant_type: \"authorization_code\",\n                    redirect_uri: redirectUri,\n                }),\n            });\n\n            const tokens = await tokenRes.json();\n\n            return {\n                success: true,\n                value: tokens.refresh_token,\n                actionSuccess: {\n                    message: \"Refresh token successfully fetched\",\n                    messageParams: {code: code},\n                },\n            };\n        }catch {\n            return {\n                success: false,\n                actionError: {\n                    message: \"An error occurred\",\n                    status: 404,\n                    messageParams: {code: code},\n                },\n            };\n        }\n\n\n});\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/channels/channel/channel-form/providers/storages/forms/google-drive.form.tsx",
    "content": "\"use client\";\n\nimport {UseFormReturn} from \"react-hook-form\";\nimport {FormControl, FormField, FormItem, FormLabel, FormMessage} from \"@/components/ui/form\";\nimport {Input} from \"@/components/ui/input\";\nimport {Separator} from \"@/components/ui/separator\";\nimport {Button} from \"@/components/ui/button\";\nimport {PasswordInput} from \"@/components/ui/password-input\";\nimport {\n    googleDriveRefreshTokenAction\n} from \"@/components/wrappers/dashboard/admin/channels/channel/channel-form/providers/storages/forms/google-drive/helpers\";\nimport {toast} from \"sonner\";\n\ntype StorageGoogleDriveFormProps = {\n    form: UseFormReturn<any>;\n};\n\nexport const StorageGoogleDriveForm = ({form}: StorageGoogleDriveFormProps) => {\n    const refreshToken = form.watch(\"config.refreshToken\");\n    const isConnected = Boolean(refreshToken);\n\n    const handleConnect = () => {\n        const clientId = form.getValues(\"config.clientId\");\n        const clientSecret = form.getValues(\"config.clientSecret\");\n        const redirectUri = `${window.location.origin}/api/google/drive/callback`;\n\n        if (!clientId || !clientSecret) {\n            form.setError(\"config.clientId\", {message: \"Client ID and Secret are required\"});\n            return;\n        }\n\n        const scope = encodeURIComponent(\"https://www.googleapis.com/auth/drive.file\");\n        const oauthUrl =\n            `https://accounts.google.com/o/oauth2/v2/auth` +\n            `?client_id=${clientId}` +\n            `&redirect_uri=${encodeURIComponent(redirectUri)}` +\n            `&response_type=code` +\n            `&scope=${scope}` +\n            `&access_type=offline` +\n            `&prompt=consent`;\n\n        const oauthWindow = window.open(oauthUrl, \"_blank\", \"width=500,height=600\");\n\n        const interval = setInterval(async () => {\n            try {\n                if (!oauthWindow || oauthWindow.closed) {\n                    clearInterval(interval);\n                    return;\n                }\n\n                if (oauthWindow.location.href.startsWith(redirectUri)) {\n                    const code = new URL(oauthWindow.location.href).searchParams.get(\"code\");\n                    if (!code) return;\n\n                    const result = await googleDriveRefreshTokenAction({\n                        code,\n                        clientId,\n                        clientSecret,\n                        redirectUri,\n                    });\n                    const inner = result?.data;\n\n                    if (inner?.success) {\n                        toast.success(inner.actionSuccess?.message);\n\n                        if (!inner.value) {\n                            form.setError(\"config\", {message: \"OAuth succeeded but no refresh token returned\"});\n                            return;\n                        }\n\n                        form.setValue(\"config.refreshToken\", inner.value, {\n                            shouldValidate: true,\n                            shouldDirty: true,\n                        });\n\n                    } else {\n                        toast.error(inner?.actionError?.message);\n                    }\n\n\n                    oauthWindow.close();\n                    clearInterval(interval);\n                }\n            } catch {\n                // Ignore cross-origin errors until redirect\n            }\n        }, 500);\n    };\n\n    return (\n        <>\n            <Separator className=\"my-1\"/>\n\n            <FormField\n                control={form.control}\n                name=\"config.clientId\"\n                render={({field}) => (\n                    <FormItem>\n                        <FormLabel>Client ID *</FormLabel>\n                        <FormControl>\n                            <Input {...field} placeholder=\"e.g. xxxx.apps.googleusercontent.com\"/>\n                        </FormControl>\n                        <FormMessage/>\n                    </FormItem>\n                )}\n            />\n\n            <FormField\n                control={form.control}\n                name=\"config.clientSecret\"\n                render={({field}) => (\n                    <FormItem>\n                        <FormLabel>Client Secret *</FormLabel>\n                        <FormControl>\n                            <PasswordInput {...field} />\n                        </FormControl>\n                        <FormMessage/>\n                    </FormItem>\n                )}\n            />\n\n            <FormField\n                control={form.control}\n                name=\"config.folderId\"\n                render={({field}) => (\n                    <FormItem>\n                        <FormLabel>Folder ID *</FormLabel>\n                        <FormControl>\n                            <Input {...field} placeholder=\"e.g. 1AbCdEfGhIjKlMnOpQrStUvWxYz\"/>\n                        </FormControl>\n                        <FormMessage/>\n                    </FormItem>\n                )}\n            />\n\n            <input type=\"hidden\" {...form.register(\"config.refreshToken\")} />\n\n            <div className=\"flex items-center gap-3\">\n                <Button type=\"button\" variant={\"secondary\"} className=\"hover:cursor-pointer\" onClick={handleConnect}>\n                    {isConnected ? \"Reconnect Google Drive\" : \"Connect Google Drive\"}\n                </Button>\n\n                {isConnected && (\n                    <span className=\"text-sm text-green-600 font-medium\">\n            Google Drive connected\n          </span>\n                )}\n            </div>\n        </>\n    );\n};\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/channels/channel/channel-form/providers/storages/forms/google-drive.schema.ts",
    "content": "import {z} from \"zod\";\n\nexport const GoogleDriveChannelConfigSchema = z.object({\n    clientId: z.string().min(1, \"Client ID is required\"),\n    clientSecret: z.string().min(1, \"Client Secret is required\"),\n    folderId: z.string().min(1, \"Folder ID is required\"),\n    refreshToken: z.string().optional(),\n});\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/channels/channel/channel-form/providers/storages/forms/local.schema.ts",
    "content": "import {z} from \"zod\";\n\nexport const LocalChannelConfigSchema = z.object({});\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/channels/channel/channel-form/providers/storages/forms/s3.form.tsx",
    "content": "import { UseFormReturn } from \"react-hook-form\";\nimport {\n  FormControl,\n  FormField,\n  FormItem,\n  FormLabel,\n  FormMessage,\n} from \"@/components/ui/form\";\nimport { Input } from \"@/components/ui/input\";\nimport { Separator } from \"@/components/ui/separator\";\nimport { PasswordInput } from \"@/components/ui/password-input\";\nimport { Switch } from \"@/components/ui/switch\";\n\ntype StorageS3FormProps = {\n  form: UseFormReturn<any, any, any>;\n};\n\nexport const StorageS3Form = ({ form }: StorageS3FormProps) => {\n  return (\n    <>\n      <Separator className=\"my-1\" />\n      <FormField\n        control={form.control}\n        name=\"config.endPointUrl\"\n        render={({ field }) => (\n          <FormItem>\n            <FormLabel>Endpoint URL *</FormLabel>\n            <FormControl>\n              <Input {...field} placeholder=\"e.g. s3.amazonaws.com\" />\n            </FormControl>\n            <FormMessage />\n          </FormItem>\n        )}\n      />\n      <FormField\n        control={form.control}\n        name=\"config.region\"\n        render={({ field }) => (\n          <FormItem>\n            <FormLabel>Region</FormLabel>\n            <FormControl>\n              <Input {...field} placeholder=\"e.g. us-east-1\" />\n            </FormControl>\n            <FormMessage />\n          </FormItem>\n        )}\n      />\n      <FormField\n        control={form.control}\n        name=\"config.accessKey\"\n        render={({ field }) => (\n          <FormItem>\n            <FormLabel>Access Key *</FormLabel>\n            <FormControl>\n              <Input {...field} placeholder=\"e.g. AKIA...\" />\n            </FormControl>\n            <FormMessage />\n          </FormItem>\n        )}\n      />\n      <FormField\n        control={form.control}\n        name=\"config.secretKey\"\n        render={({ field }) => (\n          <FormItem>\n            <FormLabel>Secret Key *</FormLabel>\n            <FormControl>\n              <PasswordInput {...field} placeholder=\"e.g. s3-secret-key\" />\n            </FormControl>\n            <FormMessage />\n          </FormItem>\n        )}\n      />\n      <FormField\n        control={form.control}\n        name=\"config.bucketName\"\n        render={({ field }) => (\n          <FormItem>\n            <FormLabel>Bucket name *</FormLabel>\n            <FormControl>\n              <Input {...field} placeholder=\"e.g. backups-prod\" />\n            </FormControl>\n            <FormMessage />\n          </FormItem>\n        )}\n      />\n      <FormField\n        control={form.control}\n        name=\"config.port\"\n        render={({ field }) => (\n          <FormItem>\n            <FormLabel>Port</FormLabel>\n            <FormControl>\n              <Input {...field} type=\"number\" placeholder=\"e.g. 443\" />\n            </FormControl>\n            <FormMessage />\n          </FormItem>\n        )}\n      />\n\n      <FormField\n        control={form.control}\n        name=\"config.ssl\"\n        render={({ field }) => (\n          <FormItem>\n            <FormLabel>Use SSL</FormLabel>\n            <FormControl>\n              <Switch checked={field.value} onCheckedChange={field.onChange} />\n            </FormControl>\n            <FormMessage />\n          </FormItem>\n        )}\n      />\n    </>\n  );\n};\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/channels/channel/channel-form/providers/storages/forms/s3.schema.ts",
    "content": "import {z} from \"zod\";\n\nexport const S3ChannelConfigSchema = z.object({\n    endPointUrl: z.string().min(1, \"Endpoint URL is required\"),\n    region: z.string().optional(),\n    accessKey: z.string().min(1, \"Access Key is required\"),\n    secretKey: z.string().min(1, \"Secret Key is required\"),\n    bucketName: z.string().min(1, \"Bucket name is required\"),\n    port: z.union([\n        z.literal(\"\").transform(() => \"\"),\n        z.literal(\"\").transform(() => \"\"),\n        z.coerce.number()\n    ]).optional(),\n    ssl: z.boolean().optional().default(true),\n});\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/channels/channels-section.tsx",
    "content": "\"use client\";\nimport { NotificationChannelWith } from \"@/db/schema/09_notification-channel\";\nimport { CardsWithPagination } from \"@/components/wrappers/common/cards-with-pagination\";\nimport { useState } from \"react\";\nimport { EmptyStatePlaceholder } from \"@/components/wrappers/common/empty-state-placeholder\";\nimport { OrganizationWithMembers } from \"@/db/schema/03_organization\";\nimport { StorageChannelWith } from \"@/db/schema/12_storage-channel\";\nimport { ChannelCard } from \"@/components/wrappers/dashboard/admin/channels/channel/channel-card/channel-card\";\nimport { ChannelAddEditModal } from \"@/components/wrappers/dashboard/admin/channels/channel/channel-add-edit-modal\";\nimport {\n  ChannelKind,\n  getChannelTextBasedOnKind,\n} from \"@/components/wrappers/dashboard/admin/channels/helpers/common\";\n\ntype ChannelsSectionProps = {\n  channels: NotificationChannelWith[] | StorageChannelWith[];\n  organizations: OrganizationWithMembers[];\n  kind: ChannelKind;\n  defaultStorageChannelId?: string | null | undefined;\n};\n\nexport const ChannelsSection = ({\n  organizations,\n  channels,\n  kind,\n  defaultStorageChannelId,\n}: ChannelsSectionProps) => {\n  const [isAddModalOpen, setIsAddModalOpen] = useState(false);\n  const channelText = getChannelTextBasedOnKind(kind);\n  const hasChannels = channels.length > 0;\n\n  return (\n    <div className=\"h-full\">\n      <ChannelAddEditModal\n        kind={kind}\n        open={isAddModalOpen}\n        onOpenChangeAction={setIsAddModalOpen}\n        adminView={false}\n        trigger={false}\n      />\n      {hasChannels ? (\n        <div className=\"h-full\">\n          <CardsWithPagination\n            data={channels}\n            cardItem={ChannelCard}\n            cardsPerPage={8}\n            numberOfColumns={2}\n            adminView={true}\n            organizations={organizations}\n            kind={kind}\n            defaultStorageChannelId={defaultStorageChannelId}\n          />\n        </div>\n      ) : (\n        <EmptyStatePlaceholder\n          text={`No ${channelText} channels configured yet`}\n          onClick={() => {\n            setIsAddModalOpen(true);\n          }}\n          className=\"h-full\"\n        />\n      )}\n    </div>\n  );\n};\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/channels/helpers/common.tsx",
    "content": "import {UseFormReturn} from \"react-hook-form\";\nimport {\n    NotifierSmtpForm\n} from \"@/components/wrappers/dashboard/admin/channels/channel/channel-form/providers/notifications/forms/smtp.form\";\nimport {\n    NotifierSlackForm\n} from \"@/components/wrappers/dashboard/admin/channels/channel/channel-form/providers/notifications/forms/slack.form\";\nimport {\n    NotifierDiscordForm\n} from \"@/components/wrappers/dashboard/admin/channels/channel/channel-form/providers/notifications/forms/discord.form\";\nimport {\n    NotifierTelegramForm\n} from \"@/components/wrappers/dashboard/admin/channels/channel/channel-form/providers/notifications/forms/telegram.form\";\nimport {\n    NotifierGotifyForm\n} from \"@/components/wrappers/dashboard/admin/channels/channel/channel-form/providers/notifications/forms/gotify.form\";\nimport {\n    NotifierNtfyForm\n} from \"@/components/wrappers/dashboard/admin/channels/channel/channel-form/providers/notifications/forms/ntfy.form\";\nimport {\n    NotifierWebhookForm\n} from \"@/components/wrappers/dashboard/admin/channels/channel/channel-form/providers/notifications/forms/webhook.form\";\nimport {\n    notificationProviders,\n} from \"@/components/wrappers/dashboard/admin/channels/helpers/notification\";\nimport {storageProviders} from \"@/components/wrappers/dashboard/admin/channels/helpers/storage\";\nimport {ForwardRefExoticComponent, JSX, RefAttributes, SVGProps} from \"react\";\nimport {LucideProps} from \"lucide-react\";\nimport {\n    StorageS3Form\n} from \"@/components/wrappers/dashboard/admin/channels/channel/channel-form/providers/storages/forms/s3.form\";\nimport {\n    StorageGoogleDriveForm\n} from \"@/components/wrappers/dashboard/admin/channels/channel/channel-form/providers/storages/forms/google-drive.form\";\n\nexport type ChannelKind = \"notification\" | \"storage\";\n\nexport function getChannelTextBasedOnKind(kind: ChannelKind) {\n    switch (kind) {\n        case \"notification\":\n            return \"Notification\";\n        case \"storage\":\n            return \"Storage\";\n        default:\n            return \"Notification\";\n    }\n}\n\n\nexport type ProviderIconTypes = {\n    value: string\n    label: string\n    icon: ForwardRefExoticComponent<Omit<LucideProps, \"ref\"> & RefAttributes<SVGSVGElement>>\n    preview?: boolean\n} | {\n    value: string\n    label: string\n    icon: (props: SVGProps<SVGSVGElement>) => JSX.Element\n    preview?: boolean\n}\n\nexport const providerIcons: ProviderIconTypes[] = [\n    ...notificationProviders,\n    ...storageProviders,\n];\n\n\nexport const getChannelIcon = (type: string) => {\n    const Icon = providerIcons.find((t) => t.value === type)?.icon\n    return Icon ? <Icon className=\"h-4 w-4\"/> : null\n}\n\n\nexport const renderChannelForm = (provider: string | undefined, form: UseFormReturn<any>) => {\n    switch (provider) {\n        case \"smtp\":\n            return <NotifierSmtpForm form={form}/>;\n        case \"slack\":\n            return <NotifierSlackForm form={form}/>;\n        case \"discord\":\n            return <NotifierDiscordForm form={form}/>;\n        case \"telegram\":\n            return <NotifierTelegramForm form={form}/>;\n        case \"gotify\":\n            return <NotifierGotifyForm form={form}/>;\n        case \"ntfy\":\n            return <NotifierNtfyForm form={form}/>;\n        case \"webhook\":\n            return <NotifierWebhookForm form={form}/>;\n        case \"s3\":\n            return <StorageS3Form form={form}/>\n        case \"google-drive\":\n            return <StorageGoogleDriveForm form={form}/>\n        case \"local\":\n            return <></>\n        default:\n            return null;\n    }\n};"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/channels/helpers/notification.tsx",
    "content": "import {Mail} from \"lucide-react\";\nimport type { SVGProps } from 'react';\nimport {ProviderIconTypes} from \"@/components/wrappers/dashboard/admin/channels/helpers/common\";\n\n\n\n\nexport const notificationProviders: ProviderIconTypes[] = [\n    {value: \"smtp\", label: \"Email\", icon: Mail},\n    {value: \"slack\", label: \"Slack\", icon: SlackIcon},\n    {value: \"discord\", label: \"Discord\", icon: DiscordIcon},\n    {value: \"telegram\", label: \"Telegram\", icon: TelegramIcon},\n    {value: \"gotify\", label: \"Gotify\", icon: GotifyIcon},\n    {value: \"ntfy\", label: \"ntfy.sh\", icon: NtfyIcon},\n    {value: \"webhook\", label: \"Webhook\", icon: WebhookIcon},\n    {value: \"microsoft-teams\", label: \"Microsoft Teams\", icon: MSTeamsIcon, preview: true}\n]\n\n\nexport function SlackIcon(props: SVGProps<SVGSVGElement>) {\n    return (<svg xmlns=\"http://www.w3.org/2000/svg\" width={256} height={256} viewBox=\"0 0 256 256\" {...props}><path fill=\"#e01e5a\" d=\"M53.841 161.32c0 14.832-11.987 26.82-26.819 26.82S.203 176.152.203 161.32c0-14.831 11.987-26.818 26.82-26.818H53.84zm13.41 0c0-14.831 11.987-26.818 26.819-26.818s26.819 11.987 26.819 26.819v67.047c0 14.832-11.987 26.82-26.82 26.82c-14.83 0-26.818-11.988-26.818-26.82z\"></path><path fill=\"#36c5f0\" d=\"M94.07 53.638c-14.832 0-26.82-11.987-26.82-26.819S79.239 0 94.07 0s26.819 11.987 26.819 26.819v26.82zm0 13.613c14.832 0 26.819 11.987 26.819 26.819s-11.987 26.819-26.82 26.819H26.82C11.987 120.889 0 108.902 0 94.069c0-14.83 11.987-26.818 26.819-26.818z\"></path><path fill=\"#2eb67d\" d=\"M201.55 94.07c0-14.832 11.987-26.82 26.818-26.82s26.82 11.988 26.82 26.82s-11.988 26.819-26.82 26.819H201.55zm-13.41 0c0 14.832-11.988 26.819-26.82 26.819c-14.831 0-26.818-11.987-26.818-26.82V26.82C134.502 11.987 146.489 0 161.32 0s26.819 11.987 26.819 26.819z\"></path><path fill=\"#ecb22e\" d=\"M161.32 201.55c14.832 0 26.82 11.987 26.82 26.818s-11.988 26.82-26.82 26.82c-14.831 0-26.818-11.988-26.818-26.82V201.55zm0-13.41c-14.831 0-26.818-11.988-26.818-26.82c0-14.831 11.987-26.818 26.819-26.818h67.25c14.832 0 26.82 11.987 26.82 26.819s-11.988 26.819-26.82 26.819z\"></path></svg>);\n}\n\nexport function DiscordIcon(props: SVGProps<SVGSVGElement>) {\n    return (<svg xmlns=\"http://www.w3.org/2000/svg\" width={256} height={199} viewBox=\"0 0 256 199\" {...props}><path fill=\"#5865f2\" d=\"M216.856 16.597A208.5 208.5 0 0 0 164.042 0c-2.275 4.113-4.933 9.645-6.766 14.046q-29.538-4.442-58.533 0c-1.832-4.4-4.55-9.933-6.846-14.046a207.8 207.8 0 0 0-52.855 16.638C5.618 67.147-3.443 116.4 1.087 164.956c22.169 16.555 43.653 26.612 64.775 33.193A161 161 0 0 0 79.735 175.3a136.4 136.4 0 0 1-21.846-10.632a109 109 0 0 0 5.356-4.237c42.122 19.702 87.89 19.702 129.51 0a132 132 0 0 0 5.355 4.237a136 136 0 0 1-21.886 10.653c4.006 8.02 8.638 15.67 13.873 22.848c21.142-6.58 42.646-16.637 64.815-33.213c5.316-56.288-9.08-105.09-38.056-148.36M85.474 135.095c-12.645 0-23.015-11.805-23.015-26.18s10.149-26.2 23.015-26.2s23.236 11.804 23.015 26.2c.02 14.375-10.148 26.18-23.015 26.18m85.051 0c-12.645 0-23.014-11.805-23.014-26.18s10.148-26.2 23.014-26.2c12.867 0 23.236 11.804 23.015 26.2c0 14.375-10.148 26.18-23.015 26.18\"></path></svg>);\n}\n\nexport function TelegramIcon(props: SVGProps<SVGSVGElement>) {\n    return (<svg xmlns=\"http://www.w3.org/2000/svg\" width={256} height={256} viewBox=\"0 0 256 256\" {...props}><defs><linearGradient id=\"SVGuySfwdaH\" x1=\"50%\" x2=\"50%\" y1=\"0%\" y2=\"100%\"><stop offset=\"0%\" stopColor=\"#2aabee\"></stop><stop offset=\"100%\" stopColor=\"#229ed9\"></stop></linearGradient></defs><path fill=\"url(#SVGuySfwdaH)\" d=\"M128 0C94.06 0 61.48 13.494 37.5 37.49A128.04 128.04 0 0 0 0 128c0 33.934 13.5 66.514 37.5 90.51C61.48 242.506 94.06 256 128 256s66.52-13.494 90.5-37.49c24-23.996 37.5-56.576 37.5-90.51s-13.5-66.514-37.5-90.51C194.52 13.494 161.94 0 128 0\"></path><path fill=\"#fff\" d=\"M57.94 126.648q55.98-24.384 74.64-32.152c35.56-14.786 42.94-17.354 47.76-17.441c1.06-.017 3.42.245 4.96 1.49c1.28 1.05 1.64 2.47 1.82 3.467c.16.996.38 3.266.2 5.038c-1.92 20.24-10.26 69.356-14.5 92.026c-1.78 9.592-5.32 12.808-8.74 13.122c-7.44.684-13.08-4.912-20.28-9.63c-11.26-7.386-17.62-11.982-28.56-19.188c-12.64-8.328-4.44-12.906 2.76-20.386c1.88-1.958 34.64-31.748 35.26-34.45c.08-.338.16-1.598-.6-2.262c-.74-.666-1.84-.438-2.64-.258c-1.14.256-19.12 12.152-54 35.686c-5.1 3.508-9.72 5.218-13.88 5.128c-4.56-.098-13.36-2.584-19.9-4.708c-8-2.606-14.38-3.984-13.82-8.41c.28-2.304 3.46-4.662 9.52-7.072\"></path></svg>);\n}\n\n\nexport function NtfyIcon(props: SVGProps<SVGSVGElement>) {\n\n    return (  <svg\n        xmlns=\"http://www.w3.org/2000/svg\"\n        xmlSpace=\"preserve\"\n        id=\"Layer_1\"\n        x={0}\n        y={0}\n        viewBox=\"0 0 512 512\"\n        {...props}\n    >\n        <style>{\".st1{fill:#fff}\"}</style>\n        <linearGradient\n            id=\"SVGID_1_\"\n            x1={115.045}\n            x2={142.93}\n            y1={512.747}\n            y2={491.741}\n            gradientTransform=\"matrix(15.8584 0 0 -15.8584 -1816.246 8200.18)\"\n            gradientUnits=\"userSpaceOnUse\"\n        >\n            <stop\n                offset={0}\n                style={{\n                    stopColor: \"#348878\",\n                }}\n            />\n            <stop\n                offset={1}\n                style={{\n                    stopColor: \"#56bda8\",\n                }}\n            />\n        </linearGradient>\n        <path\n            d=\"M441.8 64.8H84.7c-24.5 0-44.6 19-44.6 42.1l.3 285.3-6.7 38.4 95.6-28.8h312.4c24.5 0 44.6-19 44.6-42.1V106.9c.1-23.2-20-42.1-44.5-42.1\"\n            style={{\n                fill: \"url(#SVGID_1_)\",\n            }}\n        />\n        <path\n            d=\"M78.1 32.7C40.9 32.7 9 62 9 99.2l.4 311.2-9.4 69 127.1-33.8H443c37.2 0 69.1-29.3 69.1-66.5V99.2c0-37.2-31.9-66.5-69-66.5zm0 46.9H443c13.1 0 22.1 9.5 22.1 19.6V379c0 10-9 19.8-22.1 19.6H120.2l-64.6 19.5.7-3.8-.4-315.1c0-10.1 9.1-19.6 22.2-19.6\"\n            className=\"st1\"\n        />\n        <path\n            d=\"M116.4 310.9v-34.8l73.1-38.7c2.4-1.2 4.6-2.1 6.8-2.7 2.3-.8 4.5-1.4 6.3-1.8l6-.6V230q-3-.3-6-1.2-2.85-.6-6.3-1.5c-2.2-.8-4.5-1.8-6.8-3l-73.1-38.7v-35.1l113 61.5v37.4z\"\n            className=\"st1\"\n        />\n        <path\n            d=\"M110.5 139.7v50.4l76.6 40.6.5.2-.5.2-76.6 40.6v50.1l8.2-4.5L235.1 254v-46.4zm11.8 21.7 101.2 55.1V245l-101.2 55.1v-19.4l69.6-36.8.1-.1c1.9-1 3.8-1.7 5.8-2.3h.1l.2-.1c2.1-.7 3.9-1.2 5.5-1.6l11.1-1.1v-15.2l-5.4-.5c-1.7-.2-3.5-.5-5.1-1.1h-.2l-.2-.1c-2-.4-3.9-.9-5.9-1.4-2-.7-4-1.6-5.9-2.6l-.1-.1-69.6-36.7zm152.3 137.4h120.7v32.6H274.6z\"\n            className=\"st1\"\n        />\n        <path\n            d=\"M268.7 292.1v46h132.4v-46zm11.7 13.4h109v19.2h-109z\"\n            className=\"st1\"\n        />\n    </svg>)\n\n}\n\n\nexport function GotifyIcon(props: SVGProps<SVGSVGElement>) {\n\n    return (\n        <svg\n            xmlns=\"http://www.w3.org/2000/svg\"\n            xmlSpace=\"preserve\"\n            id=\"Layer_2\"\n            x={0}\n            y={0}\n            viewBox=\"46.6 113.46 377.2 307.81\"\n            {...props}\n        >\n            <style>\n                {\n                    \".st0{fill:#ddcba2}.st0,.st1,.st2,.st4,.st5{stroke:#000;stroke-width:2;stroke-linecap:round;stroke-miterlimit:10}.st1{fill:#71caee}.st2{fill:#fff}.st4{fill:#f0f0f0}.st5{fill:none}\"\n                }\n            </style>\n            <switch>\n                <foreignObject\n                    width={1}\n                    height={1}\n                    x={0}\n                    y={0}\n                    requiredExtensions=\"http://ns.adobe.com/AdobeIllustrator/10.0/\"\n                />\n                <g>\n                    <path\n                        d=\"M317.7 376.2c6.2-1.7 15.8 0 19.5 3.2 5.5 4.8 4.9 20.9 1.1 29-.8 1.7-1.8 3.4-3.2 4.4s-3.4 1.2-4.7 0-1.7-3.3-1.9-5.2c-.2-3.1-.2-6.2.3-9.2.2-1.3.2-2.9-.2-4.2-.6-2.2-2.5-3.1-4.5-3.5-3.4-.8-14.3-.7-19.5-.7-.8 0 1.5-9.1 2-9.7 2.6-2.9 7.5-3.1 11.1-4.1z\"\n                        className=\"st0\"\n                    />\n                    <path\n                        d=\"m258.9 119.7-9-2.7c-4.6-1.4-9.2-2.8-14-2.5-2.8.2-6.1 1.3-6.9 4-.6 2-1.6 7.3-1.3 7.9 1.5 3.4 13.9 6.7 18.3 6.7\"\n                        className=\"st1\"\n                    />\n                    <path d=\"M392.6 177.9c-1.4 1.4-2.2 3.5-2.5 5.5-.2 1.4-.1 3 .5 4.3s1.8 2.3 3.1 3c1.3.6 2.8.9 4.3.9 1.1 0 2.3-.1 3.1-.9.6-.7.8-1.6.9-2.5.2-2.3-.1-4.7-.9-6.9-.4-1.1-.9-2.3-1.8-3.1-1.7-1.8-4.5-2.2-6.4-.5-.1 0-.2.1-.3.2\" />\n                    <path\n                        d=\"M358.5 164.2c-1-1 0-2.7 1-3.7 5.8-5.2 15.1-4.6 21.8-.6 10.9 6.6 15.6 19.9 17.2 32.5.6 5.2.9 10.6-.5 15.7s-4.6 9.9-9.3 12.1c-1.1.5-2.3.9-3.4.5s-1.9-1.8-1.2-2.8c-9.4-13.6-19-26.8-20.9-43.2-.5-4.1-1.8-7.4-4.7-10.5z\"\n                        className=\"st2\"\n                    />\n                    <path\n                        d=\"M134.7 328.4c-5.1-3.1-9.9-6.6-14.3-10.6-1.3-1.2-2.6-2.5-2.6-4.3 0-1.2.6-2.2 1.2-3.2.8-1.4 1.7-2.8 2.5-4.1 1.1-1.8 2.9-3.9 4.9-3.2.9.3 1.5 1.1 2 1.8 2.4 3.3 4.9 6.6 7.3 9.8 1.5 2 3.7 4.3 6.1 3.5\"\n                        className=\"st1\"\n                    />\n                    <path\n                        d=\"M209.6 133c33.2-18 77.8-19.6 111.5-8.7 24.3 7.9 43.4 26.7 53.3 50 8.7 20.6 10.5 43.6 8.1 65.7-4.4 40.2-20.2 77.9-40.3 112.6-11.1 19-21.8 36-40.5 48.5-36.8 24.6-87.2 22.1-128.4 11.5-19.9-5.1-39.7-17.3-47.2-37.3-4.8-12.8-4.2-27.6 1.5-40 11.6-24.8 43.2-38.4 45.6-67.9.7-8.7-1.6-17.3-3.6-25.7-5.6-23.4-8.9-45.8 1.4-68.7 8.1-17.7 21.9-31 38.6-40z\"\n                        className=\"st1\"\n                    />\n                    <path\n                        d=\"M189.8 151.4c-5.4-5.2-11.9-8.8-19-10.3-2.2-.5-4.7-.7-6.9.7-1.8 1.2-3.1 3.3-4.2 5.3-1.6 3-3 6.2-4.1 9.4-.4 1.2-.6 2.5 0 3.5.3.6.9.9 1.5 1.2 8.1 4.2 16.8 7.1 25.5 9.8\"\n                        className=\"st1\"\n                    />\n                    <path\n                        d=\"M183.7 158.7c-2.5-1.8-16.8-12.1-18.7-4.8-.4 1.6.5 3.9 1.5 4.8\"\n                        className=\"st1\"\n                    />\n                    <path\n                        d=\"M264.5 174.9c-.5.5-.9 1-1.3 1.6-9 11.6-12 27.9-9.3 42.1 1.7 9 5.9 17.9 13.2 23.4 19.3 14.6 51.5 13.5 68.4-1.5 24.4-21.7 13-67.6-14-78.8-17.6-7.2-43.7-1.6-57 13.2zm117.6 62.2c1.4-.1 2.9-.1 4.3.1.3 0 .7.1 1 .4.2.3.4.7.5 1.1 1 3.9.5 8.2.1 12.4-.1.9-.2 1.8-.6 2.6-1 2.1-3.1 2.7-4.7 2.7-.1 0-.2 0-.3-.1-.3-.2-.3-.7-.2-1.2.3-5.9-.1-11.9-.1-18q0 .15 0 0z\"\n                        className=\"st2\"\n                    />\n                    <path\n                        d=\"M378.7 236.8c-1.4.4-2.5 2-2.8 4.4-.5 4.4-.7 8.9-.5 13.4 0 .9.1 1.9.5 2.4.2.3.5.4.8.4 1.6.3 4.1-.6 5.6-1 0 0 0-5.2-.1-8s-.1-6.1-.2-8.9v-2.2c.1-.7-2.6-.7-3.3-.5z\"\n                        className=\"st2\"\n                    />\n                    <path\n                        d=\"M358.3 231.8c-.3 2.2.1 4.7 1.7 7.4 2.6 4.4 7 6.1 11.9 5.8 8.9-.6 25.3-5.4 27.5-15.7.6-3-.3-6.1-2.2-8.5-6.2-7.8-17.8-5.7-25.6-2-5.9 2.7-12.4 7-13.3 13z\"\n                        className=\"st0\"\n                    />\n                    <path\n                        d=\"M386.4 208.6c2.2 1.4 3.7 3.8 4 7 .3 3.6-1.4 7.5-5 8.8-2.9 1.1-6.2.6-9.1-.4s-5.8-2.8-6.8-5.7c-.7-2-.3-4.3.7-6.1 1.1-1.8 2.8-3.2 4.7-4.1 3.9-1.8 8.4-1.6 11.5.5z\"\n                        style={{\n                            fill: \"#888e93\",\n                            stroke: \"#000\",\n                            strokeWidth: 2,\n                            strokeLinecap: \"round\",\n                            strokeMiterlimit: 10,\n                        }}\n                    />\n                    <path\n                        d=\"M414.7 262.6c2.4.6 4.8 2.1 5.6 4.4s.1 4.9-1.6 6.7-4.2 2.5-6.6 2.5c-.8 0-1.7-.1-2.4-.5-2.5-1.1-3.5-4-4.2-6.6-1.8-6.8 3.6-7.8 9.2-6.5z\"\n                        className=\"st0\"\n                    />\n                    <path\n                        d=\"M267.1 284.7c2.3-4.5 141.3-36.2 144.7-31.6 3.4 4.5 15.8 88.2 9 90.4-6.8 2.3-119.8 37.3-126.6 35s-29.4-89.3-27.1-93.8z\"\n                        className=\"st4\"\n                    />\n                    <path\n                        d=\"M294.2 378.5s54.3-74.6 59.9-76.9c5.7-2.3 67.3 41.3 67.3 41.3\"\n                        className=\"st5\"\n                    />\n                    <path\n                        d=\"M267 287.7s86 38.8 91.6 36.6c5.7-2.3 53.1-71.2 53.1-71.2\"\n                        className=\"st4\"\n                    />\n                    <linearGradient\n                        id=\"SVGID_1_\"\n                        x1={131.119}\n                        x2={103.259}\n                        y1={373.573}\n                        y2={396.951}\n                        gradientUnits=\"userSpaceOnUse\"\n                    >\n                        <stop\n                            offset={0}\n                            style={{\n                                stopColor: \"#71caee\",\n                            }}\n                        />\n                        <stop\n                            offset={0.041}\n                            style={{\n                                stopColor: \"#83cae2\",\n                            }}\n                        />\n                        <stop\n                            offset={0.121}\n                            style={{\n                                stopColor: \"#9fcace\",\n                            }}\n                        />\n                        <stop\n                            offset={0.211}\n                            style={{\n                                stopColor: \"#b6cbbe\",\n                            }}\n                        />\n                        <stop\n                            offset={0.314}\n                            style={{\n                                stopColor: \"#c7cbb1\",\n                            }}\n                        />\n                        <stop\n                            offset={0.438}\n                            style={{\n                                stopColor: \"#d4cba8\",\n                            }}\n                        />\n                        <stop\n                            offset={0.606}\n                            style={{\n                                stopColor: \"#dbcba3\",\n                            }}\n                        />\n                        <stop\n                            offset={1}\n                            style={{\n                                stopColor: \"#ddcba2\",\n                            }}\n                        />\n                    </linearGradient>\n                    <path\n                        d=\"M132.8 375.6c-3.5 3.8-7.3 7.8-13 9.2-4.6 1.2-10 .2-13.6-2.3-1.4-1-2.6-2.2-4-3.2-1.5-1-3.4-1.7-5.3-1.3-2.7.5-4.1 3.1-3.6 5.3 2 8.8 17 15.6 27.5 15.5 9 0 19-4.6 21.4-11.8\"\n                        style={{\n                            fill: \"url(#SVGID_1_)\",\n                        }}\n                    />\n                    <path\n                        d=\"M132.8 375.6c-3.5 3.8-7.3 7.8-13 9.2-4.6 1.2-10 .2-13.6-2.3-1.4-1-2.6-2.2-4-3.2-1.5-1-3.4-1.7-5.3-1.3-2.7.5-4.1 3.1-3.6 5.3 2 8.8 17 15.6 27.5 15.5 9 0 19-4.6 21.4-11.8\"\n                        className=\"st5\"\n                    />\n                    <linearGradient\n                        id=\"SVGID_2_\"\n                        x1={265.033}\n                        x2={275.301}\n                        y1={280.295}\n                        y2={302.314}\n                        gradientUnits=\"userSpaceOnUse\"\n                    >\n                        <stop\n                            offset={0}\n                            style={{\n                                stopColor: \"#71caee\",\n                            }}\n                        />\n                        <stop\n                            offset={0.041}\n                            style={{\n                                stopColor: \"#83cae2\",\n                            }}\n                        />\n                        <stop\n                            offset={0.121}\n                            style={{\n                                stopColor: \"#9fcace\",\n                            }}\n                        />\n                        <stop\n                            offset={0.211}\n                            style={{\n                                stopColor: \"#b6cbbe\",\n                            }}\n                        />\n                        <stop\n                            offset={0.314}\n                            style={{\n                                stopColor: \"#c7cbb1\",\n                            }}\n                        />\n                        <stop\n                            offset={0.438}\n                            style={{\n                                stopColor: \"#d4cba8\",\n                            }}\n                        />\n                        <stop\n                            offset={0.606}\n                            style={{\n                                stopColor: \"#dbcba3\",\n                            }}\n                        />\n                        <stop\n                            offset={1}\n                            style={{\n                                stopColor: \"#ddcba2\",\n                            }}\n                        />\n                    </linearGradient>\n                    <path\n                        d=\"M261.9 283.5c-.1 4.2 4.3 7.3 8.4 7.6s8.2-1.3 12.2-2.6c1.4-.4 2.9-.8 4.2-.2 1.8.9 2.7 4.1 1.8 5.9s-3.4 3.5-5.3 4.4c-6.5 3-12.9 3.6-19.9 2-5.3-1.2-11.3-4.3-13-13.5\"\n                        style={{\n                            fill: \"url(#SVGID_2_)\",\n                        }}\n                    />\n                    <path\n                        d=\"M261.9 283.5c-.1 4.2 4.3 7.3 8.4 7.6s8.2-1.3 12.2-2.6c1.4-.4 2.9-.8 4.2-.2 1.8.9 2.7 4.1 1.8 5.9s-3.4 3.5-5.3 4.4c-6.5 3-12.9 3.6-19.9 2-5.3-1.2-11.3-4.3-13-13.5\"\n                        className=\"st5\"\n                    />\n                    <path d=\"M318.4 198.4c-2-.3-4.1.1-5.9 1.3-3.2 2.1-4.7 6.2-4.7 9.9 0 1.9.4 3.8 1.4 5.3 1.2 1.7 3.1 2.9 5.2 3.4 3.4.8 8.2.7 10.5-2.5 1-1.5 1.4-3.3 1.5-5.1.5-5.7-1.8-11.4-8-12.3\" />\n                    <path\n                        d=\"M320.4 203.3c.9.3 1.7.8 2.1 1.7.4.8.4 1.7.3 2.5-.1 1-.6 2-1.5 2.7-.7.5-1.7.7-2.6.5s-1.7-.8-2.2-1.6c-1.1-1.6-.9-4.4.9-5.5.9-.4 2-.6 3-.3\"\n                        style={{\n                            fill: \"#fff\",\n                        }}\n                    />\n                    <linearGradient\n                        id=\"SVGID_3_\"\n                        x1={-18.456}\n                        x2={110.382}\n                        y1={252.286}\n                        y2={252.286}\n                        gradientTransform=\"rotate(-5.297 -26.409 -856.73)scale(.99997)\"\n                        gradientUnits=\"userSpaceOnUse\"\n                    >\n                        <stop\n                            offset={0}\n                            style={{\n                                stopColor: \"#333\",\n                                stopOpacity: 0,\n                            }}\n                        />\n                        <stop\n                            offset={0.477}\n                            style={{\n                                stopColor: \"#575756\",\n                                stopOpacity: 0.2,\n                            }}\n                        />\n                        <stop\n                            offset={0.995}\n                            style={{\n                                stopColor: \"#333\",\n                                stopOpacity: 0.001911551,\n                            }}\n                        />\n                        <stop\n                            offset={1}\n                            style={{\n                                stopColor: \"#333\",\n                                stopOpacity: 0,\n                            }}\n                        />\n                    </linearGradient>\n                    <path\n                        d=\"M81.6 222.4s56.5 68.4 123.9 42.4l6.6-29.7C150 272.2 82.8 214.3 82.8 214.3z\"\n                        style={{\n                            fill: \"url(#SVGID_3_)\",\n                        }}\n                    />\n                    <linearGradient\n                        id=\"SVGID_4_\"\n                        x1={110.198}\n                        x2={283.737}\n                        y1={262.493}\n                        y2={262.493}\n                        gradientTransform=\"matrix(.9991 .04164 -.04164 .9991 -36.323 1.051)\"\n                        gradientUnits=\"userSpaceOnUse\"\n                    >\n                        <stop\n                            offset={0}\n                            style={{\n                                stopColor: \"#333\",\n                                stopOpacity: 0,\n                            }}\n                        />\n                        <stop\n                            offset={0.477}\n                            style={{\n                                stopColor: \"#575756\",\n                                stopOpacity: 0.2,\n                            }}\n                        />\n                        <stop\n                            offset={0.995}\n                            style={{\n                                stopColor: \"#333\",\n                                stopOpacity: 0.001911551,\n                            }}\n                        />\n                        <stop\n                            offset={1}\n                            style={{\n                                stopColor: \"#333\",\n                                stopOpacity: 0,\n                            }}\n                        />\n                    </linearGradient>\n                    <path\n                        d=\"M64.2 234.9s63.1 101.5 157.8 78.9l14.2-38.5c-89.5 38.3-168.9-51-168.9-51z\"\n                        style={{\n                            fill: \"url(#SVGID_4_)\",\n                        }}\n                    />\n                    <linearGradient\n                        id=\"SVGID_5_\"\n                        x1={218.967}\n                        x2={428.745}\n                        y1={263.594}\n                        y2={263.594}\n                        gradientTransform=\"rotate(9.265 -38.832 -826.002)\"\n                        gradientUnits=\"userSpaceOnUse\"\n                    >\n                        <stop\n                            offset={0}\n                            style={{\n                                stopColor: \"#333\",\n                                stopOpacity: 0,\n                            }}\n                        />\n                        <stop\n                            offset={0.477}\n                            style={{\n                                stopColor: \"#575756\",\n                                stopOpacity: 0.2,\n                            }}\n                        />\n                        <stop\n                            offset={0.995}\n                            style={{\n                                stopColor: \"#333\",\n                                stopOpacity: 0.001911551,\n                            }}\n                        />\n                        <stop\n                            offset={1}\n                            style={{\n                                stopColor: \"#333\",\n                                stopOpacity: 0,\n                            }}\n                        />\n                    </linearGradient>\n                    <path\n                        d=\"M46.6 251.5s61.1 130.9 178 117.5l22.6-44.2c-113 33-195.3-85.7-195.3-85.7z\"\n                        style={{\n                            fill: \"url(#SVGID_5_)\",\n                        }}\n                    />\n                </g>\n            </switch>\n        </svg>\n    )\n}\n\nexport function WebhookIcon(props: SVGProps<SVGSVGElement>) {\n    return (\n        <svg\n            xmlns=\"http://www.w3.org/2000/svg\"\n            width={2500}\n            height={2448}\n            fillRule=\"evenodd\"\n            strokeLinejoin=\"round\"\n            strokeMiterlimit={2}\n            clipRule=\"evenodd\"\n            viewBox=\"-6.74 -6.74 223.55 218.799\"\n            {...props}\n        >\n            <path\n                fill=\"#7547db\"\n                d=\"M111.134 71.906a21 21 0 0 1-1.324.042c-11.314 0-20.5-9.186-20.5-20.5s9.186-20.5 20.5-20.5 20.5 9.186 20.5 20.5a20.4 20.4 0 0 1-4.582 12.913l22.66 41.655a51 51 0 0 1 17.422-3.068c28.148 0 51 22.852 51 51s-22.852 51-51 51a51.2 51.2 0 0 1-28.036-8.373 7.303 7.303 0 0 1-1.359-11.105c.015-.016.031-.033.061-.036a7.665 7.665 0 0 1 9.736-1.228 36.06 36.06 0 0 0 19.598 5.792c19.897 0 36.05-16.153 36.05-36.05s-16.153-36.05-36.05-36.05c-6.89 0-16.669 3.014-22.548 6.745a2.637 2.637 0 0 1-3.899-.845zm-9.412 88.614a51 51 0 0 1-6.054 16.62c-14.074 24.378-45.29 32.743-69.667 18.669S-6.74 150.518 7.333 126.14a51.2 51.2 0 0 1 21.27-20.094 7.3 7.3 0 0 1 6.167-.211 7.3 7.3 0 0 1 4.13 4.587c.006.022.012.043 0 .07a7.665 7.665 0 0 1-3.804 9.047 36.05 36.05 0 0 0-14.816 14.076c-9.948 17.23-4.036 39.297 13.195 49.246 17.231 9.948 39.298 4.035 49.246-13.196 3.445-5.967 5.724-15.943 5.433-22.9a2.632 2.632 0 0 1 2.681-2.953l59.054 1.499q.292-.59.626-1.168c5.657-9.798 18.205-13.161 28.003-7.504 9.8 5.658 13.161 18.206 7.504 28.004s-18.205 13.16-28.004 7.503a20.4 20.4 0 0 1-8.892-10.424zM76.97 90.555A51 51 0 0 1 65.601 77c-14.074-24.377-5.71-55.594 18.667-69.667S139.862 1.624 153.935 26a51.2 51.2 0 0 1 6.768 28.466 7.306 7.306 0 0 1-8.938 6.73c-.022-.005-.044-.011-.062-.035a7.664 7.664 0 0 1-5.932-7.817 36.04 36.04 0 0 0-4.783-19.87c-9.948-17.23-32.014-23.143-49.245-13.195S68.599 52.294 78.548 69.525c3.445 5.967 10.945 12.929 17.115 16.155a2.635 2.635 0 0 1 1.218 3.799l-30.826 50.393q.366.548.7 1.125c5.656 9.799 2.294 22.347-7.505 28.004s-22.346 2.295-28.003-7.504-2.295-22.346 7.503-28.003a20.4 20.4 0 0 1 13.474-2.488z\"\n            />\n        </svg>\n    )\n}\n\n\nexport function MSTeamsIcon(props: SVGProps<SVGSVGElement>) {\n    return (<svg xmlns=\"http://www.w3.org/2000/svg\" width={256} height={256} viewBox=\"0 0 256 239\" {...props}>\n        <defs>\n            <path id=\"logosMicrosoftTeams0\"\n                  d=\"M136.93 64.476v12.8a32.674 32.674 0 0 1-5.953-.952a38.698 38.698 0 0 1-26.79-22.742h21.848c6.008.022 10.872 4.887 10.895 10.894Z\"\n                  opacity=\".2\"/>\n        </defs>\n        <defs>\n            <linearGradient id=\"logosMicrosoftTeams1\" x1=\"17.372%\" x2=\"82.628%\" y1=\"-6.51%\" y2=\"106.51%\">\n                <stop offset=\"0%\" stop-color=\"#5A62C3\"/>\n                <stop offset=\"50%\" stop-color=\"#4D55BD\"/>\n                <stop offset=\"100%\" stop-color=\"#3940AB\"/>\n            </linearGradient>\n        </defs>\n        <path fill=\"#5059C9\"\n              d=\"M178.563 89.302h66.125c6.248 0 11.312 5.065 11.312 11.312v60.231c0 22.96-18.613 41.574-41.573 41.574h-.197c-22.96.003-41.576-18.607-41.579-41.568V95.215a5.912 5.912 0 0 1 5.912-5.913Z\"/>\n        <circle cx=\"223.256\" cy=\"50.605\" r=\"26.791\" fill=\"#5059C9\"/>\n        <circle cx=\"139.907\" cy=\"38.698\" r=\"38.698\" fill=\"#7B83EB\"/>\n        <path fill=\"#7B83EB\"\n              d=\"M191.506 89.302H82.355c-6.173.153-11.056 5.276-10.913 11.449v68.697c-.862 37.044 28.445 67.785 65.488 68.692c37.043-.907 66.35-31.648 65.489-68.692v-68.697c.143-6.173-4.74-11.296-10.913-11.449Z\"/>\n        <path\n            d=\"M142.884 89.302v96.268a10.96 10.96 0 0 1-6.787 10.062c-1.3.55-2.697.833-4.108.833H76.68c-.774-1.965-1.488-3.93-2.084-5.953a72.509 72.509 0 0 1-3.155-21.076v-68.703c-.143-6.163 4.732-11.278 10.895-11.43h60.547Z\"\n            opacity=\".1\"/>\n        <path\n            d=\"M136.93 89.302v102.222c0 1.411-.283 2.808-.833 4.108a10.96 10.96 0 0 1-10.062 6.787H79.48c-1.012-1.965-1.965-3.93-2.798-5.954a59.049 59.049 0 0 1-2.084-5.953a72.508 72.508 0 0 1-3.155-21.076v-68.703c-.143-6.163 4.732-11.278 10.895-11.43h54.593Z\"\n            opacity=\".2\"/>\n        <path\n            d=\"M136.93 89.302v90.315c-.045 5.998-4.896 10.85-10.895 10.895H74.597a72.508 72.508 0 0 1-3.155-21.076v-68.703c-.143-6.163 4.732-11.278 10.895-11.43h54.593Z\"\n            opacity=\".2\"/>\n        <path\n            d=\"M130.977 89.302v90.315c-.046 5.998-4.897 10.85-10.895 10.895H74.597a72.508 72.508 0 0 1-3.155-21.076v-68.703c-.143-6.163 4.732-11.278 10.895-11.43h48.64Z\"\n            opacity=\".2\"/>\n        <path\n            d=\"M142.884 58.523v18.753c-1.012.06-1.965.12-2.977.12c-1.012 0-1.965-.06-2.977-.12a32.674 32.674 0 0 1-5.953-.952a38.698 38.698 0 0 1-26.791-22.742a33.082 33.082 0 0 1-1.905-5.954h29.708c6.007.023 10.872 4.887 10.895 10.895Z\"\n            opacity=\".1\"/>\n        <use href=\"#logosMicrosoftTeams0\" opacity=\".2\"/>\n        <use href=\"#logosMicrosoftTeams0\" opacity=\".2\"/>\n        <path d=\"M130.977 64.476v11.848a38.698 38.698 0 0 1-26.791-22.743h15.896c6.008.023 10.872 4.888 10.895 10.895Z\"\n              opacity=\".2\"/>\n        <path fill=\"url(#logosMicrosoftTeams1)\"\n              d=\"M10.913 53.581h109.15c6.028 0 10.914 4.886 10.914 10.913v109.151c0 6.027-4.886 10.913-10.913 10.913H10.913C4.886 184.558 0 179.672 0 173.645V64.495C0 58.466 4.886 53.58 10.913 53.58Z\"/>\n        <path fill=\"#FFF\" d=\"M94.208 95.125h-21.82v59.416H58.487V95.125H36.769V83.599h57.439z\"/>\n    </svg>)\n}\n\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/channels/helpers/storage.tsx",
    "content": "import {Server} from \"lucide-react\";\nimport type {SVGProps} from \"react\";\nimport {ProviderIconTypes} from \"@/components/wrappers/dashboard/admin/channels/helpers/common\";\n\nexport const storageProviders: ProviderIconTypes[] = [\n    {value: \"local\", label: \"Local\", icon: Server},\n    {value: \"s3\", label: \"S3\", icon: S3Icon},\n    {value: \"google-drive\", label: \"Google Drive\", icon: GoogleDriveIcon},\n    {value: \"blob\", label: \"Azure Blob Storage\", icon: BlobIcon, preview: true},\n    {value: \"gcs\", label: \"Google Cloud Storage\", icon: GCSIcon, preview: true},\n]\n\nexport function S3Icon(props: SVGProps<SVGSVGElement>) {\n    return (\n        <svg xmlns=\"http://www.w3.org/2000/svg\" width={256} height={199}  {...props} viewBox=\"0 0 24 24\">\n            <path fill=\"currentColor\"\n                  d=\"M13.207.006a2.16 2.16 0 0 0-1.62.582a2.15 2.15 0 0 0-.095 3.035l3.408 3.55a3.042 3.042 0 0 1-.663 4.688l-.463.239V7.285a15.42 15.42 0 0 0-8.018 10.487v.017l6.549-3.328v7.621L13.779 24V13.682l.897-.463a4.443 4.443 0 0 0 1.22-7.03l-3.37-3.525a.75.75 0 0 1 .037-1.055a.75.75 0 0 1 1.056.038l.467.486l-.006.006l4.07 4.244a.057.057 0 0 0 .082 0a.06.06 0 0 0 0-.07l-3.14-5.143l-.149.143l.149-.145C14.494.393 13.829.054 13.207.006m-.902 9.865v2.994l-4.152 2.149a14 14 0 0 1 2.767-3.928a14 14 0 0 1 1.385-1.215\"/>\n        </svg>\n    );\n}\n\nexport function GoogleDriveIcon(props: SVGProps<SVGSVGElement>) {\n    return (\n        <svg xmlns=\"http://www.w3.org/2000/svg\" width={256} height={199}  {...props}  viewBox=\"0 0 256 229\"><path fill=\"#0066da\" d=\"m19.354 196.034l11.29 19.5c2.346 4.106 5.718 7.332 9.677 9.678q17.009-21.591 23.68-33.137q6.77-11.717 16.641-36.655q-26.604-3.502-40.32-3.502q-13.165 0-40.322 3.502c0 4.545 1.173 9.09 3.519 13.196z\"/><path fill=\"#ea4335\" d=\"M215.681 225.212c3.96-2.346 7.332-5.572 9.677-9.677l4.692-8.064l22.434-38.855a26.57 26.57 0 0 0 3.518-13.196q-27.315-3.502-40.247-3.502q-13.899 0-40.248 3.502q9.754 25.075 16.422 36.655q6.724 11.683 23.752 33.137\"/><path fill=\"#00832d\" d=\"M128.001 73.311q19.68-23.768 27.125-36.655q5.996-10.377 13.196-33.137C164.363 1.173 159.818 0 155.126 0h-54.25C96.184 0 91.64 1.32 87.68 3.519q9.16 26.103 15.544 37.154q7.056 12.213 24.777 32.638\"/><path fill=\"#2684fc\" d=\"M175.36 155.42H80.642l-40.32 69.792c3.958 2.346 8.503 3.519 13.195 3.519h148.968c4.692 0 9.238-1.32 13.196-3.52z\"/><path fill=\"#00ac47\" d=\"M128.001 73.311L87.681 3.52c-3.96 2.346-7.332 5.571-9.678 9.677L3.519 142.224A26.57 26.57 0 0 0 0 155.42h80.642z\"/><path fill=\"#ffba00\" d=\"m215.242 77.71l-37.243-64.514c-2.345-4.106-5.718-7.331-9.677-9.677l-40.32 69.792l47.358 82.109h80.496c0-4.546-1.173-9.09-3.519-13.196z\"/></svg>\n    )\n}\n\n\nexport function BlobIcon(props: SVGProps<SVGSVGElement>) {\n    return (\n        <svg xmlns=\"http://www.w3.org/2000/svg\" x=\"0px\" y=\"0px\" width={256} height={199} {...props} viewBox=\"0 0 48 48\">\n            <path fill=\"#2979ff\"\n                  d=\"M32.66,7H15.34c-0.715,0-1.375,0.381-1.732,1l-8.66,15c-0.357,0.619-0.357,1.381,0,2l8.66,15c0.357,0.619,1.018,1,1.732,1H32.66c0.715,0,1.375-0.381,1.732-1l8.66-15c0.357-0.619,0.357-1.381,0-2l-8.66-15C34.035,7.381,33.375,7,32.66,7z\"></path>\n            <path fill=\"#fff\"\n                  d=\"M32,35H16c-0.552,0-1-0.448-1-1V14c0-0.552,0.448-1,1-1h13l4,4v17C33,34.552,32.552,35,32,35z\"></path>\n            <path fill=\"#b1cfff\" d=\"M29,13v3c0,0.552,0.448,1,1,1h3L29,13z\"></path>\n            <path fill=\"#03a9f4\"\n                  d=\"M22.265 23.831H20.93V19.58l-1.312.383v-1.011l2.524-.873h.122V23.831zM28.702 21.48c0 .416-.049.776-.146 1.081-.097.303-.234.556-.411.756-.176.2-.387.349-.632.446-.245.097-.515.146-.81.146-.298 0-.57-.049-.816-.146-.246-.097-.457-.246-.633-.446-.176-.2-.315-.453-.413-.756-.099-.305-.147-.665-.147-1.081v-1.051c0-.413.049-.773.146-1.078.097-.305.234-.558.411-.758.176-.2.387-.349.632-.446C26.126 18.049 26.397 18 26.695 18c.295 0 .565.049.811.146.246.097.458.246.635.446.176.2.313.453.412.758.099.305.149.665.149 1.078V21.48zM27.37 20.26c0-.229-.016-.421-.047-.579-.032-.155-.076-.283-.134-.381-.058-.097-.129-.167-.212-.209-.083-.042-.176-.063-.282-.063-.105 0-.2.021-.283.063-.083.042-.153.112-.209.209-.057.097-.1.225-.13.381-.03.158-.045.35-.045.579v1.383c0 .234.014.431.045.589.03.158.075.286.133.381.058.097.129.166.213.208.084.042.179.063.284.063.103 0 .195-.021.278-.063.083-.042.154-.111.212-.208.058-.095.101-.223.132-.381.03-.158.046-.354.046-.589V20.26zM23.308 29.571c0 .416-.049.776-.146 1.081-.097.303-.234.556-.411.756-.176.2-.387.349-.632.446C21.874 31.951 21.604 32 21.309 32c-.298 0-.57-.049-.816-.146-.246-.097-.457-.246-.633-.446-.176-.2-.315-.453-.413-.756-.099-.305-.147-.665-.147-1.081V28.52c0-.413.049-.773.146-1.078.097-.305.234-.558.411-.758.176-.2.387-.349.632-.446.245-.097.516-.146.814-.146.295 0 .565.049.811.146.246.097.458.246.635.446.176.2.313.453.412.758s.149.665.149 1.078V29.571zM21.977 28.35c0-.229-.016-.421-.047-.579-.032-.155-.076-.283-.134-.381-.058-.097-.129-.167-.212-.209-.083-.042-.176-.063-.282-.063s-.2.021-.283.063c-.083.042-.153.112-.209.209-.057.097-.1.225-.13.381-.03.158-.045.35-.045.579v1.383c0 .234.014.431.045.589.03.158.075.286.133.381.058.097.129.166.213.208s.179.063.284.063c.103 0 .195-.021.278-.063.083-.042.154-.111.212-.208.058-.095.101-.223.132-.381.03-.158.046-.354.046-.589V28.35zM27.659 31.921h-1.335V27.67l-1.312.383v-1.011l2.524-.873h.122V31.921z\"></path>\n        </svg>\n    );\n}\n\nexport function GCSIcon(props: SVGProps<SVGSVGElement>) {\n    return (\n        <svg\n            id=\"standard_product_icon\"\n            xmlns=\"http://www.w3.org/2000/svg\"\n            viewBox=\"0 0 512 512\"\n            {...props}\n        >\n            <g id=\"bounding_box\">\n                <rect width=\"512\" height=\"512\" fill=\"none\"/>\n            </g>\n            <g id=\"art\">\n                <path\n                    fill=\"#34a853\"\n                    d=\"M442,277.9H70c-8.8,0-16,7.2-16,16v148.1c0,8.8,7.2,16,16,16h107.2c1.5.5,3.1.7,4.8.7s3.3-.3,4.8-.7h255.2c8.8,0,16-7.2,16-16v-148.1c0-8.8-7.2-16-16-16ZM86,309.9h80v116.1h-80v-116.1ZM426,425.9h-228v-116.1h228v116.1Z\"\n                />\n                <path\n                    fill=\"#fbbc04\"\n                    d=\"M442,54H70c-8.8,0-16,7.2-16,16v148.8c0,8.8,7.2,16,16,16h372c8.8,0,16-7.2,16-16V70c0-8.8-7.2-16-16-16ZM86,86h80v116.8h-80v-116.8ZM426,202.8h-228v-116.8h228v116.8Z\"\n                />\n                <path\n                    fill=\"#ea4335\"\n                    d=\"M442,234.8h-16V86H54v-16c0-8.8,7.2-16,16-16h372c8.8,0,16,7.2,16,16v148.8c0,8.8-7.2,16-16,16Z\"\n                />\n                <path\n                    fill=\"#4285f4\"\n                    d=\"M442,457.9h-16v-148.1H54v-16c0-8.8,7.2-16,16-16h372c8.8,0,16,7.2,16,16v148.1c0,8.8-7.2,16-16,16Z\"\n                />\n                <circle fill=\"#ea4335\" cx=\"349\" cy=\"144.4\" r=\"37\"/>\n                <circle fill=\"#4285f4\" cx=\"349\" cy=\"367.9\" r=\"37\"/>\n            </g>\n        </svg>\n    );\n}"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/channels/organization/channels-organization-form.tsx",
    "content": "\"use client\";\n\nimport {useRouter} from \"next/navigation\";\nimport {useMutation} from \"@tanstack/react-query\";\nimport {Form, FormControl, FormField, FormItem, useZodForm} from \"@/components/ui/form\";\nimport {ButtonWithLoading} from \"@/components/wrappers/common/button/button-with-loading\";\nimport {OrganizationWithMembers} from \"@/db/schema/03_organization\";\nimport {NotificationChannelWith} from \"@/db/schema/09_notification-channel\";\nimport {MultiSelect} from \"@/components/wrappers/common/multiselect/multi-select\";\n\nimport {toast} from \"sonner\";\nimport {StorageChannelWith} from \"@/db/schema/12_storage-channel\";\nimport {\n    ChannelsOrganizationSchema, ChannelsOrganizationType\n} from \"@/components/wrappers/dashboard/admin/channels/organization/channels-organization.schema\";\nimport {\n    updateNotificationChannelsOrganizationAction, updateStorageChannelsOrganizationAction\n} from \"@/components/wrappers/dashboard/admin/channels/organization/channels-organization.action\";\nimport {ChannelKind} from \"@/components/wrappers/dashboard/admin/channels/helpers/common\";\n\n\ntype ChannelOrganisationFormProps = {\n    organizations?: OrganizationWithMembers[];\n    defaultValues?: NotificationChannelWith | StorageChannelWith\n    kind: ChannelKind\n};\n\nexport const ChannelOrganisationForm = ({\n                                            organizations,\n                                            defaultValues,\n                                            kind\n                                        }: ChannelOrganisationFormProps) => {\n\n    const router = useRouter();\n\n    const defaultOrganizationIds = defaultValues?.organizations?.map(organization => organization.organizationId) ?? []\n\n\n    const form = useZodForm({\n        schema: ChannelsOrganizationSchema,\n        // @ts-ignore\n        defaultValues: {\n            organizations: defaultOrganizationIds\n        },\n    });\n\n    const formatOrganizationsList = (organizations: OrganizationWithMembers[]) => {\n        return organizations\n            .map((organization) => ({\n                value: organization.id,\n                label: `${organization.name}`,\n            }));\n    };\n\n\n    const mutationUpdateChannelOrganizations = useMutation({\n        mutationFn: async (values: ChannelsOrganizationType) => {\n\n            const payload = {\n                data: values.organizations,\n                id: defaultValues?.id ?? \"\"\n            };\n\n            const result = kind === \"notification\" ? await updateNotificationChannelsOrganizationAction(payload) : await updateStorageChannelsOrganizationAction(payload)\n            const inner = result?.data;\n\n            if (inner?.success) {\n                toast.success(inner.actionSuccess?.message);\n                router.refresh();\n            } else {\n                toast.error(inner?.actionError?.message);\n            }\n        }\n    });\n\n\n    return (\n\n        <Form\n            form={form}\n            className=\"flex flex-col gap-4\"\n            onSubmit={async (values) => {\n                await mutationUpdateChannelOrganizations.mutateAsync(values);\n            }}\n        >\n            <FormField\n                control={form.control}\n                name={`organizations`}\n                render={({field}) => (\n                    <FormItem>\n                        <FormControl>\n                            <MultiSelect\n                                options={formatOrganizationsList(organizations ?? [])}\n                                onValueChange={field.onChange}\n                                defaultValue={field.value ?? []}\n                                placeholder=\"Select organization(s)\"\n                                variant=\"inverted\"\n                                animation={0}\n                            />\n                        </FormControl>\n                    </FormItem>\n                )}\n            />\n\n            <div className=\"flex justify-end\">\n                <div className=\"flex gap-2 justify-end\">\n                    <ButtonWithLoading isPending={mutationUpdateChannelOrganizations.isPending}>\n                        Save\n                    </ButtonWithLoading>\n                </div>\n\n            </div>\n        </Form>\n    );\n};\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/channels/organization/channels-organization.action.ts",
    "content": "\"use server\"\nimport {userAction} from \"@/lib/safe-actions/actions\";\nimport {z} from \"zod\";\nimport {ServerActionResult} from \"@/types/action-type\";\nimport {db} from \"@/db\";\nimport {and, eq, inArray} from \"drizzle-orm\";\nimport * as drizzleDb from \"@/db\";\nimport {NotificationChannelWith} from \"@/db/schema/09_notification-channel\";\nimport {StorageChannelWith} from \"@/db/schema/12_storage-channel\";\n\n\nexport const updateNotificationChannelsOrganizationAction = userAction\n    .schema(\n        z.object({\n            data: z.array(z.string()),\n            id: z.string(),\n        })\n    )\n    .action(async ({parsedInput , ctx}): Promise<ServerActionResult<null>> => {\n        try {\n            const organizationsIds = parsedInput.data;\n            const notificationChannelId = parsedInput.id;\n\n            const notificationChannel = await db.query.notificationChannel.findFirst({\n                where: eq(drizzleDb.schemas.notificationChannel.id, notificationChannelId),\n                with: {\n                    organizations: true,\n                }\n            }) as NotificationChannelWith;\n\n\n            if (!notificationChannel) {\n                return {\n                    success: false,\n                    actionError: {\n                        message: \"Notification channel not found.\",\n                        status: 404,\n                        cause: \"not_found\",\n                    },\n                };\n            }\n\n            const existingItemIds = notificationChannel.organizations.map((organization) => organization.organizationId);\n\n            const organizationsToAdd = organizationsIds.filter((id) => !existingItemIds.includes(id));\n            const organizationsToRemove = existingItemIds.filter((id) => !organizationsIds.includes(id));\n\n            if (organizationsToAdd.length > 0) {\n                for (const organizationToAdd of organizationsToAdd) {\n                    await db.insert(drizzleDb.schemas.organizationNotificationChannel).values({\n                        organizationId: organizationToAdd,\n                        notificationChannelId: notificationChannelId\n                    });\n                }\n            }\n            if (organizationsToRemove.length > 0) {\n                await db.delete(drizzleDb.schemas.organizationNotificationChannel).where(and(inArray(drizzleDb.schemas.organizationNotificationChannel.organizationId, organizationsToRemove), eq(drizzleDb.schemas.organizationNotificationChannel.notificationChannelId,notificationChannelId))).execute();\n\n            }\n\n            return {\n                success: true,\n                value: null,\n                actionSuccess: {\n                    message: \"Notification channel organizations has been successfully updated.\",\n                    messageParams: {notificationChannelId: notificationChannelId},\n                },\n            };\n        } catch (error) {\n            console.error(\"Error updating notification channel:\", error);\n            return {\n                success: false,\n                actionError: {\n                    message: \"Failed to update notification channel.\",\n                    status: 500,\n                    cause: \"server_error\",\n                    messageParams: {message: \"Error updating the notification channel\"},\n                },\n            };\n        }\n    });\n\n\nexport const updateStorageChannelsOrganizationAction = userAction\n    .schema(\n        z.object({\n            data: z.array(z.string()),\n            id: z.string(),\n        })\n    )\n    .action(async ({parsedInput, ctx}): Promise<ServerActionResult<null>> => {\n        try {\n            const organizationsIds = parsedInput.data;\n            const storageChannelId = parsedInput.id;\n\n            const storageChannel = await db.query.storageChannel.findFirst({\n                where: eq(drizzleDb.schemas.storageChannel.id, storageChannelId),\n                with: {\n                    organizations: true,\n                }\n            }) as StorageChannelWith;\n\n\n            if (!storageChannel) {\n                return {\n                    success: false,\n                    actionError: {\n                        message: \"Storage channel not found.\",\n                        status: 404,\n                        cause: \"not_found\",\n                    },\n                };\n            }\n\n            const existingItemIds = storageChannel.organizations.map((organization) => organization.organizationId);\n\n            const organizationsToAdd = organizationsIds.filter((id) => !existingItemIds.includes(id));\n            const organizationsToRemove = existingItemIds.filter((id) => !organizationsIds.includes(id));\n\n            if (organizationsToAdd.length > 0) {\n                for (const organizationToAdd of organizationsToAdd) {\n                    await db.insert(drizzleDb.schemas.organizationStorageChannel).values({\n                        organizationId: organizationToAdd,\n                        storageChannelId: storageChannelId\n                    });\n                }\n            }\n\n            if (organizationsToRemove.length > 0) {\n                await db.delete(drizzleDb.schemas.organizationStorageChannel).where(and(inArray(drizzleDb.schemas.organizationStorageChannel.organizationId, organizationsToRemove), eq(drizzleDb.schemas.organizationStorageChannel.storageChannelId, storageChannelId))).execute();\n\n            }\n\n            return {\n                success: true,\n                value: null,\n                actionSuccess: {\n                    message: \"Storage channel organizations has been successfully updated.\",\n                    messageParams: {storageChannelId: storageChannelId},\n                },\n            };\n        } catch (error) {\n            console.error(\"Error updating storage channel:\", error);\n            return {\n                success: false,\n                actionError: {\n                    message: \"Failed to update storage channel.\",\n                    status: 500,\n                    cause: \"server_error\",\n                    messageParams: {message: \"Error updating the storage channel\"},\n                },\n            };\n        }\n    });\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/channels/organization/channels-organization.schema.ts",
    "content": "import {z} from \"zod\";\n\nexport const ChannelsOrganizationSchema = z.object({\n    organizations: z.array(z.string().uuid())\n});\n\nexport type ChannelsOrganizationType = z.infer<typeof ChannelsOrganizationSchema>;\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/notifications/logs/columns.tsx",
    "content": "\"use client\";\n\nimport {ColumnDef} from \"@tanstack/react-table\";\nimport {NotificationLogWithRelations} from \"@/db/services/notification-log\";\nimport {humanReadableDate} from \"@/utils/date-formatting\";\nimport {CheckCircle2, XCircle} from \"lucide-react\";\nimport {Badge} from \"@/components/ui/badge\";\nimport {NotificationLogModal} from \"@/components/wrappers/dashboard/admin/notifications/logs/notification-log-modal\";\nimport {getChannelIcon} from \"@/components/wrappers/dashboard/admin/channels/helpers/common\";\n\n\nexport function notificationLogsColumns(): ColumnDef<NotificationLogWithRelations>[] {\n    return [\n        {\n            accessorKey: \"success\",\n            header: \"Status\",\n            cell: ({row}) => {\n                const status = row.original.success ? \"delivered\" : \"failed\";\n                return(\n                    <Badge variant=\"outline\" className={`gap-1.5 ${getStatusColor(status)}`}>\n                        {getStatusIcon(row.original.success)}\n                        <span className=\"capitalize\">{status}</span>\n                    </Badge>\n                )\n            }\n        },\n        {\n            accessorKey: \"channel\",\n            header: \"Channel\",\n            cell: ({row}) => {\n                const channel = row.original.channel\n                return (\n                    <div className=\"flex items-center gap-2\">\n                        <div\n                            className=\"flex h-10 w-10 items-center justify-center rounded-md bg-secondary border border-border\">\n                            {getChannelIcon(channel?.provider ?? \"\")}\n                        </div>\n                        {channel?.name}\n                    </div>\n                )\n            }\n        },\n        {\n            accessorKey: \"sentAt\",\n            header: \"Sent At\",\n            cell: ({row}) => {\n                const sentAt = humanReadableDate(row.original.sentAt)\n                return (\n                    <div>\n                        {sentAt}\n                    </div>\n                )\n            }\n        },\n        {\n            accessorKey: \"policy\",\n            header: \"Event Kind\",\n            cell: ({ row }) => {\n                const eventKind = row.original.policy?.event;\n\n                if (!eventKind) {\n                    return (\n                        <div className=\"text-muted-foreground italic\">\n                            No event\n                        </div>\n                    );\n                }\n\n                return (\n                    <div className=\"flex items-center gap-2\">\n                        <Badge>{eventKind}</Badge>\n                    </div>\n                );\n            }\n        },\n        {\n            accessorKey: \"details\",\n            header: \"Details\",\n            cell: ({row}) => {\n\n                return (\n                    <div>\n                        <NotificationLogModal notificationLog={row.original} />\n                    </div>\n                );\n            }\n        }\n    ];\n}\n\n\nexport const getStatusIcon = (status: boolean) => {\n    switch (status) {\n        case true:\n            return <CheckCircle2 className=\"h-4 w-4\"/>\n        case false:\n            return <XCircle className=\"h-4 w-4\"/>\n    }\n}\n\nexport const getStatusColor = (status: string) => {\n    switch (status) {\n        case \"delivered\":\n            return \"bg-green-100 dark:bg-green-100/10\"\n        case \"success\":\n            return \"bg-green-100 dark:bg-green-100/10\"\n        case \"failed\":\n            return \"bg-red-100 dark:bg-red-100/10\"\n        case \"pending\":\n            return \"bg-orange-100 dark:bg-orange-100/10\"\n    }\n}"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/notifications/logs/notification-log-modal.tsx",
    "content": "\"use client\";\nimport {\n  AlertCircle,\n  Braces,\n  Database,\n  ExternalLink,\n  Eye,\n  Hash,\n  Server,\n  Sparkles,\n} from \"lucide-react\";\nimport { useState } from \"react\";\nimport { Button } from \"@/components/ui/button\";\nimport {\n  Dialog,\n  DialogContent,\n  DialogDescription,\n  DialogHeader,\n  DialogTitle,\n  DialogTrigger,\n} from \"@/components/ui/dialog\";\nimport type { NotificationLogWithRelations } from \"@/db/services/notification-log\";\n\ntype NotificationLogModalProps = {\n  notificationLog: NotificationLogWithRelations;\n};\n\nconst getTroubleshootingForError = (errorMsg?: any) => {\n  if (!errorMsg || String(errorMsg).toLowerCase() === \"null\") return null;\n\n  const msg = String(errorMsg).toLowerCase();\n\n  if (msg.includes(\"database connection\") || msg.includes(\"agent\")) {\n    return {\n      title: \"Agent Connection Issue\",\n      resolution:\n        \"It appears the agent cannot reach the database. Please ensure that your agent is actively running, your PostgreSQL credentials are correct, and port 5432 is open on your firewall.\",\n      docLink:\n        \"https://portabase.io/docs/agent/troubleshooting/agent-connection\",\n    };\n  }\n\n  if (msg.includes(\"timeout\")) {\n    return {\n      title: \"Timeout\",\n      resolution:\n        \"The agent is taking too long to respond. This could be due to high server load, network issues, or a large database.\",\n      docLink: \"https://portabase.io/docs/agent/troubleshooting/timeout\",\n    };\n  }\n\n  return {\n    title: \"Unexpected Execution Error\",\n    resolution:\n      \"An unexpected error occurred during execution. Please review the raw system logs or contact support if the issue persists.\",\n    docLink: \"https://discord.gg/Wgv7xZ8fWJ\",\n  };\n};\n\nconst getIconForKey = (key: string, value: any) => {\n  const isActualError =\n    key.toLowerCase().includes(\"error\") &&\n    value !== null &&\n    String(value).toLowerCase() !== \"null\";\n\n  if (key.toLowerCase().includes(\"id\"))\n    return <Hash className=\"w-3.5 h-3.5 text-muted-foreground\" />;\n  if (key.toLowerCase().includes(\"host\"))\n    return <Server className=\"w-3.5 h-3.5 text-muted-foreground\" />;\n  if (isActualError)\n    return <AlertCircle className=\"w-3.5 h-3.5 text-destructive\" />;\n  return <Database className=\"w-3.5 h-3.5 text-muted-foreground\" />;\n};\n\nexport const NotificationLogModal = ({\n  notificationLog,\n}: NotificationLogModalProps) => {\n  const [open, setOpen] = useState(false);\n\n  // TODO : to be fixed\n  // @ts-ignore\n  const payloadError = notificationLog.payload?.error;\n  const troubleshooting = getTroubleshootingForError(payloadError);\n\n  return (\n    <Dialog open={open} onOpenChange={setOpen}>\n      <DialogTrigger asChild>\n        <Button\n          variant=\"outline\"\n          onClick={() => setOpen(true)}\n          className=\"relative\"\n        >\n          <Eye className=\"w-4 h-4\" />\n        </Button>\n      </DialogTrigger>\n      <DialogContent className=\"sm:max-w-xl bg-background\">\n        <DialogHeader>\n          <DialogTitle>Notification Details</DialogTitle>\n          <DialogDescription>Execution logs and payload data</DialogDescription>\n        </DialogHeader>\n\n        <div className=\"space-y-4 mt-2 max-h-[70vh] overflow-y-auto px-1 pb-2\">\n          <div className=\"relative border rounded-xl bg-card shadow-sm flex flex-col\">\n            <div className=\"bg-primary/5 border-b px-4 py-2.5 flex items-center gap-2 rounded-t-xl\">\n              <div className=\"p-1 bg-primary/10 rounded-md\">\n                <Database className=\"w-4 h-4 text-primary\" />\n              </div>\n              <span className=\"font-semibold text-sm text-primary\">\n                Event Trigger\n              </span>\n            </div>\n            <div className=\"p-4 flex flex-col gap-4\">\n              <div className=\"flex flex-col sm:flex-row sm:items-start justify-between gap-1 sm:gap-4\">\n                <span className=\"text-xs font-medium text-muted-foreground min-w-20 pt-0.5\">\n                  Title\n                </span>\n                <span className=\"text-sm sm:text-right flex-1 wrap-break-words\">\n                  {notificationLog.content.title}\n                </span>\n              </div>\n              <div className=\"flex flex-col sm:flex-row sm:items-start justify-between gap-1 sm:gap-4\">\n                <span className=\"text-xs font-medium text-muted-foreground min-w-20 pt-0.5\">\n                  Message\n                </span>\n                <span className=\"text-sm sm:text-right flex-1 wrap-break-word text-muted-foreground\">\n                  {notificationLog.content.message}\n                </span>\n              </div>\n            </div>\n            {notificationLog.payload && (\n            <div className=\"absolute -bottom-1.5 left-1/2 -translate-x-1/2 w-3 h-3 bg-primary rounded-full border-2 border-background z-10\" />\n                )}\n          </div>\n\n          <div className=\"w-px h-6 bg-border mx-auto -my-4 relative z-0\" />\n\n          {notificationLog.payload &&\n            Object.keys(notificationLog.payload).length > 0 && (\n              <div className=\"relative border rounded-xl bg-card shadow-sm flex flex-col\">\n                <div className=\"absolute -top-1.5 left-1/2 -translate-x-1/2 w-3 h-3 bg-primary rounded-full border-2 border-background z-10\" />\n\n                <div className=\"bg-primary/5 border-b px-4 py-2.5 flex items-center justify-between rounded-t-xl\">\n                  <div className=\"flex items-center gap-2\">\n                    <div className=\"p-1 bg-primary/10 rounded-md\">\n                      <Braces className=\"w-4 h-4 text-primary\" />\n                    </div>\n                    <span className=\"font-semibold text-sm text-primary\">\n                      JSON Payload\n                    </span>\n                  </div>\n                </div>\n\n                <div className=\"flex flex-col\">\n                  {Object.entries(notificationLog.payload).map(\n                    ([key, value], index, arr) => {\n                      const isActualError =\n                        key === \"error\" &&\n                        value !== null &&\n                        String(value).toLowerCase() !== \"null\";\n\n                      return (\n                        <div\n                          key={key}\n                          className={`flex flex-col sm:flex-row sm:items-center justify-between gap-2 px-4 py-3 hover:bg-muted/50 transition-colors ${\n                            index !== arr.length - 1\n                              ? \"border-b border-border/50\"\n                              : \"\"\n                          }`}\n                        >\n                          <div className=\"flex items-center gap-2 min-w-[150px]\">\n                            {getIconForKey(key, value)}\n                            <span className=\"text-sm font-medium\">{key}</span>\n                          </div>\n                          <div className=\"flex-1 sm:text-right\">\n                            {isActualError ? (\n                              <span className=\"inline-flex items-center px-2 py-1 rounded-md bg-destructive/10 text-destructive text-xs font-mono break-all\">\n                                {String(value)}\n                              </span>\n                            ) : (\n                              <span className=\"text-sm text-muted-foreground font-mono bg-muted px-2 py-1 rounded-md break-all\">\n                                {String(value)}\n                              </span>\n                            )}\n                          </div>\n                        </div>\n                      );\n                    },\n                  )}\n                </div>\n\n                {troubleshooting && (\n                  <div className=\"absolute -bottom-1.5 left-1/2 -translate-x-1/2 w-3 h-3 bg-primary rounded-full border-2 border-background z-10\" />\n                )}\n              </div>\n            )}\n\n          {troubleshooting && (\n            <>\n              <div className=\"w-px h-6 bg-border mx-auto -my-4 relative z-0\" />\n\n              <div className=\"relative border border-destructive/20 rounded-xl bg-gradient-to-b from-destructive/5 to-transparent shadow-sm flex flex-col\">\n                <div className=\"absolute -top-1.5 left-1/2 -translate-x-1/2 w-3 h-3 bg-destructive rounded-full border-2 border-background z-10\" />\n\n                <div className=\"bg-destructive/10 border-b border-destructive/10 px-4 py-2.5 flex items-center justify-between rounded-t-xl\">\n                  <div className=\"flex items-center gap-2\">\n                    <div className=\"p-1 bg-destructive/20 rounded-md\">\n                      <Sparkles className=\"w-4 h-4 text-destructive\" />\n                    </div>\n                    <span className=\"font-semibold text-sm text-destructive\">\n                      Suggested Resolution\n                    </span>\n                  </div>\n                </div>\n\n                <div className=\"p-4 flex flex-col gap-2\">\n                  <h4 className=\"text-sm font-semibold text-foreground\">\n                    {troubleshooting.title}\n                  </h4>\n                  <p className=\"text-sm text-muted-foreground leading-relaxed\">\n                    {troubleshooting.resolution}\n                  </p>\n                  <div className=\"mt-2\">\n                    <a\n                      href={troubleshooting.docLink}\n                      target=\"_blank\"\n                      rel=\"noreferrer\"\n                      className=\"inline-flex items-center gap-1.5 text-xs font-semibold text-destructive hover:text-destructive/80 transition-colors\"\n                    >\n                      Read the documentation{\" \"}\n                      <ExternalLink className=\"w-3.5 h-3.5\" />\n                    </a>\n                  </div>\n                </div>\n              </div>\n            </>\n          )}\n        </div>\n      </DialogContent>\n    </Dialog>\n  );\n};\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/notifications/logs/notification-logs-list.tsx",
    "content": "\"use client\"\nimport {DataTable} from \"@/components/wrappers/common/table/data-table\";\nimport {useRouter} from \"next/navigation\";\nimport {\n    notificationLogsColumns,\n} from \"@/components/wrappers/dashboard/admin/notifications/logs/columns\";\nimport {NotificationLogWithRelations} from \"@/db/services/notification-log\";\n\n\ntype NotificationsLogsListProps = {\n    notificationLogs: NotificationLogWithRelations[]\n}\n\nexport const NotificationLogsList = (props: NotificationsLogsListProps) => {\n    const router = useRouter();\n\n    return (\n        <DataTable\n            enableSelect={false}\n            columns={notificationLogsColumns()}\n            data={props.notificationLogs}\n            enablePagination\n        />\n    )\n}"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/organizations/admin-organizations-table.tsx",
    "content": "\"use client\"\nimport {Card, CardContent, CardDescription, CardHeader, CardTitle} from \"@/components/ui/card\";\nimport {OrganizationWithMembers} from \"@/db/schema/03_organization\";\nimport {AdminOrganizationList} from \"@/components/wrappers/dashboard/admin/organizations/organization/admin-orgnization-list\";\n\nexport type AdminOrganizationsTableProps = {\n    organizations: OrganizationWithMembers[];\n\n};\n\nexport const AdminOrganizationsTable = (props: AdminOrganizationsTableProps) => {\n    const {organizations} = props;\n    return (\n        <div className=\"flex flex-col gap-y-4 h-full py-4 \">\n            <Card className=\"h-full\">\n                <CardHeader>\n                    <CardTitle>Active organizations</CardTitle>\n                    <CardDescription>Manage all system organizations</CardDescription>\n                </CardHeader>\n                <CardContent className=\"h-full\">\n                    <AdminOrganizationList organizations={organizations} />\n                </CardContent>\n            </Card>\n        </div>\n    );\n};\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/organizations/columns-organizations.tsx",
    "content": "\"use client\"\nimport {ColumnDef} from \"@tanstack/react-table\";\nimport {Organization} from \"@/db/schema/03_organization\";\n\nexport const organizationsColumnsAdmin: ColumnDef<Organization>[] = [\n\n    {\n        accessorKey: \"name\",\n        header: \"Name\",\n    },\n\n    // {\n    //     header: \"Action\",\n    //     id: \"actions\",\n    //     cell: ({row}) => {\n    //         const router = useRouter();\n    //         const {data: session, isPending} = useSession();\n    //         const isSuperAdmin = session?.user.role == \"superadmin\";\n    //\n    //         return (\n    //             <ButtonDeleteUser\n    //                 disabled={!isSuperAdmin || !session || session?.user.email === row.original.email}\n    //                 userId={row.original.id}/>\n    //         );\n    //     },\n    // },\n];\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/organizations/organization/admin-organization-add-modal.tsx",
    "content": "\"use client\"\n\nimport {CreateOrganizationModal} from \"@/components/wrappers/dashboard/organization/create-organisation-modal\";\nimport {useRouter} from \"next/navigation\";\nimport {authClient} from \"@/lib/auth/auth-client\";\nimport {useState} from \"react\";\nimport {Button} from \"@/components/ui/button\";\nimport {Plus} from \"lucide-react\";\n\ntype AdminOrganizationAddModalProps = {}\n\n\nexport const AdminOrganizationAddModal = (props: AdminOrganizationAddModalProps) => {\n    const router = useRouter();\n    const {data: organizations, refetch} = authClient.useListOrganizations();\n    const {data: activeOrganization, refetch: refetchActiveOrga} = authClient.useActiveOrganization();\n    const [openModal, setOpenModal] = useState(false);\n\n    if (!organizations) return null;\n\n\n    const handleReload = () => {\n        refetch();\n        refetchActiveOrga();\n        router.refresh();\n    };\n\n    const handleOpen = () => {\n        setOpenModal(true);\n    }\n\n\n    return (\n        <>\n\n            <Button onClick={handleOpen}>\n                <Plus/> Create a new organization\n            </Button>\n            <CreateOrganizationModal\n                redirect={\"/dashboard/admin/organizations\"}\n                open={openModal}\n                onSuccess={handleReload}\n                onOpenChange={setOpenModal}\n            />\n        </>\n    )\n}\n\n\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/organizations/organization/admin-organization-form.tsx",
    "content": "\"use client\";\n\nimport { useRouter } from \"next/navigation\";\nimport { ErrorContext } from \"@better-fetch/fetch\";\nimport { useMutation } from \"@tanstack/react-query\";\nimport { toast } from \"sonner\";\n\nimport { Form, FormControl, FormField, FormItem, FormLabel, FormMessage, useZodForm } from \"@/components/ui/form\";\nimport { OrganizationSchema } from \"@/components/wrappers/dashboard/admin/organizations/organization/organization.schema\";\nimport { ButtonWithLoading } from \"@/components/wrappers/common/button/button-with-loading\";\nimport { Input } from \"@/components/ui/input\";\nimport { authClient } from \"@/lib/auth/auth-client\";\nimport { slugify } from \"@/utils/slugify\";\n\ntype AdminOrganizationFormProps = {\n    onSuccess?: () => void;\n};\n\nexport const AdminOrganizationForm = ({ onSuccess }: AdminOrganizationFormProps) => {\n\n    const router = useRouter();\n    const form = useZodForm({ schema: OrganizationSchema });\n\n    const mutationCreateOrganisation = useMutation({\n        mutationFn: async ({ name }: OrganizationSchema) => {\n            const slug = slugify(name);\n            await authClient.organization.checkSlug(\n                {\n                    slug: slug,\n                },\n                {\n                    onSuccess: async () => {\n                        await authClient.organization.create(\n                            {\n                                name: name,\n                                slug: slug,\n                            },\n                            {\n                                onSuccess: () => {\n                                    toast.success(\"Organization created successfully.\");\n                                    router.refresh();\n                                    onSuccess?.();\n                                },\n                                onError: (error) => {\n                                    toast.error(error.error.message);\n                                },\n                            }\n                        );\n                    },\n                    onError: (error: ErrorContext) => {\n                        toast.error(error.error.message);\n                        onSuccess?.();\n                    },\n                }\n            );\n        },\n    });\n\n    return (\n        <Form\n            form={form}\n            className=\"flex flex-col gap-4\"\n            onSubmit={async (values) => {\n                await mutationCreateOrganisation.mutateAsync(values);\n            }}\n        >\n            <FormField\n                control={form.control}\n                name=\"name\"\n                render={({ field }) => (\n                    <FormItem>\n                        <FormLabel>Name</FormLabel>\n                        <FormControl>\n                            <Input placeholder=\"Name of your organization\" {...field} value={field.value ?? \"\"} />\n                        </FormControl>\n                        <FormMessage />\n                    </FormItem>\n                )}\n            />\n            <div className=\"flex gap-4 justify-end\">\n                <ButtonWithLoading isPending={mutationCreateOrganisation.isPending}>Validate</ButtonWithLoading>\n            </div>\n        </Form>\n    );\n};\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/organizations/organization/admin-organization-section.tsx",
    "content": "\"use client\";\n\nimport { Card, CardAction, CardContent, CardHeader, CardTitle } from \"@/components/ui/card\";\nimport { AdminOrganizationList } from \"@/components/wrappers/dashboard/admin/organizations/organization/admin-orgnization-list\";\nimport { AdminOrganizationAddModal } from \"@/components/wrappers/dashboard/admin/organizations/organization/admin-organization-add-modal\";\nimport {OrganizationWithMembers} from \"@/db/schema/03_organization\";\n\ntype AdminOrganizationSectionProps = {\n    organizations: OrganizationWithMembers[];\n};\n\nexport const AdminOrganizationSection = ({ organizations }: AdminOrganizationSectionProps) => {\n\n    return (\n        <Card>\n            <CardHeader>\n                <CardTitle>Add a new organization</CardTitle>\n                <CardAction>\n                    <AdminOrganizationAddModal />\n                </CardAction>\n            </CardHeader>\n            <CardContent>\n                <AdminOrganizationList organizations={organizations} />\n            </CardContent>\n        </Card>\n    );\n};\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/organizations/organization/admin-orgnization-list.tsx",
    "content": "\"use client\"\nimport { DataTable } from \"@/components/wrappers/common/table/data-table\";\nimport { organizationsListColumns } from \"@/components/wrappers/dashboard/admin/organizations/organization/table-colums\";\nimport {OrganizationWithMembers} from \"@/db/schema/03_organization\";\n\ntype AdminOrganizationListProps = {\n    organizations: OrganizationWithMembers[];\n};\n\nexport const AdminOrganizationList = ({ organizations }: AdminOrganizationListProps) => {\n    return <DataTable columns={organizationsListColumns()} data={organizations} enablePagination={true} enableSelect={false} />;\n};\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/organizations/organization/button-delete-organization.tsx",
    "content": "\"use client\"\n\nimport {useRouter} from \"next/navigation\";\nimport {useMutation} from \"@tanstack/react-query\";\nimport {Trash2} from \"lucide-react\";\nimport {toast} from \"sonner\";\nimport {ButtonWithConfirm} from \"@/components/wrappers/common/button/button-with-confirm\";\nimport {authClient} from \"@/lib/auth/auth-client\";\nimport {deleteOrganizationAction} from \"@/features/organization/organization.action\";\n\nexport type ButtonDeleteFleetProps = {\n    text?: string;\n    organisationId: string\n};\n\nexport const ButtonDeleteOrganization = (props: ButtonDeleteFleetProps) => {\n\n    const router = useRouter();\n    const {data: organizations, refetch} = authClient.useListOrganizations();\n\n\n    const mutationDeleteOrganisation = useMutation({\n        mutationFn: () => deleteOrganizationAction({id: props.organisationId}),\n        onSuccess: async (result) => {\n            if (result?.data?.success) {\n                await authClient.organization.setActive({\n                    organizationSlug: \"default\",\n                });\n                toast.success(\"Organization deleted!\");\n                router.refresh()\n                refetch()\n            } else {\n                toast.error(\"An error occurred.\");\n            }\n        },\n        onError: (error: any) => {\n            console.error(\"network error:\", error);\n            toast.error(error?.message || \"A network error occurred.\");\n        },\n    });\n\n\n    return (\n        <ButtonWithConfirm\n            title={props.text ? props.text : \"\"}\n            description={\"Are you sure you want to delete this organization?\"}\n            button={{\n                main: {\n                    variant: \"outline\",\n                    icon: <Trash2 color=\"red\"/>,\n                },\n                confirm: {\n                    className: \"w-full\",\n                    text: \"Delete\",\n                    icon: <Trash2/>,\n                    variant: \"destructive\",\n                    onClick: async () => {\n                        await mutationDeleteOrganisation.mutateAsync()\n                    },\n                },\n                cancel: {\n                    className: \"w-full\",\n                    text: \"Cancel\",\n                    icon: <Trash2/>,\n                    variant: \"outline\",\n                },\n            }}\n            isPending={mutationDeleteOrganisation.isPending}\n        />\n    );\n};\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/organizations/organization/details/add-member.action.ts",
    "content": "\"use server\";\n\nimport { ServerActionResult } from \"@/types/action-type\";\nimport { z } from \"zod\";\nimport { auth } from \"@/lib/auth/auth\";\nimport { MemberRoleType } from \"@/types/common\";\nimport { Member } from \"better-auth/plugins/organization\";\nimport {userAction} from \"@/lib/safe-actions/actions\";\n\nexport const addMemberOrganizationAction = userAction\n    .schema(\n        z.object({\n            userId: z.string(),\n            organizationId: z.string(),\n            role: z.string(),\n        })\n    )\n    .action(async ({ parsedInput }): Promise<ServerActionResult<Member | null>> => {\n        try {\n            const data = await auth.api.addMember({\n                body: {\n                    userId: parsedInput.userId,\n                    role: parsedInput.role as MemberRoleType,\n                    organizationId: parsedInput.organizationId,\n                },\n            });\n\n            return {\n                success: true,\n                value: data,\n                actionSuccess: {\n                    message: \"Member added successfully\",\n                },\n            };\n        } catch (error) {\n            return {\n                success: false,\n                actionError: {\n                    message: \"An error occurred while addinng member\",\n                    cause: error instanceof Error ? error.message : \"Unknown error\",\n                },\n            };\n        }\n    });\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/organizations/organization/details/organization-add-member-form.tsx",
    "content": "\"use client\";\n\nimport {useRouter} from \"next/navigation\";\nimport {useMutation} from \"@tanstack/react-query\";\n\nimport {Form, FormControl, FormField, FormItem, FormLabel, FormMessage, useZodForm} from \"@/components/ui/form\";\nimport {\n    AddMemberSchema,\n    AddMemberSchemaType\n} from \"@/components/wrappers/dashboard/admin/organizations/organization/organization.schema\";\nimport {SearchInput} from \"@/components/ui/search-input\";\nimport {\n    addMemberOrganizationAction\n} from \"@/components/wrappers/dashboard/admin/organizations/organization/details/add-member.action\";\nimport {toast} from \"sonner\";\nimport {OrganizationWithMembers, OrganizationWithMembersAndUsers} from \"@/db/schema/03_organization\";\nimport {User} from \"@/db/schema/02_user\";\nimport {ButtonWithLoading} from \"@/components/wrappers/common/button/button-with-loading\";\n\ntype OrganizationAddMemberFormProps = {\n    onSuccessAction?: () => void;\n    users: User[];\n    organization: OrganizationWithMembersAndUsers;\n};\n\nexport const OrganizationAddMemberForm = ({onSuccessAction, users, organization}: OrganizationAddMemberFormProps) => {\n\n    const organizationMemberUserIds = organization.members.map((member) => member.user.id);\n    const filteredUsers = users\n        .filter((user) => !organizationMemberUserIds.includes(user.id))\n        .map((user) => ({value: user.id, label: `${user.name} | ${user.email}`}));\n    const router = useRouter();\n    const form = useZodForm({schema: AddMemberSchema});\n\n    const mutationAddMemberOrganisation = useMutation({\n        mutationFn: async (data: AddMemberSchemaType) => {\n            const result = await addMemberOrganizationAction({\n                userId: data.userId,\n                organizationId: organization.id,\n                role: \"member\",\n            });\n            toast.success(\"Member successfully added!\");\n            router.refresh();\n            onSuccessAction?.();\n        },\n        onError: (error) => {\n            toast.error(error.message);\n            onSuccessAction?.();\n        },\n    });\n\n    return (\n        <Form\n            form={form}\n            className=\"flex flex-col gap-4\"\n            onSubmit={async (values) => {\n                await mutationAddMemberOrganisation.mutateAsync(values);\n            }}\n        >\n            <FormField\n                control={form.control}\n                name=\"userId\"\n                render={({field}) => (\n                    <FormItem>\n                        <FormLabel>User</FormLabel>\n                        <FormControl>\n                            <SearchInput\n                                name=\"userId\"\n                                placeholder=\"Enter a user email\"\n                                entries={filteredUsers}\n                                onSelect={(entySelected: any) => {\n                                    field.onChange(entySelected.value);\n                                }}\n                            />\n                        </FormControl>\n                        <FormMessage/>\n                    </FormItem>\n                )}\n            />\n\n            <div className=\"flex gap-4 justify-end\">\n                <ButtonWithLoading\n                    isPending={mutationAddMemberOrganisation.isPending}>Confirm</ButtonWithLoading>\n            </div>\n        </Form>\n    );\n};\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/organizations/organization/details/organization-add-member-modal.tsx",
    "content": "\"use client\";\n\nimport {\n    Dialog,\n    DialogContent,\n    DialogDescription,\n    DialogHeader,\n    DialogTitle,\n    DialogTrigger\n} from \"@/components/ui/dialog\";\nimport {\n    OrganizationAddMemberForm\n} from \"@/components/wrappers/dashboard/admin/organizations/organization/details/organization-add-member-form\";\nimport {useState} from \"react\";\nimport {UserPlus} from \"lucide-react\";\nimport {Button} from \"@/components/ui/button\";\nimport { OrganizationWithMembersAndUsers} from \"@/db/schema/03_organization\";\nimport {User} from \"@/db/schema/02_user\";\n\ntype OrganizationAddMemberModalProps = {\n    users: User[];\n    organization: OrganizationWithMembersAndUsers;\n};\n\nexport const OrganizationAddMemberModal = ({users, organization}: OrganizationAddMemberModalProps) => {\n    const [open, setOpen] = useState(false);\n    return (\n        <Dialog open={open} onOpenChange={setOpen}>\n            <DialogTrigger asChild>\n                <Button>\n                    <UserPlus className=\"w-4 h-4 mr-2\"/>\n                    Add member\n                </Button>\n            </DialogTrigger>\n            <DialogContent>\n                <DialogHeader>\n                    <DialogTitle>Add member to your organization</DialogTitle>\n                    <DialogDescription>Select a user to add to your organization</DialogDescription>\n                </DialogHeader>\n                <OrganizationAddMemberForm users={users} organization={organization}\n                                           onSuccessAction={() => setOpen(!open)}/>\n            </DialogContent>\n        </Dialog>\n    );\n};\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/organizations/organization/details/organization-delete-member-modal.tsx",
    "content": "\"use client\";\n\nimport { useMutation } from \"@tanstack/react-query\";\nimport { ButtonWithLoading } from \"@/components/wrappers/common/button/button-with-loading\";\nimport { useRouter } from \"next/navigation\";\nimport {\n    AlertDialog,\n    AlertDialogCancel,\n    AlertDialogContent,\n    AlertDialogDescription,\n    AlertDialogFooter,\n    AlertDialogHeader,\n    AlertDialogTitle,\n} from \"@/components/ui/alert-dialog\";\nimport { authClient } from \"@/lib/auth/auth-client\";\nimport { toast } from \"sonner\";\nimport {MemberWithUser} from \"@/db/schema/03_organization\";\n\ntype OrganizationDeleteMemberModalProps = {\n    open: boolean;\n    member: MemberWithUser;\n    onOpenChangeAction: (open: boolean) => void;\n};\n\nexport const OrganizationDeleteMemberModal = ({ member, open, onOpenChangeAction }: OrganizationDeleteMemberModalProps) => {\n\n    const router = useRouter();\n\n    const mutation = useMutation({\n        mutationFn: async () => {\n            await authClient.organization.removeMember(\n                {\n                    memberIdOrEmail: member.id,\n                    organizationId: member.organizationId,\n                },\n                {\n                    onSuccess: async (response) => {\n                        toast.success(\"Member successfully deleted!\");\n                        onOpenChangeAction(false);\n                        router.refresh();\n                    },\n                    onError: async (error) => {\n                        toast.error(\"An error occurred while deleting member!\");\n                        onOpenChangeAction(false);\n                    },\n                }\n            );\n        },\n    });\n\n    return (\n        <AlertDialog open={open} onOpenChange={onOpenChangeAction}>\n            <AlertDialogContent>\n                <AlertDialogHeader>\n                    <AlertDialogTitle>Are you sure you want to delete {member.user.name } ?</AlertDialogTitle>\n                    <AlertDialogDescription>This action is irreversible: it will permanently delete this member’s data.</AlertDialogDescription>\n                </AlertDialogHeader>\n                <AlertDialogFooter>\n                    <AlertDialogCancel>Cancel</AlertDialogCancel>\n                    <ButtonWithLoading onClick={async () => await mutation.mutateAsync()}>Validate</ButtonWithLoading>\n                </AlertDialogFooter>\n            </AlertDialogContent>\n        </AlertDialog>\n    );\n};\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/organizations/organization/details/organization-member-card.tsx",
    "content": "\"use client\";\nimport {Avatar, AvatarFallback, AvatarImage} from \"@/components/ui/avatar\";\nimport {Badge} from \"@/components/ui/badge\";\nimport {\n    DropdownMenu,\n    DropdownMenuContent,\n    DropdownMenuItem,\n    DropdownMenuSeparator,\n    DropdownMenuTrigger\n} from \"@/components/ui/dropdown-menu\";\nimport {Button} from \"@/components/ui/button\";\nimport {MoreHorizontal, Settings, Trash2} from \"lucide-react\";\nimport {\n    OrganizationDeleteMemberModal\n} from \"@/components/wrappers/dashboard/admin/organizations/organization/details/organization-delete-member-modal\";\nimport {useState} from \"react\";\nimport {authClient} from \"@/lib/auth/auth-client\";\nimport {\n    OrganizationMemberChangeRoleModal\n} from \"@/components/wrappers/dashboard/admin/organizations/organization/details/organization-member-change-role\";\nimport {MemberWithUser, OrganizationWithMembersAndUsers} from \"@/db/schema/03_organization\";\n\ntype OrganizationMemberCardProps = {\n    member: MemberWithUser;\n    organization: OrganizationWithMembersAndUsers;\n};\n\nexport const OrganizationMemberCard = ({member, organization}: OrganizationMemberCardProps) => {\n\n    const [isModalDeleteOpen, setIsModalDeleteOpen] = useState(false);\n    const [isModalRoleOpen, setIsModalRoleOpen] = useState(false);\n    const {data: session, isPending, error} = authClient.useSession();\n\n    if (isPending || error) return null;\n    const isCurrentUser = session?.user?.id === member.user.id;\n    const isOwner = member?.role === \"owner\";\n\n    return (\n        <div key={member.id}\n             className=\"flex flex-col md:flex-row md:items-center justify-between p-4 border rounded-lg\">\n            <OrganizationDeleteMemberModal member={member} open={isModalDeleteOpen}\n                                           onOpenChangeAction={setIsModalDeleteOpen}/>\n            <OrganizationMemberChangeRoleModal member={member} open={isModalRoleOpen}\n                                               onOpenChangeAction={setIsModalRoleOpen}/>\n            <div className=\"flex items-center space-x-4\">\n                <Avatar>\n                    <AvatarImage src={member.user.image || \"\"} alt={member.user.name}/>\n                    <AvatarFallback>\n                        {member.user.name\n                            .split(\" \")\n                            .map((n) => n[0])\n                            .join(\"\")}\n                    </AvatarFallback>\n                </Avatar>\n                <div>\n                    <div className=\"font-medium\">{member.user.name}</div>\n                    <div className=\"text-sm text-muted-foreground\">{member.user.email}</div>\n                    <div\n                        className=\"text-xs text-muted-foreground\">Joined {new Date(member.createdAt).toLocaleDateString()}</div>\n                </div>\n            </div>\n            <div className=\"flex items-center space-x-2 mt-4 md:mt-0\">\n                <Badge variant={getRoleBadgeVariant(member.role)}>{member.role}</Badge>\n                    <DropdownMenu>\n                        <DropdownMenuTrigger asChild>\n                            <Button variant=\"ghost\" size=\"icon\">\n                                <MoreHorizontal className=\"w-4 h-4\"/>\n                            </Button>\n                        </DropdownMenuTrigger>\n                        <DropdownMenuContent align=\"end\">\n                            <DropdownMenuItem onSelect={() => setIsModalRoleOpen(true)}>\n                                <Settings className=\"w-4 h-4 mr-2\"/>\n                                Change role\n                            </DropdownMenuItem>\n                            <DropdownMenuSeparator/>\n                            <DropdownMenuItem onSelect={() => setIsModalDeleteOpen(true)} className=\"text-red-600\">\n                                <Trash2 className=\"w-4 h-4 mr-2\"/>\n                                Remove member\n                            </DropdownMenuItem>\n                        </DropdownMenuContent>\n                    </DropdownMenu>\n            </div>\n        </div>\n    );\n};\n\nconst getRoleBadgeVariant = (role: string) => {\n    switch (role.toLowerCase()) {\n        case \"owner\":\n            return \"default\";\n        case \"admin\":\n            return \"secondary\";\n        default:\n            return \"outline\";\n    }\n};\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/organizations/organization/details/organization-member-change-role.tsx",
    "content": "\"use client\";\n\nimport {useState} from \"react\";\nimport {useRouter} from \"next/navigation\";\nimport {useMutation} from \"@tanstack/react-query\";\nimport {toast} from \"sonner\";\n\nimport {\n    Dialog,\n    DialogContent,\n    DialogDescription,\n    DialogFooter,\n    DialogHeader,\n    DialogTitle\n} from \"@/components/ui/dialog\";\nimport {Select, SelectContent, SelectItem, SelectTrigger, SelectValue} from \"@/components/ui/select\";\nimport {ButtonWithLoading} from \"@/components/wrappers/common/button/button-with-loading\";\nimport {MemberRoleType} from \"@/types/common\";\nimport {MemberWithUser} from \"@/db/schema/03_organization\";\nimport {\n    updateMemberRoleAdminAction\n} from \"@/components/wrappers/dashboard/admin/organizations/organization/details/role-member.action\";\nimport {RoleSchemaMember} from \"@/components/wrappers/dashboard/organization/settings/member.schema\";\n\ntype OrganizationMemberChangeRoleModalProps = {\n    open: boolean;\n    member: MemberWithUser;\n    onOpenChangeAction: (open: boolean) => void;\n};\n\nexport const OrganizationMemberChangeRoleModal = (props: OrganizationMemberChangeRoleModalProps) => {\n    const {member, open, onOpenChangeAction} = props;\n\n    const router = useRouter();\n    const [role, setRole] = useState<MemberRoleType>(member.role as MemberRoleType);\n\n    const mutation = useMutation({\n        mutationFn: () =>\n            updateMemberRoleAdminAction({\n                memberId: member.id,\n                organizationId: member.organizationId,\n                role: RoleSchemaMember.parse(role),\n            }),\n        onSuccess: () => {\n            toast.success(\"Member successfully updated\");\n            onOpenChangeAction(false);\n            router.refresh();\n        },\n        onError: (error) => {\n            toast.error(\"An error occurred while updating member\");\n            onOpenChangeAction(false);\n        },\n    });\n\n\n    return (\n        <Dialog open={open} onOpenChange={onOpenChangeAction}>\n            <DialogContent>\n                <DialogHeader>\n                    <DialogTitle>Change the user’s role</DialogTitle>\n                    <DialogDescription>Modify the role of this user within your organization.</DialogDescription>\n                </DialogHeader>\n                <Select defaultValue={member.role ?? \"\"} onValueChange={(role) => setRole(role as MemberRoleType)}>\n                    <SelectTrigger className=\"w-full\">\n                        <SelectValue placeholder=\"Sélectionnez un rôle\"/>\n                    </SelectTrigger>\n                    <SelectContent>\n                        <SelectItem value=\"member\">Member</SelectItem>\n                        <SelectItem value=\"admin\">Admin</SelectItem>\n                        <SelectItem value=\"owner\">Owner</SelectItem>\n                    </SelectContent>\n                </Select>\n                <DialogFooter>\n                    <div className=\"flex gap-4 justify-end\">\n                        <ButtonWithLoading\n                            variant=\"outline\"\n                            onClick={() => {\n                                onOpenChangeAction(false);\n                            }}\n                        >\n                            Cancel\n                        </ButtonWithLoading>\n                        <ButtonWithLoading\n                            isPending={mutation.isPending}\n                            onClick={async () => {\n                                await mutation.mutateAsync();\n                            }}\n                        >\n                            Validate\n                        </ButtonWithLoading>\n                    </div>\n                </DialogFooter>\n            </DialogContent>\n        </Dialog>\n    );\n};\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/organizations/organization/details/role-member.action.ts",
    "content": "\"use server\";\nimport {userAction} from \"@/lib/safe-actions/actions\";\nimport {z} from \"zod\";\nimport {ServerActionResult} from \"@/types/action-type\";\nimport {Member} from \"better-auth/plugins\";\nimport {db as dbClient} from \"@/db\";\nimport * as drizzleDb from \"@/db\";\nimport {and, eq} from \"drizzle-orm\";\nimport {withUpdatedAt} from \"@/db/utils\";\nimport {RoleSchemaMember} from \"@/components/wrappers/dashboard/organization/settings/member.schema\";\n\n\nexport const updateMemberRoleAdminAction = userAction.schema(\n    z.object({\n        memberId: z.string(),\n        organizationId: z.string(),\n        role: RoleSchemaMember,\n    })\n).action(async ({parsedInput}): Promise<ServerActionResult<Member>> => {\n    try {\n\n        const [updatedMember] = await dbClient\n            .update(drizzleDb.schemas.member)\n            .set(withUpdatedAt({\n                role: parsedInput.role as string,\n            }))\n            .where(and(eq(drizzleDb.schemas.member.id, parsedInput.memberId), eq(drizzleDb.schemas.member.organizationId, parsedInput.organizationId)))\n            .returning();\n\n\n        return {\n            success: true,\n            value: updatedMember,\n            actionSuccess: {\n                message: \"Member has been successfully updated.\",\n                messageParams: {},\n            },\n        };\n    } catch (error) {\n        return {\n            success: false,\n            actionError: {\n                message: \"Failed to update member role.\",\n                status: 500,\n                cause: error instanceof Error ? error.message : \"Unknown error\",\n                messageParams: {},\n            },\n        };\n    }\n});\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/organizations/organization/details/update-organization-form.tsx",
    "content": "\"use client\";\n\nimport {useRouter} from \"next/navigation\";\nimport {useMutation} from \"@tanstack/react-query\";\n\nimport {Form, FormControl, FormField, FormItem, FormLabel, FormMessage, useZodForm} from \"@/components/ui/form\";\nimport {\n    UpdateOrganizationSchema,\n    UpdateOrganizationSchemaType\n} from \"@/components/wrappers/dashboard/admin/organizations/organization/organization.schema\";\nimport {ButtonWithLoading} from \"@/components/wrappers/common/button/button-with-loading\";\nimport {Input} from \"@/components/ui/input\";\nimport {authClient} from \"@/lib/auth/auth-client\";\nimport {toast} from \"sonner\";\nimport {OrganizationWithMembersAndUsers} from \"@/db/schema/03_organization\";\nimport {updateOrganizationAction} from \"@/features/organization/organization.action\";\n\ntype UpdateOrganizationFormProps = {\n    onSuccessAction?: () => void;\n    defaultValues: OrganizationWithMembersAndUsers;\n};\n\nexport const UpdateOrganizationForm = ({onSuccessAction, defaultValues}: UpdateOrganizationFormProps) => {\n\n    const router = useRouter();\n    const {data: organizations, refetch} = authClient.useListOrganizations();\n\n    const isDefaultOrganization = defaultValues.slug == \"default\";\n\n    const form = useZodForm({\n        schema: UpdateOrganizationSchema,\n        defaultValues: defaultValues,\n        disabled: isDefaultOrganization,\n    });\n\n\n    const mutationUpdateOrganisation = useMutation({\n        mutationFn: ({name}: UpdateOrganizationSchemaType) => updateOrganizationAction({\n            data: {\n                name: name,\n                users: [],\n                slug: defaultValues.slug\n            },\n            organizationId: defaultValues.id,\n        }),\n        onSuccess: async (result) => {\n            if (result?.data?.success) {\n                toast.success(\"Organization updated successfully.\");\n                router.refresh();\n                refetch()\n            } else {\n                // @ts-ignore\n                const errorMsg = result?.data?.actionError?.message || result?.data?.actionError?.messageParams?.message || \"Failed to update the organization.\";\n                toast.error(errorMsg);\n            }\n        },\n        onError: (error: any) => {\n            console.error(\"Mutation network error:\", error);\n            toast.error(error?.message || \"A network error occurred.\");\n        },\n    });\n\n\n    return (\n        <Form\n            form={form}\n            className=\"flex flex-col gap-4\"\n            onSubmit={async (values) => {\n                await mutationUpdateOrganisation.mutateAsync(values);\n            }}\n        >\n            <FormField\n                control={form.control}\n                name=\"name\"\n                render={({field}) => (\n                    <FormItem>\n                        <FormLabel>Name</FormLabel>\n                        <FormControl>\n                            <Input placeholder=\"\" {...field} value={field.value ?? \"\"}/>\n                        </FormControl>\n                        <FormMessage/>\n                    </FormItem>\n                )}\n            />\n\n            <div className=\"flex gap-4 justify-end\">\n                <ButtonWithLoading disabled={isDefaultOrganization} isPending={mutationUpdateOrganisation.isPending}>Validate</ButtonWithLoading>\n            </div>\n        </Form>\n    );\n};\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/organizations/organization/organization-management.tsx",
    "content": "\"use client\";\n\nimport {Building2, Shield, Users} from \"lucide-react\";\nimport {Card, CardContent, CardDescription, CardHeader, CardTitle} from \"@/components/ui/card\";\nimport {Tabs, TabsContent, TabsList, TabsTrigger} from \"@/components/ui/tabs\";\nimport {MemberWithUser, OrganizationWithMembersAndUsers} from \"@/db/schema/03_organization\";\nimport {\n    UpdateOrganizationForm\n} from \"@/components/wrappers/dashboard/admin/organizations/organization/details/update-organization-form\";\nimport {\n    OrganizationMemberCard\n} from \"@/components/wrappers/dashboard/admin/organizations/organization/details/organization-member-card\";\nimport {useRouter, useSearchParams} from \"next/navigation\";\nimport {useEffect, useState} from \"react\";\nimport {capitalizeFirstLetter} from \"@/utils/text\";\nimport {User} from \"@/db/schema/02_user\";\nimport {\n    OrganizationAddMemberModal\n} from \"@/components/wrappers/dashboard/admin/organizations/organization/details/organization-add-member-modal\";\nimport {cn} from \"@/lib/utils\";\n\ntype OrganizationManagementProps = {\n    organization: OrganizationWithMembersAndUsers;\n    users: User[];\n};\n\nexport const OrganizationManagement = ({organization, users}: OrganizationManagementProps) => {\n\n    const router = useRouter();\n    const searchParams = useSearchParams();\n    const [tab, setTab] = useState<string>(() => searchParams.get(\"tab\") ?? \"members\");\n\n    useEffect(() => {\n        const newTab = searchParams.get(\"tab\") ?? \"members\";\n        setTab(newTab);\n    }, [searchParams]);\n\n    const handleChangeTab = (value: string) => {\n        router.push(`?tab=${value}`);\n    };\n\n    return (\n        <div className=\" space-y-8\">\n            <div className=\"flex flex-col md:flex-row md:items-center justify-between\">\n                <div className=\"flex items-center space-x-4\">\n                    <div className=\"flex items-center justify-center w-12 h-12 dark:bg-gray-700 bg-gray-100 rounded-lg\">\n                        <Building2 className=\"w-6 h-6 \"/>\n                    </div>\n                    <div>\n                        <h1 className=\"text-2xl font-bold\">{capitalizeFirstLetter(organization.name)}</h1>\n                    </div>\n                </div>\n                <div className=\"flex items-center space-x-2 mt-3 md:mt-0\">\n                    <OrganizationAddMemberModal organization={organization} users={users}/>\n                </div>\n            </div>\n            <div className=\"grid grid-cols-1 md:grid-cols-2 gap-6\">\n                <Card>\n                    <CardHeader className=\"flex flex-row items-center justify-between space-y-0 pb-2\">\n                        <CardTitle className=\"text-sm font-medium\">Members</CardTitle>\n                        <Users className=\"h-4 w-4 text-muted-foreground\"/>\n                    </CardHeader>\n                    <CardContent>\n                        <div className=\"text-2xl font-bold\">{organization.members.length}</div>\n                        <p className=\"text-xs text-muted-foreground\">Number of members</p>\n                    </CardContent>\n                </Card>\n                <Card>\n                    <CardHeader className=\"flex flex-row items-center justify-between space-y-0 pb-2\">\n                        <CardTitle className=\"text-sm font-medium\">Administrators</CardTitle>\n                        <Shield className=\"h-4 w-4 text-muted-foreground\"/>\n                    </CardHeader>\n                    <CardContent>\n                        <div\n                            className=\"text-2xl font-bold\">{organization.members.filter((m) => m.role === \"admin\" || m.role === \"owner\").length}</div>\n                        <p className=\"text-xs text-muted-foreground\">With admin roles</p>\n                    </CardContent>\n                </Card>\n            </div>\n            <Tabs className=\"space-y-6\" value={tab} onValueChange={handleChangeTab}>\n                <TabsList>\n                    <TabsTrigger value=\"members\">Members</TabsTrigger>\n                    <TabsTrigger  value=\"settings\">Settings</TabsTrigger>\n                </TabsList>\n                <TabsContent value=\"members\" className=\"space-y-6\">\n                    <Card>\n                        <CardHeader>\n                            <CardTitle>Organization members</CardTitle>\n                            <CardDescription>Manage who has access to your organization and their\n                                roles.</CardDescription>\n                        </CardHeader>\n                        <CardContent>\n                            <div className=\"space-y-4\">\n                                {organization.members.map((member: MemberWithUser) => (\n                                    <OrganizationMemberCard key={member.id} member={member}\n                                                            organization={organization}/>\n                                ))}\n                            </div>\n                        </CardContent>\n                    </Card>\n                </TabsContent>\n                <TabsContent value=\"settings\" className=\"space-y-6\">\n                    <Card>\n                        <CardHeader>\n                            <CardTitle>Settings</CardTitle>\n                            <CardDescription>Organization configuration settings.</CardDescription>\n                        </CardHeader>\n                        <CardContent className=\"space-y-4\">\n                            <UpdateOrganizationForm defaultValues={organization}/>\n                        </CardContent>\n                    </Card>\n                </TabsContent>\n            </Tabs>\n        </div>\n    );\n};\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/organizations/organization/organization.schema.ts",
    "content": "import {z} from \"zod\";\n\nexport const AddMemberSchema = z.object({\n    userId: z.string().min(1, \"Invalid field\"),\n});\n\nexport const UpdateOrganizationSchema = z.object({\n    name: z.string().min(5),\n});\n\nexport const OrganizationSchema = z.object({\n    name: z.string(),\n});\n\nexport const OrganizationInvitationSchema = z.object({\n    email: z.string(),\n    invitedByUsername: z.string(),\n    invitedByEmail: z.string(),\n    teamName: z.string(),\n    inviteLink: z.string()\n});\n\nexport type OrganizationInvitationType = z.infer<typeof OrganizationInvitationSchema>;\nexport type OrganizationSchema = z.infer<typeof OrganizationSchema>;\nexport type UpdateOrganizationSchemaType = z.infer<typeof UpdateOrganizationSchema>;\nexport type AddMemberSchemaType = z.infer<typeof AddMemberSchema>;\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/organizations/organization/table-colums.tsx",
    "content": "\"use client\";\nimport {ColumnDef} from \"@tanstack/react-table\";\nimport {ButtonDeleteOrganization} from \"@/components/wrappers/dashboard/admin/organizations/organization/button-delete-organization\";\nimport Link from \"next/link\";\nimport {Settings} from \"lucide-react\";\nimport {buttonVariants} from \"@/components/ui/button\";\nimport {OrganizationWithMembers} from \"@/db/schema/03_organization\";\n\nexport function organizationsListColumns(): ColumnDef<OrganizationWithMembers>[] {\n\n    return [\n        {\n            accessorKey: \"name\",\n            header: \"Name\",\n        },\n        {\n            accessorKey: \"members\",\n            header: \"Members\",\n            cell: ({row}) => {\n                const membersCount = row.original.members?.length;\n                return <div className=\"flex items-center gap-3\">{membersCount}</div>;\n            },\n        },\n        {\n            header: \"Actions\",\n            id: \"actions\",\n            cell: ({row}) => {\n                const isDefaultOrganization = row.original.slug == \"default\";\n                return (\n                    <div className=\"flex items-center gap-3\">\n                        {!isDefaultOrganization && (\n                            <ButtonDeleteOrganization organisationId={row.original.id}/>\n                        )}\n                        <Link className={buttonVariants({variant: \"outline\"})}\n                              href={`organizations/${row.original.id}`}>\n                            <Settings/>\n                        </Link>\n                    </div>\n                );\n            },\n        },\n    ];\n}\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/settings/email/email-form/email-form.action.ts",
    "content": "\"use server\";\nimport { z } from \"zod\";\nimport { EmailFormSchema } from \"@/components/wrappers/dashboard/admin/settings/email/email-form/email-form.schema\";\nimport { eq } from \"drizzle-orm\";\nimport { db } from \"@/db\";\nimport * as drizzleDb from \"@/db\";\nimport {userAction} from \"@/lib/safe-actions/actions\";\nimport {withUpdatedAt} from \"@/db/utils\";\n\nexport const updateEmailSettingsAction = userAction\n    .schema(\n        z.object({\n            name: z.string(),\n            data: EmailFormSchema,\n        })\n    )\n    .action(async ({ parsedInput }) => {\n        const { name, data } = parsedInput;\n\n        const [updatedSettings] = await db\n            .update(drizzleDb.schemas.setting)\n            .set(withUpdatedAt({\n                ...data,\n            }))\n            .where(eq(drizzleDb.schemas.setting.name, name))\n            .returning();\n\n        return {\n            data: updatedSettings,\n        };\n    });\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/settings/email/email-form/email-form.schema.ts",
    "content": "import { z } from \"zod\";\n\nexport const EmailFormSchema = z.object({\n    smtpPassword: z.string(),\n    smtpFrom: z.string(),\n    smtpHost: z.string(),\n    smtpPort: z.string(),\n    smtpUser: z.string(),\n    smtpSecure: z.boolean()\n});\n\nexport type EmailFormType = z.infer<typeof EmailFormSchema>;\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/settings/email/email-form/email-form.tsx",
    "content": "\"use client\";\n\nimport {\n    FormControl,\n    FormDescription,\n    FormField,\n    FormItem,\n    FormLabel,\n    FormMessage,\n    useZodForm\n} from \"@/components/ui/form\";\nimport {Input} from \"@/components/ui/input\";\nimport {Form} from \"@/components/ui/form\";\nimport {Button} from \"@/components/ui/button\";\nimport {useMutation} from \"@tanstack/react-query\";\nimport {Tooltip, TooltipContent, TooltipProvider, TooltipTrigger} from \"@/components/ui/tooltip\";\n\nimport {\n    EmailFormSchema,\n    EmailFormType\n} from \"@/components/wrappers/dashboard/admin/settings/email/email-form/email-form.schema\";\nimport {PasswordInput} from \"@/components/ui/password-input\";\nimport {\n    updateEmailSettingsAction\n} from \"@/components/wrappers/dashboard/admin/settings/email/email-form/email-form.action\";\nimport {toast} from \"sonner\";\nimport {useRouter} from \"next/navigation\";\nimport {sendEmail} from \"@/lib/email\";\nimport {render} from \"@react-email/components\";\nimport EmailSettingsTest from \"@/components/emails/email-settings-test\";\nimport {ButtonWithLoading} from \"@/components/wrappers/common/button/button-with-loading\";\nimport {Send} from \"lucide-react\";\nimport {Switch} from \"@/components/ui/switch\";\n\nexport type EmailFormProps = {\n    defaultValues?: EmailFormType;\n};\n\nexport const EmailForm = (props: EmailFormProps) => {\n    const form = useZodForm({\n        schema: EmailFormSchema,\n        defaultValues: props.defaultValues,\n    });\n    const isDirty = form.formState.isDirty;\n\n    const router = useRouter();\n\n    const mutation = useMutation({\n        mutationFn: async (values: EmailFormType) => {\n            const updateEmailSettings = await updateEmailSettingsAction({name: \"system\", data: values});\n            const data = updateEmailSettings?.data?.data;\n            if (updateEmailSettings?.serverError || !data) {\n                toast.error(updateEmailSettings?.serverError);\n                return;\n            }\n            toast.success(`Success updating email informations`);\n            form.reset(data);\n            router.refresh();\n        },\n    });\n\n    const mutationSendEmailTest = useMutation({\n        mutationFn: async () => {\n            if (!props.defaultValues?.smtpUser || !props.defaultValues?.smtpFrom) {\n                toast.error(\"SMTP is not configured\");\n                return;\n            }\n\n\n            try {\n                const email = await sendEmail({\n                    to: props.defaultValues.smtpUser,\n                    subject: \"Portabase\",\n                    html: await render(EmailSettingsTest(), {}),\n                    from: props.defaultValues.smtpFrom,\n                });\n\n                if (email?.response) {\n                    toast.success(\"Test Email successfully sent!\");\n                }\n\n                return email;\n            } catch (error: unknown) {\n                if (error instanceof Error) {\n                    toast.error(`Email sending failed: ${error.message}`);\n                } else {\n                    toast.error(\"Unknown error while sending test email\");\n                }\n\n                throw error;\n            }\n        },\n    });\n\n\n    return (\n        <TooltipProvider>\n                    <Form\n                        form={form}\n                        className=\"flex flex-col gap-4 mt-3\"\n                        onSubmit={async (values) => {\n                            await mutation.mutateAsync(values);\n                        }}\n                    >\n                        <FormField\n                            control={form.control}\n                            name=\"smtpFrom\"\n                            defaultValue=\"\"\n                            render={({field}) => (\n                                <FormItem>\n                                    <FormLabel>From Email *</FormLabel>\n                                    <FormControl>\n                                        <Input placeholder={\"example@portabase.com\"} {...field} />\n                                    </FormControl>\n                                    <FormDescription>{\"The email from where the email will be send\"}</FormDescription>\n                                    <FormMessage/>\n                                </FormItem>\n                            )}\n                        />\n                        <FormField\n                            control={form.control}\n                            name=\"smtpHost\"\n                            defaultValue=\"\"\n                            render={({field}) => (\n                                <FormItem>\n                                    <FormLabel>Server Host *</FormLabel>\n                                    <FormControl>\n                                        <Input placeholder={\"ssl0.ovh.net\"} {...field} />\n                                    </FormControl>\n                                    <FormDescription>{\"Your email server host\"}</FormDescription>\n                                    <FormMessage/>\n                                </FormItem>\n                            )}\n                        />\n                        <FormField\n                            control={form.control}\n                            name=\"smtpPort\"\n                            defaultValue=\"\"\n                            render={({field}) => (\n                                <FormItem>\n                                    <FormLabel>Server Port *</FormLabel>\n                                    <FormControl>\n                                        <Input placeholder={\"465\"} {...field} />\n                                    </FormControl>\n                                    <FormDescription>{\"Your email server port (send)\"}</FormDescription>\n                                    <FormMessage/>\n                                </FormItem>\n                            )}\n                        />\n\n                        <FormField\n                            control={form.control}\n                            name=\"smtpPassword\"\n                            defaultValue=\"\"\n                            render={({field}) => (\n                                <FormItem>\n                                    <FormLabel>Password</FormLabel>\n                                    <FormControl>\n                                        <PasswordInput placeholder=\"Password\" {...field} />\n                                    </FormControl>\n                                    <FormDescription>{\"Your email server password\"}</FormDescription>\n\n                                    <FormMessage/>\n                                </FormItem>\n                            )}\n                        />\n                        <FormField\n                            control={form.control}\n                            name=\"smtpUser\"\n                            defaultValue=\"\"\n                            render={({field}) => (\n                                <FormItem>\n                                    <FormLabel>User Email *</FormLabel>\n                                    <FormControl>\n                                        <Input placeholder={\"example@portabase.com\"} {...field} />\n                                    </FormControl>\n                                    <FormDescription>{\"The email server user\"}</FormDescription>\n                                    <FormMessage/>\n                                </FormItem>\n                            )}\n                        />\n\n                        <FormField\n                            control={form.control}\n                            name=\"smtpSecure\"\n                            render={({field}) => (\n                                <FormItem>\n                                    <FormLabel>Secure</FormLabel>\n                                    <FormControl>\n                                        <Switch\n                                            checked={field.value}\n                                            onCheckedChange={field.onChange}\n                                        />\n                                    </FormControl>\n                                    <FormMessage/>\n                                </FormItem>\n                            )}\n                        />\n                        <div className=\"flex justify-between gap-4\">\n                            {props.defaultValues?.smtpFrom && (\n                                <Tooltip>\n                                    <TooltipTrigger asChild>\n                                        <div>\n                                            <ButtonWithLoading\n                                                type=\"button\"\n                                                disabled={isDirty || mutationSendEmailTest.isPending}\n                                                isPending={mutationSendEmailTest.isPending}\n                                                onClick={async () => {\n                                                    await mutationSendEmailTest.mutateAsync();\n                                                }}\n                                                icon={<Send />}\n                                                size=\"default\"\n                                                className=\"bg-green-600 hover:bg-green-700 text-white font-medium shadow-sm transition-all\"\n\n                                            >\n                                                Send email test\n                                            </ButtonWithLoading>\n                                        </div>\n                                    </TooltipTrigger>\n\n                                    {isDirty && (\n                                        <TooltipContent>\n                                            You must save changes before testing the email settings.\n                                        </TooltipContent>\n                                    )}\n                                </Tooltip>\n                            )}\n                            <div className=\"flex justify-end\">\n                                <Button type=\"submit\">\n                                    Save\n                                </Button>\n                            </div>\n                        </div>\n                    </Form>\n        </TooltipProvider>\n    );\n};\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/settings/email/settings-email-section.tsx",
    "content": "\"use client\"\nimport {EmailForm} from \"@/components/wrappers/dashboard/admin/settings/email/email-form/email-form\";\nimport {Setting} from \"@/db/schema/01_setting\";\nimport {EmailFormType} from \"@/components/wrappers/dashboard/admin/settings/email/email-form/email-form.schema\";\n\n\nexport type SettingsEmailSectionProps = {\n    settings: Setting;\n};\n\nexport const SettingsEmailSection = (props: SettingsEmailSectionProps) => {\n\n    return (\n        <div\n            className=\"flex flex-col h-full \">\n                <EmailForm defaultValues={props.settings.smtpFrom ? props.settings as EmailFormType : undefined}/>\n        </div>\n    );\n};\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/settings/notification/settings-notification-section.tsx",
    "content": "\"use client\"\nimport {Alert, AlertDescription, AlertTitle} from \"@/components/ui/alert\";\nimport {Info, Send} from \"lucide-react\";\nimport {ButtonWithLoading} from \"@/components/wrappers/common/button/button-with-loading\";\nimport {useRouter} from \"next/navigation\";\nimport {Setting} from \"@/db/schema/01_setting\";\nimport {\n    Form,\n    FormField,\n    FormItem,\n    FormLabel,\n    useZodForm\n} from \"@/components/ui/form\";\nimport {Select, SelectContent, SelectItem, SelectTrigger, SelectValue} from \"@/components/ui/select\";\nimport {useMutation} from \"@tanstack/react-query\";\nimport {getChannelIcon} from \"@/components/wrappers/dashboard/admin/channels/helpers/common\";\nimport {NotificationChannelWith} from \"@/db/schema/09_notification-channel\";\nimport {\n    DefaultNotificationSchema, DefaultNotificationType\n} from \"@/components/wrappers/dashboard/admin/settings/notification/settings-notification.schema\";\nimport {\n    updateNotificationSettingsAction\n} from \"@/components/wrappers/dashboard/admin/settings/notification/settings-notification.action\";\nimport {toast} from \"sonner\";\nimport {Badge} from \"@/components/ui/badge\";\n\nexport type SettingsNotificationSectionProps = {\n    settings: Setting;\n    notificationChannels: NotificationChannelWith[];\n};\n\nexport const SettingsNotificationSection = ({settings, notificationChannels}: SettingsNotificationSectionProps) => {\n    const router = useRouter();\n\n    const form = useZodForm({\n        schema: DefaultNotificationSchema,\n        defaultValues: {\n            notificationChannelId: settings.defaultNotificationChannelId ?? \"\",\n        }\n    });\n\n    const mutation = useMutation({\n        mutationFn: async (values: DefaultNotificationType) => {\n            const result = await updateNotificationSettingsAction({name: \"system\", data: values})\n            const inner = result?.data;\n            if (inner?.success) {\n                toast.success(inner.actionSuccess?.message);\n                router.refresh();\n            } else {\n                toast.error(inner?.actionError?.message);\n            }\n        }\n    });\n\n    return (\n        <div className=\"flex flex-col h-full\">\n            <Alert className=\"mt-3 flex items-start gap-2\">\n                <Info className=\"h-4 w-4 mt-1\"/>\n                <div>\n                    <AlertTitle>Informations</AlertTitle>\n                    <AlertDescription className=\"flex flex-wrap items-center gap-1\">\n                        The default notification channel will be used to send\n                        <Badge>error_health_agent</Badge>\n                        <Badge>error_health_database</Badge>\n                        <Badge>error_backup</Badge>\n                        <Badge>error_restore</Badge>\n                        events. For more options like notify when success, please set policy at database level\n                    </AlertDescription>\n                </div>\n            </Alert>\n            <div className=\"flex flex-col h-full py-4 gap-3\">\n                <Form\n                    className=\"space-y-4\"\n                    form={form}\n                    onSubmit={async (values) => {\n                        await mutation.mutateAsync(values);\n                    }}\n                >\n                    <div className=\"flex flex-wrap items-center gap-3\">\n                        <FormField\n                            control={form.control}\n                            name=\"notificationChannelId\"\n                            render={({ field }) => (\n                                <FormItem className=\"flex-grow \">\n                                    <FormLabel>Default Notification Provider</FormLabel>\n                                    {notificationChannels.length === 0 ? (\n                                        <div className=\"text-sm text-muted-foreground\">No channel available</div>\n                                    ) : (\n                                        <Select\n                                            value={field.value ?? \"\"}\n                                            onValueChange={(value) => field.onChange(value)}\n                                        >\n                                            <SelectTrigger className=\"w-full h-full mb-0\">\n                                                <SelectValue placeholder=\"Select a default channel\" />\n                                            </SelectTrigger>\n                                            <SelectContent>\n                                                {notificationChannels.map((channel) => (\n                                                    <SelectItem key={channel.id} value={channel.id}>\n                                                        <div className=\"flex items-center gap-2\">\n                                                            {getChannelIcon(channel.provider)}\n                                                            <span className=\"font-medium\">{channel.name}</span>\n                                                            <span className=\"text-[9px] uppercase bg-secondary px-1.5 py-0.5 rounded\">\n                                                                {channel.provider}\n                                                            </span>\n                                                        </div>\n                                                    </SelectItem>\n                                                ))}\n                                            </SelectContent>\n                                        </Select>\n                                    )}\n                                </FormItem>\n                            )}\n                        />\n                    </div>\n\n\n                    <div className=\"flex justify-between gap-4\">\n\n                        {notificationChannels.length > 0 && (\n                            <ButtonWithLoading\n                                type=\"submit\"\n                            >\n                                Confirm\n                            </ButtonWithLoading>\n                        )}\n\n                        <div className=\"flex justify-end\">\n                            {notificationChannels.length > 0 && form.getValues(\"notificationChannelId\") ? (\n                                <ButtonWithLoading\n                                    type=\"button\"\n                                    variant=\"outline\"\n                                    onClick={async () => {\n                                        form.setValue(\"notificationChannelId\", \"\");\n                                        await mutation.mutateAsync({\n                                            notificationChannelId: null,\n                                        });\n                                    }}\n                                    className=\"flex-shrink-0 w-full sm:w-auto\"\n                                >\n                                    Reset\n                                </ButtonWithLoading>\n                            ) : null}\n                        </div>\n                    </div>\n                </Form>\n            </div>\n        </div>\n    );\n};"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/settings/notification/settings-notification.action.ts",
    "content": "\"use server\"\n\nimport {userAction} from \"@/lib/safe-actions/actions\";\nimport {db} from \"@/db\";\nimport * as drizzleDb from \"@/db\";\nimport {eq} from \"drizzle-orm\";\nimport {ServerActionResult} from \"@/types/action-type\";\nimport {Setting} from \"@/db/schema/01_setting\";\nimport {z} from \"zod\";\nimport {\n    DefaultNotificationSchema\n} from \"@/components/wrappers/dashboard/admin/settings/notification/settings-notification.schema\";\nimport {withUpdatedAt} from \"@/db/utils\";\n\nexport const updateNotificationSettingsAction = userAction\n    .schema(\n        z.object({\n            name: z.string(),\n            data: DefaultNotificationSchema,\n        })\n    )\n    .action(async ({parsedInput}): Promise<ServerActionResult<Setting>> => {\n        const {name, data} = parsedInput;\n\n        try {\n            const [updatedSettings] = await db\n                .update(drizzleDb.schemas.setting)\n                .set(withUpdatedAt({\n                    defaultNotificationChannelId: data.notificationChannelId ?? null,\n                }))\n                .where(eq(drizzleDb.schemas.setting.name, name))\n                .returning();\n            return {\n                success: true,\n                value: updatedSettings,\n                actionSuccess: {\n                    message: \"Settings successfully updated\",\n                },\n            };\n        } catch (error) {\n            return {\n                success: false,\n                actionError: {\n                    message: \"Failed update settings.\",\n                    status: 500,\n                    cause: error instanceof Error ? error.message : \"Unknown error\",\n                },\n            };\n        }\n    });\n\n\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/settings/notification/settings-notification.schema.ts",
    "content": "import {z} from \"zod\";\n\nexport const DefaultNotificationSchema = z.object({\n    notificationChannelId: z.string().optional().nullable()\n});\n\nexport type DefaultNotificationType = z.infer<typeof DefaultNotificationSchema>;\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/settings/settings-tabs.tsx",
    "content": "\"use client\";\n\nimport {Tabs, TabsContent, TabsList, TabsTrigger} from \"@/components/ui/tabs\";\nimport {useEffect, useState} from \"react\";\nimport {useRouter, useSearchParams} from \"next/navigation\";\nimport {Setting} from \"@/db/schema/01_setting\";\nimport {SettingsEmailSection} from \"@/components/wrappers/dashboard/admin/settings/email/settings-email-section\";\nimport {SettingsStorageSection} from \"@/components/wrappers/dashboard/admin/settings/storage/settings-storage-section\";\nimport {StorageChannelWith} from \"@/db/schema/12_storage-channel\";\nimport {AlarmClock, MailboxIcon, Save} from \"lucide-react\";\nimport {\n    SettingsNotificationSection\n} from \"@/components/wrappers/dashboard/admin/settings/notification/settings-notification-section\";\nimport {NotificationChannelWith} from \"@/db/schema/09_notification-channel\";\n\nexport type SettingsTabsProps = {\n    settings: Setting\n    storageChannels: StorageChannelWith[],\n    notificationChannels: NotificationChannelWith[];\n\n};\n\nexport const SettingsTabs = ({settings, storageChannels, notificationChannels}: SettingsTabsProps) => {\n    const router = useRouter();\n    const searchParams = useSearchParams();\n\n    const [tab, setTab] = useState<string>(() => searchParams.get(\"tab\") ?? \"email\");\n\n\n    useEffect(() => {\n        const newTab = searchParams.get(\"tab\") ?? \"email\";\n        setTab(newTab);\n    }, [searchParams]);\n\n    const handleChangeTab = (value: string) => {\n        router.push(`?tab=${value}`);\n    };\n\n\n    const tabs = [\n        {\n            name: 'System Email',\n            value: 'email',\n            icon: MailboxIcon,\n            content: (\n                <SettingsEmailSection settings={settings}/>\n            )\n        },\n        {\n            name: 'Storage',\n            value: 'storage',\n            icon: Save,\n            content: (\n                <SettingsStorageSection storageChannels={storageChannels} settings={settings}/>\n\n            )\n        },\n        {\n            name: 'Notification',\n            value: 'notification',\n            icon: AlarmClock,\n            content: (\n                <SettingsNotificationSection notificationChannels={notificationChannels} settings={settings}/>\n\n            )\n        }\n    ]\n\n\n    return (\n        <div className=\"h-full mt-3\">\n            <Tabs className=\"h-full gap-4\" value={tab} onValueChange={handleChangeTab}>\n                <TabsList>\n                    {tabs.map(({icon: Icon, name, value}) => (\n                        <TabsTrigger key={value} value={value} className='flex items-center gap-1 px-2.5 sm:px-3'>\n                            <Icon/>\n                            {name}\n                        </TabsTrigger>\n                    ))}\n                </TabsList>\n\n                {tabs.map(tab => (\n                    <TabsContent key={tab.value} value={tab.value} className=\"h-full\">\n                        {tab.content}\n                    </TabsContent>\n                ))}\n            </Tabs>\n        </div>\n\n\n    );\n};\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/settings/storage/settings-storage-section.tsx",
    "content": "\"use client\"\nimport {Alert, AlertDescription, AlertTitle} from \"@/components/ui/alert\";\nimport {Info} from \"lucide-react\";\nimport {ButtonWithLoading} from \"@/components/wrappers/common/button/button-with-loading\";\nimport {useRouter} from \"next/navigation\";\nimport {Setting} from \"@/db/schema/01_setting\";\nimport {\n    Form,\n    FormControl,\n    FormField,\n    FormItem,\n    FormLabel,\n    FormMessage,\n    useZodForm\n} from \"@/components/ui/form\";\nimport {StorageChannelWith} from \"@/db/schema/12_storage-channel\";\nimport {Select, SelectContent, SelectItem, SelectTrigger, SelectValue} from \"@/components/ui/select\";\nimport {useMutation} from \"@tanstack/react-query\";\nimport {\n    DefaultStorageSchema,\n    DefaultStorageType\n} from \"@/components/wrappers/dashboard/admin/settings/storage/settings-storage.schema\";\nimport {getChannelIcon} from \"@/components/wrappers/dashboard/admin/channels/helpers/common\";\nimport {\n    updateStorageSettingsAction\n} from \"@/components/wrappers/dashboard/admin/settings/storage/settings-storage.action\";\nimport {toast} from \"sonner\";\nimport {Switch} from \"@/components/ui/switch\";\nimport {downloadMasterKeyAction} from \"@/features/keys/keys.action\";\n\nexport type SettingsStorageSectionProps = {\n    settings: Setting;\n    storageChannels: StorageChannelWith[];\n};\n\nexport const SettingsStorageSection = ({settings, storageChannels}: SettingsStorageSectionProps) => {\n    const router = useRouter();\n\n    const form = useZodForm({\n        schema: DefaultStorageSchema,\n        defaultValues: {\n            storageChannelId: settings.defaultStorageChannelId ?? undefined,\n            encryption: settings.encryption ?? false\n        }\n    });\n\n\n    const mutation = useMutation({\n        mutationFn: async (values: DefaultStorageType) => {\n            const result = await updateStorageSettingsAction({name: \"system\", data: values})\n            const inner = result?.data;\n\n            if (inner?.success) {\n                toast.success(inner.actionSuccess?.message);\n                router.refresh();\n            } else {\n                toast.error(inner?.actionError?.message);\n            }\n        }\n    });\n\n\n    const handleDownload = async () => {\n        const result = await downloadMasterKeyAction();\n\n        if (!result?.success) {\n            toast.error(result?.message ?? \"Download failed\");\n            return;\n        }\n\n        const byteCharacters = atob(result.data as string);\n        const byteNumbers = new Array(byteCharacters.length)\n            .fill(null)\n            .map((_, i) => byteCharacters.charCodeAt(i));\n\n        const blob = new Blob([new Uint8Array(byteNumbers)], {\n            type: \"application/octet-stream\",\n        });\n\n        const url = window.URL.createObjectURL(blob);\n        const a = document.createElement(\"a\");\n        a.href = url;\n        a.download = \"master_key.bin\";\n        document.body.appendChild(a);\n        a.click();\n        a.remove();\n        window.URL.revokeObjectURL(url);\n    };\n\n    return (\n        <div className=\"flex flex-col h-full\">\n            <Alert className=\"mt-3\">\n                <Info className=\"h-4 w-4\"/>\n                <AlertTitle>Informations</AlertTitle>\n                <AlertDescription>\n                    The default storage channel will be used by default to store your backups if no storage policy is\n                    configured at the database level. </AlertDescription>\n            </Alert>\n            <div className=\"flex flex-col h-full py-4 gap-3\">\n                <Form\n                    className=\"space-y-4\"\n                    form={form}\n                    onSubmit={async (values) => {\n                        await mutation.mutateAsync(values);\n                    }}\n                >\n                    <div className=\"flex flex-wrap items-center gap-3\">\n                        <FormField\n                            control={form.control}\n                            name=\"storageChannelId\"\n                            render={({field}) => (\n                                <FormItem className=\"flex-grow\">\n                                    <FormLabel>Default Storage Provider</FormLabel>\n                                    <Select value={field.value} onValueChange={field.onChange}>\n                                        <SelectTrigger className=\"w-full h-full mb-0\">\n                                            <SelectValue placeholder=\"Select a default storage channel\"/>\n                                        </SelectTrigger>\n                                        <SelectContent>\n                                            {storageChannels.map((channel) => (\n                                                <SelectItem key={channel.id} value={channel.id}>\n                                                    <div className=\"flex items-center gap-2\">\n                                                        {getChannelIcon(channel.provider)}\n                                                        <span className=\"font-medium\">{channel.name}</span>\n                                                        <span\n                                                            className=\"text-[9px] uppercase bg-secondary px-1.5 py-0.5 rounded\">\n                                                            {channel.provider}\n                                                          </span>\n                                                    </div>\n                                                </SelectItem>\n                                            ))}\n                                        </SelectContent>\n                                    </Select>\n                                </FormItem>\n                            )}\n                        />\n                        <FormField\n                            control={form.control}\n                            name=\"encryption\"\n                            render={({field}) => (\n                                <FormItem>\n                                    <FormLabel>Backups Encryption</FormLabel>\n                                    <FormControl>\n                                        <Switch\n                                            checked={field.value}\n                                            onCheckedChange={field.onChange}\n                                        />\n                                    </FormControl>\n                                    <FormMessage/>\n                                </FormItem>\n                            )}\n                        />\n                    </div>\n\n                    <ButtonWithLoading className=\"flex-shrink-0 w-full sm:w-auto\" type=\"submit\">\n                        Confirm\n                    </ButtonWithLoading>\n                </Form>\n\n                <div className=\"flex flex-col gap-2\">\n                    <span className=\"text-sm font-medium \">\n                        Download instance <button\n                        type=\"button\"\n                        onClick={handleDownload}\n                        className=\"text-sm hover:text-muted-foreground underline underline-offset-4 transition-colors w-fit\"\n                    >\n                        Master Key\n                    </button>\n                    </span>\n                </div>\n            </div>\n        </div>\n    );\n};\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/settings/storage/settings-storage.action.ts",
    "content": "\"use server\"\n\nimport {userAction} from \"@/lib/safe-actions/actions\";\nimport {db} from \"@/db\";\nimport * as drizzleDb from \"@/db\";\nimport {eq} from \"drizzle-orm\";\nimport {ServerActionResult} from \"@/types/action-type\";\nimport {Setting} from \"@/db/schema/01_setting\";\nimport {z} from \"zod\";\nimport {DefaultStorageSchema} from \"@/components/wrappers/dashboard/admin/settings/storage/settings-storage.schema\";\nimport {withUpdatedAt} from \"@/db/utils\";\n\nexport const updateStorageSettingsAction = userAction\n    .schema(\n        z.object({\n            name: z.string(),\n            data: DefaultStorageSchema,\n        })\n    )\n    .action(async ({parsedInput}): Promise<ServerActionResult<Setting>> => {\n        const {name, data} = parsedInput;\n\n        try {\n            const [updatedSettings] = await db\n                .update(drizzleDb.schemas.setting)\n                .set(withUpdatedAt({\n                    defaultStorageChannelId: data.storageChannelId,\n                    encryption: data.encryption,\n                }))\n                .where(eq(drizzleDb.schemas.setting.name, name))\n                .returning();\n            return {\n                success: true,\n                value: updatedSettings,\n                actionSuccess: {\n                    message: \"Settings successfully updated\",\n                },\n            };\n        } catch (error) {\n            return {\n                success: false,\n                actionError: {\n                    message: \"Failed update settings.\",\n                    status: 500,\n                    cause: error instanceof Error ? error.message : \"Unknown error\",\n                },\n            };\n        }\n    });\n\n\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/settings/storage/settings-storage.schema.ts",
    "content": "import {z} from \"zod\";\n\nexport const DefaultStorageSchema = z.object({\n    storageChannelId: z.string(),\n    encryption: z.boolean(),\n});\n\nexport type DefaultStorageType = z.infer<typeof DefaultStorageSchema>;\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/settings/storage/storage-s3/s3-form.action.ts",
    "content": "\"use server\";\n\nimport { z } from \"zod\";\nimport { db } from \"@/db\";\nimport { S3FormSchema, StorageSwitchSchema } from \"@/components/wrappers/dashboard/admin/settings/storage/storage-s3/s3-form.schema\";\nimport { eq } from \"drizzle-orm\";\nimport * as drizzleDb from \"@/db\";\nimport {userAction} from \"@/lib/safe-actions/actions\";\nimport {withUpdatedAt} from \"@/db/utils\";\n\nexport const updateS3SettingsAction = userAction\n    .schema(\n        z.object({\n            name: z.string(),\n            data: S3FormSchema,\n        })\n    )\n    .action(async ({ parsedInput }) => {\n        const { name, data } = parsedInput;\n\n        const [updatedSettings] = await db\n            .update(drizzleDb.schemas.setting)\n            .set(withUpdatedAt({ ...data }))\n            .where(eq(drizzleDb.schemas.setting.name, name))\n            .returning();\n\n        return {\n            data: updatedSettings,\n        };\n    });\n\nexport const updateStorageSettingsAction = userAction\n    .schema(\n        z.object({\n            name: z.string(),\n            data: StorageSwitchSchema,\n        })\n    )\n    .action(async ({ parsedInput }) => {\n        const { name, data } = parsedInput;\n\n        const [updatedSettings] = await db\n            .update(drizzleDb.schemas.setting)\n            // @ts-ignore\n            .set({ ...data })\n            .where(eq(drizzleDb.schemas.setting.name, name))\n            .returning();\n\n        return {\n            data: updatedSettings,\n        };\n    });\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/settings/storage/storage-s3/s3-form.schema.ts",
    "content": "import { z } from \"zod\";\n\nexport const S3FormSchema = z.object({\n    s3EndPointUrl: z.string(),\n    s3AccessKeyId: z.string(),\n    s3SecretAccessKey: z.string(),\n    S3BucketName: z.string(),\n});\n\nexport type S3FormType = z.infer<typeof S3FormSchema>;\n\nexport const StorageSwitchSchema = z.object({\n    storage: z.enum([\"local\", \"s3\"]),\n});\n\nexport type StorageType = z.infer<typeof StorageSwitchSchema>;\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/settings/storage/storage-s3/storage-s3-form.tsx",
    "content": "\"use client\";\n\nimport { Card, CardContent } from \"@/components/ui/card\";\nimport { FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, useZodForm } from \"@/components/ui/form\";\nimport { Input } from \"@/components/ui/input\";\nimport { Form } from \"@/components/ui/form\";\nimport { Button } from \"@/components/ui/button\";\nimport { useMutation } from \"@tanstack/react-query\";\nimport { TooltipProvider } from \"@/components/ui/tooltip\";\n\nimport { S3FormSchema, S3FormType } from \"@/components/wrappers/dashboard/admin/settings/storage/storage-s3/s3-form.schema\";\nimport { useRouter } from \"next/navigation\";\nimport { toast } from \"sonner\";\nimport { updateS3SettingsAction } from \"@/components/wrappers/dashboard/admin/settings/storage/storage-s3/s3-form.action\";\nimport {PasswordInput} from \"@/components/ui/password-input\";\n\nexport type S3FormProps = {\n    defaultValues?: S3FormType;\n};\n\nexport const StorageS3Form = (props: S3FormProps) => {\n    const form = useZodForm({\n        schema: S3FormSchema,\n        defaultValues: props.defaultValues,\n    });\n\n    const router = useRouter();\n\n    const mutation = useMutation({\n        mutationFn: async (values: S3FormType) => {\n            const updateS3Settings = await updateS3SettingsAction({ name: \"system\", data: values });\n            const data = updateS3Settings?.data?.data;\n            if (updateS3Settings?.serverError || !data) {\n                toast.error(updateS3Settings?.serverError);\n                return;\n            }\n            toast.success(`Success updating storage informations`);\n            router.refresh();\n        },\n    });\n\n    return (\n        <TooltipProvider>\n            <Card>\n                <CardContent>\n                    <Form\n                        form={form}\n                        className=\"flex flex-col gap-4 mt-3\"\n                        onSubmit={async (values) => {\n                            await mutation.mutateAsync(values);\n                        }}\n                    >\n                        <FormField\n                            control={form.control}\n                            name=\"s3EndPointUrl\"\n                            render={({ field }) => (\n                                <FormItem>\n                                    <FormLabel>Endpoint Url *</FormLabel>\n                                    <FormControl>\n                                        <Input placeholder={\"s3.eu-west-3.amazonaws.com\"} {...field} />\n                                    </FormControl>\n                                    <FormDescription>{\"Your s3 compatible url\"}</FormDescription>\n                                    <FormMessage />\n                                </FormItem>\n                            )}\n                        />\n                        <FormField\n                            control={form.control}\n                            name=\"s3AccessKeyId\"\n                            render={({ field }) => (\n                                <FormItem>\n                                    <FormLabel>Access Key *</FormLabel>\n                                    <FormControl>\n                                        <Input placeholder={\"The access key token\"} {...field} />\n                                    </FormControl>\n                                    <FormDescription>{\"Add your access key\"}</FormDescription>\n                                    <FormMessage />\n                                </FormItem>\n                            )}\n                        />\n                        <FormField\n                            control={form.control}\n                            name=\"s3SecretAccessKey\"\n                            render={({ field }) => (\n                                <FormItem>\n                                    <FormLabel>Secret Key *</FormLabel>\n                                    <FormControl>\n                                        <PasswordInput placeholder={\"The secret key token\"} {...field} />\n                                    </FormControl>\n                                    <FormDescription>{\"Add your secret key\"}</FormDescription>\n                                    <FormMessage />\n                                </FormItem>\n                            )}\n                        />\n                        <FormField\n                            control={form.control}\n                            name=\"S3BucketName\"\n                            render={({ field }) => (\n                                <FormItem>\n                                    <FormLabel>Bucket name *</FormLabel>\n                                    <FormControl>\n                                        <Input placeholder={\"my-bucket\"} {...field} />\n                                    </FormControl>\n                                    <FormDescription>{\"The bucket name where you want to store your data\"}</FormDescription>\n                                    <FormMessage />\n                                </FormItem>\n                            )}\n                        />\n                        <div className=\"flex justify-end gap-4\">\n                            <Button>Save</Button>\n                        </div>\n                    </Form>\n                </CardContent>\n            </Card>\n        </TooltipProvider>\n    );\n};\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/users/admin-user-add-modal.tsx",
    "content": "\"use client\";\n\nimport { useState } from \"react\";\nimport { Plus } from \"lucide-react\";\n\nimport { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, DialogTrigger } from \"@/components/ui/dialog\";\nimport { Button } from \"@/components/ui/button\";\nimport { Organization } from \"@/db/schema/03_organization\";\nimport {AdminUserForm} from \"@/components/wrappers/dashboard/admin/users/admin-user-form\";\n\ntype AdminUserAddModalProps = {\n    organizations: Organization[];\n};\n\nexport const AdminUserAddModal = ({ organizations }: AdminUserAddModalProps) => {\n\n    const [open, setOpen] = useState(false);\n\n    return (\n        <Dialog open={open} onOpenChange={setOpen}>\n            <DialogTrigger asChild>\n                <Button>\n                    <Plus /> Create a user\n                </Button>\n            </DialogTrigger>\n            <DialogContent>\n                <DialogHeader>\n                    <DialogTitle>Create a new user</DialogTitle>\n                    <DialogDescription>To create a new user please provide following informations</DialogDescription>\n                        <AdminUserForm organizations={organizations} onSuccess={() => setOpen(false)} />\n                </DialogHeader>\n            </DialogContent>\n        </Dialog>\n    );\n};\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/users/admin-user-change-password-modal.tsx",
    "content": "\"use client\";\n\nimport { useMutation } from \"@tanstack/react-query\";\nimport { User } from \"@/db/schema/02_user\";\nimport { ButtonWithLoading } from \"@/components/wrappers/common/button/button-with-loading\";\nimport {\n    AlertDialog,\n    AlertDialogCancel,\n    AlertDialogContent,\n    AlertDialogDescription,\n    AlertDialogFooter,\n    AlertDialogHeader,\n    AlertDialogTitle,\n} from \"@/components/ui/alert-dialog\";\nimport { requestPasswordReset } from \"@/lib/auth/auth-client\";\nimport { toast } from \"sonner\";\n\ntype AdminUserChangePasswordProps = {\n    open: boolean;\n    user: User;\n    onOpenChange: (open: boolean) => void;\n};\n\nexport const AdminUserChangePassword = ({ user, open, onOpenChange }: AdminUserChangePasswordProps) => {\n\n    const mutation = useMutation({\n        mutationFn: async () => {\n            await requestPasswordReset(\n                {\n                    email: user.email,\n\n                },\n                {\n                    onSuccess: () => {\n                        toast.success(\"Reset password request successfully sent!\");\n                        onOpenChange(false);\n                    },\n                    onError: (error) => {\n                        toast.error(error.error.message);\n                    },\n                }\n            );\n        },\n        onError: (error) => {\n            toast.error(error.message);\n        },\n    });\n\n    return (\n        <AlertDialog open={open} onOpenChange={onOpenChange}>\n            <AlertDialogContent>\n                <AlertDialogHeader>\n                    <AlertDialogTitle>Change {user.name}'s password</AlertDialogTitle>\n                    <AlertDialogDescription>This action will send an email to the user to reset their password.</AlertDialogDescription>\n                </AlertDialogHeader>\n                <AlertDialogFooter>\n                    <AlertDialogCancel>Cancel</AlertDialogCancel>\n                    <ButtonWithLoading onClick={async () => await mutation.mutateAsync()} isPending={mutation.isPending}>\n                        Validate\n                    </ButtonWithLoading>\n                </AlertDialogFooter>\n            </AlertDialogContent>\n        </AlertDialog>\n    );\n};\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/users/admin-user-change-role-modal.tsx",
    "content": "\"use client\";\n\nimport { useState } from \"react\";\nimport { useRouter } from \"next/navigation\";\nimport { useMutation } from \"@tanstack/react-query\";\nimport { toast } from \"sonner\";\n\nimport { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from \"@/components/ui/dialog\";\nimport { authClient } from \"@/lib/auth/auth-client\";\nimport { User } from \"@/db/schema/02_user\";\nimport { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from \"@/components/ui/select\";\nimport { ButtonWithLoading } from \"@/components/wrappers/common/button/button-with-loading\";\n\ntype AdminUserChangeRoleModalProps = {\n    open: boolean;\n    user: User;\n    onOpenChange: (open: boolean) => void;\n};\n\nexport const AdminUserChangeRoleModal = (props: AdminUserChangeRoleModalProps) => {\n\n\n    const { user, open, onOpenChange } = props;\n    const router = useRouter();\n    const [role, setRole] = useState<string | null>(user.role);\n\n    const mutation = useMutation({\n        mutationFn: async () => {\n            await authClient.admin.setRole(\n                {\n                    userId: user.id,\n                    // @ts-ignore\n                    role: role,\n                },\n                {\n                    onSuccess: async (response) => {\n                        toast.success(\"User role changed successfully.\");\n                        onOpenChange(false);\n                        router.refresh();\n                    },\n                    onError: async (error) => {\n                        console.error(\"AdminUserChangeRoleModal - setRole\", error);\n                        toast.error(\"An error occurred while updating user roles.\");\n                        onOpenChange(false);\n                    },\n                }\n            );\n        },\n    });\n\n    return (\n        <Dialog open={open} onOpenChange={onOpenChange}>\n            <DialogContent>\n                <DialogHeader>\n                    <DialogTitle>Change the user's role</DialogTitle>\n                    <DialogDescription>Modify this user's role within your organization.</DialogDescription>\n                </DialogHeader>\n                <Select defaultValue={user.role ?? \"\"} onValueChange={setRole}>\n                    <SelectTrigger className=\"w-full\">\n                        <SelectValue placeholder=\"Sélectionnez un rôle\" />\n                    </SelectTrigger>\n                    <SelectContent>\n                        <SelectItem value=\"pending\">Pending</SelectItem>\n                        <SelectItem value=\"user\">User</SelectItem>\n                        <SelectItem value=\"admin\">Admin</SelectItem>\n                    </SelectContent>\n                </Select>\n                <DialogFooter>\n                    <div className=\"flex gap-4 justify-end\">\n                        <ButtonWithLoading\n                            variant=\"outline\"\n                            onClick={() => {\n                                onOpenChange(false);\n                            }}\n                        >\n                            Cancel\n                        </ButtonWithLoading>\n                        <ButtonWithLoading\n                            isPending={mutation.isPending}\n                            onClick={async () => {\n                                await mutation.mutateAsync();\n                            }}\n                        >\n                            Validate\n                        </ButtonWithLoading>\n                    </div>\n                </DialogFooter>\n            </DialogContent>\n        </Dialog>\n    );\n};\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/users/admin-user-delete-modal.tsx",
    "content": "\"use client\";\n\nimport { useMutation } from \"@tanstack/react-query\";\nimport { User } from \"@/db/schema/02_user\";\nimport { ButtonWithLoading } from \"@/components/wrappers/common/button/button-with-loading\";\nimport { useRouter } from \"next/navigation\";\nimport {\n  AlertDialog,\n  AlertDialogCancel,\n  AlertDialogContent,\n  AlertDialogDescription,\n  AlertDialogFooter,\n  AlertDialogHeader,\n  AlertDialogTitle,\n} from \"@/components/ui/alert-dialog\";\nimport { authClient } from \"@/lib/auth/auth-client\";\nimport { toast } from \"sonner\";\nimport { setSuperAdminOwnerOfOrganizationsOwnedByUser } from \"@/components/wrappers/dashboard/admin/users/user.action\";\n\ntype AdminDeleteUserModalProps = {\n  open: boolean;\n  user: User;\n  onOpenChange: (open: boolean) => void;\n};\n\nexport const AdminDeleteUserModal = ({\n  user,\n  open,\n  onOpenChange,\n}: AdminDeleteUserModalProps) => {\n  const router = useRouter();\n\n  const mutation = useMutation({\n    mutationFn: async () => {\n      const res = await setSuperAdminOwnerOfOrganizationsOwnedByUser({\n        userId: user.id,\n      });\n      const result = res?.data;\n      if (result?.success) {\n        await authClient.admin.removeUser(\n          {\n            userId: user.id,\n          },\n          {\n            onSuccess: async () => {\n              toast.success(`User ${user.name} successfully deleted`);\n              onOpenChange(false);\n              router.refresh();\n            },\n            onError: async (error) => {\n              toast.error(\"An error has occurred while deleting user\");\n              onOpenChange(false);\n            },\n          },\n        );\n      } else {\n        toast.error(\"An error has occurred while deleting user\");\n      }\n    },\n    onError: (error) => {\n      toast.error(error.message);\n    },\n  });\n\n  return (\n    <AlertDialog open={open} onOpenChange={onOpenChange}>\n      <AlertDialogContent>\n        <AlertDialogHeader>\n          <AlertDialogTitle>\n            Are you sure you want to delete {user.name} ?\n          </AlertDialogTitle>\n          <AlertDialogDescription>\n            This action is irreversible: it will lead to the deletion of the\n            user's data.\n          </AlertDialogDescription>\n        </AlertDialogHeader>\n        <AlertDialogFooter>\n          <AlertDialogCancel>Cancel</AlertDialogCancel>\n          <ButtonWithLoading onClick={async () => await mutation.mutateAsync()}>\n            Confirm\n          </ButtonWithLoading>\n        </AlertDialogFooter>\n      </AlertDialogContent>\n    </AlertDialog>\n  );\n};\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/users/admin-user-edit-form.tsx",
    "content": "\"use client\";\n\nimport { useRouter } from \"next/navigation\";\nimport { useMutation } from \"@tanstack/react-query\";\nimport { toast } from \"sonner\";\nimport { Form, FormControl, FormField, FormItem, FormLabel, FormMessage, useZodForm } from \"@/components/ui/form\";\nimport { Input } from \"@/components/ui/input\";\nimport { ButtonWithLoading } from \"@/components/wrappers/common/button/button-with-loading\";\nimport {Button} from \"@/components/ui/button\";\nimport {UserEditSchema, UserEditType, UserSchema} from \"@/components/wrappers/dashboard/admin/users/user.schema\";\nimport {updateUserAction} from \"@/components/wrappers/dashboard/admin/users/user.action\";\ntype AdminUserEditFormProps = {\n    onSuccess?: () => void;\n    defaultValues: {\n        id: string;\n    } & UserEditType;\n};\n\nexport const AdminUserEditForm = ({ onSuccess, defaultValues }: AdminUserEditFormProps) => {\n\n\n    const router = useRouter();\n    const form = useZodForm({\n        schema: defaultValues ? UserEditSchema : UserSchema,\n        defaultValues: {\n            name: defaultValues.name,\n            email: defaultValues.email,\n        },\n    });\n\n    const onCancel = () => {\n        form.reset();\n        onSuccess?.();\n    };\n\n    const mutation = useMutation({\n        mutationFn: async (data: UserEditType) => {\n            const result = await updateUserAction({\n                ...data,\n                id: defaultValues?.id || \"\",\n            });\n            const inner = result?.data;\n            if (inner?.success) {\n                toast.success(\"User Successfully updated\");\n                onSuccess?.();\n                router.refresh();\n            } else {\n                toast.error(\"An error occurred\");\n                onSuccess?.();\n            }\n        },\n    });\n\n    return (\n        <Form\n            form={form}\n            className=\"flex flex-col gap-4\"\n            onSubmit={async (values) => {\n                await mutation.mutateAsync(values);\n            }}\n        >\n            <FormField\n                control={form.control}\n                name=\"name\"\n                render={({ field }) => (\n                    <FormItem>\n                        <FormLabel>Name</FormLabel>\n                        <FormControl>\n                            <Input placeholder=\"Enter a name\" {...field} />\n                        </FormControl>\n                        <FormMessage />\n                    </FormItem>\n                )}\n            />\n\n            <FormField\n                control={form.control}\n\n                name=\"email\"\n                render={({ field }) => (\n                    <FormItem>\n                        <FormLabel>Email</FormLabel>\n                        <FormControl>\n                            <Input disabled placeholder=\"Fill user email\" {...field} />\n                        </FormControl>\n                        <FormMessage />\n                    </FormItem>\n                )}\n            />\n\n            <div className=\"flex gap-4 justify-end\">\n                <Button type=\"button\" variant=\"outline\" onClick={onCancel}>\n                    Cancel\n                </Button>\n                <ButtonWithLoading type=\"submit\" isPending={mutation.isPending}>Validate</ButtonWithLoading>\n            </div>\n        </Form>\n    );\n};\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/users/admin-user-edit-modal.tsx",
    "content": "\"use client\";\n\nimport {User} from \"@/db/schema/02_user\";\nimport {\n    Dialog,\n    DialogContent,\n    DialogDescription,\n    DialogHeader,\n    DialogTitle\n} from \"@/components/ui/dialog\";\nimport {AdminUserEditForm} from \"./admin-user-edit-form\";\n\ntype AdminUserEditPasswordProps = {\n    open: boolean;\n    user: User;\n    onOpenChange: (open: boolean) => void;\n};\n\nexport const AdminUserEdit = ({user, open, onOpenChange}: AdminUserEditPasswordProps) => {\n\n    return (\n        <Dialog open={open} onOpenChange={onOpenChange}>\n            <DialogContent>\n                <DialogHeader>\n                    <DialogTitle>Edit ${user.name}'s profile</DialogTitle>\n                    <DialogDescription>Update following information</DialogDescription>\n                </DialogHeader>\n                <DialogContent\n                    onOpenAutoFocus={(e) => e.preventDefault()}\n                >\n                    <AdminUserEditForm\n                        defaultValues={{\n                            name: user.name,\n                            email: user.email,\n                            id: user.id,\n                        }}\n                        onSuccess={() => onOpenChange(false)}\n                    />\n                </DialogContent>\n            </DialogContent>\n        </Dialog>\n    );\n};\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/users/admin-user-form.tsx",
    "content": "\"use client\";\n\nimport {useRouter} from \"next/navigation\";\nimport {useMutation} from \"@tanstack/react-query\";\nimport {Form, FormControl, FormField, FormItem, FormLabel, FormMessage, useZodForm} from \"@/components/ui/form\";\nimport {Organization} from \"@/db/schema/03_organization\";\nimport {Input} from \"@/components/ui/input\";\nimport {ButtonWithLoading} from \"@/components/wrappers/common/button/button-with-loading\";\nimport {Button} from \"@/components/ui/button\";\nimport {UserSchema, UserType} from \"@/components/wrappers/dashboard/admin/users/user.schema\";\nimport {toast} from \"sonner\";\nimport {createUserAction} from \"@/components/wrappers/dashboard/admin/users/user.action\";\n\ntype AdminUserFormProps = {\n    onSuccess?: () => void;\n    organizations: Organization[];\n};\n\nexport const AdminUserForm = ({onSuccess, organizations}: AdminUserFormProps) => {\n\n\n    const router = useRouter();\n    const form = useZodForm({\n        schema: UserSchema,\n    });\n\n\n    const onCancel = () => {\n        form.reset();\n        onSuccess?.();\n    };\n\n    const mutation = useMutation({\n        mutationFn: async (data: UserType) => {\n            const result = await createUserAction(data);\n            const inner = result?.data;\n            if (inner?.success) {\n                toast.success(\"User Successfully created\");\n                onSuccess?.();\n                router.refresh();\n            } else {\n                toast.error(\"An error occurred\");\n                onSuccess?.();\n            }\n        },\n    });\n\n    return (\n        <Form\n            form={form}\n            className=\"flex flex-col gap-4\"\n            onSubmit={async (values) => {\n                await mutation.mutateAsync(values);\n            }}\n        >\n            <FormField\n                control={form.control}\n                name=\"name\"\n                render={({field}) => (\n                    <FormItem>\n                        <FormLabel>Name</FormLabel>\n                        <FormControl>\n                            <Input placeholder=\"Enter a name\" {...field} value={field.value ?? \"\"}/>\n                        </FormControl>\n                        <FormMessage/>\n                    </FormItem>\n                )}\n            />\n\n            <FormField\n                control={form.control}\n                name=\"email\"\n                render={({field}) => (\n                    <FormItem>\n                        <FormLabel>Email</FormLabel>\n                        <FormControl>\n                            <Input placeholder=\"Fill user email\" {...field} value={field.value ?? \"\"}/>\n                        </FormControl>\n                        <FormMessage/>\n                    </FormItem>\n                )}\n            />\n\n\n            <div className=\"flex gap-4 justify-end\">\n                <Button type=\"button\" variant=\"outline\" onClick={onCancel}>\n                    Cancel\n                </Button>\n                <ButtonWithLoading type=\"submit\" isPending={mutation.isPending}>\n                    Validate\n                </ButtonWithLoading>\n            </div>\n        </Form>\n    );\n};\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/users/admin-user-list.tsx",
    "content": "\"use client\";\nimport { DataTable } from \"@/components/wrappers/common/table/data-table\";\nimport {usersListColumns} from \"@/components/wrappers/dashboard/admin/users/table-colums\";\nimport {User} from \"@/db/schema/02_user\";\n\ntype AdminUserListProps = {\n    users: User[];\n    isPasswordAuthEnabled: boolean;\n};\n\nexport const AdminUserList = ({ users, isPasswordAuthEnabled }: AdminUserListProps) => {\n    return <DataTable columns={usersListColumns({ isPasswordAuthEnabled })} data={users} enablePagination={true} enableSelect={false} />;\n};\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/users/table-colums.tsx",
    "content": "import {ColumnDef} from \"@tanstack/react-table\";\nimport {User} from \"@/db/schema/02_user\";\nimport {Badge} from \"@/components/ui/badge\";\nimport {Avatar, AvatarFallback, AvatarImage} from \"@/components/ui/avatar\";\nimport {formatLocalizedDate, timeAgo} from \"@/utils/date-formatting\";\nimport {Tooltip, TooltipProvider, TooltipTrigger} from \"@/components/ui/tooltip\";\nimport {TooltipContent} from \"@radix-ui/react-tooltip\";\nimport {Info} from \"lucide-react\";\nimport {Table, TableBody, TableCell, TableRow} from \"@/components/ui/table\";\nimport {UserActionsCell} from \"@/components/wrappers/dashboard/admin/users/user-actions-cell\";\n\ntype UsersListColumnsProps = {\n    isPasswordAuthEnabled: boolean;\n}\n\nexport function usersListColumns({ isPasswordAuthEnabled }: UsersListColumnsProps): ColumnDef<User>[] {\n\n    return [\n        {\n            accessorKey: \"name\",\n            header: \"Profile\",\n            cell: ({row}) => {\n\n                return (\n                    <TooltipProvider>\n                        <Tooltip>\n                            <TooltipTrigger>\n                                <div className=\"flex flex-row items-center gap-x-2\">\n                                    <Avatar>\n                                        <AvatarImage src={row.original.image ?? \"\"} alt={row.original.name}/>\n                                        <AvatarFallback>\n                                            {row.original.name\n                                                .split(\" \")\n                                                .map((n) => n[0])\n                                                .join(\"\")}\n                                        </AvatarFallback>\n                                    </Avatar>\n                                    <div className=\"flex flex-row items-center gap-x-2\">\n                                        <div className=\"font-medium\">{row.original.name}</div>\n                                        <Info size={16} aria-hidden=\"true\" className=\"text-muted-foreground\"/>\n                                    </div>\n                                </div>\n                            </TooltipTrigger>\n                            <TooltipContent className=\"bg-background shadow-lg border border-border z-20 rounded-md\"\n                                            side=\"bottom\">\n                                <Table>\n                                    <TableBody>\n                                        <TableRow>\n                                            <TableCell>Joined</TableCell>\n                                            <TableCell\n                                                className=\"text-right text-muted-foreground\">{formatLocalizedDate(row.original.createdAt)}</TableCell>\n                                        </TableRow>\n                                        {row.original.lastConnectedAt && (\n                                            <TableRow>\n                                                <TableCell>Last connected</TableCell>\n                                                <TableCell className=\"text-right text-muted-foreground\">\n                                                    {formatLocalizedDate(row.original.lastConnectedAt)} ({timeAgo(row.original.lastConnectedAt)})\n                                                </TableCell>\n                                            </TableRow>\n                                        )}\n                                        {row.original.lastChangedPasswordAt && (\n                                            <TableRow>\n                                                <TableCell>Last password change</TableCell>\n                                                <TableCell className=\"text-right text-muted-foreground\">\n                                                    {formatLocalizedDate(row.original.lastChangedPasswordAt)} ({timeAgo(row.original.lastChangedPasswordAt)})\n                                                </TableCell>\n                                            </TableRow>\n                                        )}\n                                    </TableBody>\n                                </Table>\n                            </TooltipContent>\n                        </Tooltip>\n                    </TooltipProvider>\n                );\n            },\n        },\n        {\n            accessorKey: \"email\",\n            header: \"Email\",\n        },\n        {\n            accessorKey: \"role\",\n            header: \"Role\",\n            cell: ({row}) => {\n                const role = row.original.role!;\n                return <Badge>{role}</Badge>;\n            },\n        },\n        {\n            id: \"actions\",\n            header: \"Actions\",\n            cell: ({row}) => <UserActionsCell user={row.original} isPasswordAuthEnabled={isPasswordAuthEnabled} />,\n        },\n    ];\n}\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/users/user-actions-cell.tsx",
    "content": "\"use client\";\n\nimport {useState} from \"react\";\nimport {Button} from \"@/components/ui/button\";\nimport {\n    DropdownMenu,\n    DropdownMenuContent,\n    DropdownMenuItem,\n    DropdownMenuSeparator,\n    DropdownMenuTrigger\n} from \"@/components/ui/dropdown-menu\";\nimport {MoreHorizontal, Settings, Trash2, RotateCcwKey, UserCog} from \"lucide-react\";\nimport {authClient} from \"@/lib/auth/auth-client\";\nimport {cn} from \"@/lib/utils\";\nimport {User} from \"@/db/schema/02_user\";\nimport {AdminUserChangePassword} from \"./admin-user-change-password-modal\";\nimport {AdminUserEdit} from \"./admin-user-edit-modal\";\nimport {AdminUserChangeRoleModal} from \"@/components/wrappers/dashboard/admin/users/admin-user-change-role-modal\";\nimport {AdminDeleteUserModal} from \"@/components/wrappers/dashboard/admin/users/admin-user-delete-modal\";\n\ninterface UserActionsCellProps {\n    user: User;\n    isPasswordAuthEnabled: boolean;\n}\n\nexport function UserActionsCell({user, isPasswordAuthEnabled}: UserActionsCellProps) {\n\n    const [isModalOpen, setIsModalOpen] = useState(false);\n    const [isModalChangePasswordOpen, setIsModalChangePasswordOpen] = useState(false);\n    const [isModalEditUserOpen, setIsModalEditUserOpen] = useState(false);\n    const [isModalDeleteOpen, setIsModalDeleteOpen] = useState(false);\n    const {data: session, isPending, error} = authClient.useSession();\n    if (isPending || error) return null;\n    const isCurrentUser = session?.user?.id === user.id;\n    const isSuperAdmin = session?.user?.role === \"superadmin\";\n\n    if (isCurrentUser || user.role === \"superadmin\") return null;\n\n    return (\n        <>\n            <AdminUserChangeRoleModal user={user} open={isModalOpen} onOpenChange={setIsModalOpen}/>\n            <AdminDeleteUserModal user={user} open={isModalDeleteOpen} onOpenChange={setIsModalDeleteOpen}/>\n            <AdminUserChangePassword user={user} open={isModalChangePasswordOpen}\n                                     onOpenChange={setIsModalChangePasswordOpen}/>\n            <AdminUserEdit user={user} open={isModalEditUserOpen} onOpenChange={setIsModalEditUserOpen}/>\n            <div className={cn(\"flex items-center space-x-2\")}>\n                {isPasswordAuthEnabled && (\n                    <Button variant=\"outline\" size=\"icon\" onClick={() => setIsModalChangePasswordOpen(true)}>\n                        <RotateCcwKey className=\"w-4 h-4\"/>\n                    </Button>\n                )}\n                <DropdownMenu>\n                    <DropdownMenuTrigger asChild>\n                        <Button variant=\"ghost\" size=\"icon\">\n                            <MoreHorizontal className=\"w-4 h-4\"/>\n                        </Button>\n                    </DropdownMenuTrigger>\n                    <DropdownMenuContent align=\"end\">\n                        <DropdownMenuItem onSelect={() => setIsModalOpen(true)}>\n                            <Settings className=\"w-4 h-4 mr-2\"/>\n                            Role\n                        </DropdownMenuItem>\n                        <DropdownMenuItem onSelect={() => setIsModalEditUserOpen(true)}>\n                            <UserCog className=\"w-4 h-4 mr-2\"/>\n                            Edit User\n                        </DropdownMenuItem>\n                        {isSuperAdmin && (\n                            <>\n                                <DropdownMenuSeparator/>\n                                <DropdownMenuItem onSelect={() => setIsModalDeleteOpen(true)} className=\"text-red-600\">\n                                    <Trash2 className=\"w-4 h-4 mr-2\"/>\n                                    Delete\n                                </DropdownMenuItem>\n                            </>\n                        )}\n                    </DropdownMenuContent>\n                </DropdownMenu>\n            </div>\n        </>\n    );\n}\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/users/user.action.ts",
    "content": "\"use server\";\n\nimport * as drizzleDb from \"@/db\";\nimport { ServerActionResult } from \"@/types/action-type\";\nimport { render } from \"@react-email/render\";\nimport { UserSchema } from \"@/components/wrappers/dashboard/admin/users/user.schema\";\nimport { extractNameFromEmail } from \"@/utils/name-from-email\";\nimport { generateValidPassword } from \"@/utils/password\";\nimport { auth } from \"@/lib/auth/auth\";\nimport { z } from \"zod\";\nimport { Organization } from \"@/db/schema/03_organization\";\nimport { db } from \"@/db\";\nimport { and, eq } from \"drizzle-orm\";\n\nimport { zEmail, zString } from \"@/lib/zod\";\nimport { withUpdatedAt } from \"@/db/utils\";\nimport { userAction } from \"@/lib/safe-actions/actions\";\nimport { addMemberOrganizationAction } from \"@/components/wrappers/dashboard/admin/organizations/organization/details/add-member.action\";\nimport { sendEmail } from \"@/lib/email\";\nimport EmailCreateUser from \"@/components/emails/email-create-user\";\nimport { SignUpUser } from \"@/types/auth\";\nimport { createUserDb } from \"@/db/services/user\";\nimport { User } from \"@/db/schema/02_user\";\nimport { env } from \"@/env.mjs\";\n\nexport const createUserAction = userAction\n  .schema(UserSchema)\n  .action(async ({ parsedInput }): Promise<ServerActionResult<User>> => {\n    try {\n      const isPasswordAuthEnabled = env.AUTH_EMAIL_PASSWORD_ENABLED === \"true\";\n      let password;\n\n      const userData: SignUpUser = {\n        name: parsedInput.name || extractNameFromEmail(parsedInput.email),\n        email: parsedInput.email,\n        theme: \"dark\",\n        role: \"user\",\n      };\n\n      if (isPasswordAuthEnabled) {\n        password = generateValidPassword();\n        userData.password = password;\n      }\n\n      const newUser = await createUserDb(userData);\n\n      if (newUser) {\n        await sendEmail({\n          to: parsedInput.email,\n          subject: \"Your account is created\",\n          html: await render(\n            EmailCreateUser({\n              password: password,\n              email: parsedInput.email,\n            }),\n          ),\n        });\n\n        const defaultOrganization = await db.query.organization.findFirst({\n          where: eq(drizzleDb.schemas.organization.slug, \"default\"),\n        });\n\n        if (defaultOrganization) {\n          await auth.api.addMember({\n            body: {\n              userId: newUser.id,\n              organizationId: defaultOrganization.id,\n              role: \"admin\",\n            },\n          });\n        }\n\n        return {\n          success: true,\n          value: newUser,\n          actionSuccess: {\n            message: \"user_created\",\n          },\n        };\n      }\n      return {\n        success: false,\n        actionError: {\n          message: \"user_created\",\n          cause: \"Unknown error\",\n        },\n      };\n    } catch (error) {\n      return {\n        success: false,\n        actionError: {\n          message: \"user_created\",\n          cause: error instanceof Error ? error.message : \"Unknown error\",\n        },\n      };\n    }\n  });\n\nexport const updateUserAction = userAction\n  .schema(\n    z.object({\n      id: zString(),\n      name: zString().optional(),\n      email: zEmail(),\n    }),\n  )\n  .action(async ({ parsedInput, ctx }): Promise<ServerActionResult<{}>> => {\n    try {\n      const [updatedUser] = await db\n        .update(drizzleDb.schemas.user)\n        .set(\n          withUpdatedAt({\n            name: parsedInput.name\n              ? parsedInput.name\n              : extractNameFromEmail(parsedInput.email),\n            email: parsedInput.email,\n            emailVerified: false,\n          }),\n        )\n        .where(eq(drizzleDb.schemas.user.id, parsedInput.id))\n        .returning();\n\n      if (updatedUser) {\n        return {\n          success: true,\n          actionSuccess: {\n            message: \"user_updated\",\n          },\n        };\n      }\n\n      return {\n        success: false,\n        actionError: {\n          message: \"user_updated\",\n          cause: \"Unknown error\",\n        },\n      };\n    } catch (error) {\n      return {\n        success: false,\n        actionError: {\n          message: \"user_updated\",\n          cause: error instanceof Error ? error.message : \"Unknown error\",\n        },\n      };\n    }\n  });\n\nexport const setSuperAdminOwnerOfOrganizationsOwnedByUser = userAction\n  .schema(\n    z.object({\n      userId: z.string(),\n    }),\n  )\n  .action(\n    async ({ parsedInput }): Promise<ServerActionResult<Organization[]>> => {\n      try {\n        const organizationsWhereUserIsMemberAndOwner =\n          await db.query.member.findMany({\n            where: and(\n              eq(drizzleDb.schemas.member.role, \"owner\"),\n              eq(drizzleDb.schemas.member.userId, parsedInput.userId),\n            ),\n            with: {\n              organization: true,\n            },\n          });\n\n        const superAdminUser = await db.query.user.findFirst();\n        if (!superAdminUser) {\n          return {\n            success: false,\n            actionError: {\n              message: \"set_super_admin_owner_of_organizations_owned_by_user\",\n              cause: \"Unknown error\",\n            },\n          };\n        }\n\n        for (let { organization } of organizationsWhereUserIsMemberAndOwner) {\n          await addMemberOrganizationAction({\n            userId: superAdminUser.id,\n            organizationId: organization.id,\n            role: \"owner\",\n          });\n        }\n        const organizations = organizationsWhereUserIsMemberAndOwner.map(\n          (organizationWhereUserIsMemberAndOwner) =>\n            organizationWhereUserIsMemberAndOwner.organization,\n        );\n\n        return {\n          success: true,\n          value: organizations as unknown as Organization[],\n          actionSuccess: {\n            message: \"set_super_admin_owner_of_organizations_owned_by_user\",\n          },\n        };\n      } catch (error) {\n        return {\n          success: false,\n          actionError: {\n            message:\n              \"error_set_super_admin_owner_of_organizations_owned_by_user\",\n            cause: error instanceof Error ? error.message : \"Unknown error\",\n          },\n        };\n      }\n    },\n  );\n"
  },
  {
    "path": "src/components/wrappers/dashboard/admin/users/user.schema.ts",
    "content": "import { z } from \"zod\";\nimport { zEmail, zString } from \"@/lib/zod\";\n\nexport const UserSchema = z.object({\n    email: zEmail(),\n    name: zString(),\n});\n\nexport type UserType = z.infer<typeof UserSchema>;\n\nexport const UserEditSchema = z.object({\n    email: zEmail(),\n    name: zString(),\n});\n\nexport type UserEditType = z.infer<typeof UserEditSchema>;\n"
  },
  {
    "path": "src/components/wrappers/dashboard/agent/agent-card/agent-card.tsx",
    "content": "\"use client\";\n\nimport {useState} from \"react\";\nimport Link from \"next/link\";\nimport {Card} from \"@/components/ui/card\";\nimport {ConnectionIndicator} from \"@/components/wrappers/common/connection-indicator\";\nimport {formatDateLastContact} from \"@/utils/date-formatting\";\nimport {AgentWith} from \"@/db/schema/08_agent\";\nimport {Activity, ChevronRight, Copy, Check, Fingerprint, Server, Database, AlertCircle} from \"lucide-react\";\nimport {Badge} from \"@/components/ui/badge\";\nimport {truncateWords} from \"@/utils/text\";\nimport {useIsMobile} from \"@/hooks/use-mobile\";\nimport {Tooltip, TooltipContent, TooltipTrigger} from \"@/components/ui/tooltip\";\nimport {useAgentUpdateCheck} from \"@/features/agents/hooks/use-agent-update-check\";\n\nexport type agentCardProps = {\n    data: AgentWith;\n    organizationView?: boolean;\n};\n\nexport const AgentCard = (props: agentCardProps) => {\n    const {data: agent} = props;\n    const isMobile = useIsMobile();\n    const [isCopied, setIsCopied] = useState(false);\n\n    const {newRelease, isUpdateAvailable} = useAgentUpdateCheck(agent.version);\n\n    const handleCopy = (e: React.MouseEvent) => {\n        e.preventDefault();\n        e.stopPropagation();\n        navigator.clipboard.writeText(agent.id);\n        setIsCopied(true);\n        setTimeout(() => setIsCopied(false), 2000);\n    };\n\n    return (\n        <Link \n            href={props.organizationView ? `/dashboard/settings/agents/${agent.id}`:  `/dashboard/agents/${agent.id}`}\n            className=\"group block transition-all duration-200 outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 rounded-xl\"\n        >\n            <Card className=\"flex flex-row items-center p-4 gap-5 transition-all border-border/50 bg-card hover:bg-accent/50 hover:border-primary/50 group-hover:shadow-md overflow-hidden\">\n                <div className=\"relative w-12 h-12 p-2.5 bg-background rounded-xl border border-border/50 shadow-sm flex items-center justify-center group-hover:border-primary/30 transition-all duration-300 group-hover:scale-105 shrink-0\">\n                    <Server className=\"w-6 h-6 text-foreground/80 group-hover:text-primary transition-colors\" />\n                </div>\n                \n                <div className=\"flex-1 min-w-0 flex flex-col gap-1.5\">\n                    <div className=\"flex items-center gap-3\">\n                        <h3 className=\"text-lg font-black text-foreground group-hover:text-primary transition-colors truncate tracking-tight \">\n                            {isMobile ? truncateWords(agent.name, 2) : agent.name}\n                        </h3>\n                        {agent.version && (\n                            <div className=\"flex items-center gap-2\">\n                                <Badge variant=\"secondary\" className=\"h-5 px-1.5 text-[10px] font-bold tracking-wider\">\n                                    v{agent.version}\n                                </Badge>\n                                {agent.healthErrorCount && (\n                                    <Badge variant=\"destructive\" className=\"h-5 px-1.5 text-[10px] font-bold tracking-wider\">\n                                        down\n                                    </Badge>\n                                )}\n                                {isUpdateAvailable && (\n                                    <Tooltip>\n                                        <TooltipTrigger asChild>\n                                            <div className=\"flex items-center justify-center w-5 h-5 bg-yellow-500/10 rounded-full border border-yellow-500/20 text-yellow-600\">\n                                                <AlertCircle className=\"w-3 h-3\" />\n                                            </div>\n                                        </TooltipTrigger>\n                                        <TooltipContent>\n                                            <p>Update available: {newRelease?.tag_name}</p>\n                                        </TooltipContent>\n                                    </Tooltip>\n                                )}\n                            </div>\n                        )}\n                    </div>\n                    \n                    <div className=\"flex  items-center gap-4 text-muted-foreground group-hover:text-foreground transition-colors\">\n                        <div className=\"hidden sm:flex items-center gap-1.5 min-w-0\">\n                            <Fingerprint className=\"w-3.5 h-3.5 shrink-0\" />\n                            <span className=\"font-mono text-xs font-bold truncate opacity-80\">\n                                {agent.id}\n                            </span>\n                            <button\n                                onClick={handleCopy}\n                                className=\"ml-0.5 p-1 hover:bg-muted rounded-md transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 z-10\"\n                                title=\"Copy ID\"\n                            >\n                                {isCopied ? <Check className=\"w-3 h-3 text-green-500\" /> : <Copy className=\"w-3 h-3\" />}\n                            </button>\n                        </div>\n\n                        <div className=\"flex items-center gap-1.5 shrink-0\">\n                            <Database className=\"w-3.5 h-3.5\" />\n                            <span className=\"text-xs font-bold uppercase tracking-tight opacity-80\">\n                                {agent.databases?.length ?? 0} DBs\n                            </span>\n                        </div>\n                    </div>\n                </div>\n\n                <div className=\"flex items-center gap-4 shrink-0\">\n                     <div className=\"hidden sm:flex flex-col items-end gap-1 text-right\">\n                        <span className=\"text-[10px] font-bold uppercase tracking-widest text-muted-foreground/70\">Last Contact</span>\n                        <div className=\"flex items-center gap-1.5\">\n                            <Activity className=\"w-3.5 h-3.5 text-muted-foreground\" />\n                             <span className=\"text-xs font-bold uppercase tracking-tight\">\n                                {formatDateLastContact(agent.lastContact)}\n                            </span>\n                        </div>\n                    </div>\n\n                    <div className=\"scale-110\">\n                        <ConnectionIndicator date={agent.lastContact}/>\n                    </div>\n                    \n                    <ChevronRight className=\"w-5 h-5 text-muted-foreground group-hover:text-primary group-hover:translate-x-1 transition-all\" />\n                </div>\n            </Card>\n        </Link>\n    );\n};\n"
  },
  {
    "path": "src/components/wrappers/dashboard/agent/agent-card-key/agent-card-key.tsx",
    "content": "\"use client\";\n\nimport {Input} from \"@/components/ui/input\";\nimport {Button} from \"@/components/ui/button\";\nimport {Copy, Check, Eye, EyeOff, Terminal, Key, Info} from \"lucide-react\";\nimport {useState} from \"react\";\nimport {copyToClipboardWithMeta} from \"@/components/wrappers/common/button/copy-button\";\nimport {Card, CardContent, CardDescription, CardHeader, CardTitle} from \"@/components/ui/card\";\n\nexport type AgentCardKeyProps = {\n    edgeKey: string;\n    agentName: string;\n};\n\nexport const AgentCardKey = ({edgeKey, agentName}: AgentCardKeyProps) => {\n    const [isCopiedKey, setIsCopiedKey] = useState(false);\n    const [isCopiedCommand, setIsCopiedCommand] = useState(false);\n    const [isVisible, setIsVisible] = useState(false);\n\n    const command = `portabase agent \"${agentName}\" --key ${edgeKey}`;\n    const maskedKey = \"••••••••••••••••••••••••••••••••\";\n\n    const handleCopy = async (text: string, setter: (v: boolean) => void) => {\n        await copyToClipboardWithMeta(text);\n        setter(true);\n    };\n\n    return (\n        <div className=\"flex flex-col gap-4 py-2\">\n                    <Card className=\"border-muted/60 shadow-none py-0\">\n                        <CardHeader className=\"px-4 pt-4\">\n                            <CardTitle className=\"text-sm font-semibold flex items-center gap-2 uppercase tracking-tight\">\n                                CLI Setup\n                            </CardTitle>\n                            <CardDescription className=\"text-xs leading-relaxed\">\n                                To setup your agent using the CLI, copy the command below and paste it in your terminal.\n                                Make sure you have the PortaBase CLI installed. If not, you can <a href=\"https://portabase.io/docs/cli\" target=\"_blank\" className=\"underline hover:text-primary\">install it here</a>.\n                            </CardDescription>\n                        </CardHeader>\n                        <CardContent className=\"px-4 pb-4 space-y-4\">\n                            <div className=\"flex items-center gap-2\">\n                                <div className=\"relative flex-1\">\n                                    <Input\n                                        readOnly\n                                        value={isVisible ? command : `portabase agent \"${agentName}\" --key ${maskedKey}`}\n                                        onFocus={(e) => {\n                                            setIsVisible(true);\n                                            handleCopy(command, setIsCopiedCommand);\n                                            e.currentTarget.select();\n                                        }}\n                                        onClick={(e) => e.currentTarget.select()}\n                                        onBlur={() => {\n                                            setIsVisible(false);\n                                            setIsCopiedCommand(false);\n                                        }}\n                                        className=\"font-mono text-xs bg-muted/30 h-10 pr-10 cursor-pointer\"\n                                    />\n                                    <Button\n                                        variant=\"ghost\"\n                                        size=\"icon\"\n                                        onClick={(e) => {\n                                            e.stopPropagation();\n                                            setIsVisible(!isVisible);\n                                        }}\n                                        className=\"absolute right-1 top-1.5 h-7 w-7\"\n                                        type=\"button\"\n                                    >\n                                        {isVisible ? <EyeOff className=\"h-3.5 w-3.5\" /> : <Eye className=\"h-3.5 w-3.5\" />}\n                                    </Button>\n                                </div>\n                                <Button\n                                    variant=\"outline\"\n                                    onClick={() => handleCopy(command, setIsCopiedCommand)}\n                                    className=\"shrink-0 gap-2 h-10 px-4\"\n                                    type=\"button\"\n                                >\n                                    {isCopiedCommand ? (\n                                        <><Check className=\"h-4 w-4 text-green-500\" /></>\n                                    ) : (\n                                        <><Copy className=\"h-4 w-4\" /></>\n                                    )}\n                                </Button>\n                            </div>\n                        </CardContent>\n                    </Card>\n\n                  <Card className=\"border-muted/60 shadow-none py-0\">\n                        <CardHeader className=\"px-4 pt-4\">\n                            <CardTitle className=\"text-sm font-semibold flex items-center gap-2 uppercase tracking-tight\">\n                                Manual Setup\n                            </CardTitle>\n                            <CardDescription className=\"text-xs leading-relaxed\">\n                                Use this key to manually configure your agent in your configuration file.\n                                If you need help for manual configuration, you can follow our guide in the <a href=\"https://portabase.io/docs\" target=\"_blank\" className=\"underline hover:text-primary\">documentation</a>.\n                            </CardDescription>\n                        </CardHeader>\n                        <CardContent className=\"px-4 pb-4 space-y-4\">\n                            <div className=\"flex items-center gap-2\">\n                                <div className=\"relative flex-1\">\n                                    <Input\n                                        readOnly\n                                        value={isVisible ? edgeKey : maskedKey}\n                                        onFocus={(e) => {\n                                            setIsVisible(true);\n                                            handleCopy(edgeKey, setIsCopiedKey);\n                                            e.currentTarget.select();\n                                        }}\n                                        onClick={(e) => e.currentTarget.select()}\n                                        onBlur={() => {\n                                            setIsVisible(false);\n                                            setIsCopiedKey(false);\n                                        }}\n                                        className=\"font-mono text-xs bg-muted/30 h-10 pr-10 cursor-pointer\"\n                                    />\n                                    <Button\n                                        variant=\"ghost\"\n                                        size=\"icon\"\n                                        onClick={(e) => {\n                                            e.stopPropagation();\n                                            setIsVisible(!isVisible);\n                                        }}\n                                        className=\"absolute right-1 top-1.5 h-7 w-7 hover:bg-transparent\"\n                                        type=\"button\"\n                                    >\n                                        {isVisible ? <EyeOff className=\"h-3.5 w-3.5\" /> : <Eye className=\"h-3.5 w-3.5\" />}\n                                    </Button>\n                                </div>\n                                <Button\n                                    variant=\"outline\"\n                                    onClick={() => handleCopy(edgeKey, setIsCopiedKey)}\n                                    className=\"shrink-0 gap-2 h-10 px-4 \"\n                                    type=\"button\"\n                                >\n                                    {isCopiedKey ? (\n                                        <><Check className=\"h-4 w-4 text-green-500\" /></>\n                                    ) : (\n                                        <><Copy className=\"h-4 w-4\" /></>\n                                    )}\n                                </Button>\n                            </div>\n                        </CardContent>\n                    </Card>\n        </div>\n    );\n};\n"
  },
  {
    "path": "src/components/wrappers/dashboard/agent/agent-content.tsx",
    "content": "\"use client\"\n\nimport {Card, CardContent, CardHeader, CardTitle} from \"@/components/ui/card\";\nimport {Server} from \"lucide-react\";\nimport {formatDateLastContact} from \"@/utils/date-formatting\";\nimport {AgentCardKey} from \"@/components/wrappers/dashboard/agent/agent-card-key/agent-card-key\";\nimport {AgentWithDatabases} from \"@/db/schema/08_agent\";\nimport {useQuery} from \"@tanstack/react-query\";\nimport {getAgentAction} from \"@/features/agents/agents.action\";\nimport {\n    Accordion,\n    AccordionContent,\n    AccordionItem,\n    AccordionTrigger,\n} from \"@/components/ui/accordion\";\nimport {Separator} from \"@/components/ui/separator\";\nimport {Badge} from \"@/components/ui/badge\";\nimport {CardsWithPagination} from \"@/components/wrappers/common/cards-with-pagination\";\nimport {AgentDatabaseCard} from \"@/components/wrappers/dashboard/agent/agent-database-card\";\nimport {HealthCheckGraph} from \"@/components/wrappers/dashboard/health/heath-grid\";\nimport {HealthcheckLog} from \"@/db/schema/15_healthcheck-log\";\n\ntype AgentContentPageProps = {\n    edgeKey: string;\n    agent: AgentWithDatabases\n}\n\nexport const AgentContentPage = ({edgeKey, agent: initialAgent}: AgentContentPageProps) => {\n\n    const {data} = useQuery({\n        queryKey: [\"agent-data\", initialAgent.id],\n        queryFn: async () => {\n            const result = await getAgentAction(initialAgent.id);\n            return result?.data;\n        },\n        initialData: {\n            data: initialAgent,\n            health: []\n        },\n        staleTime: 0,\n        gcTime: 0,\n        refetchInterval: 1000,\n    });\n\n    const agent = data?.data ?? initialAgent;\n    const agentHealthLogs: HealthcheckLog[] = data?.health ?? [];\n\n    return (\n        <div className=\"space-y-10\">\n            <div className=\"flex flex-col sm:flex-row sm:justify-between gap-6 \">\n                <Card className=\"w-full sm:w-auto flex-1  transition-all  border-border/50 bg-card \">\n                    <CardHeader className=\"flex flex-row items-center justify-between space-y-0 pb-2\">\n                        <CardTitle\n                            className=\"text-sm font-semibold uppercase tracking-wider text-muted-foreground\">Databases</CardTitle>\n                        <Server className=\"h-4 w-4 text-muted-foreground opacity-50\"/>\n                    </CardHeader>\n                    <CardContent>\n                        <div className=\"text-3xl font-bold tracking-tight\">{agent.databases.length}</div>\n                        <p className=\"text-xs text-muted-foreground mt-1\">Linked resources</p>\n                    </CardContent>\n                </Card>\n\n                <Card className=\"w-full sm:w-auto flex-1  transition-all  border-border/50 bg-card \">\n                    <CardHeader className=\"flex flex-row items-center justify-between space-y-0 pb-2\">\n                        <CardTitle className=\"text-sm font-semibold uppercase tracking-wider text-muted-foreground\">Last\n                            contact</CardTitle>\n                        <Server className=\"h-4 w-4 text-muted-foreground opacity-50\"/>\n                    </CardHeader>\n                    <CardContent>\n                        <div\n                            className=\"text-3xl font-bold tracking-tight\">{formatDateLastContact(agent.lastContact)}</div>\n                        <p className=\"text-xs text-muted-foreground mt-1\">Status heartbeat</p>\n                    </CardContent>\n                </Card>\n            </div>\n\n            {agent.lastContact && (\n                <HealthCheckGraph logs={agentHealthLogs}/>\n            )}\n\n            <div className=\"space-y-6\">\n                <Accordion type=\"single\" collapsible defaultValue={!agent.lastContact ? \"registration\" : undefined}>\n                    <AccordionItem value=\"registration\"\n                                   className=\"border rounded-xl px-6 bg-card shadow-sm overflow-hidden transition-all duration-300\">\n                        <AccordionTrigger className=\"hover:no-underline py-4 group\">\n                            <div className=\"flex items-center gap-3\">\n                                <span className=\"text-xl font-bold tracking-tight\">Registration & Setup</span>\n                                {!agent.lastContact && (\n                                    <Badge variant=\"outline\"\n                                           className=\"bg-orange-500/10 text-orange-600 border-orange-500/20 animate-pulse\">\n                                        Action Required\n                                    </Badge>\n                                )}\n                            </div>\n                        </AccordionTrigger>\n                        <AccordionContent className=\"pb-6 pt-2 border-t border-dashed\">\n                            <AgentCardKey\n                                edgeKey={edgeKey}\n                                agentName={agent.name}\n                            />\n                        </AccordionContent>\n                    </AccordionItem>\n                </Accordion>\n            </div>\n\n            {agent.databases.length > 0 && (\n                <div className=\"space-y-6\">\n                    <div className=\"flex items-center justify-between px-1\">\n                        <div className=\"space-y-1\">\n                            <h2 className=\"text-2xl font-bold tracking-tight\">Managed Databases</h2>\n                            <p className=\"text-sm text-muted-foreground\">\n                                Resources currently connected to this agent.\n                            </p>\n                        </div>\n                    </div>\n                    <Separator className=\"opacity-50\"/>\n                    <CardsWithPagination\n                        cardsPerPage={4}\n                        numberOfColumns={2}\n                        data={agent.databases}\n                        cardItem={AgentDatabaseCard}\n                    />\n                </div>\n            )}\n        </div>\n    )\n}"
  },
  {
    "path": "src/components/wrappers/dashboard/agent/agent-database-card.tsx",
    "content": "\"use client\";\n\nimport {Database} from \"@/db/schema/07_database\";\nimport {DatabaseCard} from \"@/components/wrappers/dashboard/projects/project-card/project-database-card\";\n\nexport type agentDatabaseCardProps = {\n    data: Database;\n};\n\nexport const AgentDatabaseCard = (props: agentDatabaseCardProps) => {\n    const {data: database} = props;\n\n    return <DatabaseCard withDetails={false} data={database}/>;\n\n    //Todo: Add again when impersonation system will be implemented\n   /* if (!database.projectId) {\n         return <DatabaseCard data={database}/>;\n    }\n\n    return (\n        <Link className=\"group block transition-all duration-200 outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 rounded-xl\"\n              href={`/dashboard/projects/${database.projectId}/database/${database.id}`}>\n            <DatabaseCard data={database}/>\n        </Link>\n    );*/\n};\n"
  },
  {
    "path": "src/components/wrappers/dashboard/agent/agent-database-columns.tsx",
    "content": "\"use client\"\n\nimport {ColumnDef} from \"@tanstack/react-table\"\nimport {Database} from \"@/db/schema/07_database\"\nimport Image from \"next/image\"\nimport {ConnectionIndicator} from \"@/components/wrappers/common/connection-indicator\"\nimport {formatDateLastContact} from \"@/utils/date-formatting\"\nimport Link from \"next/link\"\nimport {Button} from \"@/components/ui/button\"\nimport {ChevronRight} from \"lucide-react\"\n\nexport const agentDatabaseColumns: ColumnDef<Database>[] = [\n    {\n        accessorKey: \"dbms\",\n        header: \"Type\",\n        cell: ({row}) => (\n            <div className=\"flex items-center justify-center w-8 h-8 p-1.5 bg-muted/50 rounded-lg border border-border/50\">\n                <Image\n                    src={`/images/${row.original.dbms}.png`}\n                    alt={row.original.dbms}\n                    width={20}\n                    height={20}\n                    className=\"object-contain\"\n                />\n            </div>\n        )\n    },\n    {\n        accessorKey: \"name\",\n        header: \"Name\",\n        cell: ({row}) => (\n            <div className=\"flex flex-col\">\n                <span className=\"font-bold text-sm\">{row.original.name}</span>\n                <span className=\"text-[10px] text-muted-foreground font-mono truncate max-w-[150px]\">\n                    {row.original.agentDatabaseId}\n                </span>\n            </div>\n        )\n    },\n    {\n        accessorKey: \"lastContact\",\n        header: \"Last Contact\",\n        cell: ({row}) => (\n            <div className=\"flex flex-col\">\n                <span className=\"text-xs\">\n                    {formatDateLastContact(row.original.lastContact)}\n                </span>\n            </div>\n        )\n    },\n    {\n        id: \"status\",\n        header: \"Status\",\n        cell: ({row}) => (\n            <div className=\"flex justify-center w-full\">\n                <ConnectionIndicator date={row.original.lastContact} />\n            </div>\n        )\n    },\n    {\n        id: \"actions\",\n        header: () => null,\n        cell: ({row}) => {\n             const href = row.original.projectId \n                ? `/dashboard/projects/${row.original.projectId}/database/${row.original.id}`\n                : \"#\";\n                \n             return (\n                 <div className=\"flex justify-end\">\n                    <Button variant=\"ghost\" size=\"icon\" asChild className=\"hover:bg-accent group\">\n                        <Link href={href}>\n                            <ChevronRight className=\"h-4 w-4 text-muted-foreground group-hover:text-foreground transition-transform group-hover:translate-x-0.5\" />\n                        </Link>\n                    </Button>\n                 </div>\n             )\n        }\n    }\n]\n"
  },
  {
    "path": "src/components/wrappers/dashboard/agent/agent-modal-key/agent-modal-key.tsx",
    "content": "\"use client\";\n\nimport { Button } from \"@/components/ui/button\";\nimport { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, DialogClose } from \"@/components/ui/dialog\";\n\nimport { generateEdgeKey } from \"@/utils/edge_key\";\nimport { PropsWithChildren } from \"react\";\nimport { CopyButton } from \"@/components/wrappers/common/button/copy-button\";\nimport { getServerUrl } from \"@/utils/get-server-url\";\nimport { CodeSnippet } from \"@/components/wrappers/code-snippet/code-snippet\";\nimport {Agent} from \"@/db/schema/08_agent\";\n\nexport type agentRegistrationDialogProps = PropsWithChildren<{\n    agent: Agent;\n}>;\n\nexport function AgentModalKey(props: agentRegistrationDialogProps) {\n    const edge_key = generateEdgeKey(getServerUrl(), props.agent.id);\n    const command = `portabase agent \"${props.agent.name}\" --key ${edge_key}`;\n\n    return (\n        <Dialog>\n            <DialogTrigger asChild>{props.children}</DialogTrigger>\n            <DialogContent className=\"sm:max-w-[425px] w-full\">\n                <DialogHeader>\n                    <DialogTitle>Agent Connection</DialogTitle>\n                </DialogHeader>\n                <div className=\"sm:max-w-[375px] w-full space-y-4\">\n                    <CodeSnippet\n                        title=\"Installation Command\"\n                        code={command}\n                    />\n                    <CodeSnippet\n                        title=\"Agent Key (Manual)\"\n                        code={edge_key}\n                    />\n                </div>\n                <DialogFooter>\n                    <DialogClose asChild>\n                        <Button type=\"button\" variant=\"outline\">Close</Button>\n                    </DialogClose>\n                </DialogFooter>\n            </DialogContent>\n        </Dialog>\n    );\n}\n"
  },
  {
    "path": "src/components/wrappers/dashboard/agent/button-delete-agent/button-delete-agent.tsx",
    "content": "\"use client\";\n\nimport {Trash2} from \"lucide-react\";\nimport {ButtonWithConfirm} from \"@/components/wrappers/common/button/button-with-confirm\";\nimport {useMutation} from \"@tanstack/react-query\";\nimport {useRouter} from \"next/navigation\";\nimport {toast} from \"sonner\";\nimport {deleteAgentAction} from \"@/components/wrappers/dashboard/agent/button-delete-agent/delete-agent.action\";\nimport {useIsMobile} from \"@/hooks/use-mobile\";\n\nexport type ButtonDeleteAgentProps = {\n    text?: string,\n    agentId: string,\n    organizationId?: string\n    organizationIds?: string[]\n};\n\nexport const ButtonDeleteAgent = (props: ButtonDeleteAgentProps) => {\n    const router = useRouter();\n    const isMobile = useIsMobile();\n\n    const mutation = useMutation({\n        mutationFn: () => deleteAgentAction({agentId: props.agentId, organizationId: props.organizationId, organizationIds: props.organizationIds}),\n        onSuccess: async (result: any) => {\n            if (result.data?.success) {\n                toast.success(result.data.actionSuccess.message);\n                router.push(props.organizationId ? \"/dashboard/settings?tab=agents\" :  \"/dashboard/agents\");\n            } else {\n                toast.error(result.data.actionError.message || \"Unknown error occurred.\");\n            }\n        },\n    });\n\n    return (\n        <ButtonWithConfirm\n            title={props.text ? props.text : \"\"}\n            description=\"Are you sure you want to remove this agent? This action cannot be undone.\"\n            button={{\n                main: {\n                    text: props.text ? !isMobile ? props.text : \"\" : \"\",\n                    variant: \"outline\",\n                    icon: <Trash2 color=\"red\"/>,\n                },\n                confirm: {\n                    className: \"w-full\",\n                    text: \"Delete\",\n                    icon: <Trash2/>,\n                    variant: \"destructive\",\n                    onClick: () => {\n                        mutation.mutate();\n                    },\n                },\n                cancel: {\n                    className: \"w-full\",\n                    text: \"Cancel\",\n                    icon: <Trash2/>,\n                    variant: \"outline\",\n                },\n            }}\n            isPending={mutation.isPending}\n        />\n    );\n};\n"
  },
  {
    "path": "src/components/wrappers/dashboard/agent/button-delete-agent/delete-agent.action.ts",
    "content": "\"use server\";\n\nimport {z} from \"zod\";\nimport {v4 as uuidv4} from \"uuid\";\nimport {ServerActionResult} from \"@/types/action-type\";\nimport {and, eq, inArray} from \"drizzle-orm\";\nimport {db} from \"@/db\";\nimport * as drizzleDb from \"@/db\";\nimport {Agent} from \"@/db/schema/08_agent\";\nimport {userAction} from \"@/lib/safe-actions/actions\";\nimport {zString} from \"@/lib/zod\";\nimport {withUpdatedAt} from \"@/db/utils\";\n\nexport const deleteAgentAction = userAction\n    .schema(\n        z.object({\n            agentId: zString(),\n            organizationId: zString().optional(),\n            organizationIds: z.array(z.string()).optional()\n        })\n    )\n    .action(async ({parsedInput}): Promise<ServerActionResult<Agent>> => {\n        const {agentId, organizationId, organizationIds} = parsedInput;\n\n        try {\n            let projectIds: string[] = [];\n\n            const uuid = uuidv4();\n            if (organizationId) {\n                await db\n                    .delete(drizzleDb.schemas.organizationAgent)\n                    .where(\n                        and(\n                            eq(drizzleDb.schemas.organizationAgent.organizationId, organizationId),\n                            eq(drizzleDb.schemas.organizationAgent.agentId, agentId)\n                        )\n                    );\n\n                const organization = await db.query.organization.findFirst({\n                    where: eq(drizzleDb.schemas.organization.id, organizationId),\n                    with: {\n                        projects: true,\n                    }\n                });\n\n                projectIds = organization?.projects?.map(project => project.id) ?? [];\n\n\n            } else if (organizationIds) {\n\n                const organizationsToRemoveDetails = await db.query.organization.findMany({\n                    where: inArray(drizzleDb.schemas.organization.id, organizationIds),\n                    with: {\n                        projects: true\n                    }\n                });\n\n                projectIds = organizationsToRemoveDetails.flatMap(org =>\n                    org.projects.map(project => project.id)\n                );\n\n            }\n\n\n            if (projectIds?.length > 0) {\n                const databases = await db.query.database.findMany({\n                    where: (db, {inArray}) => inArray(db.projectId, projectIds),\n                    columns: {id: true}\n                });\n\n                const databaseIds = databases.map(d => d.id);\n\n                await db\n                    .update(drizzleDb.schemas.database)\n                    .set(withUpdatedAt({\n                        backupPolicy: null,\n                        projectId: null\n                    }))\n                    .where(inArray(drizzleDb.schemas.database.projectId, projectIds))\n                    .execute();\n\n                await db.delete(drizzleDb.schemas.retentionPolicy)\n                    .where(inArray(drizzleDb.schemas.retentionPolicy.databaseId, databaseIds))\n                    .execute();\n\n                await db.delete(drizzleDb.schemas.alertPolicy)\n                    .where(inArray(drizzleDb.schemas.alertPolicy.databaseId, databaseIds))\n                    .execute();\n\n                await db.delete(drizzleDb.schemas.storagePolicy)\n                    .where(inArray(drizzleDb.schemas.storagePolicy.databaseId, databaseIds))\n                    .execute();\n            }\n\n\n            const updatedAgent = await db\n                .update(drizzleDb.schemas.agent)\n                .set(withUpdatedAt({\n                    isArchived: true,\n                    slug: uuid,\n                    deletedAt: new Date()\n                }))\n                .where(eq(drizzleDb.schemas.agent.id, agentId))\n                .returning();\n\n\n            if (!updatedAgent[0]) {\n                return {\n                    success: false,\n                    actionError: {\n                        message: \"Agent not found or update failed\",\n                        status: 404,\n                        messageParams: {agentId: agentId},\n                    },\n                };\n            }\n\n            return {\n                success: true,\n                value: updatedAgent[0],\n                actionSuccess: {\n                    message: \"Agent has been successfully deleted.\",\n                    messageParams: {projectId: agentId},\n                },\n            };\n        } catch (error) {\n            return {\n                success: false,\n                actionError: {\n                    message: \"Failed to delete agent.\",\n                    status: 500,\n                    cause: error instanceof Error ? error.message : \"Unknown error\",\n                    messageParams: {agentId: agentId},\n                },\n            };\n        }\n    });\n"
  },
  {
    "path": "src/components/wrappers/dashboard/backup/backup-button/backup-button.action.ts",
    "content": "\"use server\";\n\nimport {z} from \"zod\";\nimport {db} from \"@/db\";\nimport {ServerActionResult} from \"@/types/action-type\";\nimport * as drizzleDb from \"@/db\";\nimport {Backup} from \"@/db/schema/07_database\";\nimport {withUpdatedAt} from \"@/db/utils\";\nimport {userAction} from \"@/lib/safe-actions/actions\";\n\nexport const backupButtonAction = userAction.schema(z.string()).action(async ({parsedInput}): Promise<ServerActionResult<Backup>> => {\n    try {\n        const [createdBackup] = await db\n            .insert(drizzleDb.schemas.backup)\n            .values({\n                databaseId: parsedInput,\n                status: \"waiting\",\n            })\n            .returning();\n\n        return {\n            success: true,\n            value: createdBackup,\n            actionSuccess: {\n                message: \"Backup has been successfully created.\",\n                messageParams: {databaseId: parsedInput},\n            },\n        };\n    } catch (error) {\n        console.error(\"Error creating backup:\", error);\n\n        return {\n            success: false,\n            actionError: {\n                message: \"Failed to create backup.\",\n                status: 500,\n                cause: error instanceof Error ? error.message : \"Unknown error\",\n                messageParams: {databaseId: parsedInput},\n            },\n        };\n    }\n});\n"
  },
  {
    "path": "src/components/wrappers/dashboard/backup/backup-button/backup-button.tsx",
    "content": "\"use client\";\n\nimport { useMutation, useQueryClient } from \"@tanstack/react-query\";\nimport { useRouter } from \"next/navigation\";\nimport { toast } from \"sonner\";\n\nimport { backupButtonAction } from \"@/components/wrappers/dashboard/backup/backup-button/backup-button.action\";\nimport { Check, DatabaseZap, X } from \"lucide-react\";\nimport { useIsMobile } from \"@/hooks/use-mobile\";\nimport { ButtonWithConfirm } from \"@/components/wrappers/common/button/button-with-confirm\";\n\nexport type BackupButtonProps = {\n  databaseId: string;\n  disable: boolean;\n};\n\nexport const BackupButton = (props: BackupButtonProps) => {\n  const queryClient = useQueryClient();\n  const router = useRouter();\n  const isMobile = useIsMobile();\n\n  const mutation = useMutation({\n    mutationFn: async (databaseId: string) => {\n      const backup = await backupButtonAction(databaseId);\n      if (backup?.data?.success) {\n        toast.success(\n          backup.data.actionSuccess?.message || \"Backup created successfully!\",\n        );\n        queryClient.invalidateQueries({\n          queryKey: [\"database-data\", props.databaseId],\n        });\n        router.refresh();\n      } else {\n        toast.error(backup?.serverError || \"Failed to create backup.\");\n      }\n    },\n  });\n  const HandleAction = async () => {\n    await mutation.mutateAsync(props.databaseId);\n  };\n\n  return (\n    <ButtonWithConfirm\n      title=\"Create Backup\"\n      description={\"Are you sure you want to create a backup?\"}\n      button={{\n        main: {\n          disabled: props.disable,\n          text: isMobile ? \"\" : \"Backup\",\n          variant: \"default\",\n          icon: <DatabaseZap />,\n        },\n        confirm: {\n          className: \"w-full\",\n          text: \"Yes, create backup\",\n          icon: <Check />,\n          variant: \"default\",\n          onClick: async () => {\n            await HandleAction();\n          },\n        },\n        cancel: {\n          className: \"w-full\",\n          text: \"No, cancel\",\n          icon: <X />,\n          variant: \"outline\",\n        },\n      }}\n      isPending={mutation.isPending}\n    />\n  );\n};\n"
  },
  {
    "path": "src/components/wrappers/dashboard/common/logged-in/logged-in-button.server.tsx",
    "content": "import { currentUser } from \"@/lib/auth/current-user\";\nimport { getAccounts, getSession, getSessions } from \"@/lib/auth/auth\";\nimport { LoggedInButtonClient } from \"./logged-in-button\";\nimport { SUPPORTED_PROVIDERS } from \"@/lib/auth/config\";\n\nexport const LoggedInButton = async () => {\n    const user = await currentUser();\n    const sessions = await getSessions();\n    const currentSession = await getSession();\n    const accounts = await getAccounts();\n\n    if (!user) return null;\n\n    return (\n        <LoggedInButtonClient\n            user={user}\n            sessions={sessions}\n            // @ts-ignore\n            currentSession={currentSession.session}\n            accounts={accounts}\n            providers={SUPPORTED_PROVIDERS.filter((p) => p.isActive)}\n        />\n    );\n};\n"
  },
  {
    "path": "src/components/wrappers/dashboard/common/logged-in/logged-in-button.tsx",
    "content": "\"use client\";\n\nimport { ChevronsUpDown } from \"lucide-react\";\nimport { Avatar, AvatarFallback, AvatarImage } from \"@/components/ui/avatar\";\nimport { SidebarMenuButton } from \"@/components/ui/sidebar\";\nimport { LoggedInDropdown } from \"./logged-in-dropdown\";\nimport { Account, Session, User } from \"better-auth\";\nimport { AuthProviderConfig } from \"@/lib/auth/config\";\n\ntype LoggedInButtonClientProps = {\n    user: User;\n    sessions: Session[];\n    currentSession: Session;\n    accounts: Account[];\n    providers: AuthProviderConfig[];\n};\n\nexport const LoggedInButtonClient = ({ user, sessions, currentSession, accounts, providers }: LoggedInButtonClientProps) => {\n    return (\n        <LoggedInDropdown\n            // @ts-ignore\n            user={user}\n            // @ts-ignore\n            sessions={sessions}\n            // @ts-ignore\n            currentSession={currentSession}\n            // @ts-ignore\n            accounts={accounts}\n            providers={providers}\n        >\n            <SidebarMenuButton type=\"button\" className=\"h-auto justify-between py-2\" data-testid=\"profile-dropdown\">\n                <div className=\"flex items-center gap-2\">\n                    <Avatar className=\"size-6\">\n                        <AvatarFallback>{user.name[0].toUpperCase()}</AvatarFallback>\n                        {user.image && <AvatarImage src={user.image} />}\n                    </Avatar>\n                    <div className=\"flex flex-col items-start\">\n                        <span className=\"text-sm font-medium first-letter:capitalize max-w-[170px] truncate\">{user.name}</span>\n                        <span className=\"text-xs text-muted-foreground max-w-[170px] truncate\" title={user.email}>\n                            {user.email}\n                        </span>\n                    </div>\n                </div>\n                <ChevronsUpDown className=\"h-4 w-4 shrink-0 opacity-50\" />\n            </SidebarMenuButton>\n        </LoggedInDropdown>\n    );\n};\n"
  },
  {
    "path": "src/components/wrappers/dashboard/common/logged-in/logged-in-dropdown.tsx",
    "content": "\"use client\";\n\nimport { PropsWithChildren, ReactNode, useState } from \"react\";\n\nimport { useRouter } from \"next/navigation\";\n\nimport { LogOut, User } from \"lucide-react\";\n\nimport { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from \"@/components/ui/dropdown-menu\";\n\nimport { signOut } from \"@/lib/auth/auth-client\";\n\nimport { ProfileModal } from \"@/components/wrappers/dashboard/common/profile/profile-modal\";\n\nimport { Account, Session, User as UserType } from \"@/db/schema/02_user\";\n\nimport { AuthProviderConfig } from \"@/lib/auth/config\";\n\nexport type LoggedInDropdownProps = PropsWithChildren<{\n    user: UserType;\n    sessions: Session[];\n    currentSession: Session;\n    accounts: Account[];\n    children: ReactNode;\n    providers: AuthProviderConfig[];\n}>;\n\nexport const LoggedInDropdown = ({ user, sessions, currentSession, accounts, children, providers }: LoggedInDropdownProps) => {\n    const router = useRouter();\n\n    const [isModalOpen, setIsModalOpen] = useState(false);\n\n    return (\n        <>\n            <ProfileModal\n                user={user}\n                sessions={sessions}\n                currentSession={currentSession}\n                accounts={accounts}\n                open={isModalOpen}\n                onOpenChange={setIsModalOpen}\n                providers={providers}\n            />\n            <DropdownMenu>\n                <DropdownMenuTrigger asChild>{children}</DropdownMenuTrigger>\n                <DropdownMenuContent\n                    className=\"w-[var(--radix-popper-anchor-width)] rounded-xl border-2 border-border bg-popover shadow-none p-1\"\n                    align=\"start\"\n                    side=\"top\"\n                    sideOffset={8}\n                >\n                    <DropdownMenuItem\n                        onClick={() => setIsModalOpen(!isModalOpen)}\n                        className=\"group gap-2 p-1 cursor-pointer rounded-lg mb-1 transition-colors focus:bg-accent hover:bg-accent/50 border border-transparent\"\n                    >\n                        <div className=\"flex size-9 items-center justify-center rounded-md border border-border bg-muted/50 shadow-sm transition-all group-hover:shadow-md group-hover:bg-background\">\n                            <User size={18} className=\"text-muted-foreground group-hover:text-foreground transition-colors\" />\n                        </div>\n                        <div className=\"flex flex-col\">\n                            <span className=\"text-sm font-medium leading-none\">Account Settings</span>\n                        </div>\n                    </DropdownMenuItem>\n                    <DropdownMenuItem\n                        className=\"group gap-2 p-1 cursor-pointer rounded-lg transition-colors focus:bg-red-50 dark:focus:bg-red-950/20 border border-transparent text-red-600 focus:text-red-600\"\n                        onClick={async () => {\n                            await signOut({\n                                fetchOptions: {\n                                    onSuccess: () => {\n                                        router.push(\"/login\");\n                                    },\n                                },\n                            });\n                        }}\n                    >\n                        <div className=\"flex size-9 items-center justify-center rounded-md border border-red-100 bg-red-50/50 dark:border-red-900/30 dark:bg-red-950/20 shadow-sm transition-all group-hover:shadow-md\">\n                            <LogOut size={18} className=\"text-red-500\" />\n                        </div>\n                        <div className=\"flex flex-col\">\n                            <span className=\"text-sm font-medium leading-none\">Logout</span>\n                        </div>\n                    </DropdownMenuItem>\n                </DropdownMenuContent>\n            </DropdownMenu>\n        </>\n    );\n};\n"
  },
  {
    "path": "src/components/wrappers/dashboard/common/profile/profile-modal.tsx",
    "content": "\"use client\";\n\nimport { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from \"@/components/ui/dialog\";\nimport { Tabs, TabsContent } from \"@/components/ui/tabs\";\nimport { ProfileSidebar } from \"./profile-sidebar\";\nimport type { AuthProviderConfig } from \"@/lib/auth/config\";\nimport { User, Session, Account } from \"@/db/schema/02_user\";\nimport { ProfileGeneral } from \"../../profile/profile-general\";\nimport { ProfileSecurity } from \"../../profile/profile-security\";\nimport { ProfileProviders } from \"../../profile/profile-providers\";\nimport { ProfileAccount } from \"../../profile/profile-account\";\nimport { ProfileAppearance } from \"../../profile/profile-apperance\";\n\ntype ProfileModalProps = {\n    open: boolean;\n    user: User;\n    sessions: Session[];\n    currentSession: Session;\n    accounts: Account[];\n    onOpenChange: (open: boolean) => void;\n    providers: AuthProviderConfig[];\n};\n\nexport const ProfileModal = ({ user, sessions, currentSession, accounts, open, onOpenChange, providers }: ProfileModalProps) => {\n    return (\n        <Dialog open={open} onOpenChange={onOpenChange}>\n            <DialogContent className=\"w-[95vw] h-[90vh] max-w-md lg:max-w-[1000px] lg:h-[800px] pb-6 p-0 overflow-hidden flex flex-col outline-none gap-0 rounded-xl bg-background\">\n                <DialogHeader className=\"sr-only\">\n                    <DialogTitle>Settings</DialogTitle>\n                    <DialogDescription>Manage your account settings</DialogDescription>\n                </DialogHeader>\n                <Tabs defaultValue=\"profile\" orientation=\"vertical\" className=\"flex flex-col lg:flex-row h-full w-full\">\n                    <ProfileSidebar user={user} />\n\n                    <div className=\"flex-1 overflow-y-auto bg-background h-full scroll-smooth\">\n                        <TabsContent value=\"profile\" className=\"mt-0 h-full p-6 lg:p-10 outline-none focus-visible:ring-0\">\n                            <ProfileGeneral user={user} />\n                        </TabsContent>\n\n                        <TabsContent value=\"security\" className=\"mt-0 h-full p-6 lg:p-10 outline-none focus-visible:ring-0\">\n                            <ProfileSecurity\n                                user={user}\n                                sessions={sessions}\n                                currentSession={currentSession}\n                                credentialAccount={accounts.find((acc) => acc.providerId === \"credential\")!}\n                                isPasswordEnabled={providers.some((p) => p.id === \"credential\")}\n                                isPasskeyEnabled={providers.some((p) => p.id === \"passkey\")}\n                                providers={providers}\n                            />\n                        </TabsContent>\n\n                        <TabsContent value=\"providers\" className=\"mt-0 h-full p-6 lg:p-10 outline-none focus-visible:ring-0\">\n                            <ProfileProviders accounts={accounts} providers={providers} />\n                        </TabsContent>\n\n                        <TabsContent value=\"account\" className=\"mt-0 h-full p-6 lg:p-10 outline-none focus-visible:ring-0\">\n                            <ProfileAccount user={user} />\n                        </TabsContent>\n\n                        <TabsContent value=\"appearance\" className=\"mt-0 h-full p-6 lg:p-10 outline-none focus-visible:ring-0\">\n                            <ProfileAppearance />\n                        </TabsContent>\n                    </div>\n                </Tabs>\n            </DialogContent>\n        </Dialog>\n    );\n};\n"
  },
  {
    "path": "src/components/wrappers/dashboard/common/profile/profile-sidebar.tsx",
    "content": "\"use client\";\n\nimport React from \"react\";\nimport { TabsList, TabsTrigger } from \"@/components/ui/tabs\";\nimport { UserIcon, Settings, Palette, ShieldHalf, Workflow } from \"lucide-react\";\nimport { User } from \"@/db/schema/02_user\";\n\ninterface ProfileSidebarProps {\n    user: User;\n}\n\nexport function ProfileSidebar({ user }: ProfileSidebarProps) {\n    return (\n        <div className=\"w-full lg:w-[260px] flex-shrink-0 lg:border-r bg-muted/10 p-4 lg:p-6 flex flex-col gap-4 border-b lg:border-b-0\">\n            <div className=\"flex items-center px-2 mb-2\">\n                <span className=\"font-bold text-xl tracking-tight\">Settings</span>\n            </div>\n\n            <TabsList className=\"flex flex-col h-auto w-full bg-transparent p-0 gap-1 justify-start items-stretch\">\n                <SettingsTabTrigger value=\"profile\" icon={<UserIcon className=\"w-4 h-4\" />}>\n                    Profile\n                </SettingsTabTrigger>\n                <SettingsTabTrigger value=\"security\" icon={<ShieldHalf className=\"w-4 h-4\" />}>\n                    Security & Access\n                </SettingsTabTrigger>\n                <SettingsTabTrigger value=\"providers\" icon={<Workflow className=\"w-4 h-4\" />}>\n                    Connected Accounts\n                </SettingsTabTrigger>\n                <SettingsTabTrigger value=\"account\" icon={<Settings className=\"w-4 h-4\" />}>\n                    Account\n                </SettingsTabTrigger>\n                <SettingsTabTrigger value=\"appearance\" icon={<Palette className=\"w-4 h-4\" />}>\n                    Appearance\n                </SettingsTabTrigger>\n            </TabsList>\n        </div>\n    );\n}\n\nfunction SettingsTabTrigger({ value, icon, children }: { value: string; icon: React.ReactNode; children: React.ReactNode }) {\n    return (\n        <TabsTrigger\n            value={value}\n            className=\"w-full justify-start gap-3 px-3 py-2.5 rounded-md transition-all whitespace-nowrap flex-shrink-0 text-sm data-[state=active]:bg-background data-[state=active]:text-primary data-[state=active]:shadow-sm data-[state=active]:font-medium hover:bg-muted/50 hover:text-foreground text-muted-foreground\"\n        >\n            {icon}\n            {children}\n        </TabsTrigger>\n    );\n}\n"
  },
  {
    "path": "src/components/wrappers/dashboard/common/sidebar/app-sidebar.tsx",
    "content": "import {\n    Sidebar,\n    SidebarContent,\n    SidebarHeader,\n    SidebarMenu,\n    SidebarMenuItem\n} from \"@/components/ui/sidebar\";\nimport {SidebarLogo} from \"@/components/wrappers/dashboard/common/sidebar/logo-sidebar\";\nimport {SidebarMenuCustomMain} from \"@/components/wrappers/dashboard/common/sidebar/menu-sidebar-main\";\nimport {SideBarFooterCredit} from \"@/components/wrappers/dashboard/common/sidebar/side-bar-footer-credit\";\nimport {OrganizationCombobox} from \"@/components/wrappers/dashboard/organization/organization-combobox\";\nimport {env} from \"@/env.mjs\";\nimport {LoggedInButton} from \"@/components/wrappers/dashboard/common/logged-in/logged-in-button.server\";\nimport {UpdateNotification} from \"@/features/updates/components/update-notification\";\n\nexport function AppSidebar() {\n    const projectName = env.PROJECT_NAME;\n    return (\n        <Sidebar collapsible=\"icon\">\n            <SidebarHeader>\n                <SidebarMenu>\n                    <SidebarMenuItem>\n                        <SidebarLogo projectName={projectName ?? \"Portabase\"}/>\n                    </SidebarMenuItem>\n                    <SidebarMenuItem>\n                        <OrganizationCombobox/>\n                    </SidebarMenuItem>\n                </SidebarMenu>\n            </SidebarHeader>\n\n            <SidebarContent>\n                <SidebarMenuCustomMain/>\n            </SidebarContent>\n\n            <UpdateNotification/>\n\n            <SidebarMenu className=\"mb-2\">\n                <SidebarMenuItem className=\"p-2\">\n                    <LoggedInButton/>\n                </SidebarMenuItem>\n            </SidebarMenu>\n            <SideBarFooterCredit/>\n        </Sidebar>\n    );\n}"
  },
  {
    "path": "src/components/wrappers/dashboard/common/sidebar/logo-sidebar.tsx",
    "content": "\"use client\";\n\nimport { useSidebar } from \"@/components/ui/sidebar\";\nimport Link from \"next/link\";\nimport { useTheme } from \"next-themes\";\nimport Image from \"next/image\";\nimport { useEffect, useState } from \"react\";\nimport {Skeleton} from \"@/components/ui/skeleton\";\n\nexport const SidebarLogo = ({ projectName }: { projectName: string }) => {\n    const { state, isMobile } = useSidebar();\n    const { resolvedTheme } = useTheme();\n\n    const [mounted, setMounted] = useState(false);\n    const [loaded, setLoaded] = useState(false);\n\n    useEffect(() => {\n        setMounted(true);\n    }, []);\n\n    if (!mounted) return(\n        <div className=\"m-4 w-[190px] h-[45px]\">\n            <Skeleton className=\"w-full h-full bg-transparent\" />\n        </div>\n    );\n\n    const imageTheme =\n        resolvedTheme === \"dark\" ? \"/images/logo-dark.png\" : \"/images/logo-light.png\";\n\n    const handleLoad = () => setLoaded(true);\n\n    const style = {\n        transition: \"opacity 0.3s ease-in-out\",\n        opacity: loaded ? 1 : 0,\n    };\n\n    return (\n        <div className=\"ml-1 flex items-center justify-center\">\n            <Link href=\"/dashboard/home\">\n                {state === \"collapsed\" && !isMobile ? (\n                    <Image\n                        src=\"/images/logo.png\"\n                        alt={`Logo ${projectName}`}\n                        width={40}\n                        height={40}\n                        loading=\"eager\"\n                        priority\n                        style={style}\n                        onLoad={handleLoad}\n                    />\n                ) : (\n                    <div className=\"m-4 w-[190px] h-[45px] \">\n                        <Image\n                            src={imageTheme}\n                            alt={`Logo ${projectName}`}\n                            width={190}\n                            height={90}\n                            loading=\"eager\"\n                            priority\n                            style={style}\n                            onLoad={handleLoad}\n                        />\n                    </div>\n                )}\n            </Link>\n        </div>\n    );\n};\n"
  },
  {
    "path": "src/components/wrappers/dashboard/common/sidebar/menu-sidebar-main.tsx",
    "content": "\"use client\"\n\nimport {\n    Home,\n    Settings,\n    Users,\n    Layers,\n    ChartArea,\n    ShieldHalf,\n    Building, UserRoundCog, Mail, PackageOpen, Logs, Megaphone, Blocks, Warehouse, BookOpen, Hammer,\n    ChevronsLeftRightEllipsis\n} from \"lucide-react\";\nimport {SidebarGroupItem, SidebarMenuCustomBase} from \"@/components/wrappers/dashboard/common/sidebar/menu-sidebar\";\nimport {authClient} from \"@/lib/auth/auth-client\";\n\n\nexport const SidebarMenuCustomMain = () => {\n\n    const BASE_URL = `/dashboard`;\n\n    const {data: session, isPending, error} = authClient.useSession();\n\n    if (isPending) return null;\n\n    if (error || !session) {\n        return null;\n    }\n\n    const groupContentApplication: SidebarGroupItem[\"group_content\"] = [\n        {title: \"Dashboard\", url: \"/home\", icon: Home, type: \"item\"},\n    ];\n\n    const groupContent: SidebarGroupItem[\"group_content\"] = [\n        {title: \"Projects\", url: \"/projects\", icon: Layers, details: true, type: \"item\"},\n        {title: \"Statistics\", url: \"/statistics\", icon: ChartArea, type: \"item\"},\n        {title: \"Settings\", url: \"/settings\", icon: Settings, details: true, type: \"item\"},\n        {\n            title: \"Tools\",\n            url: \"/tools\",\n            icon: Hammer,\n            details: true,\n            type: \"collapse\",\n            submenu: [\n                {title: \"Migration\", url: \"/migration\", icon: ChevronsLeftRightEllipsis, type: \"item\"},\n            ]\n        }\n    ];\n\n\n    const items: SidebarGroupItem[] = [\n        {\n            label: \"Application\",\n            type: \"list\",\n            group_content: groupContentApplication,\n        },\n        {\n            label: \"Organization\",\n            type: \"list\",\n            group_content: groupContent,\n        },\n    ];\n\n\n    if (session?.user.role == \"admin\" || session?.user.role == \"superadmin\") {\n        items.push({\n            label: \"Administration\",\n            type: \"list\",\n            group_content: [\n                {\n                    title: \"Agents\",\n                    url: \"/agents\",\n                    icon: ShieldHalf,\n                    details: true,\n                    type: \"item\"\n                },\n                {\n                    title: \"Notifications\",\n                    url: \"/notifications\",\n                    icon: Megaphone,\n                    details: true,\n                    type: \"collapse\",\n                    submenu: [\n                        {title: \"Channels\", url: \"/notifications/channels\", icon: Blocks, type: \"item\"},\n                        {title: \"Activity Logs\", url: \"/notifications/logs\", icon: Logs, type: \"item\"},\n                    ],\n                },\n                {\n                    title: \"Storages\",\n                    url: \"/storages\",\n                    icon: Warehouse,\n                    details: true,\n                    type: \"collapse\",\n                    submenu: [\n                        {title: \"Channels\", url: \"/storages/channels\", icon: Blocks, type: \"item\"},\n                    ],\n                },\n                {\n                    title: \"Access management\",\n                    url: \"/admin\",\n                    icon: UserRoundCog,\n                    details: true,\n                    type: \"collapse\",\n                    submenu: [\n                        {title: \"Users\", url: \"/admin/users\", icon: Users, type: \"item\"},\n                        {\n                            title: \"Organizations\",\n                            url: \"/admin/organizations\",\n                            icon: Building,\n                            type: \"item\",\n                            details: true\n                        },\n                    ],\n                },\n                {\n                    title: \"Settings\",\n                    url: \"/admin/settings\",\n                    icon: Settings,\n                    type: \"item\",\n                },\n            ],\n        });\n    }\n\n    items.push(\n        {\n            label: \"Resources\",\n            type: \"list\",\n            group_content: [\n                {\n                    title: \"Documentation\",\n                    url: \"https://portabase.io/docs\",\n                    icon: BookOpen,\n                    type: \"item\",\n                    redirect: true,\n                    not_from_base_url: true,\n                }\n            ],\n        },\n    )\n\n\n    return <SidebarMenuCustomBase baseUrl={BASE_URL} items={items}/>;\n};"
  },
  {
    "path": "src/components/wrappers/dashboard/common/sidebar/menu-sidebar.tsx",
    "content": "\"use client\";\n\nimport {\n    SidebarGroup,\n    SidebarGroupContent,\n    SidebarGroupLabel,\n    SidebarMenu,\n    SidebarMenuAction,\n    SidebarMenuButton,\n    SidebarMenuItem,\n    SidebarMenuSub,\n    SidebarMenuSubButton,\n    SidebarMenuSubItem,\n} from \"@/components/ui/sidebar\";\nimport { ChevronRight, ChevronDown, MoreHorizontal } from \"lucide-react\";\nimport { Collapsible, CollapsibleContent, CollapsibleTrigger } from \"@radix-ui/react-collapsible\";\nimport React from \"react\";\nimport Link from \"next/link\";\nimport { cn } from \"@/lib/utils\";\nimport { buttonVariants } from \"@/components/ui/button\";\nimport { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from \"@/components/ui/dropdown-menu\";\nimport { usePathname } from \"next/navigation\";\n\nexport type SidebarItem = {\n    title: string;\n    url: string;\n    redirect?: boolean;\n    not_from_base_url?: boolean;\n    icon: React.ElementType;\n    dropdown?: SidebarItem[];\n    submenu?: SidebarItem[];\n    details?: boolean;\n    type: \"item\" | \"collapse\";\n};\n\nexport type SidebarGroupItem = {\n    label: string;\n    type: \"list\" | \"collapse\";\n    group_content: SidebarItem[];\n};\n\ntype SidebarMenuCustomBaseProps = {\n    baseUrl: string;\n    items: SidebarGroupItem[];\n};\n\nexport const SidebarMenuCustomBase = ({ baseUrl, items }: SidebarMenuCustomBaseProps) => {\n    const pathname = usePathname();\n\n    const normalize = (url: string) => url.split(\"?\")[0].replace(/\\/$/, \"\");\n\n    const isItemActive = (item: SidebarItem) => {\n        const fullUrl = item.not_from_base_url ? normalize(item.url) : normalize(`${baseUrl}${item.url}`);\n        if (item.details) return normalize(pathname).startsWith(fullUrl);\n        return normalize(pathname) === fullUrl;\n    };\n\n    const isSubActive = (item: SidebarItem) => {\n        if (!item.submenu) return false;\n        return item.submenu.some((sub) => isItemActive(sub));\n    };\n\n    return (\n        <SidebarMenu>\n            {items.map((group, index) => (\n                <Collapsible key={index} defaultOpen className=\"group/group-collapsible\">\n                    <SidebarGroup>\n                        <SidebarGroupLabel asChild>\n                            <CollapsibleTrigger disabled={group.type === \"list\"} className=\"flex w-full items-center text-sm font-medium text-sidebar-foreground/70\">\n                                {group.label}\n                                {group.type === \"collapse\" && (\n                                    <ChevronDown className=\"ml-auto h-4 w-4 transition-transform group-data-[state=open]/group-collapsible:rotate-180\" />\n                                )}\n                            </CollapsibleTrigger>\n                        </SidebarGroupLabel>\n                        <CollapsibleContent>\n                            <SidebarGroupContent>\n                                {group.group_content.map((item, idx) => {\n                                    if (item.type === \"collapse\" && item.submenu) {\n                                        const isChildActive = isSubActive(item);\n\n                                        return (\n                                            <Collapsible key={idx} asChild defaultOpen={isChildActive} className=\"group/collapsible\">\n                                                <SidebarMenuItem>\n                                                    <CollapsibleTrigger asChild>\n                                                        <SidebarMenuButton className={cn(buttonVariants({ variant: \"ghost\", size: \"lg\" }), \"justify-between\")}>\n                                                            <item.icon />\n                                                            <span>{item.title}</span>\n                                                            <ChevronRight className=\"ml-auto transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90\" />\n                                                        </SidebarMenuButton>\n                                                    </CollapsibleTrigger>\n                                                    <CollapsibleContent>\n                                                        <SidebarMenuSub>\n                                                            {item.submenu.map((sub, subIdx) => (\n                                                                <SidebarMenuSubItem key={subIdx}>\n                                                                    <SidebarMenuSubButton asChild isActive={isItemActive(sub)}>\n                                                                        <Link\n                                                                            href={sub.not_from_base_url ? sub.url : `${baseUrl}${sub.url}`}\n                                                                            className={cn(buttonVariants({ variant: \"ghost\", size: \"sm\" }), \"w-full justify-start\")}\n                                                                        >\n                                                                            <sub.icon />\n                                                                            <span>{sub.title}</span>\n                                                                        </Link>\n                                                                    </SidebarMenuSubButton>\n                                                                </SidebarMenuSubItem>\n                                                            ))}\n                                                        </SidebarMenuSub>\n                                                    </CollapsibleContent>\n                                                </SidebarMenuItem>\n                                            </Collapsible>\n                                        );\n                                    }\n\n                                    return (\n                                        <SidebarMenuItem key={idx}>\n                                            <SidebarMenuButton asChild isActive={isItemActive(item)} tooltip={item.title}>\n                                                <Link\n                                                    href={item.redirect || item.not_from_base_url ? item.url : `${baseUrl}${item.url}`}\n                                                    target={item.redirect ? \"_blank\" : \"\"}\n                                                    className={cn(buttonVariants({ variant: \"ghost\", size: \"lg\" }), \"justify-start\")}\n                                                >\n                                                    <item.icon />\n                                                    <span>{item.title}</span>\n                                                </Link>\n                                            </SidebarMenuButton>\n                                            {item.dropdown && (\n                                                <SidebarMenuAction showOnHover>\n                                                    <DropdownMenu>\n                                                        <DropdownMenuTrigger asChild>\n                                                            <MoreHorizontal />\n                                                        </DropdownMenuTrigger>\n                                                        <DropdownMenuContent side=\"right\" align=\"start\">\n                                                            {item.dropdown.map((dropdown, dIdx) => (\n                                                                <DropdownMenuItem key={dIdx} asChild>\n                                                                    <Link\n                                                                        href={dropdown.redirect || dropdown.not_from_base_url ? dropdown.url : `${baseUrl}${dropdown.url}`}\n                                                                        target={dropdown.redirect ? \"_blank\" : \"\"}\n                                                                    >\n                                                                        <span>{dropdown.title}</span>\n                                                                    </Link>\n                                                                </DropdownMenuItem>\n                                                            ))}\n                                                        </DropdownMenuContent>\n                                                    </DropdownMenu>\n                                                </SidebarMenuAction>\n                                            )}\n                                        </SidebarMenuItem>\n                                    );\n                                })}\n                            </SidebarGroupContent>\n                        </CollapsibleContent>\n                    </SidebarGroup>\n                </Collapsible>\n            ))}\n        </SidebarMenu>\n    );\n};\n"
  },
  {
    "path": "src/components/wrappers/dashboard/common/sidebar/side-bar-footer-credit.tsx",
    "content": "\"use client\";\nimport { useSidebar } from \"@/components/ui/sidebar\";\nimport { env } from \"@/env.mjs\";\n\nexport type SideBarFooterCreditProps = {};\n\nexport const SideBarFooterCredit = (props: SideBarFooterCreditProps) => {\n    const { state } = useSidebar();\n\n    return (\n        <>\n            {state === \"expanded\" && (\n                <div className=\"text-center mb-2\">\n                    <h1 className=\"text-[10px]\">Portabase Community Edition v{env.NEXT_PUBLIC_PROJECT_VERSION}</h1>\n                </div>\n            )}\n        </>\n    );\n};"
  },
  {
    "path": "src/components/wrappers/dashboard/common/sidebar/side-bar-logo.tsx",
    "content": "\"use client\";\nimport {useSidebar} from \"@/components/ui/sidebar\";\nimport {useTheme} from \"next-themes\";\nimport Image from \"next/image\";\nimport Link from \"next/link\";\n\nexport type SideBarLogoProps = {};\n\nexport const SideBarLogo = (props: SideBarLogoProps) => {\n    const {state, isMobile} = useSidebar();\n    const {resolvedTheme} = useTheme();\n    return state === \"collapsed\" && !isMobile ? (\n        <Link href={\"/dashboard\"}>\n\n            <div className=\"flex items-center justify-center\">\n                <Image\n                    src={\"/images/logo/picto.png\"}\n                    alt=\"Logo\"\n                    width={32}\n                    height={32}\n                    loading=\"eager\"\n                    className=\"object-contain\"\n                />\n            </div>\n        </Link>\n    ) : (\n        <Link href={\"/dashboard\"}>\n\n        <div className=\"w-full h-auto p-4 flex items-center justify-center\">\n            <Image\n                loading=\"eager\"\n                src={\"/images/logo/logo.png\"}\n                alt=\"Logo\"\n                width={190}\n                height={190}\n                className=\"object-contain\"\n            />\n        </div>\n        </Link>\n    );\n};\n"
  },
  {
    "path": "src/components/wrappers/dashboard/database/backup/actions/backup-actions-cell.tsx",
    "content": "\"use client\";\n\nimport {BackupWith} from \"@/db/schema/07_database\";\nimport {useBackupModal} from \"@/components/wrappers/dashboard/database/backup/backup-modal-context\";\nimport {Button} from \"@/components/ui/button\";\nimport {\n    DropdownMenu,\n    DropdownMenuTrigger,\n    DropdownMenuContent,\n    DropdownMenuItem,\n    DropdownMenuLabel,\n    DropdownMenuSeparator\n} from \"@/components/ui/dropdown-menu\";\nimport {MoreHorizontal, Trash2, Download} from \"lucide-react\";\nimport {ReloadIcon} from \"@radix-ui/react-icons\";\nimport {cn} from \"@/lib/utils\";\nimport {MemberWithUser} from \"@/db/schema/03_organization\";\nimport {TooltipCustom} from \"@/components/wrappers/common/tooltip-custom\";\n\ninterface DatabaseActionsCellProps {\n    backup: BackupWith;\n    activeMember: MemberWithUser;\n    isAlreadyRestore: boolean;\n    isBackupOnly: boolean;\n}\n\nexport function DatabaseActionsCell({backup, activeMember, isAlreadyRestore, isBackupOnly}: DatabaseActionsCellProps) {\n    const {openModal} = useBackupModal();\n\n    if (backup.deletedAt || activeMember.role === \"member\") return null;\n\n    return (\n        <div className={cn(\"flex items-center space-x-2\")}>\n            <DropdownMenu>\n                <DropdownMenuTrigger asChild>\n                    <Button variant=\"ghost\" size=\"icon\" type=\"button\" onClick={(e) => e.stopPropagation()}>\n                        <span className=\"sr-only\">Open menu</span>\n                        <MoreHorizontal className=\"w-4 h-4\"/>\n                    </Button>\n                </DropdownMenuTrigger>\n                <DropdownMenuContent align=\"end\">\n                    <DropdownMenuLabel>Actions</DropdownMenuLabel>\n                    {backup.status == \"success\" ? (\n                        <>\n                            {!isBackupOnly && (\n                                <TooltipCustom disabled={isAlreadyRestore}\n                                               text=\"Already a restoration waiting\">\n                                    <DropdownMenuItem\n                                        disabled={isAlreadyRestore}\n                                        onSelect={() => openModal(\"restore\", backup)}\n                                    >\n                                        <ReloadIcon/> Restore\n                                    </DropdownMenuItem>\n                                </TooltipCustom>\n                            )}\n                            <DropdownMenuItem\n                                onSelect={() => openModal(\"download\", backup)}\n                            >\n                                <Download/> Download\n                            </DropdownMenuItem>\n                        </>\n                    ) : null}\n\n                    <DropdownMenuSeparator/>\n                    <DropdownMenuItem onSelect={() => openModal(\"delete\", backup)} className=\"text-red-600\">\n                        <Trash2/> Delete\n                    </DropdownMenuItem>\n                </DropdownMenuContent>\n            </DropdownMenu>\n        </div>\n\n    );\n}\n\n"
  },
  {
    "path": "src/components/wrappers/dashboard/database/backup/actions/backup-actions-form.tsx",
    "content": "\"use client\";\nimport { Alert, AlertDescription, AlertTitle } from \"@/components/ui/alert\";\nimport { Badge } from \"@/components/ui/badge\";\nimport {\n  Form,\n  FormControl,\n  FormField,\n  FormItem,\n  FormLabel,\n  FormMessage,\n  useZodForm,\n} from \"@/components/ui/form\";\nimport { TooltipProvider } from \"@/components/ui/tooltip\";\nimport { ButtonWithLoading } from \"@/components/wrappers/common/button/button-with-loading\";\nimport { getChannelIcon } from \"@/components/wrappers/dashboard/admin/channels/helpers/common\";\nimport {\n  getStatusColor,\n  getStatusIcon,\n} from \"@/components/wrappers/dashboard/admin/notifications/logs/columns\";\nimport {\n  createRestorationBackupAction,\n  deleteBackupAction,\n  deleteBackupStorageAction,\n  downloadBackupAction,\n} from \"@/components/wrappers/dashboard/database/backup/actions/backup-actions.action\";\nimport {\n  BackupActionsSchema,\n  BackupActionsType,\n} from \"@/components/wrappers/dashboard/database/backup/actions/backup-actions.schema\";\nimport {\n  DatabaseActionKind,\n  useBackupModal,\n} from \"@/components/wrappers/dashboard/database/backup/backup-modal-context\";\nimport { Backup, BackupWith, Restoration } from \"@/db/schema/07_database\";\nimport { BackupStorageWith } from \"@/db/schema/14_storage-backup\";\nimport { ServerActionResult } from \"@/types/action-type\";\nimport { useMutation, useQueryClient } from \"@tanstack/react-query\";\nimport { AlertCircleIcon } from \"lucide-react\";\nimport { SafeActionResult } from \"next-safe-action\";\nimport { useRouter } from \"next/navigation\";\nimport { toast } from \"sonner\";\nimport { ZodString } from \"zod\";\n\ntype BackupActionsFormProps = {\n  backup: BackupWith;\n  action: DatabaseActionKind;\n};\n\nexport const BackupActionsForm = ({\n  backup,\n  action,\n}: BackupActionsFormProps) => {\n  const filteredBackupStorages =\n    backup.storages?.filter((storage) => storage.deletedAt === null) ?? [];\n  const { closeModal } = useBackupModal();\n  const queryClient = useQueryClient();\n  const router = useRouter();\n\n  const form = useZodForm({\n    schema: BackupActionsSchema,\n  });\n\n  const mutation = useMutation({\n    mutationFn: async (values: BackupActionsType) => {\n      let result:\n        | SafeActionResult<\n            string,\n            ZodString,\n            readonly [],\n            {\n              _errors?: string[] | undefined;\n            },\n            readonly [],\n            ServerActionResult<string | Restoration | Backup>,\n            object\n          >\n        | undefined;\n\n      if (action === \"download\") {\n        result = await downloadBackupAction({\n          backupStorageId: values.backupStorageId,\n        });\n      } else if (action === \"restore\") {\n        result = await createRestorationBackupAction({\n          databaseId: backup.databaseId,\n          backupStorageId: values.backupStorageId,\n          backupId: backup.id,\n        });\n      } else if (action === \"delete\") {\n        result = await deleteBackupStorageAction({\n          databaseId: backup.databaseId,\n          backupStorageId: values.backupStorageId,\n          backupId: backup.id,\n        });\n      }\n\n      const inner = result?.data;\n\n      if (inner?.success) {\n        toast.success(inner.actionSuccess?.message);\n        queryClient.invalidateQueries({\n          queryKey: [\"database-data\", backup.databaseId],\n        });\n        router.refresh();\n        if (action === \"download\") {\n          const url = inner.value;\n          if (typeof url === \"string\") {\n            window.open(url, \"_self\");\n          }\n          closeModal();\n        } else if (action === \"restore\") {\n          closeModal();\n        } else if (action === \"delete\") {\n          closeModal();\n        } else {\n          closeModal();\n        }\n      } else {\n        if (action === \"delete\") {\n          toast.success(\"Backup deleted successfully.\");\n          queryClient.invalidateQueries({\n            queryKey: [\"database-data\", backup.databaseId],\n          });\n          router.refresh();\n          closeModal();\n        } else {\n          toast.error(inner?.actionError?.message ?? \"An error occurred.\");\n        }\n      }\n    },\n  });\n\n  const mutationDeleteEntireBackup = useMutation({\n    mutationFn: async () => {\n      const result = await deleteBackupAction({\n        databaseId: backup.databaseId,\n        backupId: backup.id,\n      });\n\n      const inner = result?.data;\n\n      if (inner?.success) {\n        toast.success(inner.actionSuccess?.message);\n        queryClient.invalidateQueries({\n          queryKey: [\"database-data\", backup.databaseId],\n        });\n        router.refresh();\n        closeModal();\n      } else {\n        toast.error(inner?.actionError?.message);\n      }\n    },\n  });\n\n  return (\n    <TooltipProvider>\n      <Form\n        form={form}\n        className=\"flex flex-col gap-4 mb-1 min-w-0\"\n        onSubmit={async (values) => {\n          await mutation.mutateAsync(values);\n        }}\n      >\n        {filteredBackupStorages.length > 0 ? (\n          <FormField\n            control={form.control}\n            name=\"backupStorageId\"\n            render={({ field }) => (\n              <FormItem>\n                <FormLabel>Choose a storage backup</FormLabel>\n                <FormControl>\n                  <div\n                    className=\"flex flex-col gap-2.5 overflow-y-auto overflow-x-hidden w-full pr-1\"\n                    style={{ maxHeight: \"250px\" }}\n                  >\n                    {filteredBackupStorages.map(\n                      (storage: BackupStorageWith) => (\n                        <button\n                          key={storage.id}\n                          disabled={\n                            action !== \"delete\" &&\n                            storage.status.toLowerCase() !== \"success\"\n                          }\n                          type=\"button\"\n                          onClick={() => field.onChange(storage.id)}\n                          className={`w-full flex items-center gap-3 p-4 rounded-lg border text-left transition-colors\n                            ${\n                              field.value === storage.id\n                                ? \"border-foreground bg-background\"\n                                : \"border-border bg-background\" +\n                                  (storage.status.toLowerCase() === \"success\" ||\n                                  action === \"delete\"\n                                    ? \" hover:border-muted-foreground\"\n                                    : \"\")\n                            }\n                            ${\n                              storage.status.toLowerCase() !== \"success\" &&\n                              action !== \"delete\"\n                                ? \"opacity-50 cursor-not-allowed\"\n                                : \"\"\n                            }`}\n                        >\n                          <div\n                            className={`h-4 w-4 shrink-0 rounded-full border ${\n                              field.value === storage.id\n                                ? \"border-foreground\"\n                                : \"border-muted-foreground\"\n                            } flex items-center justify-center`}\n                          >\n                            {field.value === storage.id && (\n                              <div className=\"h-2 w-2 rounded-full bg-foreground\" />\n                            )}\n                          </div>\n\n                          <div className=\"flex-1 min-w-0 flex items-center gap-2\">\n                            <div className=\"shrink-0\">\n                              {getChannelIcon(\n                                storage.storageChannel?.provider || \"\",\n                              )}\n                            </div>\n\n                            <h3 className=\"font-medium text-foreground truncate flex-1\">\n                              {storage.storageChannel?.name}\n                            </h3>\n\n                            {storage.storageChannel?.provider && (\n                              <Badge\n                                variant=\"secondary\"\n                                className=\"text-xs font-mono shrink-0\"\n                              >\n                                {storage.storageChannel.provider}\n                              </Badge>\n                            )}\n\n                            <Badge\n                              variant=\"outline\"\n                              className={`gap-1.5 shrink-0 ${getStatusColor(storage.status)}`}\n                            >\n                              {getStatusIcon(storage.status === \"success\")}\n                              <span className=\"capitalize hidden sm:inline\">\n                                {storage.status.toUpperCase()}\n                              </span>\n                            </Badge>\n                          </div>\n                        </button>\n                      ),\n                    ) ?? <p>No storages available</p>}\n                  </div>\n                </FormControl>\n                <FormMessage />\n              </FormItem>\n            )}\n          />\n        ) : (\n          <Alert>\n            <AlertCircleIcon />\n            <AlertTitle>Backup does not have files</AlertTitle>\n            <AlertDescription>\n              <p>\n                You can safely delete the entire backup; no files seem to be\n                related. Maybe an error occurred.\n              </p>\n            </AlertDescription>\n          </Alert>\n        )}\n\n        <div className=\"flex flex-row items-center gap-x-4 w-full\">\n          {action === \"delete\" && (\n            <ButtonWithLoading\n              type=\"button\"\n              variant=\"destructive\"\n              onClick={() => mutationDeleteEntireBackup.mutateAsync()}\n              isPending={mutationDeleteEntireBackup.isPending}\n              disabled={mutationDeleteEntireBackup.isPending}\n            >\n              Delete entire backup\n            </ButtonWithLoading>\n          )}\n\n          {filteredBackupStorages.length > 0 && (\n            <ButtonWithLoading\n              type=\"submit\"\n              isPending={mutation.isPending}\n              disabled={mutation.isPending}\n              className=\"ml-auto\"\n            >\n              Confirm\n            </ButtonWithLoading>\n          )}\n        </div>\n      </Form>\n    </TooltipProvider>\n  );\n};\n"
  },
  {
    "path": "src/components/wrappers/dashboard/database/backup/actions/backup-actions-modal.tsx",
    "content": "\"use client\"\nimport {\n    Dialog,\n    DialogContent,\n    DialogDescription,\n    DialogHeader,\n    DialogTitle,\n} from \"@/components/ui/dialog\";\nimport {Separator} from \"@/components/ui/separator\";\nimport {BackupActionsForm} from \"@/components/wrappers/dashboard/database/backup/actions/backup-actions-form\";\nimport {\n    getBackupActionTextBasedOnActionKind,\n    useBackupModal\n} from \"@/components/wrappers/dashboard/database/backup/backup-modal-context\";\n\n\ntype DatabaseActionsModalProps = {}\n\n\nexport const DatabaseBackupActionsModal = ({}: DatabaseActionsModalProps) => {\n    const {open, action, backup, closeModal} = useBackupModal();\n    if (!backup || !action) return null;\n    const text = getBackupActionTextBasedOnActionKind(action);\n\n\n    return (\n        <Dialog open={open} onOpenChange={closeModal}>\n            <DialogContent>\n                <DialogHeader>\n                    <DialogTitle>{text} backup ?</DialogTitle>\n                    <DialogDescription>\n                        Select the backup storage\n                    </DialogDescription>\n                    <Separator className=\"mt-3 mb-3\"/>\n                </DialogHeader>\n                <BackupActionsForm backup={backup} action={action}/>\n            </DialogContent>\n        </Dialog>\n    )\n}"
  },
  {
    "path": "src/components/wrappers/dashboard/database/backup/actions/backup-actions.action.ts",
    "content": "\"use server\"\nimport {userAction} from \"@/lib/safe-actions/actions\";\nimport {ServerActionResult} from \"@/types/action-type\";\nimport {z} from \"zod\";\nimport type {StorageInput} from \"@/features/storages/types\";\nimport {dispatchStorage} from \"@/features/storages/dispatch\";\nimport {db} from \"@/db\";\nimport {and, eq, isNull, ne, sql} from \"drizzle-orm\";\nimport * as drizzleDb from \"@/db\";\nimport {Backup, Restoration} from \"@/db/schema/07_database\";\nimport {withUpdatedAt} from \"@/db/utils\";\n\n\nexport const downloadBackupAction = userAction.schema(\n    z.object({\n        backupStorageId: z.string(),\n    })\n).action(async ({parsedInput}): Promise<ServerActionResult<string>> => {\n    const {backupStorageId} = parsedInput;\n    try {\n\n        const backupStorage = await db.query.backupStorage.findFirst({\n            where: eq(drizzleDb.schemas.backupStorage.id, backupStorageId),\n\n        });\n\n        if (!backupStorage) {\n            return {\n                success: false,\n                actionError: {\n                    message: \"Backup storage not found.\",\n                    status: 404,\n                    messageParams: {backupStorageId: backupStorageId},\n                },\n            };\n        }\n        if (backupStorage.status != \"success\" || !backupStorage.path) {\n            return {\n                success: false,\n                actionError: {\n                    message: \"An error occurred.\",\n                    status: 500,\n                    messageParams: {backupStorageId: backupStorageId},\n                },\n            }\n        }\n\n        const input: StorageInput = {\n            action: \"get\",\n            data: {\n                path: backupStorage.path,\n                signedUrl: true,\n            },\n            metadata: {\n                storageId: backupStorage.storageChannelId,\n                fileKind: \"backups\"\n            }\n        };\n\n\n        const result = await dispatchStorage(input, undefined, backupStorage.storageChannelId);\n        return {\n            success: result.success,\n            value: result.url,\n            actionSuccess: {\n                message: \"Backup Storage downloaded successfully.\",\n                messageParams: {backupStorageId: backupStorageId},\n            },\n        };\n    } catch (error) {\n        console.error(\"Error:\", error);\n        return {\n            success: false,\n            actionError: {\n                message: \"Failed to get presigned url.\",\n                status: 500,\n                cause: error instanceof Error ? error.message : \"Unknown error\",\n                messageParams: {backupStorageId: backupStorageId},\n            },\n        };\n    }\n});\n\n\nexport const createRestorationBackupAction = userAction\n    .schema(\n        z.object({\n            backupId: z.string(),\n            databaseId: z.string(),\n            backupStorageId: z.string(),\n        })\n    )\n    .action(async ({parsedInput}): Promise<ServerActionResult<Restoration>> => {\n        try {\n            const restorationData = await db\n                .insert(drizzleDb.schemas.restoration)\n                .values({\n                    databaseId: parsedInput.databaseId,\n                    backupId: parsedInput.backupId,\n                    backupStorageId: parsedInput.backupStorageId,\n                    status: \"waiting\",\n                })\n                .returning()\n                .execute();\n\n            const createdRestoration = restorationData[0];\n\n            return {\n                success: true,\n                value: createdRestoration,\n                actionSuccess: {\n                    message: \"Restoration has been successfully created.\",\n                    messageParams: {restorationId: createdRestoration.id},\n                },\n            };\n        } catch (error) {\n            return {\n                success: false,\n                actionError: {\n                    message: \"Failed to create restoration.\",\n                    status: 500,\n                    cause: error instanceof Error ? error.message : \"Unknown error\",\n                    messageParams: {message: \"Error creating the restoration\"},\n                },\n            };\n        }\n    });\n\n\nexport const deleteBackupStorageAction = userAction\n    .schema(\n        z.object({\n            backupId: z.string(),\n            databaseId: z.string(),\n            backupStorageId: z.string(),\n        })\n    )\n    .action(async ({parsedInput}): Promise<ServerActionResult<Backup>> => {\n        const {backupId, databaseId, backupStorageId} = parsedInput;\n\n        try {\n            const backup = await db.query.backup.findFirst({\n                where: and(eq(drizzleDb.schemas.backup.id, backupId), eq(drizzleDb.schemas.backup.databaseId, databaseId))\n            });\n\n            if (!backup) {\n                return {\n                    success: false,\n                    actionError: {\n                        message: \"Backup not found.\",\n                        status: 404,\n                        messageParams: {backupStorageId: backupStorageId},\n                    },\n                }\n            }\n\n\n            const backupStorage = await db.query.backupStorage.findFirst({\n                where: eq(drizzleDb.schemas.backupStorage.id, backupStorageId),\n            });\n\n\n            if (!backupStorage) {\n                return {\n                    success: false,\n                    actionError: {\n                        message: \"Backup storage not found.\",\n                        status: 404,\n                        messageParams: {backupStorageId: backupStorageId},\n                    },\n                };\n            }\n\n\n            const [{count}] = await db\n                .select({count: sql<number>`count(*)`})\n                .from(drizzleDb.schemas.backupStorage)\n                .where(\n                    and(\n                        eq(drizzleDb.schemas.backupStorage.backupId, backupId),\n                        isNull(drizzleDb.schemas.backupStorage.deletedAt),\n                        ne(drizzleDb.schemas.backupStorage.id, backupStorageId)\n                    )\n                );\n\n\n            if (Number(count) === 0) {\n                await db\n                    .update(drizzleDb.schemas.backup)\n                    .set(withUpdatedAt({\n                        deletedAt: new Date(),\n                        status: backup.status == \"ongoing\" ? \"failed\" : backup.status\n                    }))\n                    .where(and(eq(drizzleDb.schemas.backup.id, backupId), eq(drizzleDb.schemas.backup.databaseId, databaseId)))\n            }\n\n            await db\n                .update(drizzleDb.schemas.backupStorage)\n                .set(withUpdatedAt({\n                    deletedAt: new Date(),\n                }))\n                .where(eq(drizzleDb.schemas.backupStorage.id, backupStorageId))\n\n\n            if (backupStorage.status != \"success\" || !backupStorage.path) {\n                return {\n                    success: false,\n                    actionError: {\n                        message: \"An error occurred.\",\n                        status: 500,\n                        messageParams: {backupStorageId: backupStorageId},\n                    },\n                }\n            }\n\n\n            const input: StorageInput = {\n                action: \"delete\",\n                data: {\n                    path: backupStorage.path,\n                },\n            };\n\n            await dispatchStorage(input, undefined, backupStorage.storageChannelId);\n\n            return {\n                success: true,\n                value: backup,\n                actionSuccess: {\n                    message: `Backup deleted successfully.`,\n                },\n            };\n        } catch (error) {\n            return {\n                success: false,\n                actionError: {\n                    message: \"Failed to delete backup.\",\n                    status: 500,\n                    cause: error instanceof Error ? error.message : \"Unknown error\",\n                    messageParams: {message: \"Error deleting the backup\"},\n                },\n            };\n        }\n    });\n\n\nexport const deleteBackupAction = userAction\n    .schema(\n        z.object({\n            backupId: z.string(),\n            databaseId: z.string(),\n        })\n    )\n    .action(async ({parsedInput}): Promise<ServerActionResult<Backup>> => {\n        const {backupId, databaseId} = parsedInput;\n\n        try {\n            const backup = await db.query.backup.findFirst({\n                where: and(eq(drizzleDb.schemas.backup.id, backupId), eq(drizzleDb.schemas.backup.databaseId, databaseId))\n            });\n\n            if (!backup) {\n                return {\n                    success: false,\n                    actionError: {\n                        message: \"Backup not found.\",\n                        status: 404,\n                        messageParams: {backupId: backupId},\n                    },\n                }\n            }\n\n\n            const backupStorages = await db.query.backupStorage.findMany({\n                where: eq(drizzleDb.schemas.backupStorage.backupId, backupId),\n            });\n\n\n            if (!backupStorages) {\n                return {\n                    success: false,\n                    actionError: {\n                        message: \"Backup storage not found.\",\n                        status: 404,\n                        messageParams: {backupId: backupId},\n                    },\n                };\n            }\n\n            for (const backupStorage of backupStorages) {\n\n                await db\n                    .update(drizzleDb.schemas.backupStorage)\n                    .set(withUpdatedAt({\n                        deletedAt: new Date(),\n                    }))\n                    .where(eq(drizzleDb.schemas.backupStorage.id, backupStorage.id))\n\n                if (backupStorage.status != \"success\" || !backupStorage.path) {\n                    continue;\n                }\n\n                const input: StorageInput = {\n                    action: \"delete\",\n                    data: {\n                        path: backupStorage.path,\n                    },\n                };\n\n                await dispatchStorage(input, undefined, backupStorage.storageChannelId);\n\n            }\n\n            await db\n                .update(drizzleDb.schemas.backup)\n                .set(withUpdatedAt({\n                    deletedAt: new Date(),\n                    status: backup.status == \"ongoing\" ? \"failed\" : backup.status\n                }))\n                .where(and(eq(drizzleDb.schemas.backup.id, backupId), eq(drizzleDb.schemas.backup.databaseId, databaseId)))\n\n\n            return {\n                success: true,\n                value: backup,\n                actionSuccess: {\n                    message: `Backup deleted successfully (ref: ${parsedInput.backupId}).`,\n                },\n            };\n        } catch (error) {\n            return {\n                success: false,\n                actionError: {\n                    message: \"Failed to delete backup.\",\n                    status: 500,\n                    cause: error instanceof Error ? error.message : \"Unknown error\",\n                    messageParams: {message: \"Error deleting the backup\"},\n                },\n            };\n        }\n    });"
  },
  {
    "path": "src/components/wrappers/dashboard/database/backup/actions/backup-actions.schema.ts",
    "content": "\"use client\";\n\nimport { z } from \"zod\";\nimport {zString} from \"@/lib/zod\";\n\nexport const BackupActionsSchema = z.object({\n    backupStorageId: zString(),\n});\n\nexport type BackupActionsType = z.infer<typeof BackupActionsSchema>;\n"
  },
  {
    "path": "src/components/wrappers/dashboard/database/backup/actions/get-data.action.ts",
    "content": "\"use server\"\nimport {userAction} from \"@/lib/safe-actions/actions\";\nimport {z} from \"zod\";\nimport {db} from \"@/db\";\nimport {eq} from \"drizzle-orm\";\nimport * as drizzleDb from \"@/db\";\nimport {BackupWith, Restoration} from \"@/db/schema/07_database\";\nimport {getOrganizationChannels} from \"@/db/services/notification-channel\";\nimport {getOrganizationStorageChannels} from \"@/db/services/storage-channel\";\nimport {getHealthLast12hLogs} from \"@/db/services/healthcheck\";\n\nexport const getDatabaseDataAction = userAction\n    .schema(\n        z.object({\n            databaseId: z.string(),\n        })\n    )\n    .action(async ({parsedInput}) => {\n        const {databaseId} = parsedInput;\n\n        const database = await db.query.database.findFirst({\n            where: eq(drizzleDb.schemas.database.id, databaseId),\n            with: {\n                project: true,\n                retentionPolicy: true,\n                alertPolicies: true,\n                storagePolicies: true\n            }\n        });\n\n        const backups = await db.query.backup.findMany({\n            where: eq(drizzleDb.schemas.backup.databaseId, databaseId),\n            with: {\n                restorations: true,\n                storages: {\n                    with: {\n                        storageChannel: true\n                    }\n                }\n            },\n            orderBy: (b, {desc}) => [desc(b.createdAt)],\n        }) as BackupWith[];\n\n        const restorations = await db.query.restoration.findMany({\n            where: eq(drizzleDb.schemas.restoration.databaseId, databaseId),\n            orderBy: (r, {desc}) => [desc(r.createdAt)],\n        }) as Restoration[];\n\n        const totalBackups = backups.length;\n        const availableBackups = backups.filter(b => !b.deletedAt).length;\n        const successfulBackups = backups.filter(b => b.status === \"success\").length;\n        const successRate = totalBackups > 0 ? (successfulBackups / totalBackups) * 100 : null;\n\n        // @ts-ignore\n        let activeOrganizationChannels = [];\n        // @ts-ignore\n        let activeOrganizationStorageChannels = [];\n\n        if (database?.project?.organizationId) {\n            const organizationChannels = await getOrganizationChannels(database.project.organizationId);\n            activeOrganizationChannels = organizationChannels.filter(channel => channel.enabled);\n\n            const organizationStorageChannels = await getOrganizationStorageChannels(database.project.organizationId);\n            activeOrganizationStorageChannels = organizationStorageChannels.filter(channel => channel.enabled);\n        }\n\n\n        return {\n            database,\n            backups,\n            restorations,\n            // @ts-ignore\n            activeOrganizationChannels,\n            // @ts-ignore\n            activeOrganizationStorageChannels,\n            stats: {\n                totalBackups,\n                availableBackups,\n                successRate\n            },\n            health: database ? await getHealthLast12hLogs({ id: database.id }) : []\n        };\n    });"
  },
  {
    "path": "src/components/wrappers/dashboard/database/backup/backup-modal-context.tsx",
    "content": "\"use client\";\n\nimport {createContext, useContext, useState, ReactNode} from \"react\";\nimport {BackupWith} from \"@/db/schema/07_database\";\n\nexport type DatabaseActionKind = \"restore\" | \"download\" | \"delete\";\n\nexport function getBackupActionTextBasedOnActionKind(kind: DatabaseActionKind) {\n    switch (kind) {\n        case \"restore\":\n            return \"Restore\";\n        case \"download\":\n            return \"Download\";\n        case \"delete\":\n            return \"Delete\";\n        default:\n            return \"Unknown\";\n    }\n}\n\n\ntype BackupModalContextType = {\n    open: boolean;\n    action: DatabaseActionKind | null;\n    backup: BackupWith | null;\n    openModal: (action: DatabaseActionKind, backup: BackupWith) => void;\n    closeModal: () => void;\n};\n\nconst BackupModalContext = createContext<BackupModalContextType | undefined>(undefined);\n\nexport const BackupModalProvider = ({children}: { children: ReactNode }) => {\n    const [open, setOpen] = useState(false);\n    const [action, setAction] = useState<DatabaseActionKind | null>(null);\n    const [backup, setBackup] = useState<BackupWith | null>(null);\n\n    const openModal = (newAction: DatabaseActionKind, newBackup: BackupWith) => {\n        setAction(newAction);\n        setBackup(newBackup);\n        setOpen(true);\n    };\n\n    const closeModal = () => {\n        setOpen(false);\n        setAction(null);\n        setBackup(null);\n    };\n\n    return (\n        <BackupModalContext.Provider value={{open, action, backup, openModal, closeModal}}>\n            {children}\n        </BackupModalContext.Provider>\n    );\n};\n\nexport const useBackupModal = () => {\n    const context = useContext(BackupModalContext);\n    if (!context) throw new Error(\"useBackupModal must be used within BackupModalProvider\");\n    return context;\n};\n"
  },
  {
    "path": "src/components/wrappers/dashboard/database/channels-policy/policy-form.tsx",
    "content": "import {Form, FormControl, FormField, FormItem, FormLabel, FormMessage, useZodForm} from \"@/components/ui/form\";\nimport {InfoIcon, Plus, Trash2} from \"lucide-react\";\nimport {useFieldArray} from \"react-hook-form\";\nimport {DatabaseWith} from \"@/db/schema/07_database\";\nimport {NotificationChannel} from \"@/db/schema/09_notification-channel\";\nimport {Label} from \"@/components/ui/label\";\nimport {Button} from \"@/components/ui/button\";\nimport {ButtonWithLoading} from \"@/components/wrappers/common/button/button-with-loading\";\nimport {Select, SelectContent, SelectItem, SelectTrigger, SelectValue} from \"@/components/ui/select\";\nimport {MultiSelect} from \"@/components/wrappers/common/multiselect/multi-select\";\nimport {useMutation, useQueryClient} from \"@tanstack/react-query\";\nimport {toast} from \"sonner\";\nimport {Switch} from \"@/components/ui/switch\";\nimport {Card} from \"@/components/ui/card\";\nimport Link from \"next/link\";\nimport {useIsMobile} from \"@/hooks/use-mobile\";\nimport {useRouter} from \"next/navigation\";\nimport {\n    ChannelKind,\n    getChannelIcon,\n    getChannelTextBasedOnKind\n} from \"@/components/wrappers/dashboard/admin/channels/helpers/common\";\nimport {StorageChannel} from \"@/db/schema/12_storage-channel\";\nimport {\n    EVENT_KIND_BACKUP_ONLY_OPTIONS,\n    EVENT_KIND_OPTIONS,\n    PoliciesSchema,\n    PoliciesType,\n    PolicyType\n} from \"@/components/wrappers/dashboard/database/channels-policy/policy.schema\";\nimport {\n    createAlertPoliciesAction, createStoragePoliciesAction, deleteAlertPoliciesAction, deleteStoragePoliciesAction,\n    updateAlertPoliciesAction, updateStoragePoliciesAction\n} from \"@/components/wrappers/dashboard/database/channels-policy/policy.action\";\nimport {backupOnly} from \"@/components/wrappers/dashboard/projects/database/database-tabs\";\n\ntype ChannelPoliciesFormProps = {\n    onSuccess?: () => void;\n    channels: NotificationChannel[] | StorageChannel[];\n    database: DatabaseWith;\n    kind: ChannelKind\n};\n\n\nexport const ChannelPoliciesForm = ({\n                                        database,\n                                        channels,\n                                        onSuccess,\n                                        kind\n                                    }: ChannelPoliciesFormProps) => {\n    const queryClient = useQueryClient();\n    const router = useRouter();\n    const isMobile = useIsMobile();\n    const channelText = getChannelTextBasedOnKind(kind);\n\n    const isBackupOnly = backupOnly.some((type) => database.dbms === type);\n\n\n    const organizationChannels = channels.map(c => c.id);\n\n    const filterByChannel = <T, K extends keyof T>(\n        items: T[] | undefined | null,\n        channelKey: K\n    ): T[] => items?.filter(item => organizationChannels.includes(item[channelKey] as string)) ?? [];\n\n    const formattedAlertPolicies = filterByChannel(database.alertPolicies, \"notificationChannelId\")\n        .map(({notificationChannelId, eventKinds, enabled}) => ({\n            channelId: notificationChannelId,\n            eventKinds,\n            enabled\n        }));\n\n    const formattedStoragePolicies = filterByChannel(database.storagePolicies, \"storageChannelId\")\n        .map(({storageChannelId, enabled}) => ({\n            channelId: storageChannelId,\n            enabled\n        }));\n\n    const defaultPolicies: PolicyType[] =\n        kind === \"notification\"\n            ? formattedAlertPolicies\n            : formattedStoragePolicies.map(({ channelId, enabled }) => ({ channelId, enabled }));\n\n    const form = useZodForm({\n        schema: PoliciesSchema,\n        defaultValues: { policies: defaultPolicies },\n        context: { kind }\n    });\n\n    const {fields, append, remove} = useFieldArray({ control: form.control, name: \"policies\" });\n\n    const addPolicy = () => append({channelId: \"\", eventKinds: [], enabled: true});\n    const removePolicyHandler = (index: number) => remove(index);\n    const onCancel = () => { form.reset(); onSuccess?.(); };\n\n    const mutation = useMutation({\n        mutationFn: async ({policies}: PoliciesType) => {\n            const payload = policies.map(p => kind === \"notification\" ? p : { ...p, eventKinds: undefined });\n\n            const policiesToAdd = payload.filter(\n                (policy) => !defaultPolicies.some((a) => a.channelId === policy.channelId)\n            );\n            const policiesToRemove = defaultPolicies.filter(\n                (policy) => !payload.some((v) => v.channelId === policy.channelId)\n            );\n            const policiesToUpdate = payload.filter((policy) => {\n                const existing = defaultPolicies.find((a) => a.channelId === policy.channelId);\n                return existing &&\n                    (existing.eventKinds !== policy.eventKinds || existing.enabled !== policy.enabled);\n            });\n            const promises = kind === \"notification\"\n                ? [\n                    policiesToAdd.length > 0 ? await createAlertPoliciesAction({databaseId: database.id, alertPolicies: policiesToAdd}) : null,\n                    policiesToUpdate.length > 0 ? await updateAlertPoliciesAction({databaseId: database.id, alertPolicies: policiesToUpdate}) : null,\n                    policiesToRemove.length > 0 ? await deleteAlertPoliciesAction({databaseId: database.id, alertPolicies: policiesToRemove}) : null,\n                ]\n                : [\n                    policiesToAdd.length > 0 ? await createStoragePoliciesAction({databaseId: database.id, storagePolicies: policiesToAdd}) : null,\n                    policiesToUpdate.length > 0 ? await updateStoragePoliciesAction({databaseId: database.id, storagePolicies: policiesToUpdate}) : null,\n                    policiesToRemove.length > 0 ? await deleteStoragePoliciesAction({databaseId: database.id, storagePolicies: policiesToRemove}) : null,\n                ];\n\n            const results = await Promise.allSettled(promises);\n            const rejected = results.find((r): r is PromiseRejectedResult => r.status === \"rejected\");\n            if (rejected) throw new Error(rejected.reason?.message || \"Network or server error\");\n\n            const failedActions = results\n                .filter((r): r is PromiseFulfilledResult<any> => r.status === \"fulfilled\")\n                .map(r => r.value)\n                .filter((v): v is { data: { success: false; actionError: any } } => v !== null && v.data?.success === false);\n\n            if (failedActions.length > 0) throw new Error(failedActions[0].data.actionError?.message || \"One or more operations failed\");\n            return {success: true};\n        },\n        onSuccess: () => {\n            toast.success(\"Policies saved successfully\");\n            queryClient.invalidateQueries({queryKey: [\"database-data\", database.id]});\n            router.refresh();\n        },\n        onError: (error: any) => { toast.error(error.message || \"Failed to save policies\"); },\n    });\n\n    return (\n        <Form form={form} className=\"flex flex-col gap-6\" onSubmit={\n            async (values) => {\n\n                if (kind === \"notification\") {\n                    for (const policy of values.policies) {\n                        if (!policy.eventKinds || policy.eventKinds.length === 0) {\n                            toast.error(\"Please select at least one event for all notification policies\");\n                            return;\n                        }\n                    }\n                }\n\n                await mutation.mutateAsync(values)\n            }\n        }>\n            <div className=\"space-y-4\">\n                <div className=\"flex items-center justify-between\">\n                    <div>\n                        <Label className=\"text-base font-medium\">\n                            Configure {kind === \"notification\" ? \"Alerts\" : \"Storages\"}\n                        </Label>\n                        {!isMobile && (\n                            <p className=\"text-xs text-muted-foreground mt-1\">\n                                {kind === \"notification\"\n                                    ? \"Choose which channels receive notifications for specific events.\"\n                                    : \"Choose which storage to use with your database\"}\n                            </p>\n                        )}\n                    </div>\n                    <Button\n                        disabled={fields.length >= channels.length || channels.length === 0}\n                        type=\"button\"\n                        size=\"sm\"\n                        className=\"h-8\"\n                        onClick={addPolicy}>\n                        <Plus className=\"w-4 h-4 mr-1.5\"/> Add Policy\n                    </Button>\n                </div>\n\n                <div className=\"space-y-3 w-full\">\n                    {channels.length === 0 ? (\n                        <div className=\"flex flex-col items-center justify-center p-8 border border-dashed rounded-xl bg-muted/20 text-center gap-2\">\n                            <InfoIcon className=\"h-8 w-8 text-muted-foreground/50\"/>\n                            <p className=\"font-medium text-sm text-foreground\">No channels</p>\n                            <p className=\"text-xs text-muted-foreground max-w-xs\">\n                                Please <Link href={`/dashboard/settings`} className=\"underline underline-offset-4 hover:text-primary transition-colors\">\n                                configure {channelText.toLowerCase()} channels\n                            </Link> in your organization settings first.\n                            </p>\n                        </div>\n                    ) : fields.length === 0 ? (\n                        <div className=\"flex flex-col items-center justify-center p-8 border border-dashed rounded-xl bg-muted/20 text-center gap-2\">\n                            <div className=\"h-8 w-8 rounded-full bg-primary/10 flex items-center justify-center\">\n                                <Plus className=\"h-4 w-4 text-primary\"/>\n                            </div>\n                            <p className=\"font-medium text-sm text-foreground\">No policies</p>\n                            <p className=\"text-xs text-muted-foreground\">\n                                {kind === \"notification\" ? `Click \"Add Policy\" to start receiving notifications.` : `Click \"Add Policy\" to use this storage.`}\n                            </p>\n                        </div>\n                    ) : (\n                        <div className=\"grid gap-4\">\n                            {fields.map((field, index) => (\n                                <Card key={field.id} className=\"p-4 transition-all hover:border-primary/50 relative group min-w-0 overflow-hidden\">\n                                    <div className=\"flex flex-col gap-4\">\n                                        <div className=\"flex flex-row gap-2 items-start md:items-end flex-nowrap min-w-0 \">\n                                            <div className=\"flex-1 min-w-0 flex flex-col gap-1.5\">\n                                                <Label className=\"text-[10px] font-bold text-muted-foreground uppercase tracking-widest pl-0.5\">\n                                                    {channelText} Channel\n                                                </Label>\n                                                <FormField\n                                                    control={form.control}\n                                                    name={`policies.${index}.channelId`}\n                                                    render={({field}) => {\n                                                        const selectedIds = form.watch(\"policies\").map((a: PolicyType) => a.channelId).filter(Boolean);\n                                                        const availableChannels = channels.filter(\n                                                            (channel) => channel.id.toString() === field.value?.toString() || !selectedIds.includes(channel.id.toString())\n                                                        );\n                                                        const selectedChannel = channels.find(c => c.id === field.value);\n\n                                                        return (\n                                                            <FormItem className=\"space-y-0 min-w-0\">\n                                                                <Select onValueChange={field.onChange} value={field.value?.toString() || \"\"}>\n                                                                    <FormControl>\n                                                                        <SelectTrigger className=\"h-9 w-full bg-background border-input min-w-0\">\n                                                                            <SelectValue placeholder=\"Select channel\">\n                                                                                {selectedChannel && (\n                                                                                    <div className=\"flex items-center gap-2 min-w-0 w-full\">\n                                                                                        <div className=\"flex items-center justify-center h-4 w-4 shrink-0\">\n                                                                                            {getChannelIcon(selectedChannel.provider)}\n                                                                                        </div>\n                                                                                        <span className=\"truncate font-medium text-sm min-w-0\">\n                                                                                            {selectedChannel.name}\n                                                                                        </span>\n                                                                                        <span className=\"shrink-0 text-[9px] bg-secondary px-1.5 py-0.5 rounded text-muted-foreground font-mono uppercase\">\n                                                                                            {selectedChannel.provider}\n                                                                                        </span>\n                                                                                    </div>\n                                                                                )}\n                                                                            </SelectValue>\n                                                                        </SelectTrigger>\n                                                                    </FormControl>\n                                                                    <SelectContent>\n                                                                        {availableChannels.map(channel => (\n                                                                            <SelectItem key={channel.id.toString()} value={channel.id.toString()}>\n                                                                                <div className=\"flex items-center gap-2 w-full min-w-0\">\n                                                                                    <div className=\"text-muted-foreground scale-90 shrink-0\">{getChannelIcon(channel.provider)}</div>\n                                                                                    <span className=\"font-medium truncate min-w-0\">{channel.name}</span>\n                                                                                    <span className=\"text-xs text-muted-foreground ml-2 capitalize shrink-0\">({channel.provider})</span>\n                                                                                </div>\n                                                                            </SelectItem>\n                                                                        ))}\n                                                                    </SelectContent>\n                                                                </Select>\n                                                                <FormMessage className=\"mt-1\"/>\n                                                            </FormItem>\n                                                        );\n                                                    }}\n                                                />\n                                            </div>\n\n                                            <div className=\"flex flex-col gap-1.5 shrink-0\">\n                                                <Label className=\"text-[10px] font-bold text-muted-foreground uppercase tracking-widest pl-0.5\">Status</Label>\n                                                <FormField\n                                                    control={form.control}\n                                                    name={`policies.${index}.enabled`}\n                                                    render={({field}) => (\n                                                        <FormItem className=\"space-y-0\">\n                                                            <FormControl>\n                                                                <div className=\"flex items-center h-9 px-1 md:px-3 rounded-md border border-input bg-background justify-between min-w-0\">\n                                                                    {!isMobile && (\n                                                                        <Label htmlFor={`switch-${index}`} className=\"text-xs cursor-pointer font-medium text-foreground mr-2\">\n                                                                            {field.value ? \"Active\" : \"Off\"}\n                                                                        </Label>\n                                                                    )}\n                                                                    <Switch checked={field.value} onCheckedChange={field.onChange} id={`switch-${index}`} className=\"scale-75 origin-right\"/>\n                                                                </div>\n                                                            </FormControl>\n                                                        </FormItem>\n                                                    )}\n                                                />\n                                            </div>\n\n                                            <div className=\"flex flex-col gap-1.5 shrink-0 mt-auto\">\n                                                <Button type=\"button\" variant=\"outline\" size=\"icon\"\n                                                        className=\"h-9 w-9 text-muted-foreground hover:text-destructive hover:border-destructive/50 hover:bg-destructive/10 transition-colors border-input bg-background\"\n                                                        onClick={() => removePolicyHandler(index)}>\n                                                    <Trash2 className=\"w-4 h-4\"/>\n                                                </Button>\n                                            </div>\n                                        </div>\n\n                                        {kind === \"notification\" && (\n                                            <FormField\n                                                control={form.control}\n                                                name={`policies.${index}.eventKinds`}\n                                                render={({field}) => (\n                                                    <FormItem className=\"space-y-1.5 min-w-0\">\n                                                        <FormLabel className=\"text-xs font-semibold text-muted-foreground uppercase tracking-wider\">Trigger Events</FormLabel>\n                                                        <FormControl>\n                                                            <div className=\"max-w-full overflow-hidden\">\n                                                                <MultiSelect\n                                                                    options={isBackupOnly ? EVENT_KIND_BACKUP_ONLY_OPTIONS : EVENT_KIND_OPTIONS}\n                                                                    onValueChange={field.onChange}\n                                                                    defaultValue={field.value ?? []}\n                                                                    placeholder={isMobile ? \"Select events...\" : \"Select events to trigger notifications...\"}\n                                                                    variant=\"inverted\"\n                                                                    animation={0}\n                                                                    className=\"bg-background/50 w-full min-w-0 flex-wrap\"\n                                                                />\n                                                            </div>\n                                                        </FormControl>\n                                                        <FormMessage/>\n                                                    </FormItem>\n                                                )}\n                                            />\n                                        )}\n                                    </div>\n                                </Card>\n                            ))}\n                        </div>\n                    )}\n                </div>\n            </div>\n\n            <div className=\"flex gap-3 justify-end pt-2 border-t mt-2\">\n                <ButtonWithLoading variant=\"outline\" type=\"button\" onClick={onCancel}>Cancel</ButtonWithLoading>\n                <ButtonWithLoading isPending={mutation.isPending}>Save Changes</ButtonWithLoading>\n            </div>\n        </Form>\n    );\n};"
  },
  {
    "path": "src/components/wrappers/dashboard/database/channels-policy/policy-modal.tsx",
    "content": "\"use client\"\nimport {ReactNode, useState} from \"react\";\nimport {\n    Dialog,\n    DialogContent,\n    DialogDescription,\n    DialogHeader,\n    DialogTitle,\n    DialogTrigger\n} from \"@/components/ui/dialog\";\nimport {Button} from \"@/components/ui/button\";\nimport {DatabaseWith} from \"@/db/schema/07_database\";\nimport {NotificationChannel} from \"@/db/schema/09_notification-channel\";\nimport {Separator} from \"@/components/ui/separator\";\nimport {Badge} from \"@/components/ui/badge\";\nimport {StorageChannel} from \"@/db/schema/12_storage-channel\";\nimport {ChannelKind, getChannelTextBasedOnKind} from \"@/components/wrappers/dashboard/admin/channels/helpers/common\";\nimport {ChannelPoliciesForm} from \"@/components/wrappers/dashboard/database/channels-policy/policy-form\";\n\n\ntype ChannelPoliciesModalProps = {\n    database: DatabaseWith;\n    channels: NotificationChannel[] | StorageChannel[];\n    organizationId: string;\n    kind: ChannelKind;\n    icon: ReactNode;\n\n}\n\nexport const ChannelPoliciesModal = ({icon, kind, database, channels, organizationId}: ChannelPoliciesModalProps) => {\n    const [open, setOpen] = useState(false);\n    const channelText = getChannelTextBasedOnKind(kind)\n\n\n    const channelsFiltered = channels\n        .filter((channel) => channel.enabled)\n\n    const channelsIds = channelsFiltered\n        .map(channel => channel.id);\n    const activeAlertPolicies = database.alertPolicies?.filter((policy) => channelsIds.includes(policy.notificationChannelId));\n    const activeStoragePolicies = database.storagePolicies?.filter((policy) => channelsIds.includes(policy.storageChannelId));\n\n\n    const activePolicies = kind === \"notification\" ? activeAlertPolicies : activeStoragePolicies;\n\n    return (\n        <Dialog open={open} onOpenChange={setOpen}>\n            <DialogTrigger asChild>\n                <Button variant=\"outline\" onClick={() => setOpen(true)} className=\"relative\">\n                    {icon}\n                    {activePolicies && activePolicies.length > 0 && (\n                        <Badge\n                            className=\"absolute -top-1.5 -right-1.5 h-4 w-4 rounded-full p-0 text-[10px] flex items-center justify-center\"\n                        >\n                            {activePolicies.length}\n                        </Badge>\n                    )}\n                </Button>\n            </DialogTrigger>\n            <DialogContent>\n                <DialogHeader>\n                    <DialogTitle>{channelText} policies</DialogTitle>\n                    <DialogDescription>\n                        Add and manage your database {channelText.toLowerCase()} policies\n                    </DialogDescription>\n                    <Separator className=\"mt-3 mb-3\"/>\n                    <ChannelPoliciesForm\n                        channels={channels}\n                        database={database}\n                        onSuccess={() => setOpen(false)}\n                        kind={kind}\n                    />\n                </DialogHeader>\n            </DialogContent>\n        </Dialog>\n    )\n}"
  },
  {
    "path": "src/components/wrappers/dashboard/database/channels-policy/policy.action.ts",
    "content": "\"use server\"\nimport {userAction} from \"@/lib/safe-actions/actions\";\nimport {z} from \"zod\";\nimport {ServerActionResult} from \"@/types/action-type\";\nimport {db} from \"@/db\";\nimport * as drizzleDb from \"@/db\";\nimport {and, eq, inArray} from \"drizzle-orm\";\nimport {withUpdatedAt} from \"@/db/utils\";\nimport {AlertPolicy} from \"@/db/schema/10_alert-policy\";\nimport {PolicySchema} from \"@/components/wrappers/dashboard/database/channels-policy/policy.schema\";\nimport {StoragePolicy} from \"@/db/schema/13_storage-policy\";\n\n\nexport const createAlertPoliciesAction = userAction\n    .schema(\n        z.object({\n            databaseId: z.string(),\n            alertPolicies: z.array(PolicySchema),\n        })\n    )\n    .action(async ({parsedInput}): Promise<ServerActionResult<AlertPolicy[]>> => {\n        try {\n\n            const valuesToInsert = parsedInput.alertPolicies.map((policy) => ({\n                databaseId: parsedInput.databaseId,\n                notificationChannelId: policy.channelId,\n                eventKinds: policy.eventKinds!,\n                enabled: policy.enabled,\n            }));\n\n            const insertedPolicies = await db\n                .insert(drizzleDb.schemas.alertPolicy)\n                .values(valuesToInsert)\n                .returning();\n\n            return {\n                success: true,\n                value: insertedPolicies,\n                actionSuccess: {\n                    message: `Alert policies successfully added`,\n                },\n            };\n\n        } catch (error) {\n            return {\n                success: false,\n                actionError: {\n                    message: \"Failed to add policies.\",\n                    status: 500,\n                    cause: error instanceof Error ? error.message : \"Unknown error\",\n                },\n            };\n        }\n    });\n\n\nexport const updateAlertPoliciesAction = userAction\n    .schema(\n        z.object({\n            databaseId: z.string().min(1),\n            alertPolicies: z.array(PolicySchema),\n        })\n    )\n    .action(async ({parsedInput}): Promise<ServerActionResult<AlertPolicy[]>> => {\n        const {databaseId, alertPolicies} = parsedInput;\n\n        try {\n\n            const updatedPolicies = await db.transaction(async (tx) => {\n                const results: AlertPolicy[] = [];\n                for (const policy of alertPolicies) {\n                    const {channelId: notificationChannelId, ...updateData} = policy;\n\n                    const updated = await tx\n                        .update(drizzleDb.schemas.alertPolicy)\n                        .set(withUpdatedAt({\n                            ...updateData,\n                        }))\n                        .where(\n                            and(\n                                eq(drizzleDb.schemas.alertPolicy.notificationChannelId, notificationChannelId),\n                                eq(drizzleDb.schemas.alertPolicy.databaseId, databaseId)\n                            )\n                        )\n                        .returning();\n\n                    if (updated[0]) {\n                        results.push(updated[0]);\n                    }\n                }\n\n                return results;\n            });\n\n            if (updatedPolicies.length === 0) {\n                return {\n                    success: false,\n                    actionError: {message: \"No policies were updated.\"},\n                };\n            }\n\n            return {\n                success: true,\n                value: updatedPolicies,\n                actionSuccess: {\n                    message: `Successfully updated ${updatedPolicies.length} alert policy(ies).`,\n                },\n            };\n        } catch (error) {\n            console.error(\"Update alert policies failed:\", error);\n            return {\n                success: false,\n                actionError: {\n                    message: \"Failed to update alert policies.\",\n                    status: 500,\n                    cause: error instanceof Error ? error.message : \"Unknown error\",\n                },\n            };\n        }\n    });\n\n\nexport const deleteAlertPoliciesAction = userAction\n    .schema(\n        z.object({\n            databaseId: z.string().min(1),\n            alertPolicies: z.array(PolicySchema),\n        })\n    )\n    .action(async ({parsedInput}): Promise<ServerActionResult<AlertPolicy[]>> => {\n        const {databaseId, alertPolicies} = parsedInput;\n\n        try {\n\n            const notificationChannelIds = alertPolicies.map((alertPolicy) => alertPolicy.channelId);\n\n            const policiesToDelete = await db\n                .select()\n                .from(drizzleDb.schemas.alertPolicy)\n                .where(\n                    and(\n                        eq(drizzleDb.schemas.alertPolicy.databaseId, databaseId),\n                        inArray(drizzleDb.schemas.alertPolicy.notificationChannelId, notificationChannelIds)\n                    )\n                );\n\n            if (policiesToDelete.length === 0) {\n                return {\n                    success: false,\n                    actionError: {message: \"No alert policies found to delete.\"},\n                };\n            }\n\n            await db\n                .delete(drizzleDb.schemas.alertPolicy)\n                .where(\n                    and(\n                        eq(drizzleDb.schemas.alertPolicy.databaseId, databaseId),\n                        inArray(drizzleDb.schemas.alertPolicy.notificationChannelId, notificationChannelIds)\n                    )\n                );\n\n            return {\n                success: true,\n                value: policiesToDelete,\n                actionSuccess: {\n                    message: `Successfully deleted ${policiesToDelete.length} alert policy(ies).`,\n                },\n            };\n        } catch (error) {\n            console.error(\"Delete alert policies failed:\", error);\n            return {\n                success: false,\n                actionError: {\n                    message: \"Failed to delete alert policies.\",\n                    status: 500,\n                    cause: error instanceof Error ? error.message : \"Unknown error\",\n                },\n            };\n        }\n    });\n\n\nexport const createStoragePoliciesAction = userAction\n    .schema(\n        z.object({\n            databaseId: z.string(),\n            storagePolicies: z.array(PolicySchema),\n        })\n    )\n    .action(async ({parsedInput}): Promise<ServerActionResult<StoragePolicy[]>> => {\n        try {\n\n            const valuesToInsert = parsedInput.storagePolicies.map((policy) => ({\n                databaseId: parsedInput.databaseId,\n                storageChannelId: policy.channelId,\n                enabled: policy.enabled,\n            }));\n\n\n            const insertedPolicies = await db\n                .insert(drizzleDb.schemas.storagePolicy)\n                .values(valuesToInsert)\n                .returning();\n\n            return {\n                success: true,\n                value: insertedPolicies,\n                actionSuccess: {\n                    message: `Storage policies successfully added`,\n                },\n            };\n\n        } catch (error) {\n            return {\n                success: false,\n                actionError: {\n                    message: \"Failed to add policies.\",\n                    status: 500,\n                    cause: error instanceof Error ? error.message : \"Unknown error\",\n                },\n            };\n        }\n    });\n\n\nexport const updateStoragePoliciesAction = userAction\n    .schema(\n        z.object({\n            databaseId: z.string().min(1),\n            storagePolicies: z.array(PolicySchema),\n        })\n    )\n    .action(async ({parsedInput}): Promise<ServerActionResult<StoragePolicy[]>> => {\n        const {databaseId, storagePolicies} = parsedInput;\n\n        try {\n\n            const updatedPolicies = await db.transaction(async (tx) => {\n                const results: StoragePolicy[] = [];\n                for (const policy of storagePolicies) {\n                    const {channelId: storageChannelId, ...updateData} = policy;\n\n                    const updated = await tx\n                        .update(drizzleDb.schemas.storagePolicy)\n                        .set(withUpdatedAt({\n                            ...updateData,\n                        }))\n                        .where(\n                            and(\n                                eq(drizzleDb.schemas.storagePolicy.storageChannelId, storageChannelId),\n                                eq(drizzleDb.schemas.storagePolicy.databaseId, databaseId)\n                            )\n                        )\n                        .returning();\n\n                    if (updated[0]) {\n                        results.push(updated[0]);\n                    }\n                }\n\n                return results;\n            });\n\n            if (updatedPolicies.length === 0) {\n                return {\n                    success: false,\n                    actionError: {message: \"No policies were updated.\"},\n                };\n            }\n\n            return {\n                success: true,\n                value: updatedPolicies,\n                actionSuccess: {\n                    message: `Successfully updated ${updatedPolicies.length} storage policy(ies).`,\n                },\n            };\n        } catch (error) {\n            console.error(\"Update storage policies failed:\", error);\n            return {\n                success: false,\n                actionError: {\n                    message: \"Failed to update storage policies.\",\n                    status: 500,\n                    cause: error instanceof Error ? error.message : \"Unknown error\",\n                },\n            };\n        }\n    });\n\n\nexport const deleteStoragePoliciesAction = userAction\n    .schema(\n        z.object({\n            databaseId: z.string().min(1),\n            storagePolicies: z.array(PolicySchema),\n        })\n    )\n    .action(async ({parsedInput}): Promise<ServerActionResult<StoragePolicy[]>> => {\n        const {databaseId, storagePolicies} = parsedInput;\n\n        try {\n\n            const storageChannelIds = storagePolicies.map((storagePolicy) => storagePolicy.channelId);\n\n            const policiesToDelete = await db\n                .select()\n                .from(drizzleDb.schemas.storagePolicy)\n                .where(\n                    and(\n                        eq(drizzleDb.schemas.storagePolicy.databaseId, databaseId),\n                        inArray(drizzleDb.schemas.storagePolicy.storageChannelId, storageChannelIds)\n                    )\n                );\n\n            if (policiesToDelete.length === 0) {\n                return {\n                    success: false,\n                    actionError: {message: \"No storage policies found to delete.\"},\n                };\n            }\n\n            await db\n                .delete(drizzleDb.schemas.storagePolicy)\n                .where(\n                    and(\n                        eq(drizzleDb.schemas.storagePolicy.databaseId, databaseId),\n                        inArray(drizzleDb.schemas.storagePolicy.storageChannelId, storageChannelIds)\n                    )\n                );\n\n            return {\n                success: true,\n                value: policiesToDelete,\n                actionSuccess: {\n                    message: `Successfully deleted ${policiesToDelete.length} storage policy(ies).`,\n                },\n            };\n        } catch (error) {\n            console.error(\"Delete storage policies failed:\", error);\n            return {\n                success: false,\n                actionError: {\n                    message: \"Failed to delete storage policies.\",\n                    status: 500,\n                    cause: error instanceof Error ? error.message : \"Unknown error\",\n                },\n            };\n        }\n    });\n"
  },
  {
    "path": "src/components/wrappers/dashboard/database/channels-policy/policy.schema.ts",
    "content": "import {z} from \"zod\";\n\nexport const PolicySchema = z.object({\n    channelId: z.string().min(1, \"Please select channel\"),\n    eventKinds: z.array(z.enum([\n        'error_backup', 'error_restore', 'success_restore', 'success_backup', 'weekly_report', 'error_health_database'\n    ]))\n        .optional(),\n    enabled: z.boolean().default(true),\n});\n\nexport const PoliciesSchema = z.object({\n    policies: z.array(PolicySchema)\n});\n\n\nexport type PoliciesType = z.infer<typeof PoliciesSchema>;\nexport type PolicyType = z.infer<typeof PolicySchema>;\n\nexport const EVENT_KIND_BACKUP_ONLY_OPTIONS = [\n    {label: \"Error Backup\", value: \"error_backup\"},\n    {label: \"Success Backup\", value: \"success_backup\"},\n    {label: \"Health Ping Fail\", value: \"error_health_database\"},\n];\n\nexport const EVENT_KIND_OPTIONS = [\n    ...EVENT_KIND_BACKUP_ONLY_OPTIONS,\n    {label: \"Error Restore\", value: \"error_restore\"},\n    {label: \"Success Restore\", value: \"success_restore\"},\n    // {label: \"Weekly Report\", value: \"weekly_report\"},\n];\n\n"
  },
  {
    "path": "src/components/wrappers/dashboard/database/cron-button/advanced-cron-select.tsx",
    "content": "import { useState } from \"react\";\nimport { Label } from \"@/components/ui/label\";\nimport { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from \"@/components/ui/select\";\nimport { Input } from \"@/components/ui/input\";\nimport { isValidCronPart } from \"@/utils/cron\";\n\nexport const AdvancedCronSelect = ({\n    id,\n    label,\n    options,\n    type,\n    value,\n    defaultValue,\n    onValueChange,\n}: {\n    id: string;\n    label: string;\n    options: string[];\n    type: string;\n    value: string;\n    defaultValue: string;\n    onValueChange: (value: string) => void;\n}) => {\n    const [isAdvanced, setIsAdvanced] = useState(false);\n    const [customValue, setCustomValue] = useState(defaultValue || value);\n    const [error, setError] = useState<string | null>(null);\n\n    const handleBlur = () => {\n        if (customValue.trim() === \"\") {\n            setIsAdvanced(false);\n        } else if (!isValidCronPart(type, customValue)) {\n            setError(\"Invalid cron part value.\");\n        } else {\n            setError(null);\n            onValueChange(customValue);\n        }\n    };\n\n    return (\n        <div className=\"grid grid-cols-2 items-center gap-2\">\n            <Label htmlFor={id} className=\"text-left\">\n                {label}\n            </Label>\n            {!isAdvanced ? (\n                <Select\n                    // @ts-ignore\n                    id={id}\n                    className=\"col-span-4\"\n                    value={defaultValue}\n                    onValueChange={(value: string) => {\n                        if (value === \"advanced\") {\n                            setIsAdvanced(true);\n                        } else {\n                            setCustomValue(value);\n                            onValueChange(value);\n                        }\n                    }}\n                >\n                    <SelectTrigger>\n                        <SelectValue>\n                            {value}\n                            {/*{options.includes(value) ? value : \"Custom value\"}*/}\n                        </SelectValue>\n                        {/*<SelectValue placeholder=\"Select value\" />*/}\n                    </SelectTrigger>\n                    <SelectContent>\n                        {options.map((opt: string) => (\n                            <SelectItem key={opt} value={opt}>\n                                {opt}\n                            </SelectItem>\n                        ))}\n                        <SelectItem value=\"advanced\">Advanced</SelectItem>\n                    </SelectContent>\n                </Select>\n            ) : (\n                <Input\n                    id={id}\n                    className=\"col-span-4\"\n                    type=\"text\"\n                    value={customValue}\n                    onChange={(e) => {\n                        const newValue = e.target.value;\n                        setCustomValue(newValue);\n                        if (isValidCronPart(type, newValue)) {\n                            setError(null);\n                        } else {\n                            setError(\"Invalid cron part value.\");\n                        }\n                    }}\n                    onBlur={handleBlur}\n                    placeholder=\"e.g., *, 1-5, */5\"\n                />\n            )}\n            {error && <p className=\"text-sm text-red-500 col-span-4\">{error}</p>}\n        </div>\n    );\n};\n"
  },
  {
    "path": "src/components/wrappers/dashboard/database/cron-button/cron-button.tsx",
    "content": "\"use client\";\nimport { Clock9 } from \"lucide-react\";\nimport { Button } from \"@/components/ui/button\";\nimport { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, DialogTrigger } from \"@/components/ui/dialog\";\nimport { CronInput } from \"@/components/wrappers/dashboard/database/cron-button/cron-input\";\nimport { Switch } from \"@/components/ui/switch\";\nimport { Label } from \"@/components/ui/label\";\nimport { Separator } from \"@/components/ui/separator\";\nimport { useState } from \"react\";\nimport { useMutation, useQueryClient } from \"@tanstack/react-query\";\nimport { useRouter } from \"next/navigation\";\nimport { toast } from \"sonner\";\nimport { updateDatabaseBackupPolicyAction } from \"@/components/wrappers/dashboard/database/cron-button/cron.action\";\nimport {Database} from \"@/db/schema/07_database\";\n\nexport type CronButtonProps = {\n    database: Database;\n};\n\nexport const CronButton = (props: CronButtonProps) => {\n    const queryClient = useQueryClient();\n    const router = useRouter();\n    const [isSwitched, setIsSwitched] = useState(props.database.backupPolicy !== null);\n    const [open, setOpen] = useState(false);\n\n    const updateDatabaseBackupPolicy = useMutation({\n        mutationFn: (value: string) =>\n            updateDatabaseBackupPolicyAction({ databaseId: props.database.id, backupPolicy: value }),\n        onSuccess: () => {\n            toast.success(`Method updated successfully.`);\n            queryClient.invalidateQueries({ queryKey: [\"database-data\", props.database.id] });\n            router.refresh();\n        },\n        onError: () => {\n            toast.error(`An error occurred while updating backup method.`);\n        },\n    });\n\n    const handleTypeChange = async (state: boolean) => {\n        setIsSwitched(state);\n        if (!state) {\n            await updateDatabaseBackupPolicy.mutateAsync(\"\");\n        }\n    };\n\n    return (\n        <Dialog open={open} onOpenChange={setOpen}>\n            <DialogTrigger asChild>\n                <Button variant=\"outline\" {...props} onClick={() => setOpen(true)}>\n                    <Clock9 />\n                </Button>\n            </DialogTrigger>\n            <DialogContent className=\"sm:max-w-[425px]\">\n                <DialogHeader>\n                    <DialogTitle>Backup method</DialogTitle>\n                    <DialogDescription>Your settings for the backup method</DialogDescription>\n                </DialogHeader>\n                <Separator />\n\n                <h1>Select your backup method</h1>\n                <div className=\"flex items-center space-x-2\">\n                    <Label>Manual / Automatic </Label>\n                    <Switch\n                        checked={isSwitched}\n                        onCheckedChange={async () => {\n                            await handleTypeChange(!isSwitched);\n                        }}\n                        id=\"type-mode\"\n                    />\n                </div>\n                {isSwitched ? (\n                    <CronInput\n                        database={props.database}\n                        onSuccess={() => {\n                            setOpen(false);\n                        }}\n                    />\n                ) : null}\n            </DialogContent>\n        </Dialog>\n    );\n};\n"
  },
  {
    "path": "src/components/wrappers/dashboard/database/cron-button/cron-input.tsx",
    "content": "import {AdvancedCronSelect} from \"./advanced-cron-select\";\nimport {updateDatabaseBackupPolicyAction} from \"@/components/wrappers/dashboard/database/cron-button/cron.action\";\nimport {useMutation, useQueryClient} from \"@tanstack/react-query\";\nimport {useRouter} from \"next/navigation\";\nimport {useState} from \"react\";\nimport {toast} from \"sonner\";\nimport {Button} from \"@/components/ui/button\";\nimport {Separator} from \"@/components/ui/separator\";\nimport {Database} from \"@/db/schema/07_database\";\n\nexport type CronInputProps = {\n    database: Database;\n    onSuccess?: () => void;\n};\n\nexport const CronInput = ({database, onSuccess}: CronInputProps) => {\n    const [cron, setCron] = useState<string>(database.backupPolicy ?? \"* * * * *\");\n    const queryClient = useQueryClient();\n    const router = useRouter();\n\n    const updateBackupPolicy = useMutation({\n        mutationFn: (value: string) => updateDatabaseBackupPolicyAction({databaseId: database.id, backupPolicy: value}),\n        onSuccess: () => {\n            toast.success(`Cron updated successfully.`);\n            onSuccess?.()\n            queryClient.invalidateQueries({queryKey: [\"database-data\", database.id]});\n            router.refresh();\n        },\n        onError: () => {\n            toast.error(`An error occurred while updating cron value.`);\n        },\n    });\n\n    const handleChangeCron = (type: \"minute\" | \"hour\" | \"day-of-month\" | \"month\" | \"day-of-week\", value: string) => {\n        const cronParts = cron.split(\" \");\n        const indexMap = {minute: 0, hour: 1, \"day-of-month\": 2, month: 3, \"day-of-week\": 4};\n        cronParts[indexMap[type]] = value;\n        setCron(cronParts.join(\" \"));\n    };\n\n    const handleUpdateCron = async (cron: string) => {\n        await updateBackupPolicy.mutateAsync(cron);\n    };\n\n    return (\n        <>\n            <h1>Configure your cron schedule</h1>\n            <AdvancedCronSelect\n                id=\"minute\"\n                label=\"Minute\"\n                options={Array.from({length: 60}, (_, i) => String(i).padStart(2, \"0\"))}\n                type=\"minute\"\n                value={cron.split(\" \")[0]}\n                defaultValue={cron.split(\" \")[0]}\n                onValueChange={(value) => handleChangeCron(\"minute\", value)}\n            />\n            <AdvancedCronSelect\n                id=\"hour\"\n                label=\"Hour\"\n                options={Array.from({length: 24}, (_, i) => String(i).padStart(2, \"0\"))}\n                type=\"hour\"\n                value={cron.split(\" \")[1]}\n                defaultValue={cron.split(\" \")[1]}\n                onValueChange={(value) => handleChangeCron(\"hour\", value)}\n            />\n            <AdvancedCronSelect\n                id=\"day-of-month\"\n                label=\"Day of Month\"\n                options={Array.from({length: 31}, (_, i) => String(i + 1).padStart(2, \"0\"))}\n                type=\"day-of-month\"\n                value={cron.split(\" \")[2]}\n                defaultValue={cron.split(\" \")[2]}\n                onValueChange={(value) => handleChangeCron(\"day-of-month\", value)}\n            />\n            <AdvancedCronSelect\n                id=\"month\"\n                label=\"Month\"\n                options={[\"01\", \"02\", \"03\", \"04\", \"05\", \"06\", \"07\", \"08\", \"09\", \"10\", \"11\", \"12\"]}\n                type=\"month\"\n                value={cron.split(\" \")[3]}\n                defaultValue={cron.split(\" \")[3]}\n                onValueChange={(value) => handleChangeCron(\"month\", value)}\n            />\n            <AdvancedCronSelect\n                id=\"day-of-week\"\n                label=\"Day of Week\"\n                options={[\"0\", \"1\", \"2\", \"3\", \"4\", \"5\", \"6\"]}\n                type=\"day-of-week\"\n                value={cron.split(\" \")[4]}\n                defaultValue={cron.split(\" \")[4]}\n                onValueChange={(value) => handleChangeCron(\"day-of-week\", value)}\n            />\n            <Separator/>\n            <div className=\"grid gap-2\">\n                <div className=\"flex items-center justify-between\">\n                    <div className=\"font-semibold\">Cron Expression</div>\n                    <div className=\"font-mono text-muted-foreground\">{cron}</div>\n                </div>\n                <div className=\"text-sm text-muted-foreground\">This cron expression determines when the job will run.\n                </div>\n            </div>\n            <div className=\"flex justify-between gap-2\">\n                <Button\n                    onClick={async () => {\n                        setCron(\"* * * * *\");\n                        await handleUpdateCron(\"* * * * *\");\n                    }}\n                    variant=\"destructive\"\n                >\n                    Reset\n                </Button>\n                <Button\n                    onClick={async () => {\n                        await handleUpdateCron(cron);\n                    }}\n                >\n                    Save cron\n                </Button>\n            </div>\n        </>\n    );\n};\n"
  },
  {
    "path": "src/components/wrappers/dashboard/database/cron-button/cron.action.ts",
    "content": "\"use server\";\n\nimport {z} from \"zod\";\nimport {db} from \"@/db\";\nimport {eq} from \"drizzle-orm\";\nimport * as drizzleDb from \"@/db\";\nimport {userAction} from \"@/lib/safe-actions/actions\";\n\nexport const updateDatabaseBackupPolicyAction = userAction\n    .schema(\n        z.object({\n            databaseId: z.string(),\n            backupPolicy: z.string(),\n        })\n    )\n    .action(async ({parsedInput}) => {\n        const cronPolicy = parsedInput.backupPolicy === \"\" ? null : parsedInput.backupPolicy;\n\n        const [updated] = await db\n            .update(drizzleDb.schemas.database)\n            .set({\n                backupPolicy: cronPolicy,\n            })\n            .where(eq(drizzleDb.schemas.database.id, parsedInput.databaseId))\n            .returning()\n            .execute();\n\n        if (cronPolicy == null) {\n            await db.delete(drizzleDb.schemas.retentionPolicy)\n                .where(eq(drizzleDb.schemas.retentionPolicy.databaseId, parsedInput.databaseId)).execute();\n        }\n\n        return {\n            data: updated,\n        };\n    });\n"
  },
  {
    "path": "src/components/wrappers/dashboard/database/database-form/database-form.tsx",
    "content": "\"use client\";\n\nimport { Card, CardContent } from \"@/components/ui/card\";\nimport { FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, useZodForm } from \"@/components/ui/form\";\nimport { Input } from \"@/components/ui/input\";\nimport { Form } from \"@/components/ui/form\";\nimport { Button } from \"@/components/ui/button\";\nimport { useRouter } from \"next/navigation\";\nimport { useMutation } from \"@tanstack/react-query\";\nimport { TooltipProvider } from \"@/components/ui/tooltip\";\nimport { DatabaseSchema, DatabaseType } from \"@/components/wrappers/dashboard/database/database-form/form-database.schema\";\nimport { updateDatabaseAction } from \"@/components/wrappers/dashboard/database/database-form/form-database.action\";\nimport { toast } from \"sonner\";\n\nexport type DatabaseFormProps = {\n    defaultValues?: DatabaseType;\n    databaseId?: string;\n};\n\nexport const DatabaseForm = (props: DatabaseFormProps) => {\n    const { defaultValues, databaseId } = props;\n\n    const isCreate = !Boolean(defaultValues);\n\n    const form = useZodForm({\n        schema: DatabaseSchema,\n        defaultValues: { ...defaultValues },\n    });\n\n    const router = useRouter();\n\n    const mutation = useMutation({\n        mutationFn: async (values: DatabaseType) => {\n            if (!databaseId) {\n                throw new Error(\"Database ID is required\");\n            }\n            const database = await updateDatabaseAction({ id: databaseId, data: values });\n\n            if (!database) {\n                toast.error(\"Failed to update database\");\n                return;\n            }\n            if (database.serverError) {\n                toast.error(database.serverError);\n                return;\n            }\n            toast.success(`Database settings successfully updated!`);\n\n            router.back();\n        },\n    });\n\n    return (\n        <TooltipProvider>\n            <Card>\n                <CardContent>\n                    <Form\n                        form={form}\n                        className=\"flex flex-col gap-4 mt-3\"\n                        onSubmit={async (values) => {\n                            await mutation.mutateAsync(values);\n                        }}\n                    >\n                        <FormField\n                            control={form.control}\n                            name=\"name\"\n                            render={({ field }) => (\n                                <FormItem>\n                                    <FormLabel>Name</FormLabel>\n                                    <FormControl>\n                                        <Input disabled placeholder=\"Database 1\" {...field} />\n                                    </FormControl>\n                                    <FormDescription>Your database project name setup in agent</FormDescription>\n                                    <FormMessage />\n                                </FormItem>\n                            )}\n                        />\n                        <FormField\n                            control={form.control}\n                            name=\"dbms\"\n                            render={({ field }) => (\n                                <FormItem>\n                                    <FormLabel>Database type</FormLabel>\n                                    <FormControl>\n                                        <Input disabled placeholder=\"PostgreSQL\" {...field} />\n                                    </FormControl>\n                                    <FormDescription>Your database project name setup in agent</FormDescription>\n                                    <FormMessage />\n                                </FormItem>\n                            )}\n                        />\n                        <FormField\n                            control={form.control}\n                            name=\"description\"\n                            render={({ field }) => (\n                                <FormItem>\n                                    <FormLabel>Description</FormLabel>\n                                    <FormControl>\n                                        <Input placeholder=\"Prod database for project 1\" {...field} />\n                                    </FormControl>\n                                    <FormDescription>Add a short description about this database</FormDescription>\n                                    <FormMessage />\n                                </FormItem>\n                            )}\n                        />\n                        <Button>{isCreate ? `Create database` : `Save database`}</Button>\n                    </Form>\n                </CardContent>\n            </Card>\n        </TooltipProvider>\n    );\n};\n"
  },
  {
    "path": "src/components/wrappers/dashboard/database/database-form/form-database.action.ts",
    "content": "\"use server\";\n\nimport { z } from \"zod\";\nimport { db } from \"@/db\";\nimport { eq } from \"drizzle-orm\";\nimport { DatabaseSchema } from \"@/components/wrappers/dashboard/database/database-form/form-database.schema\";\nimport * as drizzleDb from \"@/db\";\nimport {userAction} from \"@/lib/safe-actions/actions\";\nimport {Database} from \"@/db/schema/07_database\";\n\nexport const updateDatabaseAction = userAction\n    .schema(\n        z.object({\n            id: z.string(),\n            data: DatabaseSchema,\n        })\n    )\n    .action(async ({ parsedInput }) => {\n        const [updated] = await db.update(drizzleDb.schemas.database).set(parsedInput.data).where(eq(drizzleDb.schemas.database.id, parsedInput.id)).returning().execute();\n\n        return updated;\n    });\n"
  },
  {
    "path": "src/components/wrappers/dashboard/database/database-form/form-database.schema.ts",
    "content": "import { z } from \"zod\";\n\nexport const DatabaseSchema = z.object({\n    name: z.string().readonly(),\n    description: z.string().optional(),\n    dbms: z.enum([\"active\", \"inactive\"]).readonly(),\n});\n\nexport type DatabaseType = z.infer<typeof DatabaseSchema>;\n"
  },
  {
    "path": "src/components/wrappers/dashboard/database/health/health-modal.tsx",
    "content": "\"use client\"\n\nimport {useState} from \"react\";\nimport {Button} from \"@/components/ui/button\";\nimport {DatabaseWith} from \"@/db/schema/07_database\";\nimport {HeartPulse} from \"lucide-react\";\nimport {\n    Sheet,\n    SheetContent,\n    SheetTitle,\n    SheetTrigger\n} from \"@/components/ui/sheet\";\nimport {HealthcheckLog} from \"@/db/schema/15_healthcheck-log\";\nimport {HealthCheckGraph} from \"@/components/wrappers/dashboard/health/heath-grid\";\n\ntype HealthModalProps = {\n    database: DatabaseWith,\n    healthLogs: HealthcheckLog[]\n}\n\nexport const HealthModal = ({database, healthLogs}: HealthModalProps) => {\n    const [open, setOpen] = useState(false);\n\n    return (\n        <Sheet open={open} onOpenChange={setOpen}>\n            <SheetTrigger asChild>\n                <Button variant=\"outline\" onClick={() => setOpen(true)}>\n                    <HeartPulse/>\n                </Button>\n            </SheetTrigger>\n            <SheetContent side=\"bottom\">\n                <div className=\"flex  pl-5 pt-4\">\n                    <SheetTitle>\n                        Database Health Status\n                    </SheetTitle>\n                </div>\n                <div className=\"px-4 pb-5\">\n                    <HealthCheckGraph logs={healthLogs} />\n                </div>\n            </SheetContent>\n        </Sheet>\n    )\n}"
  },
  {
    "path": "src/components/wrappers/dashboard/database/import/import-modal.tsx",
    "content": "\"use client\"\n\nimport {useState} from \"react\";\nimport {\n    Dialog,\n    DialogContent,\n    DialogDescription,\n    DialogHeader,\n    DialogTitle,\n    DialogTrigger\n} from \"@/components/ui/dialog\";\nimport {Button} from \"@/components/ui/button\";\nimport {DatabaseWith} from \"@/db/schema/07_database\";\nimport {Separator} from \"@/components/ui/separator\";\nimport {Import} from \"lucide-react\";\nimport {UploadBackupZone} from \"@/components/wrappers/dashboard/database/import/upload-backup-zone\";\n\ntype ImportModalProps = {\n    database: DatabaseWith;\n}\n\nexport const ImportModal = ({database}: ImportModalProps) => {\n    const [open, setOpen] = useState(false);\n\n    return (\n        <Dialog open={open} onOpenChange={setOpen}>\n            <DialogTrigger asChild>\n                <Button variant=\"outline\" onClick={() => setOpen(true)}>\n                    <Import/>\n                </Button>\n            </DialogTrigger>\n            <DialogContent>\n                <DialogHeader>\n                    <DialogTitle>Import Backup</DialogTitle>\n                    <DialogDescription>\n                        Import backup file of your choice.\n                    </DialogDescription>\n                    <Separator className=\"mt-3 \"/>\n                    <UploadBackupZone\n                        onSuccessAction={() => setOpen(false)}\n                        database={database}/>\n                </DialogHeader>\n            </DialogContent>\n        </Dialog>\n    )\n}"
  },
  {
    "path": "src/components/wrappers/dashboard/database/import/upload-backup-zone.tsx",
    "content": "\"use client\";\n\nimport {DropZoneFile} from \"@/components/wrappers/common/dropzone/dropzone-file\";\nimport {useMutation, useQueryClient} from \"@tanstack/react-query\";\nimport {useRouter} from \"next/navigation\";\nimport {useState} from \"react\";\nimport {Loader2} from \"lucide-react\";\nimport {ButtonWithLoading} from \"@/components/wrappers/common/button/button-with-loading\";\nimport {toast} from \"sonner\";\nimport {uploadBackupAction} from \"@/components/wrappers/dashboard/database/import/upload-backup.action\";\nimport {Card, CardContent} from \"@/components/ui/card\";\nimport {DatabaseWith} from \"@/db/schema/07_database\";\nimport {getFileHeadersBasedOnDbms} from \"@/utils/common\";\n\ntype UploadRetentionZoneProps = {\n    onSuccessAction?: () => void;\n    database: DatabaseWith;\n};\n\nexport const UploadBackupZone = ({onSuccessAction, database}: UploadRetentionZoneProps) => {\n    const queryClient = useQueryClient();\n    const router = useRouter();\n\n    const [isProcessing, setIsProcessing] = useState(false);\n    const [file, setFile] = useState<File | null>(null);\n\n    const mutationUpload = useMutation({\n        mutationFn: async (file: File) => {\n\n            try {\n                setIsProcessing(true);\n\n                const formData = new FormData();\n                formData.append(\"file\", file);\n                formData.append(\"databaseId\",  database.id);\n\n                const result = await uploadBackupAction(formData)\n\n                const inner = result?.data;\n                if (inner?.success) {\n                    toast.success(inner.actionSuccess?.message);\n                    onSuccessAction?.()\n                    queryClient.invalidateQueries({queryKey: [\"database-data\", database.id]});\n                    router.refresh();\n                } else {\n                    toast.error(inner?.actionError?.message);\n                }\n            } catch (err) {\n                console.error(err);\n                toast.error(\"An error occurred while upload in the backup\");\n            } finally {\n                queryClient.invalidateQueries({queryKey: [\"database-data\",  database.id]});\n                setIsProcessing(false);\n            }\n        },\n    });\n\n    const acceptDbImportFiles = getFileHeadersBasedOnDbms(database.dbms)\n\n    const fileKindDescription = Object.values(acceptDbImportFiles)\n        .flat()\n        .join(\", \");\n\n\n    return (\n        <>\n            {isProcessing ? (\n                <UploadLoader label=\"Uploading database backup…\"/>\n            ) : (\n                <DropZoneFile\n                    accept={getFileHeadersBasedOnDbms(database.dbms)}\n                    maxSize={2 * 1024 * 1024 * 1024}\n                    maxFiles={1}\n                    description=\"Import database backup\"\n                    fileKind={`Database file (${fileKindDescription})`}\n                    dragMessage=\"Click or drag a database dump here\"\n                    onFileDropAction={(file: File) => setFile(file)}\n                />\n            )}\n\n            {(!isProcessing && file) && (\n                <div className=\"flex gap-4 justify-end\">\n                    <ButtonWithLoading\n                        onClick={() => mutationUpload.mutateAsync(file)}\n                        isPending={false}>\n                        Upload\n                    </ButtonWithLoading>\n                </div>\n            )}\n        </>\n    );\n};\n\n\nconst UploadLoader = ({label = \"Processing uploading...\"}: { label?: string }) => {\n    return (\n        <Card className=\"w-full border\">\n            <CardContent className=\"flex flex-col items-center justify-center gap-3 py-10 text-muted-foreground\">\n                <div className=\"relative\">\n                    <Loader2 className=\"w-8 h-8 animate-spin inset-0\"/>\n                </div>\n                <p className=\"text-sm font-medium\">{label}</p>\n                <p className=\"text-xs text-muted-foreground\">\n                    Do not close this window\n                </p>\n            </CardContent>\n        </Card>\n    );\n};"
  },
  {
    "path": "src/components/wrappers/dashboard/database/import/upload-backup.action.ts",
    "content": "\"use server\"\nimport {userAction} from \"@/lib/safe-actions/actions\";\nimport {ServerActionResult} from \"@/types/action-type\";\nimport {db} from \"@/db\";\nimport * as drizzleDb from \"@/db\";\nimport {Backup} from \"@/db/schema/07_database\";\nimport {v4 as uuidv4} from \"uuid\";\nimport {eq} from \"drizzle-orm\";\nimport {z} from \"zod\";\nimport {storeBackupFiles} from \"@/features/storages/helpers\";\nimport {getFileExtension} from \"@/utils/common\";\n\n\nexport const uploadBackupAction = userAction\n    .schema(z.instanceof(FormData))\n    .action(async ({parsedInput: formData}): Promise<ServerActionResult<Backup>> => {\n        try {\n            const file = formData.get(\"file\") as File;\n            const databaseId = formData.get(\"databaseId\") as string;\n\n            const database = await db.query.database.findFirst({\n                where: eq(drizzleDb.schemas.database.id, databaseId),\n                with: {\n                    project: true,\n                    alertPolicies: true,\n                    storagePolicies: true\n                }\n            });\n\n            if (!database) {\n                return {\n                    success: false,\n                    actionError: {\n                        message: \"Database does not exist\",\n                        status: 500,\n                        cause: \"Unknown error\",\n                    },\n                };\n            }\n\n            const fileExtension = getFileExtension(database.dbms)\n\n            const arrayBuffer = await file.arrayBuffer();\n\n            const uuid = uuidv4();\n            const fileName = `${uuid}${fileExtension}`;\n            const buffer = Buffer.from(arrayBuffer);\n\n\n            const [backup] = await db\n                .insert(drizzleDb.schemas.backup)\n                .values({\n                    imported: true,\n                    status: 'ongoing',\n                    databaseId: database.id,\n                })\n                .returning();\n\n            await storeBackupFiles(backup, database, buffer, fileName)\n\n            return {\n                success: true,\n                value: backup,\n                actionSuccess: {\n                    message: `Backup successfully imported`,\n                },\n            };\n\n        } catch (error) {\n            return {\n                success: false,\n                actionError: {\n                    message: \"Failed to import backup.\",\n                    status: 500,\n                    cause: error instanceof Error ? error.message : \"Unknown error\",\n                },\n            };\n        }\n    });\n\n"
  },
  {
    "path": "src/components/wrappers/dashboard/database/restore-form.schema.ts",
    "content": "import { z } from \"zod\";\n\nconst ImmediateExecutionSchema = z.object({\n    executionMode: z.literal(\"immediate\"),\n});\n\nconst ScheduledExecutionSchema = z.object({\n    executionMode: z.literal(\"scheduled\"),\n    scheduledDatetime: z.date(),\n});\n\nconst RemoteImmediateSchema = z\n    .object({\n        backupLocation: z.literal(\"remote-file\"),\n    })\n    .merge(ImmediateExecutionSchema);\n\nconst RemoteScheduledSchema = z\n    .object({\n        backupLocation: z.literal(\"remote-file\"),\n    })\n    .merge(ScheduledExecutionSchema);\n\nconst DesktopImmediateSchema = z\n    .object({\n        backupLocation: z.literal(\"desktop-file\"),\n        uploadedBackupFile: z.instanceof(File),\n    })\n    .merge(ImmediateExecutionSchema);\n\nconst DesktopScheduledSchema = z\n    .object({\n        backupLocation: z.literal(\"desktop-file\"),\n        uploadedBackupFile: z.instanceof(File),\n    })\n    .merge(ScheduledExecutionSchema);\n\nexport const RestoreSchema = z.union([RemoteImmediateSchema, RemoteScheduledSchema, DesktopImmediateSchema, DesktopScheduledSchema]);\nexport type RestoreType = z.infer<typeof RestoreSchema>;\n"
  },
  {
    "path": "src/components/wrappers/dashboard/database/restore-form.tsx",
    "content": "// \"use client\";\n//\n// import { useState } from \"react\";\n//\n// import { DateTimePicker } from \"@/components/wrappers/common/day-time-picker\";\n// import { Button } from \"@/components/ui/button\";\n// import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage, useZodForm } from \"@/components/ui/form\";\n// import { Input } from \"@/components/ui/input\";\n// import { RestoreSchema } from \"@/components/wrappers/dashboard/database/restore-form.schema\";\n// import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from \"@/components/ui/select\";\n// import { ComboBox } from \"@/components/wrappers/common/combobox\";\n// import { Label } from \"@/components/ui/label\";\n//\n// export type restoreFormProps = {\n//     databaseToRestore: any;\n//     databases: any[];\n//     backups: any[];\n// };\n//\n// export const RestoreForm = (props: restoreFormProps) => {\n//     const { databaseToRestore, databases, backups } = props;\n//\n//     const backupLocations = [\n//         {\n//             value: \"remote-file\",\n//             label: \"Remote File\",\n//         },\n//         {\n//             value: \"desktop-file\",\n//             label: \"Desktop File\",\n//         },\n//     ];\n//\n//     const executionModes = [\n//         {\n//             value: \"immediate\",\n//             label: \"Immediate\",\n//         },\n//         {\n//             value: \"scheduled\",\n//             label: \"Scheduled\",\n//         },\n//     ];\n//\n//     const [selectedDatabaseId, setSelectedDatabaseId] = useState(databaseToRestore.id);\n//\n//     const filteredBackups = backups.filter((backup) => backup.databaseId == selectedDatabaseId);\n//\n//     const defaultValues = {\n//         executionMode: \"immediate\" as const,\n//         backupLocation: \"remote-file\" as const,\n//     };\n//\n//     const form = useZodForm({\n//         schema: RestoreSchema,\n//         defaultValues: defaultValues,\n//     });\n//\n//     const values = form.getValues();\n//\n//     return (\n//         <div>\n//             <Form\n//                 form={form}\n//                 onSubmit={async (values) => {\n//                     console.log(values);\n//                 }}\n//             >\n//                 <FormField\n//                     control={form.control}\n//                     name=\"backupLocation\"\n//                     render={({ field }) => (\n//                         <FormItem>\n//                             <FormLabel>Backup location</FormLabel>\n//                             <Select onValueChange={field.onChange} defaultValue={field.value}>\n//                                 <FormControl>\n//                                     <SelectTrigger>\n//                                         <SelectValue />\n//                                     </SelectTrigger>\n//                                 </FormControl>\n//                                 <SelectContent>\n//                                     {backupLocations.map((backupLocation, key) => (\n//                                         <SelectItem key={key} value={backupLocation.value}>\n//                                             {backupLocation.label}\n//                                         </SelectItem>\n//                                     ))}\n//                                 </SelectContent>\n//                             </Select>\n//                             <FormMessage />\n//                         </FormItem>\n//                     )}\n//                 />\n//\n//                 {values.backupLocation == \"remote-file\" ? (\n//                     <>\n//                         <div className=\"flex flex-col\">\n//                             <Label>Database</Label>\n//                             <ComboBox\n//                                 values={databases.map((database) => ({ value: database.id, label: database.name }))}\n//                                 onValueChange={setSelectedDatabaseId}\n//                                 defaultValue={selectedDatabaseId}\n//                                 searchField\n//                             />\n//                         </div>\n//                         <FormField\n//                             control={form.control}\n//                             name=\"remoteBackup\"\n//                             render={({ field }) => (\n//                                 <FormItem className=\"flex flex-col\">\n//                                     <FormLabel>Remote backup</FormLabel>\n//                                     <ComboBoxFormItem\n//                                         values={filteredBackups.map((backup) => ({\n//                                             value: backup.id,\n//                                             label: backup.createdAt.toString(),\n//                                         }))}\n//                                         {...field}\n//                                     />\n//                                     <FormMessage />\n//                                 </FormItem>\n//                             )}\n//                         />\n//                     </>\n//                 ) : null}\n//\n//                 {values.backupLocation == \"desktop-file\" ? (\n//                     <FormField\n//                         control={form.control}\n//                         name=\"uploadedBackupFile\"\n//                         render={({ field }) => (\n//                             <FormItem>\n//                                 <FormLabel>File</FormLabel>\n//                                 <FormControl>\n//                                     <Input id=\"uploadedBackupFile\" type=\"file\" {...field} />\n//                                 </FormControl>\n//                                 <FormMessage />\n//                             </FormItem>\n//                         )}\n//                     />\n//                 ) : null}\n//\n//                 <FormField\n//                     control={form.control}\n//                     name=\"executionMode\"\n//                     render={({ field }) => (\n//                         <FormItem>\n//                             <FormLabel>Execution mode</FormLabel>\n//                             <Select onValueChange={field.onChange} defaultValue={field.value}>\n//                                 <FormControl>\n//                                     <SelectTrigger>\n//                                         <SelectValue />\n//                                     </SelectTrigger>\n//                                 </FormControl>\n//                                 <SelectContent>\n//                                     {executionModes.map((executionMode, key) => (\n//                                         <SelectItem key={key} value={executionMode.value}>\n//                                             {executionMode.label}\n//                                         </SelectItem>\n//                                     ))}\n//                                 </SelectContent>\n//                             </Select>\n//                             <FormMessage />\n//                         </FormItem>\n//                     )}\n//                 />\n//\n//                 {values.executionMode == \"scheduled\" ? (\n//                     <FormField\n//                         control={form.control}\n//                         name=\"scheduledDatetime\"\n//                         render={({ field }) => (\n//                             <FormItem>\n//                                 <FormLabel>Scheduled date</FormLabel>\n//                                 <FormControl>\n//                                     <DateTimePicker value={field.value} onSelect={field.onChange} />\n//                                 </FormControl>\n//                                 <FormMessage />\n//                             </FormItem>\n//                         )}\n//                     />\n//                 ) : null}\n//\n//                 <Button type=\"submit\">Launch restore</Button>\n//             </Form>\n//         </div>\n//     );\n// };\n"
  },
  {
    "path": "src/components/wrappers/dashboard/database/retention-policy/backup-retention-settings-form.tsx",
    "content": "\"use client\"\nimport {\n    Form,\n    FormControl,\n    FormDescription,\n    FormField,\n    FormItem,\n    FormLabel,\n    FormMessage,\n    useZodForm\n} from \"@/components/ui/form\";\nimport {RetentionSettings, RetentionSettingsSchema} from \"./backup-retention-settings.schema\";\nimport {useMutation, useQueryClient} from \"@tanstack/react-query\";\nimport {useRouter} from \"next/navigation\";\nimport {updateOrCreateBackupRetentionPolicyAction} from \"./backup-retention-settings.action\";\nimport {DatabaseWith, RetentionPolicy} from \"@/db/schema/07_database\";\nimport {toast} from \"sonner\";\nimport {RadioGroup, RadioGroupItem} from \"@/components/ui/radio-group\";\nimport {Badge} from \"@/components/ui/badge\";\nimport {Separator} from \"@/components/ui/separator\";\nimport {Input} from \"@/components/ui/input\";\nimport {Button} from \"@/components/ui/button\";\nimport {Calendar, Save} from \"lucide-react\";\n\nexport type BackupRetentionSettingsFormProps = {\n    defaultValues?: RetentionPolicy;\n    database: DatabaseWith;\n};\n\nexport const BackupRetentionSettingsForm = ({defaultValues, database}: BackupRetentionSettingsFormProps) => {\n    const queryClient = useQueryClient();\n    const router = useRouter();\n\n    const defaultValuesFormatted: RetentionSettings = {\n        type: defaultValues?.type,\n        count: defaultValues?.count ?? 7,\n        days: defaultValues?.days ?? 30,\n        gfs: {\n            daily: defaultValues?.gfsDaily ?? 7,\n            weekly: defaultValues?.gfsWeekly ?? 4,\n            monthly: defaultValues?.gfsMonthly ?? 12,\n            yearly: defaultValues?.gfsYearly ?? 3,\n        },\n    };\n\n    const form = useZodForm({\n        schema: RetentionSettingsSchema,\n        defaultValues: defaultValuesFormatted,\n    });\n\n    const mutation = useMutation({\n        mutationFn: async (payload: RetentionSettings) =>\n            await updateOrCreateBackupRetentionPolicyAction({\n                databaseId: database.id,\n                settings: payload,\n            }),\n        onSuccess: () => {\n            toast.success(\"Retention policy updated successfully.\");\n            queryClient.invalidateQueries({queryKey: [\"database-data\", database.id]});\n            router.refresh();\n        },\n        onError: () => {\n            toast.error(\"An error occurred while updating retention policy.\");\n        },\n    });\n\n    const calculateTotalFiles = (values: RetentionSettings) => {\n        if (values.type === \"gfs\" && values.gfs) {\n            return (\n                (values.gfs.daily ?? 0) +\n                (values.gfs.weekly ?? 0) +\n                (values.gfs.monthly ?? 0) +\n                (values.gfs.yearly ?? 0)\n            );\n        }\n        return values.type === \"count\" ? values.count ?? 0 : values.type === \"days\" ? values.days ?? 0 : 0;\n    };\n\n    const getStorageEstimate = (totalFiles: number) => {\n        if (totalFiles <= 10) return \"Low\";\n        if (totalFiles <= 30) return \"Medium\";\n        return \"High\";\n    };\n\n    return (\n        <div className=\"flex flex-col gap-3 py-0\">\n            <div className=\"px-3\">\n                <Form\n                    form={form}\n                    className=\"flex flex-col gap-6 mt-0\"\n                    onSubmit={async (values) => {\n                        await mutation.mutateAsync(values);\n                    }}\n                >\n                    <FormField\n                        control={form.control}\n                        name=\"type\"\n                        render={({field}) => (\n                            <FormItem>\n                                <FormLabel>Retention Policy Type</FormLabel>\n                                <FormControl>\n                                    <RadioGroup\n                                        value={field.value ?? \"\"}\n                                        onValueChange={field.onChange}\n                                        className=\"grid grid-cols-1 gap-4\"\n                                    >\n                                        {[\n                                            {\n                                                id: \"count\",\n                                                label: \"Keep last N backups\",\n                                                desc: \"Simple count-based retention (e.g., keep last 10 backups)\",\n                                            },\n                                            {\n                                                id: \"days\",\n                                                label: \"Keep backups for X days\",\n                                                desc: \"Time-based retention (e.g., keep backups for 30 days)\",\n                                            },\n                                            {\n                                                id: \"gfs\",\n                                                label: \"GFS Rotation\",\n                                                desc: \"Grandfather-Father-Son rotation for enterprise/critical systems\",\n                                                badge: \"Recommended\",\n                                            },\n                                        ].map((opt) => (\n                                            <FormLabel\n                                                key={opt.id}\n                                                htmlFor={opt.id}\n                                                className={`flex items-center space-x-3 rounded-lg border p-4 transition-colors cursor-pointer ${\n                                                    field.value === opt.id\n                                                        ? \"border-primary bg-primary/5\"\n                                                        : \"hover:bg-muted/50\"\n                                                }`}\n                                            >\n                                                <RadioGroupItem value={opt.id} id={opt.id}/>\n                                                <div className=\"flex-1\">\n                                                <span className=\"font-medium flex items-center gap-2\">\n                                                  {opt.label}\n                                                    {opt.badge && (\n                                                        <Badge variant=\"secondary\" className=\"text-xs\">\n                                                            {opt.badge}\n                                                        </Badge>\n                                                    )}\n                                                </span>\n                                                    <p className=\"text-sm text-muted-foreground\">{opt.desc}</p>\n                                                </div>\n\n                                                {database.retentionPolicy?.type === opt.id && (\n                                                    <Badge variant=\"secondary\" className=\"text-xs\">\n                                                        Actual\n                                                    </Badge>\n                                                )}\n                                            </FormLabel>\n                                        ))}\n                                    </RadioGroup>\n                                </FormControl>\n                                <FormMessage/>\n                            </FormItem>\n                        )}\n                    />\n\n                    {form.watch(\"type\") && (\n                        <Separator/>\n                    )}\n\n\n                    {form.watch(\"type\") === \"count\" && (\n                        <FormField\n                            control={form.control}\n                            name=\"count\"\n                            render={({field}) => (\n                                <FormItem>\n                                    <FormLabel>Number of backups to keep</FormLabel>\n                                    <FormControl>\n                                        <Input\n                                            type=\"number\"\n                                            min={1}\n                                            max={100}\n                                            className=\"w-32\"\n                                            {...field}\n                                            onChange={(e) => field.onChange(e.target.valueAsNumber)}\n                                        />\n                                    </FormControl>\n                                    <FormDescription>\n                                        Older backups beyond this count will be automatically deleted.\n                                    </FormDescription>\n                                    <FormMessage/>\n                                </FormItem>\n                            )}\n                        />\n                    )}\n\n                    {form.watch(\"type\") === \"days\" && (\n                        <FormField\n                            control={form.control}\n                            name=\"days\"\n                            render={({field}) => (\n                                <FormItem>\n                                    <FormLabel>Retention period (days)</FormLabel>\n                                    <FormControl>\n                                        <Input\n                                            type=\"number\"\n                                            min={1}\n                                            max={3650}\n                                            className=\"w-32\"\n                                            {...field}\n                                            onChange={(e) => field.onChange(e.target.valueAsNumber)}\n                                        />\n                                    </FormControl>\n                                    <FormDescription>\n                                        Backups older than {field.value} days will be automatically deleted.\n                                    </FormDescription>\n                                    <FormMessage/>\n                                </FormItem>\n                            )}\n                        />\n                    )}\n\n                    {form.watch(\"type\") === \"gfs\" && (\n                        <div className=\"space-y-4\">\n                            {[\"daily\", \"weekly\", \"monthly\", \"yearly\"].map((key) => (\n                                <FormField\n                                    key={key}\n                                    control={form.control}\n                                    name={`gfs.${key}` as const}\n                                    render={({field}) => (\n                                        <FormItem>\n                                            <FormLabel>\n                                                {key.charAt(0).toUpperCase() + key.slice(1)} backups\n                                            </FormLabel>\n                                            <FormControl>\n                                                <Input\n                                                    type=\"number\"\n                                                    min={0}\n                                                    max={key === \"yearly\" ? 50 : key === \"monthly\" ? 120 : key === \"weekly\" ? 52 : 31}\n                                                    {...field}\n                                                    onChange={(e) => field.onChange(e.target.valueAsNumber)}\n                                                />\n                                            </FormControl>\n                                            <FormDescription>\n                                                Keep N {key} backups\n                                            </FormDescription>\n                                            <FormMessage/>\n                                        </FormItem>\n                                    )}\n                                />\n                            ))}\n                        </div>\n                    )}\n\n                    {form.watch(\"type\") && (\n                        <>\n                            <Separator/>\n                            <div className=\"rounded-lg border p-4 space-y-3 bg-card\">\n                                <div className=\"flex items-center justify-between\">\n                                    <div className=\"flex items-center gap-2\">\n                                        <Calendar className=\"h-4 w-4 text-muted-foreground\"/>\n                                        <span className=\"font-medium\">Storage Impact Summary</span>\n                                    </div>\n                                    {(() => {\n                                        const totalFiles = calculateTotalFiles(form.getValues());\n                                        const estimate = getStorageEstimate(totalFiles);\n                                        return (\n                                            <Badge\n                                                variant={\n                                                    estimate === \"Low\"\n                                                        ? \"default\"\n                                                        : estimate === \"Medium\"\n                                                            ? \"secondary\"\n                                                            : \"destructive\"\n                                                }\n                                            >\n                                                {estimate} Usage\n                                            </Badge>\n                                        );\n                                    })()}\n                                </div>\n                                <div className=\"grid grid-cols-2 gap-4 text-sm\">\n                                    <div>\n                                        <span className=\"text-muted-foreground\">Estimated files per database:</span>\n                                        <p className=\"font-medium\">\n                                            {calculateTotalFiles(form.getValues())} backup files\n                                        </p>\n                                    </div>\n                                    <div>\n                                        <span className=\"text-muted-foreground\">Policy type:</span>\n                                        <p className=\"font-medium capitalize\">\n                                            {form.watch(\"type\") === \"gfs\"\n                                                ? \"GFS Rotation\"\n                                                : form.watch(\"type\") === \"count\"\n                                                    ? \"Count-based\"\n                                                    : \"Time-based\"}\n                                        </p>\n                                    </div>\n                                </div>\n                            </div>\n                            <Button type=\"submit\" disabled={mutation.isPending} className=\"w-full\">\n                                <Save className=\"h-4 w-4 mr-2\"/>\n                                {mutation.isPending ? \"Saving Policy...\" : \"Save Retention Policy\"}\n                            </Button>\n                        </>\n                    )}\n                </Form>\n            </div>\n        </div>\n    );\n};\n"
  },
  {
    "path": "src/components/wrappers/dashboard/database/retention-policy/backup-retention-settings.action.tsx",
    "content": "\"use server\"\n\nimport {z} from \"zod\"\nimport {db} from \"@/db\"\nimport {eq} from \"drizzle-orm\"\nimport * as drizzleDb from \"@/db\";\nimport {\n    RetentionSettingsSchema\n} from \"@/components/wrappers/dashboard/database/retention-policy/backup-retention-settings.schema\";\nimport {userAction} from \"@/lib/safe-actions/actions\";\n\n\nexport const updateOrCreateBackupRetentionPolicyAction = userAction\n    .schema(\n        z.object({\n            databaseId: z.string(),\n            settings: RetentionSettingsSchema,\n        })\n    )\n    .action(async ({parsedInput}) => {\n        const {databaseId, settings} = parsedInput\n\n        // Check if a retention policy already exists\n        const existing = await db\n            .select()\n            .from(drizzleDb.schemas.retentionPolicy)\n            .where(eq(drizzleDb.schemas.retentionPolicy.databaseId, databaseId))\n            .limit(1)\n\n        let updated\n\n        if (existing.length > 0) {\n            // Update existing policy\n            updated = await db\n                .update(drizzleDb.schemas.retentionPolicy)\n                .set({\n                    type: settings.type,\n                    count: settings.count,\n                    days: settings.days,\n                    gfsDaily: settings.gfs.daily,\n                    gfsWeekly: settings.gfs.weekly,\n                    gfsMonthly: settings.gfs.monthly,\n                    gfsYearly: settings.gfs.yearly,\n                })\n                .where(eq(drizzleDb.schemas.retentionPolicy.databaseId, databaseId))\n                .returning()\n        } else {\n            // Insert new policy\n\n            updated = await db\n                .insert(drizzleDb.schemas.retentionPolicy)\n                .values({\n                    databaseId,\n                    type: settings.type ?? \"gfs\",\n                    count: settings.count,\n                    days: settings.days,\n                    gfsDaily: settings.gfs.daily,\n                    gfsWeekly: settings.gfs.weekly,\n                    gfsMonthly: settings.gfs.monthly,\n                    gfsYearly: settings.gfs.yearly,\n                })\n                .returning()\n        }\n        return {\n            data: updated[0],\n        }\n    })\n"
  },
  {
    "path": "src/components/wrappers/dashboard/database/retention-policy/backup-retention-settings.schema.ts",
    "content": "import {z} from \"zod\";\n\nconst GFSSettingsSchema = z.object({\n    daily: z.number().min(1).max(31),\n    weekly: z.number().min(0).max(52),\n    monthly: z.number().min(0).max(120),\n    yearly: z.number().min(0).max(50),\n});\n\nexport const RetentionSettingsSchema = z.object({\n    type: z.enum([\"count\", \"days\", \"gfs\"]).optional(),\n    count: z.number().min(1).max(100),\n    days: z.number().min(1).max(3650),\n    gfs: GFSSettingsSchema,\n});\n\nexport type RetentionSettings = z.infer<typeof RetentionSettingsSchema>;"
  },
  {
    "path": "src/components/wrappers/dashboard/database/retention-policy/backup-retention-settings.tsx",
    "content": "\"use client\"\n\nimport {useState} from \"react\"\nimport {Label} from \"@/components/ui/label\"\nimport {Button} from \"@/components/ui/button\"\nimport {Badge} from \"@/components/ui/badge\"\nimport {Input} from \"@/components/ui/input\"\nimport {Separator} from \"@/components/ui/separator\"\nimport {RadioGroup, RadioGroupItem} from \"@/components/ui/radio-group\"\nimport {Clock, Database, Save, Settings, Calendar, RotateCcw} from \"lucide-react\"\nimport {toast} from \"sonner\";\nimport {useMutation} from \"@tanstack/react-query\";\nimport {useRouter} from \"next/navigation\";\nimport {\n    updateOrCreateBackupRetentionPolicyAction\n} from \"@/components/wrappers/dashboard/database/retention-policy/backup-retention-settings.action\";\nimport {Database as DbSchema} from \"@/db/schema/07_database\";\n\ntype RetentionPolicyType = \"count\" | \"days\" | \"gfs\"\n\ninterface GFSSettings {\n    daily: number\n    weekly: number\n    monthly: number\n    yearly: number\n}\n\nexport interface RetentionSettings {\n    type: RetentionPolicyType\n    count: number\n    days: number\n    gfs: GFSSettings\n}\n\ntype BackupRetentionSettingsProps = {\n    database: DbSchema,\n}\n\n\nexport function BackupRetentionSettings({database}: BackupRetentionSettingsProps) {\n    const [settings, setSettings] = useState<RetentionSettings>({\n        type: \"gfs\",\n        count: 7,\n        days: 30,\n        gfs: {\n            daily: 7,\n            weekly: 4,\n            monthly: 12,\n            yearly: 3,\n        },\n    })\n    const queryClient = useQueryClient()\n\n    const updateRetentionPolicy = useMutation({\n        mutationFn: async (payload: RetentionSettings) => await updateOrCreateBackupRetentionPolicyAction({\n            databaseId: database.id,\n            settings: payload\n        }),\n        onSuccess: () => {\n            toast.success(\"Retention policy updated successfully.\")\n            queryClient.invalidateQueries({queryKey: [\"database-data\", database.id]})\n        },\n        onError: () => {\n            toast.error(\"An error occurred while updating retention policy.\")\n        },\n    })\n\n    const handleSave = () => {\n        updateRetentionPolicy.mutate(settings)\n    }\n    const calculateTotalFiles = () => {\n        if (settings.type === \"gfs\") {\n            return settings.gfs.daily + settings.gfs.weekly + settings.gfs.monthly + settings.gfs.yearly\n        }\n        return settings.type === \"count\" ? settings.count : Math.ceil(settings.days / 1) // Assuming daily backups\n    }\n\n    const getStorageEstimate = () => {\n        const totalFiles = calculateTotalFiles()\n        if (totalFiles <= 10) return \"Low\"\n        if (totalFiles <= 30) return \"Medium\"\n        return \"High\"\n    }\n\n    return (\n        <div className=\"space-y-6\">\n            <div className=\"flex flex-col\">\n\n                <div className=\"px-3 space-y-6\">\n                    <div className=\"space-y-4\">\n                        <Label className=\"text-sm font-medium\">Retention Policy Type</Label>\n                        <RadioGroup\n                            value={settings.type}\n                            onValueChange={(value: RetentionPolicyType) => setSettings((prev) => ({\n                                ...prev,\n                                type: value\n                            }))}\n                            className=\"grid grid-cols-1 gap-4\"\n                        >\n                            <div\n                                className=\"flex items-center space-x-3 rounded-lg border p-4 hover:bg-muted/50 transition-colors\">\n                                <RadioGroupItem value=\"count\" id=\"count\"/>\n                                <div className=\"flex-1\">\n                                    <Label htmlFor=\"count\" className=\"font-medium cursor-pointer\">\n                                        Keep last N backups\n                                    </Label>\n                                    <p className=\"text-sm text-muted-foreground\">\n                                        Simple count-based retention (e.g., keep last 10 backups)\n                                    </p>\n                                </div>\n                            </div>\n\n                            <div\n                                className=\"flex items-center space-x-3 rounded-lg border p-4 hover:bg-muted/50 transition-colors\">\n                                <RadioGroupItem value=\"days\" id=\"days\"/>\n                                <div className=\"flex-1\">\n                                    <Label htmlFor=\"days\" className=\"font-medium cursor-pointer\">\n                                        Keep backups for X days\n                                    </Label>\n                                    <p className=\"text-sm text-muted-foreground\">Time-based retention (e.g., keep\n                                        backups for 30 days)</p>\n                                </div>\n                            </div>\n\n                            <div\n                                className=\"flex items-center space-x-3 rounded-lg border p-4 hover:bg-muted/50 transition-colors bg-accent/5\">\n                                <RadioGroupItem value=\"gfs\" id=\"gfs\"/>\n                                <div className=\"flex-1\">\n                                    <Label htmlFor=\"gfs\" className=\"font-medium cursor-pointer flex items-center gap-2\">\n                                        GFS Rotation\n                                        <Badge variant=\"secondary\" className=\"text-xs\">\n                                            Recommended\n                                        </Badge>\n                                    </Label>\n                                    <p className=\"text-sm text-muted-foreground\">\n                                        Grandfather-Father-Son rotation for enterprise/critical systems\n                                    </p>\n                                </div>\n                            </div>\n                        </RadioGroup>\n                    </div>\n\n                    <Separator/>\n\n                    {settings.type === \"count\" && (\n                        <div className=\"space-y-4\">\n                            <div className=\"flex items-center gap-2\">\n                                <Settings className=\"h-4 w-4 text-muted-foreground\"/>\n                                <Label className=\"font-medium\">Count-Based Configuration</Label>\n                            </div>\n                            <div className=\"space-y-2\">\n                                <Label htmlFor=\"backup-count\">Number of backups to keep</Label>\n                                <Input\n                                    id=\"backup-count\"\n                                    type=\"number\"\n                                    min=\"1\"\n                                    max=\"100\"\n                                    value={settings.count}\n                                    onChange={(e) => setSettings((prev) => ({\n                                        ...prev,\n                                        count: Number.parseInt(e.target.value) || 1\n                                    }))}\n                                    className=\"w-32\"\n                                />\n                                <p className=\"text-xs text-muted-foreground\">\n                                    Older backups beyond this count will be automatically deleted\n                                </p>\n                            </div>\n                        </div>\n                    )}\n\n                    {settings.type === \"days\" && (\n                        <div className=\"space-y-4\">\n                            <div className=\"flex items-center gap-2\">\n                                <Clock className=\"h-4 w-4 text-muted-foreground\"/>\n                                <Label className=\"font-medium\">Time-Based Configuration</Label>\n                            </div>\n                            <div className=\"space-y-2\">\n                                <Label htmlFor=\"retention-days\">Retention period (days)</Label>\n                                <Input\n                                    id=\"retention-days\"\n                                    type=\"number\"\n                                    min=\"1\"\n                                    max=\"3650\"\n                                    value={settings.days}\n                                    onChange={(e) => setSettings((prev) => ({\n                                        ...prev,\n                                        days: Number.parseInt(e.target.value) || 1\n                                    }))}\n                                    className=\"w-32\"\n                                />\n                                <p className=\"text-xs text-muted-foreground\">\n                                    Backups older than {settings.days} days will be automatically deleted\n                                </p>\n                            </div>\n                        </div>\n                    )}\n\n                    {settings.type === \"gfs\" && (\n                        <div className=\"space-y-4\">\n                            <div className=\"flex items-center gap-2\">\n                                <RotateCcw className=\"h-4 w-4 text-muted-foreground\"/>\n                                <Label className=\"font-medium\">GFS Rotation Configuration</Label>\n                            </div>\n                            <div className=\"grid grid-cols-2 gap-4\">\n                                <div className=\"space-y-2\">\n                                    <Label htmlFor=\"daily-backups\">Daily backups</Label>\n                                    <Input\n                                        id=\"daily-backups\"\n                                        type=\"number\"\n                                        min=\"1\"\n                                        max=\"31\"\n                                        value={settings.gfs.daily}\n                                        onChange={(e) =>\n                                            setSettings((prev) => ({\n                                                ...prev,\n                                                gfs: {...prev.gfs, daily: Number.parseInt(e.target.value) || 1},\n                                            }))\n                                        }\n                                    />\n                                    <p className=\"text-xs text-muted-foreground\">Keep last N daily backups</p>\n                                </div>\n\n                                <div className=\"space-y-2\">\n                                    <Label htmlFor=\"weekly-backups\">Weekly backups</Label>\n                                    <Input\n                                        id=\"weekly-backups\"\n                                        type=\"number\"\n                                        min=\"0\"\n                                        max=\"52\"\n                                        value={settings.gfs.weekly}\n                                        onChange={(e) =>\n                                            setSettings((prev) => ({\n                                                ...prev,\n                                                gfs: {...prev.gfs, weekly: Number.parseInt(e.target.value) || 0},\n                                            }))\n                                        }\n                                    />\n                                    <p className=\"text-xs text-muted-foreground\">Keep N weekly backups</p>\n                                </div>\n\n                                <div className=\"space-y-2\">\n                                    <Label htmlFor=\"monthly-backups\">Monthly backups</Label>\n                                    <Input\n                                        id=\"monthly-backups\"\n                                        type=\"number\"\n                                        min=\"0\"\n                                        max=\"120\"\n                                        value={settings.gfs.monthly}\n                                        onChange={(e) =>\n                                            setSettings((prev) => ({\n                                                ...prev,\n                                                gfs: {...prev.gfs, monthly: Number.parseInt(e.target.value) || 0},\n                                            }))\n                                        }\n                                    />\n                                    <p className=\"text-xs text-muted-foreground\">Keep N monthly backups</p>\n                                </div>\n\n                                <div className=\"space-y-2\">\n                                    <Label htmlFor=\"yearly-backups\">Yearly backups</Label>\n                                    <Input\n                                        id=\"yearly-backups\"\n                                        type=\"number\"\n                                        min=\"0\"\n                                        max=\"50\"\n                                        value={settings.gfs.yearly}\n                                        onChange={(e) =>\n                                            setSettings((prev) => ({\n                                                ...prev,\n                                                gfs: {...prev.gfs, yearly: Number.parseInt(e.target.value) || 0},\n                                            }))\n                                        }\n                                    />\n                                    <p className=\"text-xs text-muted-foreground\">Keep N yearly backups</p>\n                                </div>\n                            </div>\n\n                            <div className=\"bg-muted/50 p-3 rounded-lg\">\n                                <p className=\"text-sm font-medium mb-1\">GFS Strategy Benefits:</p>\n                                <ul className=\"text-xs text-muted-foreground space-y-1\">\n                                    <li>• Balanced storage usage with long-term retention</li>\n                                    <li>• Automatic promotion of backups (daily → weekly → monthly → yearly)</li>\n                                    <li>• Industry standard for enterprise backup systems</li>\n                                </ul>\n                            </div>\n                        </div>\n                    )}\n\n                    <Separator/>\n\n                    <div className=\"rounded-lg border p-4 space-y-3 bg-card\">\n                        <div className=\"flex items-center justify-between\">\n                            <div className=\"flex items-center gap-2\">\n                                <Calendar className=\"h-4 w-4 text-muted-foreground\"/>\n                                <span className=\"font-medium\">Storage Impact Summary</span>\n                            </div>\n                            <Badge\n                                variant={\n                                    getStorageEstimate() === \"Low\"\n                                        ? \"default\"\n                                        : getStorageEstimate() === \"Medium\"\n                                            ? \"secondary\"\n                                            : \"destructive\"\n                                }\n                            >\n                                {getStorageEstimate()} Usage\n                            </Badge>\n                        </div>\n\n                        <div className=\"grid grid-cols-2 gap-4 text-sm\">\n                            <div>\n                                <span className=\"text-muted-foreground\">Estimated files per database:</span>\n                                <p className=\"font-medium\">{calculateTotalFiles()} backup files</p>\n                            </div>\n                            <div>\n                                <span className=\"text-muted-foreground\">Policy type:</span>\n                                <p className=\"font-medium capitalize\">\n                                    {settings.type === \"gfs\" ? \"GFS Rotation\" : settings.type === \"count\" ? \"Count-based\" : \"Time-based\"}\n                                </p>\n                            </div>\n                        </div>\n\n                        {settings.type === \"gfs\" && (\n                            <div\n                                className=\"text-xs text-muted-foreground bg-accent/10 p-2 rounded border border-accent/20\">\n                                <strong>Note:</strong> With GFS rotation, you'll have\n                                approximately {calculateTotalFiles()} files per\n                                database per year, providing excellent long-term retention with optimized storage usage.\n                            </div>\n                        )}\n                    </div>\n\n                    <Button onClick={handleSave} disabled={updateRetentionPolicy.isPending} className=\"w-full\">\n                        <Save className=\"h-4 w-4 mr-2\"/>\n                        {updateRetentionPolicy.isPending ? \"Saving Policy...\" : \"Save Retention Policy\"}\n                    </Button>\n                </div>\n            </div>\n        </div>\n    )\n}\n"
  },
  {
    "path": "src/components/wrappers/dashboard/database/retention-policy/retention-policy-sheet.tsx",
    "content": "import {Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle, SheetTrigger} from \"@/components/ui/sheet\";\nimport {Button} from \"@/components/ui/button\";\nimport {Database, Ruler} from \"lucide-react\";\nimport {DatabaseWith as DbSchema, RetentionPolicy} from \"@/db/schema/07_database\";\nimport {\n    BackupRetentionSettingsForm\n} from \"@/components/wrappers/dashboard/database/retention-policy/backup-retention-settings-form\";\n\ntype RetentionPolicySheetProps = {\n    database: DbSchema\n}\n\nexport const RetentionPolicySheet = ({database}: RetentionPolicySheetProps) => {\n    return (\n        <Sheet>\n            <SheetTrigger asChild>\n                <Button variant=\"outline\">\n                    <Ruler />\n                </Button>\n            </SheetTrigger>\n            <SheetContent\n                className=\"flex gap-4 p-4 w-full md:w-[800px] max-w-[800px] max-h-screen overflow-y-scroll\"\n            >\n                <SheetHeader>\n                    <SheetTitle className=\"flex items-center gap-2 text-balance\">\n                        <Database className=\"h-5 w-5\"/>\n                        Backup Retention Policy\n                    </SheetTitle>\n                    <SheetDescription className=\"text-pretty\">\n                        Configure how long to keep your .dump backup files. Choose from simple count-based, time-based,\n                        or\n                        enterprise GFS rotation strategies.\n                    </SheetDescription>\n                </SheetHeader>\n                {database.backupPolicy !== null ?\n                    <BackupRetentionSettingsForm database={database}\n                                                 defaultValues={database.retentionPolicy as RetentionPolicy}/>\n                    :\n                    <div\n                        className=\"flex flex-col items-center justify-center text-center py-12 gap-4 border  rounded-lg\">\n                        <p className=\"text-muted-foreground\">\n                            No backup policy configured yet. Please configure one !\n                        </p>\n                    </div>\n                }\n            </SheetContent>\n        </Sheet>\n    )\n}"
  },
  {
    "path": "src/components/wrappers/dashboard/health/heath-grid.tsx",
    "content": "\"use client\"\n\nimport {useMemo} from \"react\"\nimport {Card} from \"@/components/ui/card\"\nimport {HealthcheckLog} from \"@/db/schema/15_healthcheck-log\"\nimport {useIsMobile} from \"@/hooks/use-mobile\";\n\ntype HealthStatus = \"healthy\" | \"degraded\" | \"down\" | \"unknown\"\n\ninterface HealthCheckData {\n    timestamp: Date\n    status: HealthStatus\n}\n\ninterface Props {\n    logs: HealthcheckLog[]\n}\n\nconst INTERVAL_MINUTES = 10\nconst WINDOW_HOURS = 12\n\nfunction roundDateToInterval(date: Date, intervalMinutes: number): Date {\n    const ms = intervalMinutes * 60 * 1000\n    return new Date(Math.floor(date.getTime() / ms) * ms)\n}\n\nfunction buildTimeSeries(logs: HealthcheckLog[]): HealthCheckData[] {\n    const intervalMs = INTERVAL_MINUTES * 60 * 1000\n    const now = new Date()\n    const roundedNow = roundDateToInterval(now, INTERVAL_MINUTES)\n\n    const buckets = (WINDOW_HOURS * 60) / INTERVAL_MINUTES\n    const data: HealthCheckData[] = []\n    const oldestLog = logs.length > 0 ? getOldestLog(logs) : null\n    for (let i = buckets - 1; i >= 0; i--) {\n        const start = new Date(roundedNow.getTime() - i * intervalMs)\n        const end = new Date(start.getTime() + intervalMs)\n\n        const bucketLogs = logs.filter(\n            (l) =>\n                l.date &&\n                new Date(l.date) >= start &&\n                new Date(l.date) < end\n        )\n\n        let status: HealthStatus = \"unknown\"\n\n        if (!oldestLog || new Date(oldestLog.date!) > start) {\n            status = \"unknown\"\n        } else if (new Date(oldestLog.date!) < start) {\n            status = \"down\"\n        }\n\n        if (bucketLogs.length > 0) {\n            const hasFailure = bucketLogs.some((l) => l.status === \"failed\")\n            const hasSuccess = bucketLogs.some((l) => l.status === \"success\")\n\n            if (hasFailure && hasSuccess) {\n                status = \"degraded\"\n            } else if (hasFailure) {\n                status = \"down\"\n            } else if (hasSuccess) {\n                status = \"healthy\"\n            }\n        }\n\n        data.push({timestamp: start, status})\n    }\n\n    return data\n}\n\nfunction getStatusColor(status: HealthStatus): string {\n    switch (status) {\n        case \"healthy\":\n            return \"bg-emerald-500\"\n        case \"degraded\":\n            return \"bg-emerald-700\"\n        case \"down\":\n            return \"bg-red-500\"\n        case \"unknown\":\n            return \"bg-zinc-700\"\n    }\n}\n\nfunction getOldestLog(logs: HealthcheckLog[]): HealthcheckLog {\n    console.log(logs)\n    const validLogs = logs.filter(l => l.date)\n\n    return validLogs.reduce((oldest, current) =>\n        new Date(current.date!) < new Date(oldest.date!) ? current : oldest\n    )\n}\n\nfunction formatTime(date: Date): string {\n    return date.toLocaleTimeString(\"en-US\", {\n        hour: \"2-digit\",\n        minute: \"2-digit\",\n        hour12: false,\n    })\n}\n\n\nexport const HealthCheckGraph = ({logs}: Props) => {\n    const data = useMemo(() => {\n        return buildTimeSeries(logs)\n    }, [logs])\n\n    const isMobile = useIsMobile()\n\n\n    const hourLabels = useMemo(() => {\n        if (data.length === 0) return []\n\n\n        return data\n            .map((item, index) => ({ item, index }))\n            .filter(({ item }) => {\n                const hours = item.timestamp.getHours()\n                const minutes = item.timestamp.getMinutes()\n                if (isMobile) {\n                    return minutes === 0 && hours % 3 === 0\n                } else {\n                    return minutes === 0\n                }\n            })\n            .map(({ item, index }) => ({\n                hour: formatTime(item.timestamp),\n                index,\n            }))\n    }, [data])\n\n    const healthyCount = data.filter((d) => d.status === \"healthy\").length\n\n    const uptimePercent =\n        data.length > 0\n            ? ((healthyCount / data.length) * 100).toFixed(1)\n            : \"0.0\"\n\n    return (\n        <div className=\"flex items-center justify-center\">\n            <div className=\"w-full\">\n                <Card className=\"h-full flex flex-col p-4 border-border/50 bg-card gap-0\">\n                    <div className=\"flex items-center justify-between mb-4\">\n                        <div>\n                            <h2 className=\"text-lg font-semibold\">Health</h2>\n                            <p className=\"text-zinc-500 text-sm\">\n                                Last 12 hours • {INTERVAL_MINUTES} minute intervals\n                            </p>\n                        </div>\n                        <div className=\"text-right\">\n                            <p className=\"text-emerald-400 text-2xl font-bold\">\n                                {uptimePercent}%\n                            </p>\n                            <p className=\"text-zinc-500 text-sm\">Uptime</p>\n                        </div>\n                    </div>\n\n\n                    <div className=\"relative mb-1 h-4 text-xs text-zinc-500\">\n                        {hourLabels.map((label, i) => {\n                            const left = (label.index / (data.length - 1)) * 100\n\n                            return (\n                                <div\n                                    key={i}\n                                    className=\"absolute -translate-x-1/2 whitespace-nowrap\"\n                                    style={{ left: `${left}%` }}\n                                >\n                                    {label.hour}\n                                </div>\n                            )\n                        })}\n                    </div>\n\n\n                    <div className=\"flex gap-0.5\">\n                        {data.map((item, index) => (\n                            <div\n                                key={index}\n                                className={`flex-1 h-8 rounded-sm ${getStatusColor(item.status)} hover:ring-2 hover:ring-zinc-400 transition-all cursor-pointer`}\n                                title={`${formatTime(item.timestamp)} - ${item.status}`}\n                            />\n                        ))}\n                    </div>\n\n                    <div className=\"flex items-center justify-end gap-4 mt-4 text-xs text-zinc-500\">\n                        <Legend color=\"bg-zinc-700\" label=\"Unknown\"/>\n                        <Legend color=\"bg-red-500\" label=\"Down\"/>\n                        <Legend color=\"bg-emerald-700\" label=\"Degraded\"/>\n                        <Legend color=\"bg-emerald-500\" label=\"Healthy\"/>\n                    </div>\n                </Card>\n            </div>\n        </div>\n    )\n}\n\nconst Legend = ({color, label}: { color: string; label: string }) => (\n    <div className=\"flex items-center gap-1.5\">\n        <div className={`w-3 h-3 rounded-sm ${color}`}/>\n        <span>{label}</span>\n    </div>\n)"
  },
  {
    "path": "src/components/wrappers/dashboard/organization/create-organisation-modal.tsx",
    "content": "\"use client\";\n\nimport {useMutation} from \"@tanstack/react-query\";\n\nimport {Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle} from \"@/components/ui/dialog\";\nimport {Button} from \"@/components/ui/button\";\nimport {Form, FormControl, FormField, FormItem, FormLabel, FormMessage, useZodForm} from \"@/components/ui/form\";\nimport {Input} from \"@/components/ui/input\";\nimport {CreateOrganizationSchema, CreateOrganizationType} from \"@/features/organization/organization.schema\";\nimport {createOrganizationAction} from \"@/features/organization/organization.action\";\nimport {useRouter} from \"next/navigation\";\nimport {useState} from \"react\";\nimport {authClient} from \"@/lib/auth/auth-client\";\nimport {toast} from \"sonner\";\n\nexport type createOrganizationModalProps = {\n    open: boolean;\n    onOpenChange: (open: boolean) => void;\n    onSuccess?: () => void;\n    redirect?: string;\n\n};\n\nexport function CreateOrganizationModal({\n                                            open,\n                                            onOpenChange,\n                                            onSuccess,\n                                            redirect = \"/dashboard/home\"\n                                        }: createOrganizationModalProps) {\n\n\n    const router = useRouter();\n\n    const form = useZodForm({\n        schema: CreateOrganizationSchema,\n    });\n\n\n    const mutation = useMutation({\n        mutationFn: async (values: CreateOrganizationType) => {\n\n            const result = await createOrganizationAction(values);\n\n            if (result?.data?.success && result.data.value) {\n                onOpenChange(false);\n                await authClient.organization.setActive({organizationSlug: result.data.value.slug});\n                onSuccess?.();\n                toast.success(result.data.actionSuccess?.message);\n                form.reset()\n                router.replace(redirect);\n            } else {\n                // @ts-ignore\n                const errorMsg = result?.data?.actionError?.message || result?.data?.actionError?.messageParams?.message || \"Failed to create the organization.\";\n                toast.error(errorMsg);\n            }\n\n        },\n    });\n\n    return (\n        <Dialog open={open} onOpenChange={(state) => {\n            form.reset()\n            onOpenChange(state)\n        }}>\n            <DialogContent className=\"sm:max-w-[425px] w-full\">\n                <DialogHeader>\n                    <DialogTitle>Create a new organization</DialogTitle>\n                </DialogHeader>\n\n                <div className=\"sm:max-w-[375px] w-full\">\n                    <Form\n                        form={form}\n                        className=\"flex flex-col gap-4\"\n                        onSubmit={async (values) => {\n                            await mutation.mutateAsync(values);\n                        }}\n                    >\n                        <FormField\n                            control={form.control}\n                            name=\"name\"\n                            defaultValue=\"\"\n                            render={({field}) => (\n                                <FormItem>\n                                    <FormLabel>Name</FormLabel>\n                                    <FormControl>\n                                        <Input {...field} />\n                                    </FormControl>\n                                    <FormMessage/>\n                                </FormItem>\n                            )}\n                        />\n                        <DialogFooter>\n                            <div className=\"flex items-center justify-between w-full\">\n                                <Button type=\"submit\">Create</Button>\n                            </div>\n                        </DialogFooter>\n                    </Form>\n                </div>\n            </DialogContent>\n        </Dialog>\n    );\n}\n"
  },
  {
    "path": "src/components/wrappers/dashboard/organization/delete-organization-button.tsx",
    "content": "\"use client\";\nimport {ButtonWithConfirm} from \"@/components/wrappers/common/button/button-with-confirm\";\nimport {deleteOrganizationAction} from \"@/features/organization/organization.action\";\nimport {useMutation} from \"@tanstack/react-query\";\nimport {useRouter} from \"next/navigation\";\nimport {toast} from \"sonner\";\nimport {authClient} from \"@/lib/auth/auth-client\";\nimport {Trash2} from \"lucide-react\";\nimport {useIsMobile} from \"@/hooks/use-mobile\";\n\nexport type DeleteOrganizationButtonProps = {\n    organizationSlug: string;\n    disabled?: boolean\n};\n\nexport const DeleteOrganizationButton = (props: DeleteOrganizationButtonProps) => {\n    const router = useRouter();\n    const isMobile = useIsMobile();\n    const {data: organizations, refetch} = authClient.useListOrganizations();\n\n    const mutation = useMutation({\n        mutationFn: () => deleteOrganizationAction({slug: props.organizationSlug}),\n\n        onSuccess: async (result) => {\n            if (result?.data?.success) {\n                await authClient.organization.setActive({\n                    organizationSlug: \"default\",\n                });\n                toast.success(result.data.actionSuccess?.message || \"Organization deleted.\");\n                router.refresh()\n                refetch()\n                router.push(\"/\");\n            } else {\n                // @ts-ignore\n                const errorMsg = result?.data?.actionError?.message || result?.data?.actionError?.messageParams?.message || \"Failed to delete the organization.\";\n                toast.error(errorMsg);\n            }\n        },\n\n        onError: (error: any) => {\n            console.error(\"Mutation network error:\", error);\n            toast.error(error?.message || \"A network error occurred.\");\n        },\n    });\n\n    return (\n\n        <ButtonWithConfirm\n            title=\"Delete Organization\"\n            description=\"Are you sure you want to remove this organization? This action cannot be undone.\"\n            button={{\n                main: {\n                    text: !isMobile ? \"Delete Organization\" : \"\",\n                    variant: \"outline\",\n                    disabled: props.disabled,\n                    icon: <Trash2 color=\"red\"/>,\n                },\n                confirm: {\n                    className: \"w-full\",\n                    text: \"Delete\",\n                    icon: <Trash2/>,\n                    variant: \"destructive\",\n                    onClick: () => {\n                        mutation.mutate();\n                    },\n                },\n                cancel: {\n                    className: \"w-full\",\n                    text: \"Cancel\",\n                    icon: <Trash2/>,\n                    variant: \"outline\",\n                },\n            }}\n            isPending={mutation.isPending}\n        />\n\n\n    );\n};\n"
  },
  {
    "path": "src/components/wrappers/dashboard/organization/migration/migration-flow.tsx",
    "content": "\"use client\"\n\nimport {\n    ArrowRight,\n    CheckCircle2,\n    Circle,\n    Loader2,\n    Play,\n    Server,\n    FolderOpen,\n    HardDrive,\n} from \"lucide-react\"\nimport {cn} from \"@/lib/utils\"\nimport {ProjectWithDatabasesAndBackups as ProjectWith} from \"@/db/schema/06_project\";\nimport {Backup, DatabaseWith} from \"@/db/schema/07_database\";\nimport {ButtonWithLoading} from \"@/components/wrappers/common/button/button-with-loading\";\n\ninterface MigrationFlowProps {\n    sourceProject: ProjectWith | null\n    sourceDatabase: DatabaseWith | null\n    selectedBackups: Backup[]\n    targetProject: ProjectWith | null\n    targetDatabase: DatabaseWith | null\n    status: MigrationStatus\n    onStartMigration: () => void\n    canStart: boolean\n}\n\nexport type MigrationStatus = \"idle\" | \"migrating\" | \"completed\" | \"error\"\n\n\nexport function MigrationFlow({\n                                  sourceProject,\n                                  sourceDatabase,\n                                  selectedBackups,\n                                  targetProject,\n                                  targetDatabase,\n                                  status,\n                                  onStartMigration,\n                                  canStart,\n                              }: MigrationFlowProps) {\n\n    const steps = [\n        {\n            id: \"source-project\",\n            label: \"Source Project\",\n            description: \"Choose source project\",\n            completed: sourceProject !== null,\n            active: status === \"idle\" && !sourceProject,\n        },\n        {\n            id: \"source-database\",\n            label: \"Source Database\",\n            description: \"Select database\",\n            completed: sourceDatabase !== null,\n            active: status === \"idle\" && sourceProject !== null && !sourceDatabase,\n        },\n        {\n            id: \"backups\",\n            label: \"Select Backups\",\n            description: \"Choose backups to migrate\",\n            completed: selectedBackups.length > 0,\n            active: status === \"idle\" && sourceDatabase !== null && selectedBackups.length === 0,\n        },\n        {\n            id: \"target-project\",\n            label: \"Target Project\",\n            description: \"Choose destination project\",\n            completed: targetProject !== null,\n            active: status === \"idle\" && selectedBackups.length > 0 && !targetProject,\n        },\n        {\n            id: \"target-database\",\n            label: \"Target Database\",\n            description: \"Select destination database\",\n            completed: targetDatabase !== null,\n            active: status === \"idle\" && targetProject !== null && !targetDatabase,\n        },\n        {\n            id: \"migrate\",\n            label: \"Migrate Data\",\n            description: \"Transfer to target\",\n            completed: status === \"completed\",\n            active: status === \"migrating\",\n        },\n    ]\n\n    return (\n        <div className=\"flex h-full flex-col rounded-xl border border-border bg-card\">\n            <div className=\"border-b border-border px-5 py-4\">\n                <div className=\"flex items-center gap-3\">\n                    <div className=\"flex h-9 w-9 items-center justify-center rounded-lg bg-primary/10\">\n                        <ArrowRight className=\"h-5 w-5 text-primary\"/>\n                    </div>\n                    <div>\n                        <h2 className=\"font-semibold text-foreground\">Migration Flow</h2>\n                        <p className=\"text-sm text-muted-foreground\">\n                            {status === \"idle\" && \"Configure your migration\"}\n                            {status === \"migrating\" && \"Migration in progress...\"}\n                            {status === \"completed\" && \"Migration completed!\"}\n                        </p>\n                    </div>\n                </div>\n            </div>\n\n            <div className=\"flex-1 overflow-y-auto p-5\">\n                <div className=\"mb-6 flex flex-col gap-3\">\n                    {steps.map((step, index) => (\n                        <div key={step.id} className=\"flex items-start gap-3\">\n                            <div className=\"flex flex-col items-center\">\n                                <div\n                                    className={cn(\n                                        \"flex h-7 w-7 items-center justify-center rounded-full border-2 transition-all\",\n                                        step.completed\n                                            ? \"border-emerald-500 bg-emerald-500 text-white\"\n                                            : step.active\n                                                ? \"border-primary bg-primary/10 text-primary\"\n                                                : \"border-muted-foreground/30 bg-muted text-muted-foreground\"\n                                    )}\n                                >\n                                    {step.completed ? (\n                                        <CheckCircle2 className=\"h-4 w-4\"/>\n                                    ) : step.active && status === \"migrating\" ? (\n                                        <Loader2 className=\"h-3.5 w-3.5 animate-spin\"/>\n                                    ) : (\n                                        <Circle className=\"h-3.5 w-3.5\"/>\n                                    )}\n                                </div>\n                                {index < steps.length - 1 && (\n                                    <div\n                                        className={cn(\n                                            \"mt-1 h-6 w-0.5\",\n                                            step.completed ? \"bg-emerald-500\" : \"bg-border\"\n                                        )}\n                                    />\n                                )}\n                            </div>\n                            <div className=\"pt-0.5\">\n                                <p\n                                    className={cn(\n                                        \"text-sm font-medium\",\n                                        step.completed || step.active\n                                            ? \"text-foreground\"\n                                            : \"text-muted-foreground\"\n                                    )}\n                                >\n                                    {step.label}\n                                </p>\n                                <p className=\"text-xs text-muted-foreground\">{step.description}</p>\n                            </div>\n                        </div>\n                    ))}\n                </div>\n\n                {(sourceProject || targetProject) && (\n                    <div className=\"mb-6 rounded-lg border border-border bg-muted/30 p-4\">\n                        <h3 className=\"mb-3 text-sm font-medium text-foreground\">\n                            Migration Summary\n                        </h3>\n                        <div className=\"flex flex-col gap-2.5 text-sm\">\n                            {/* Source */}\n                            {sourceProject && (\n                                <div className=\"flex items-start gap-2\">\n                                    <FolderOpen className=\"mt-0.5 h-4 w-4 shrink-0 text-muted-foreground\"/>\n                                    <div className=\"min-w-0\">\n                                        <span className=\"text-muted-foreground\">From: </span>\n                                        <span className=\"font-medium text-foreground\">\n                      {sourceProject.name}\n                    </span>\n                                        {sourceDatabase && (\n                                            <span className=\"text-muted-foreground\">\n                        {\" \"}/ {sourceDatabase.name}\n                      </span>\n                                        )}\n                                    </div>\n                                </div>\n                            )}\n\n                            {selectedBackups.length > 0 && (\n                                <div className=\"flex items-center gap-2\">\n                                    <HardDrive className=\"h-4 w-4 text-muted-foreground\"/>\n                                    <span className=\"text-muted-foreground\">Backups:</span>\n                                    <span className=\"font-medium text-foreground\">\n                                    {selectedBackups.length}\n                                  </span>\n                                </div>\n                            )}\n\n                            {targetProject && (\n                                <div className=\"flex items-start gap-2\">\n                                    <Server className=\"mt-0.5 h-4 w-4 shrink-0 text-muted-foreground\"/>\n                                    <div className=\"min-w-0\">\n                                        <span className=\"text-muted-foreground\">To: </span>\n                                        <span className=\"font-medium text-foreground\">\n                      {targetProject.name}\n                    </span>\n                                        {targetDatabase && (\n                                            <span className=\"text-muted-foreground\">\n                        {\" \"}/ {targetDatabase.name}\n                      </span>\n                                        )}\n                                    </div>\n                                </div>\n                            )}\n                        </div>\n                    </div>\n                )}\n\n                {status === \"completed\" && (\n                    <div className=\"mb-6 rounded-lg border border-emerald-500/20 bg-emerald-500/10 p-4\">\n                        <div className=\"flex items-center gap-2\">\n                            <CheckCircle2 className=\"h-5 w-5 text-emerald-600\"/>\n                            <span className=\"font-medium text-emerald-600\">\n                Migration completed successfully!\n              </span>\n                        </div>\n                    </div>\n                )}\n            </div>\n\n            <div className=\"border-t border-border p-5\">\n\n                <ButtonWithLoading\n                    className={cn(\n                        \"flex w-full items-center justify-center gap-2 rounded-lg px-4 py-3 font-medium transition-all\",\n                        canStart\n                            ? \"bg-primary text-primary-foreground hover:bg-primary/90\"\n                            : \"cursor-not-allowed bg-muted text-muted-foreground\"\n                    )}\n                    onClick={onStartMigration}\n                    disabled={!canStart}\n                    isPending={status === \"migrating\"}\n                    size=\"lg\"\n                    type=\"button\"\n                >\n\n                    {status === \"migrating\" ? (\n                        <>\n                            Migrating...\n                        </>\n                    ) : status === \"completed\" ? (\n                        <>\n                            <CheckCircle2 className=\"h-4 w-4\"/>\n                            Completed\n                        </>\n                    ) : (\n                        <>\n                            <Play className=\"h-4 w-4\"/>\n                            Start Migration\n                        </>\n                    )}\n                </ButtonWithLoading>\n\n                {!canStart && status === \"idle\" && (\n                    <p className=\"mt-2 text-center text-xs text-muted-foreground\">\n                        {!sourceProject\n                            ? \"Select a source project\"\n                            : !sourceDatabase\n                                ? \"Select a source database\"\n                                : selectedBackups.length === 0\n                                    ? \"Select at least one backup\"\n                                    : !targetProject\n                                        ? \"Select a target project\"\n                                        : !targetDatabase\n                                            ? \"Select a target database\"\n                                            : \"Ready to start\"}\n                    </p>\n                )}\n            </div>\n        </div>\n    )\n}\n"
  },
  {
    "path": "src/components/wrappers/dashboard/organization/migration/migration-tool.tsx",
    "content": "\"use client\"\n\nimport {useState, useMemo} from \"react\"\nimport {ProjectWithDatabasesAndBackups as ProjectWith} from \"@/db/schema/06_project\"\nimport {SourcePanel} from \"@/components/wrappers/dashboard/organization/migration/source-panel\"\nimport {Backup, DatabaseWith} from \"@/db/schema/07_database\"\nimport {MigrationFlow, MigrationStatus} from \"@/components/wrappers/dashboard/organization/migration/migration-flow\"\nimport {TargetPanel} from \"@/components/wrappers/dashboard/organization/migration/target-panel\"\nimport {useMutation} from \"@tanstack/react-query\";\nimport {toast} from \"sonner\";\nimport {migrationAction} from \"@/components/wrappers/dashboard/organization/migration/migration.action\";\nimport {useRouter} from \"next/navigation\";\n\ninterface MigrationToolProps {\n    projects: ProjectWith[]\n}\n\nexport const MigrationTool = ({projects}: MigrationToolProps) => {\n    const [sourceProject, setSourceProject] = useState<ProjectWith | null>(null)\n    const [sourceDatabase, setSourceDatabase] = useState<DatabaseWith | null>(null)\n    const [selectedBackups, setSelectedBackups] = useState<Backup[]>([])\n    const router = useRouter()\n    const [targetProject, setTargetProject] = useState<ProjectWith | null>(null)\n    const [targetDatabase, setTargetDatabase] = useState<DatabaseWith | null>(null)\n\n    const [migrationStatus, setMigrationStatus] = useState<MigrationStatus>(\"idle\")\n    const [_migrationProgress, setMigrationProgress] = useState(0)\n\n    const sourceDbKind = sourceDatabase?.dbms\n\n    const isTargetEnabled = useMemo(() => {\n        return migrationStatus === \"idle\" &&\n            sourceDatabase !== null &&\n            selectedBackups.length > 0\n    }, [sourceDatabase, migrationStatus, selectedBackups])\n\n    const filteredProjects = useMemo(() => {\n        if (!sourceDbKind) return []\n\n        return projects.map((project) => ({\n            ...project,\n            databases: project.databases.filter((db) => {\n                const sameKind = db.dbms === sourceDbKind\n                const notSource = db.id !== sourceDatabase?.id\n                return sameKind && notSource\n            }),\n        }))\n    }, [projects, sourceDbKind, sourceDatabase])\n\n    const handleSelectSourceProject = (project: ProjectWith | null) => {\n        setSourceProject(project)\n        setSourceDatabase(null)\n        setSelectedBackups([])\n        setTargetProject(null)\n        setTargetDatabase(null)\n    }\n\n    const handleSelectSourceDatabase = (database: DatabaseWith | null) => {\n        setSourceDatabase(database)\n        setSelectedBackups([])\n\n        if (targetDatabase && database?.dbms !== targetDatabase.dbms) {\n            setTargetProject(null)\n            setTargetDatabase(null)\n        }\n\n        if (targetDatabase && database?.id === targetDatabase.id) {\n            setTargetProject(null)\n            setTargetDatabase(null)\n        }\n    }\n\n    const handleSelectBackup = (backup: Backup) => {\n        setSelectedBackups((prev) => {\n            const isSelected = prev.some((b) => b.id === backup.id)\n            if (isSelected) {\n                return prev.filter((b) => b.id !== backup.id)\n            }\n            return [...prev, backup]\n        })\n    }\n\n    const handleSelectTargetProject = (project: ProjectWith | null) => {\n        setTargetProject(project)\n        setTargetDatabase(null)\n    }\n\n    const handleSelectTargetDatabase = (database: DatabaseWith | null) => {\n        setTargetDatabase(database)\n    }\n\n    const mutation = useMutation({\n        mutationFn: async () => {\n            if (selectedBackups.length === 0 || !targetDatabase) return\n            setMigrationStatus(\"migrating\")\n\n            const result = await migrationAction({\n                targetDatabaseId: targetDatabase?.id,\n                backupIds: selectedBackups.map((backup) => backup.id)\n            })\n            const inner = result?.data;\n            console.log(inner)\n            if (inner?.success) {\n                toast.success(inner.actionSuccess?.message);\n                handleReset()\n                router.refresh();\n            } else {\n                toast.error(inner?.actionError?.message);\n            }\n        },\n    });\n\n    const handleReset = () => {\n        setMigrationStatus(\"idle\")\n        setMigrationProgress(0)\n        setSelectedBackups([])\n        setSourceProject(null)\n        setSourceDatabase(null)\n        setTargetProject(null)\n        setTargetDatabase(null)\n    }\n\n    const canStartMigration =\n        selectedBackups.length > 0 &&\n        targetDatabase !== null &&\n        migrationStatus === \"idle\"\n\n    return (\n\n        <div className=\"h-full\">\n            <div className=\"flex flex-col md:grid md:grid-cols-12 gap-6 h-full\">\n                <div className=\"col-span-4\">\n                    <SourcePanel\n                        projects={projects}\n                        selectedProject={sourceProject}\n                        selectedDatabase={sourceDatabase}\n                        selectedBackups={selectedBackups}\n                        onSelectProject={handleSelectSourceProject}\n                        onSelectDatabase={handleSelectSourceDatabase}\n                        onSelectBackup={handleSelectBackup}\n                        disabled={migrationStatus !== \"idle\"}\n                    />\n                </div>\n\n                <div className=\"col-span-4\">\n                    <MigrationFlow\n                        sourceProject={sourceProject}\n                        sourceDatabase={sourceDatabase}\n                        selectedBackups={selectedBackups}\n                        targetProject={targetProject}\n                        targetDatabase={targetDatabase}\n                        status={migrationStatus}\n                        onStartMigration={() => mutation.mutateAsync()}\n                        canStart={canStartMigration}\n                    />\n                </div>\n\n                <div className=\"col-span-4 min-h-36\">\n                    <TargetPanel\n                        projects={filteredProjects}\n                        selectedProject={targetProject}\n                        selectedDatabase={targetDatabase}\n                        onSelectProject={handleSelectTargetProject}\n                        onSelectDatabase={handleSelectTargetDatabase}\n                        disabled={!isTargetEnabled}\n                    />\n                </div>\n            </div>\n        </div>\n\n    )\n}"
  },
  {
    "path": "src/components/wrappers/dashboard/organization/migration/migration.action.ts",
    "content": "\"use server\"\nimport {userAction} from \"@/lib/safe-actions/actions\";\nimport {ServerActionResult} from \"@/types/action-type\";\nimport {z} from \"zod\";\nimport {db} from \"@/db\";\nimport * as drizzleDb from \"@/db\";\nimport {eq, inArray} from \"drizzle-orm\";\nimport {dispatchStorage} from \"@/features/storages/dispatch\";\nimport {v4 as uuidv4} from \"uuid\";\nimport {getTodayISODate} from \"@/utils/date-formatting\";\nimport {withUpdatedAt} from \"@/db/utils\";\n\nexport const migrationAction = userAction.schema(\n    z.object({\n        targetDatabaseId: z.string(),\n        backupIds: z.array(z.string()),\n    })\n).action(async ({ parsedInput }): Promise<ServerActionResult<{}>> => {\n\n    const { targetDatabaseId, backupIds } = parsedInput;\n\n    let hasError = false;\n\n    try {\n\n        const targetDatabase = await db.query.database.findFirst({\n            where: eq(drizzleDb.schemas.database.id, targetDatabaseId),\n            with: {\n                project: true,\n                retentionPolicy: true,\n                alertPolicies: true,\n                storagePolicies: true\n            }\n        });\n\n        if (!targetDatabase) {\n            return {\n                success: false,\n                actionError: {\n                    message: \"Unable to find target database\",\n                    status: 404,\n                },\n            };\n        }\n\n        const backups = await db.query.backup.findMany({\n            where: inArray(drizzleDb.schemas.backup.id, backupIds),\n            with: {\n                database: true,\n                storages: true\n            }\n        });\n\n        if (backups.length !== backupIds.length) {\n            return {\n                success: false,\n                actionError: {\n                    message: \"Some backups were not found\",\n                    status: 400,\n                },\n            };\n        }\n\n        await Promise.all(\n            backups.map(async (backup) => {\n\n                const [migratedBackup] = await db\n                    .insert(drizzleDb.schemas.backup)\n                    .values({\n                        status: \"ongoing\",\n                        databaseId: targetDatabaseId,\n                        fileSize: backup.fileSize,\n                        migrated: true,\n                    })\n                    .returning();\n\n                const storageResults = await Promise.allSettled(\n                    backup.storages.map(async (storage) => {\n\n                        const [backupStorage] = await db\n                            .insert(drizzleDb.schemas.backupStorage)\n                            .values({\n                                backupId: migratedBackup.id,\n                                storageChannelId: storage.storageChannelId,\n                                status: \"pending\",\n                            })\n                            .returning();\n\n                        const fileName = `${uuidv4()}.tar.gz`;\n                        const pathTo = `backups/${getTodayISODate()}/${fileName}`;\n\n                        try {\n                            const result = await dispatchStorage(\n                                {\n                                    action: \"copy\",\n                                    data: {\n                                        from: storage.path ?? \"\",\n                                        to: pathTo,\n                                    },\n                                    metadata: {\n                                        storageId: storage.storageChannelId,\n                                        fileKind: \"backups\",\n                                    },\n                                },\n                                undefined,\n                                storage.storageChannelId\n                            );\n\n                            if (!result.success) {\n                                hasError = true;\n                                throw new Error(\"dispatchStorage failed\");\n                            }\n\n                            await db\n                                .update(drizzleDb.schemas.backupStorage)\n                                .set(\n                                    withUpdatedAt({\n                                        status: \"success\",\n                                        path: pathTo,\n                                        size: backup.fileSize,\n                                    })\n                                )\n                                .where(eq(drizzleDb.schemas.backupStorage.id, backupStorage.id));\n\n                            return { success: true };\n\n                        } catch (error) {\n\n                            hasError = true;\n\n                            await db\n                                .update(drizzleDb.schemas.backupStorage)\n                                .set(\n                                    withUpdatedAt({\n                                        status: \"failed\",\n                                    })\n                                )\n                                .where(eq(drizzleDb.schemas.backupStorage.id, backupStorage.id));\n\n                            return { success: false };\n                        }\n                    })\n                );\n\n                const failed = storageResults.some(\n                    r => r.status === \"rejected\" || (r.status === \"fulfilled\" && !r.value.success)\n                );\n\n                if (failed) hasError = true;\n\n                await db\n                    .update(drizzleDb.schemas.backup)\n                    .set(\n                        withUpdatedAt({\n                            status: failed ? \"failed\" : \"success\",\n                        })\n                    )\n                    .where(eq(drizzleDb.schemas.backup.id, migratedBackup.id));\n\n            })\n        );\n\n        if (hasError) {\n            return {\n                success: false,\n                actionError: {\n                    message: \"Migration completed with errors\",\n                    status: 500,\n                },\n            };\n        }\n\n        return {\n            success: true,\n            value: {},\n            actionSuccess: {\n                message: \"Backups successfully migrated.\",\n                messageParams: {},\n            },\n        };\n\n    } catch (error) {\n        return {\n            success: false,\n            actionError: {\n                message: \"Migration failed unexpectedly\",\n                status: 500,\n                cause: error instanceof Error ? error.message : \"Unknown error\",\n            },\n        };\n    }\n});"
  },
  {
    "path": "src/components/wrappers/dashboard/organization/migration/source-panel.tsx",
    "content": "\"use client\"\n\nimport {\n    Database,\n    HardDrive,\n    Calendar,\n    Check,\n    ChevronLeft,\n    FolderOpen,\n    Server,\n} from \"lucide-react\"\nimport {cn} from \"@/lib/utils\"\nimport {ProjectWithDatabasesAndBackups as ProjectWith} from \"@/db/schema/06_project\";\nimport {Backup, DatabaseWith} from \"@/db/schema/07_database\";\nimport {ScrollArea} from \"@/components/ui/scroll-area\";\nimport {formatLocalizedDate} from \"@/utils/date-formatting\";\nimport {formatBytes, truncateWords} from \"@/utils/text\";\n\ntype ViewState = \"projects\" | \"databases\" | \"backups\"\n\ninterface SourcePanelProps {\n    projects: ProjectWith[]\n    selectedProject: ProjectWith | null\n    selectedDatabase: DatabaseWith | null\n    selectedBackups: Backup[]\n    onSelectProject: (project: ProjectWith | null) => void\n    onSelectDatabase: (database: DatabaseWith | null) => void\n    onSelectBackup: (backup: Backup) => void\n    disabled?: boolean\n}\n\nexport function SourcePanel({\n                                projects,\n                                selectedProject,\n                                selectedDatabase,\n                                selectedBackups,\n                                onSelectProject,\n                                onSelectDatabase,\n                                onSelectBackup,\n                                disabled,\n                            }: SourcePanelProps) {\n    const currentView: ViewState = selectedDatabase\n        ? \"backups\"\n        : selectedProject\n            ? \"databases\"\n            : \"projects\"\n\n\n    const handleBack = () => {\n        if (currentView === \"backups\") {\n            onSelectDatabase(null)\n        } else if (currentView === \"databases\") {\n            onSelectProject(null)\n        }\n    }\n\n    const getHeaderInfo = () => {\n        if (currentView === \"backups\" && selectedDatabase) {\n            return {\n                title: selectedDatabase.name,\n                subtitle: selectedDatabase.backups?.length? `${selectedBackups.length} of ${selectedDatabase.backups.length} backups selected` : \"\",\n                icon: <Database className=\"h-5 w-5 text-primary\"/>,\n            }\n        }\n        if (currentView === \"databases\" && selectedProject) {\n            return {\n                title: selectedProject.name,\n                subtitle: `${selectedProject.databases.length} database${selectedProject.databases.length !== 1 ? \"s\" : \"\"} available`,\n                icon: <FolderOpen className=\"h-5 w-5 text-primary\"/>,\n            }\n        }\n        return {\n            title: \"Source\",\n            subtitle: \"Select a project to start\",\n            icon: <FolderOpen className=\"h-5 w-5 text-primary\"/>,\n        }\n    }\n\n    const headerInfo = getHeaderInfo()\n\n    return (\n        <div className=\"rounded-xl border border-border bg-card h-full flex flex-col overflow-hidden\">\n            <div className=\"border-b border-border px-5 py-4\">\n                <div className=\"flex items-center gap-3\">\n                    {currentView !== \"projects\" ? (\n                        <button\n                            onClick={handleBack}\n                            disabled={disabled}\n                            className=\"flex h-9 w-9 items-center justify-center rounded-lg bg-secondary transition-colors hover:bg-secondary/80 disabled:cursor-not-allowed disabled:opacity-50\"\n                        >\n                            <ChevronLeft className=\"h-5 w-5 text-secondary-foreground\"/>\n                        </button>\n                    ) : (\n                        <div className=\"flex h-9 w-9 items-center justify-center rounded-lg bg-primary/10\">\n                            {headerInfo.icon}\n                        </div>\n                    )}\n                    <div className=\"min-w-0 flex-1\">\n                        <h2 className=\"truncate font-semibold text-foreground\">\n                            {headerInfo.title}\n                        </h2>\n                        <p className=\"text-sm text-muted-foreground\">{headerInfo.subtitle}</p>\n                    </div>\n                </div>\n\n                {currentView !== \"projects\" && (\n                    <div className=\"mt-3 flex items-center gap-1.5 text-xs text-muted-foreground\">\n                        <button\n                            onClick={() => {\n                                onSelectDatabase(null)\n                                onSelectProject(null)\n                            }}\n                            disabled={disabled}\n                            className=\"hover:text-foreground disabled:opacity-50\"\n                        >\n                            Projects\n                        </button>\n                        {selectedProject && (\n                            <>\n                                <span>/</span>\n                                <button\n                                    onClick={() => onSelectDatabase(null)}\n                                    disabled={disabled}\n                                    className={cn(\n                                        \"truncate hover:text-foreground disabled:opacity-50\",\n                                        currentView === \"databases\" && \"text-foreground\"\n                                    )}\n                                >\n                                    {selectedProject.name}\n                                </button>\n                            </>\n                        )}\n                        {selectedDatabase && (\n                            <>\n                                <span>/</span>\n                                <span className=\"truncate text-foreground\">\n                                  {selectedDatabase.name}\n                                </span>\n                            </>\n                        )}\n                    </div>\n                )}\n            </div>\n\n            <ScrollArea\n                // Do not remove the radix scroll\n                className=\"w-full flex-1 [&>[data-radix-scroll-area-viewport]]:max-h-[calc(100vh-320px)]\"\n            >\n                <div className=\"p-4\">\n                    {currentView === \"projects\" && (\n                        <div className=\"flex flex-col gap-2\">\n                            {projects.length === 0 ? (\n                                <div\n                                    className=\"flex flex-col items-center justify-center rounded-lg border border-dashed border-border p-6 text-center\">\n                                    <p className=\"text-sm text-muted-foreground\">\n                                        No projects available\n                                    </p>\n                                </div>\n                            ) : (\n                                projects.map((project) => (\n                                    <button\n                                        key={project.id}\n                                        onClick={() => onSelectProject(project)}\n                                        disabled={disabled}\n                                        className={cn(\n                                            \"group w-full rounded-lg border border-border bg-card p-4 text-left transition-all\",\n                                            \"hover:border-primary/50 hover:bg-accent/50\",\n                                            \"focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2\",\n                                            disabled && \"cursor-not-allowed opacity-50\"\n                                        )}\n                                    >\n                                        <div className=\"flex items-start gap-3\">\n                                            <div\n                                                className=\"flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-muted\">\n                                                <Server className=\"h-5 w-5 text-muted-foreground\"/>\n                                            </div>\n                                            <div className=\"min-w-0 flex-1\">\n                                                <h3 className=\"truncate font-medium text-foreground\">\n                                                    {truncateWords(project.name, 6)}\n                                                </h3>\n\n                                                <p className=\"mt-2 text-sm text-muted-foreground\">\n                                                    {project.databases.length} database\n                                                    {project.databases.length !== 1 ? \"s\" : \"\"}\n                                                </p>\n                                            </div>\n\n                                            <ChevronLeft\n                                                className=\"h-5 w-5 rotate-180 text-muted-foreground transition-transform group-hover:translate-x-1\"/>\n                                        </div>\n                                    </button>\n                                ))\n                            )}\n                        </div>\n                    )}\n\n                    {currentView === \"databases\" && selectedProject && (\n                        <div className=\"flex flex-col gap-2\">\n                            {selectedProject.databases.length === 0 ? (\n                                <div className=\"py-8 text-center\">\n                                    <Database className=\"mx-auto h-10 w-10 text-muted-foreground/50\"/>\n                                    <p className=\"mt-2 text-sm text-muted-foreground\">\n                                        No databases in this project\n                                    </p>\n                                </div>\n                            ) : (\n                                selectedProject.databases.map((database) => (\n                                    <button\n                                        key={database.id}\n                                        onClick={() => onSelectDatabase(database)}\n                                        disabled={disabled}\n                                        className={cn(\n                                            \"group w-full rounded-lg border border-border bg-card p-4 text-left transition-all\",\n                                            \"hover:border-primary/50 hover:bg-accent/50\",\n                                            \"focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2\",\n                                            disabled && \"cursor-not-allowed opacity-50\"\n                                        )}\n                                    >\n                                        <div className=\"flex items-start gap-3\">\n                                            <div\n                                                className=\"flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-muted\">\n                                                <Database className=\"h-5 w-5 text-muted-foreground\"/>\n                                            </div>\n                                            <div className=\"min-w-0 flex-1\">\n                                                <h3 className=\"truncate font-medium text-foreground\">\n                                                    {truncateWords(database.name, 6)}\n                                                </h3>\n                                                <p className=\"mt-0.5 text-sm text-muted-foreground\">\n                                                    {database.dbms}\n                                                </p>\n                                                <p className=\"mt-2 text-sm text-muted-foreground\">\n                                                    {database?.backups?.length} backup\n                                                    {database?.backups?.length !== 1 ? \"s\" : \"\"} available\n                                                </p>\n                                            </div>\n                                            <ChevronLeft\n                                                className=\"h-5 w-5 rotate-180 text-muted-foreground transition-transform group-hover:translate-x-1\"/>\n                                        </div>\n                                    </button>\n                                ))\n                            )}\n                        </div>\n                    )}\n\n                    {currentView === \"backups\" && selectedDatabase && (\n                        <div className=\"flex flex-col gap-2\">\n                            {selectedDatabase?.backups?.length === 0 ? (\n                                <div className=\"py-8 text-center\">\n                                    <HardDrive className=\"mx-auto h-10 w-10 text-muted-foreground/50\"/>\n                                    <p className=\"mt-2 text-sm text-muted-foreground\">\n                                        No backups available for this database\n                                    </p>\n                                </div>\n                            ) : (\n                                selectedDatabase?.backups?.map((backup) => {\n                                    const isSelected = selectedBackups.some((b) => b.id === backup.id)\n                                    return (\n                                        <button\n                                            key={backup.id}\n                                            onClick={() => onSelectBackup(backup)}\n                                            disabled={disabled}\n                                            className={cn(\n                                                \"group relative w-full rounded-lg border p-4 text-left transition-all\",\n                                                \"hover:border-primary/50 hover:bg-accent/50\",\n                                                \"focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2\",\n                                                isSelected\n                                                    ? \"border-primary bg-primary/5\"\n                                                    : \"border-border bg-card\",\n                                                disabled && \"cursor-not-allowed opacity-50\"\n                                            )}\n                                        >\n                                            <div\n                                                className={cn(\n                                                    \"absolute right-3 top-3 flex h-5 w-5 items-center justify-center rounded-full border-2 transition-all\",\n                                                    isSelected\n                                                        ? \"border-primary bg-primary\"\n                                                        : \"border-muted-foreground/30 bg-transparent\"\n                                                )}\n                                            >\n                                                {isSelected && (\n                                                    <Check className=\"h-3 w-3 text-primary-foreground\"/>\n                                                )}\n                                            </div>\n\n                                            <div className=\"mb-3 pr-8\">\n                                                <h3 className=\"font-medium text-foreground\">{backup.id}</h3>\n                                            </div>\n\n                                            <div className=\"grid grid-cols-2 gap-2 text-xs\">\n                                                <div className=\"flex items-center gap-1.5 text-muted-foreground\">\n                                                    <HardDrive className=\"h-3.5 w-3.5\"/>\n                                                    <span>{formatBytes(backup.fileSize)}</span>\n                                                </div>\n                                                <div className=\"flex items-center gap-1.5 text-muted-foreground\">\n                                                    <Calendar className=\"h-3.5 w-3.5\"/>\n                                                    <span>{ formatLocalizedDate(backup.createdAt)}</span>\n                                                </div>\n                                            </div>\n                                        </button>\n                                    )\n                                })\n                            )}\n                        </div>\n                    )}\n                </div>\n            </ScrollArea>\n        </div>\n    )\n}\n"
  },
  {
    "path": "src/components/wrappers/dashboard/organization/migration/target-panel.tsx",
    "content": "\"use client\"\n\nimport {\n    Database,\n    Check,\n    ChevronLeft,\n    FolderOpen,\n    Server,\n} from \"lucide-react\"\nimport {cn} from \"@/lib/utils\"\nimport {ProjectWithDatabasesAndBackups as ProjectWith} from \"@/db/schema/06_project\";\nimport {DatabaseWith} from \"@/db/schema/07_database\";\nimport {ScrollArea} from \"@/components/ui/scroll-area\";\nimport {truncateWords} from \"@/utils/text\";\n\ntype ViewState = \"projects\" | \"databases\"\n\ninterface TargetPanelProps {\n    projects: ProjectWith[]\n    selectedProject: ProjectWith | null\n    selectedDatabase: DatabaseWith | null\n    onSelectProject: (project: ProjectWith | null) => void\n    onSelectDatabase: (database: DatabaseWith | null) => void\n    disabled?: boolean\n}\n\nexport function TargetPanel({\n                                projects,\n                                selectedProject,\n                                selectedDatabase,\n                                onSelectProject,\n                                onSelectDatabase,\n                                disabled,\n                            }: TargetPanelProps) {\n    const currentView: ViewState = selectedProject ? \"databases\" : \"projects\"\n\n    const handleBack = () => {\n        onSelectDatabase(null)\n        onSelectProject(null)\n    }\n\n    const getHeaderInfo = () => {\n        if (selectedProject) {\n            return {\n                title: selectedProject.name,\n                subtitle: selectedDatabase\n                    ? selectedDatabase.name\n                    : \"Select a target database\",\n                icon: <FolderOpen className=\"h-5 w-5 text-primary\"/>,\n            }\n        }\n        return {\n            title: \"Target\",\n            subtitle: \"Select destination project\",\n            icon: <Server className=\"h-5 w-5 text-primary\"/>,\n        }\n    }\n\n    const headerInfo = getHeaderInfo()\n\n    return (\n        <div className=\"rounded-xl border border-border bg-card h-full flex flex-col overflow-hidden\">\n            <div className=\"border-b border-border px-5 py-4\">\n                <div className=\"flex items-center gap-3\">\n                    {currentView !== \"projects\" ? (\n                        <button\n                            onClick={handleBack}\n                            disabled={disabled}\n                            className=\"flex h-9 w-9 items-center justify-center rounded-lg bg-secondary transition-colors hover:bg-secondary/80 disabled:cursor-not-allowed disabled:opacity-50\"\n                        >\n                            <ChevronLeft className=\"h-5 w-5 text-secondary-foreground\"/>\n                        </button>\n                    ) : (\n                        <div className=\"flex h-9 w-9 items-center justify-center rounded-lg bg-primary/10\">\n                            {headerInfo.icon}\n                        </div>\n                    )}\n                    <div className=\"min-w-0 flex-1\">\n                        <h2 className=\"truncate font-semibold text-foreground\">\n                            {headerInfo.title}\n                        </h2>\n                        <p className=\"text-sm text-muted-foreground\">{headerInfo.subtitle}</p>\n                    </div>\n                </div>\n\n                {currentView !== \"projects\" && (\n                    <div className=\"mt-3 flex items-center gap-1.5 text-xs text-muted-foreground\">\n                        <button\n                            onClick={handleBack}\n                            disabled={disabled}\n                            className=\"hover:text-foreground disabled:opacity-50\"\n                        >\n                            Projects\n                        </button>\n                        {selectedProject && (\n                            <>\n                                <span>/</span>\n                                <span className=\"truncate text-foreground\">\n                  {selectedProject.name}\n                </span>\n                            </>\n                        )}\n                    </div>\n                )}\n            </div>\n\n            <ScrollArea\n                // Do not remove the radix scroll\n                className=\"w-full flex-1 [&>[data-radix-scroll-area-viewport]]:max-h-[calc(100vh-320px)]\"\n            >\n                <div className=\"p-4\">\n                    {currentView === \"projects\" && (\n                        <div className=\"flex flex-col gap-2\">\n                            {projects.map((project) => (\n                                <button\n                                    key={project.id}\n                                    onClick={() => onSelectProject(project)}\n                                    disabled={disabled}\n                                    className={cn(\n                                        \"group w-full rounded-lg border border-border bg-card p-4 text-left transition-all\",\n                                        \"hover:border-primary/50 hover:bg-accent/50\",\n                                        \"focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2\",\n                                        disabled && \"cursor-not-allowed opacity-50\"\n                                    )}\n                                >\n                                    <div className=\"flex items-start gap-3\">\n                                        <div\n                                            className=\"flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-muted\">\n                                            <Server className=\"h-5 w-5 text-muted-foreground\"/>\n                                        </div>\n                                        <div className=\"min-w-0 flex-1\">\n                                            <h3 className=\"truncate font-medium text-foreground\">\n                                                {truncateWords(project.name, 6)}\n                                            </h3>\n                                            <div className=\"mt-1 flex items-center gap-2\">\n                                            </div>\n                                            <p className=\"mt-2 text-sm text-muted-foreground\">\n                                                {project.databases.length} database\n                                                {project.databases.length !== 1 ? \"s\" : \"\"}\n                                            </p>\n                                        </div>\n                                        <ChevronLeft\n                                            className=\"h-5 w-5 rotate-180 text-muted-foreground transition-transform group-hover:translate-x-1\"/>\n                                    </div>\n                                </button>\n                            ))}\n                        </div>\n                    )}\n\n                    {currentView === \"databases\" && selectedProject && (\n                        <div className=\"flex flex-col gap-2\">\n                            {selectedProject.databases.length === 0 ? (\n                                <div className=\"py-8 text-center\">\n                                    <Database className=\"mx-auto h-10 w-10 text-muted-foreground/50\"/>\n                                    <p className=\"mt-2 text-sm text-muted-foreground\">\n                                        No databases in this project\n                                    </p>\n                                </div>\n                            ) : (\n                                selectedProject.databases.map((database) => {\n                                    const isSelected = selectedDatabase?.id === database.id\n\n                                    return (\n                                        <button\n                                            key={database.id}\n                                            onClick={() => onSelectDatabase(database)}\n                                            disabled={disabled}\n                                            className={cn(\n                                                \"group relative w-full rounded-lg border p-4 text-left transition-all\",\n                                                \"focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2\",\n                                                isSelected\n                                                    ? \"border-primary bg-primary/5\"\n                                                    : \"border-border bg-card\",\n                                                (disabled) && \"cursor-not-allowed opacity-50\"\n                                            )}\n                                        >\n                                            <div\n                                                className={cn(\n                                                    \"absolute right-3 top-3 flex h-5 w-5 items-center justify-center rounded-full border-2 transition-all\",\n                                                    isSelected\n                                                        ? \"border-primary bg-primary\"\n                                                        : \"border-muted-foreground/30 bg-transparent\"\n                                                )}\n                                            >\n                                                {isSelected && (\n                                                    <Check className=\"h-3 w-3 text-primary-foreground\"/>\n                                                )}\n                                            </div>\n\n                                            <div className=\"flex items-start gap-3 pr-8\">\n                                                <div\n                                                    className=\"flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-muted\">\n                                                    <Database className=\"h-5 w-5 text-muted-foreground\"/>\n                                                </div>\n                                                <div className=\"min-w-0 flex-1\">\n                                                    <h3 className=\"truncate font-medium text-foreground\">\n                                                        {database.name}\n                                                    </h3>\n                                                    <p className=\"mt-0.5 text-sm text-muted-foreground\">\n                                                        {database.dbms}\n                                                    </p>\n                                                </div>\n                                            </div>\n                                        </button>\n                                    )\n                                })\n                            )}\n                        </div>\n                    )}\n                </div>\n            </ScrollArea>\n        </div>\n    )\n}\n"
  },
  {
    "path": "src/components/wrappers/dashboard/organization/organization-combobox.tsx",
    "content": "\"use client\"\n\nimport * as React from \"react\"\nimport {Building2, Check, ChevronsUpDown, Plus} from \"lucide-react\"\nimport {useRouter} from \"next/navigation\"\nimport {authClient} from \"@/lib/auth/auth-client\"\nimport {cn} from \"@/lib/utils\"\n\nimport {\n    DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger,\n} from \"@/components/ui/dropdown-menu\"\nimport {\n    SidebarMenuButton, useSidebar,\n} from \"@/components/ui/sidebar\"\nimport {CreateOrganizationModal} from \"@/components/wrappers/dashboard/organization/create-organisation-modal\"\nimport {Skeleton} from \"@/components/ui/skeleton\"\n\n\nexport function OrganizationCombobox() {\n    const router = useRouter()\n    const {state} = useSidebar()\n    const {data: organizations, isPending: isPendingList, refetch} = authClient.useListOrganizations()\n    const {\n        data: activeOrganization,\n        isPending: isPendingActive,\n        refetch: refetchActiveOrga\n    } = authClient.useActiveOrganization()\n    const [openModal, setOpenModal] = React.useState(false)\n    const [isOpen, setIsOpen] = React.useState(false)\n\n    const handleSelect = async (slug: string) => {\n        if (activeOrganization?.slug === slug) return\n        await authClient.organization.setActive({organizationSlug: slug})\n        router.refresh()\n        setIsOpen(false)\n    }\n\n    const handleReload = () => {\n        refetch();\n        refetchActiveOrga();\n        router.refresh();\n    };\n\n    const orgs = organizations || []\n\n    if (isPendingList || isPendingActive) {\n        return (\n            <SidebarMenuButton size=\"lg\" className=\"pointer-events-none\">\n                <Skeleton className=\"size-8 rounded-lg shrink-0\"/>\n                <div className=\"flex flex-col gap-1.5 flex-1 overflow-hidden\">\n                    <Skeleton className=\"h-4 w-24\"/>\n                    <Skeleton className=\"h-3 w-16\"/>\n                </div>\n                <Skeleton className=\"size-4 shrink-0\"/>\n            </SidebarMenuButton>\n        )\n    }\n\n\n    return (\n        <>\n            <CreateOrganizationModal\n                open={openModal}\n                onSuccess={handleReload}\n                onOpenChange={setOpenModal}\n            />\n            <DropdownMenu open={isOpen} onOpenChange={setIsOpen} >\n                <DropdownMenuTrigger data-testid=\"organization-dropdown\" asChild>\n                    <SidebarMenuButton\n                        size=\"lg\"\n                        className={cn(\n                            \"data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground transition-all duration-200 ease-in-out\",\n                            state === \"collapsed\" && \"justify-center p-0\"\n                        )}\n                    >\n                        <div className={cn(\n                            \"flex aspect-square size-8 items-center justify-center rounded-lg text-white shadow-sm transition-transform duration-200\",\n                            activeOrganization?.logo ? \"bg-transparent\" : \"bg-primary\",\n                            isOpen && \"scale-105\"\n                        )}>\n                            {activeOrganization?.logo ? (\n                                <img src={activeOrganization.logo} alt={activeOrganization.name}\n                                     className=\"size-8 rounded-lg object-cover\"/>\n                            ) : (\n                                <Building2 className=\"size-5\"/>\n                            )}\n                        </div>\n                        <div\n                            className=\"grid flex-1 text-left text-sm leading-tight group-data-[collapsible=icon]:hidden\">\n                                <span className=\"truncate font-semibold tracking-tight\">\n                                    {activeOrganization?.name || \"Select Organization\"}\n                                </span>\n                        </div>\n                        <ChevronsUpDown className=\"ml-auto size-4 opacity-50 group-data-[collapsible=icon]:hidden\"/>\n                    </SidebarMenuButton>\n                </DropdownMenuTrigger>\n                <DropdownMenuContent\n                    className=\"w-[var(--radix-popper-anchor-width)] rounded-xl border-2 border-border bg-popover shadow-none\"\n                    align=\"start\"\n                    side=\"bottom\"\n                    sideOffset={4}\n                >\n                    {orgs.map((org) => {\n                        const isActive = activeOrganization?.id === org.id;\n                        return (\n                            <DropdownMenuItem\n                                key={org.id}\n                                onClick={() => handleSelect(org.slug)}\n                                className={cn(\n                                    \"group gap-2 p-1 cursor-pointer rounded-lg mb-1 last:mb-0 transition-colors\",\n                                    isActive\n                                        ? \"bg-primary/10 text-primary border border-primary/20\"\n                                        : \"focus:bg-accent hover:bg-accent/50 border border-transparent\"\n                                )}>\n                                <div className={cn(\n                                    \"flex size-9 shrink-0 items-center justify-center rounded-md border shadow-sm transition-all group-hover:shadow-md\",\n                                    org.logo ? \"bg-transparent border-transparent\" : \"\",\n                                    isActive && !org.logo ? \"bg-primary text-primary-foreground border-primary/30\" : \"bg-muted/50 border-border\"\n                                )}>\n                                    {org.logo ? (\n                                        <img src={org.logo} alt={org.name} className=\"size-9 rounded-md object-cover\"/>\n                                    ) : (\n                                        <Building2 className={cn(\n                                            \"size-5\",\n                                            isActive ? \"text-primary-foreground\" : \"text-muted-foreground\"\n                                        )}/>\n                                    )}\n                                </div>\n                                <div className=\"flex flex-col gap-0.5 flex-1 min-w-0\">\n                                    <span className={cn(\n                                        \"text-sm max-w-42.5 truncate font-medium leading-none\",\n                                        isActive ? \"text-primary\" : \"\"\n                                    )}>{org.name}</span>\n                                </div>\n                                {isActive && (\n                                    <div\n                                        className=\"ml-auto flex size-5 items-center justify-center rounded-full bg-primary shadow-sm\">\n                                        <Check className=\"size-3 text-primary-foreground\" strokeWidth={3}/>\n                                    </div>\n                                )}\n                            </DropdownMenuItem>\n                        )\n                    })}\n                    <DropdownMenuSeparator className=\"my-2 bg-border/50\"/>\n                    <DropdownMenuItem\n                        className=\"gap-3 p-2.5 cursor-pointer text-muted-foreground focus:text-foreground group rounded-lg\"\n                        onClick={() => setOpenModal(true)}\n                    >\n                        <div\n                            className=\"flex size-9 items-center justify-center rounded-md border border-dashed border-muted-foreground/30 bg-background transition-colors group-hover:border-primary/50 group-hover:bg-primary/5\">\n                            <Plus className=\"size-4\"/>\n                        </div>\n                        <div className=\"font-medium\">Create organization</div>\n                    </DropdownMenuItem>\n                </DropdownMenuContent>\n            </DropdownMenu>\n        </>\n    )\n}"
  },
  {
    "path": "src/components/wrappers/dashboard/organization/settings/columns-organization-members.tsx",
    "content": "\"use client\";\n\nimport { ColumnDef } from \"@tanstack/react-table\";\nimport { MemberWithUser } from \"@/db/schema/03_organization\";\nimport { useState } from \"react\";\nimport { authClient, useSession } from \"@/lib/auth/auth-client\";\nimport { useMutation } from \"@tanstack/react-query\";\nimport { toast } from \"sonner\";\nimport { Badge } from \"@/components/ui/badge\";\nimport {\n    Tooltip,\n    TooltipContent,\n    TooltipProvider,\n    TooltipTrigger,\n} from \"@/components/ui/tooltip\";\nimport {updateMemberRoleAction} from \"@/components/wrappers/dashboard/organization/settings/update-member.action\";\nimport {RoleSchemaMember} from \"@/components/wrappers/dashboard/organization/settings/member.schema\";\n\nexport const organizationMemberColumns: ColumnDef<MemberWithUser>[] = [\n    {\n        accessorKey: \"role\",\n        header: \"Role\",\n        cell: ({ row }) => {\n            const [role, setRole] = useState<string>(row.getValue(\"role\"));\n            const { data: session } = useSession();\n            const activeOrgaMember = authClient.useActiveMember();\n\n            const updateMutation = useMutation({\n                mutationFn: () =>\n                    updateMemberRoleAction({\n                        memberId: row.original.id,\n                        organizationId: row.original.organizationId,\n                        role: RoleSchemaMember.parse(role),\n                    }),\n                onSuccess: () => {\n                    toast.success(\"User updated successfully.\");\n                },\n                onError: () => {\n                    toast.error(\"An error occurred while updating user information.\");\n                },\n            });\n\n            // Only allow cycling between admin <-> member\n            const handleUpdateRole = async () => {\n                const nextRole = role === \"admin\" ? \"member\" : \"admin\";\n                setRole(nextRole);\n                await updateMutation.mutateAsync();\n            };\n\n            const isCurrentUser = session?.user.email === row.original.user.email;\n            const isMember = activeOrgaMember.data?.role === \"member\";\n            const isRowRoleOwner = role === \"owner\";\n\n            const isDisabled = isMember || isCurrentUser || isRowRoleOwner;\n\n            // Dynamic tooltip reason\n            const disabledReason = isCurrentUser\n                ? \"You cannot change your own role\"\n                : isRowRoleOwner\n                    ? \"Owner role cannot be modified\"\n                    : \"Members cannot edit roles\";\n\n            const badge = (\n                <Badge\n                    className={\n                        isDisabled\n                            ? \"cursor-not-allowed opacity-50\"\n                            : \"cursor-pointer hover:bg-accent\"\n                    }\n                    onClick={isDisabled ? undefined : handleUpdateRole}\n                    variant=\"outline\"\n                >\n                    {role}\n                </Badge>\n            );\n\n            return isDisabled ? (\n                <TooltipProvider>\n                    <Tooltip>\n                        <TooltipTrigger asChild>{badge}</TooltipTrigger>\n                        <TooltipContent>\n                            <p>{disabledReason}</p>\n                        </TooltipContent>\n                    </Tooltip>\n                </TooltipProvider>\n            ) : (\n                badge\n            );\n        },\n    },\n    {\n        accessorKey: \"user.name\",\n        header: \"Name\",\n    },\n    {\n        accessorKey: \"user.email\",\n        header: \"Email\",\n    },\n];"
  },
  {
    "path": "src/components/wrappers/dashboard/organization/settings/member.schema.ts",
    "content": "import {z} from \"zod\";\n\nconst RoleEnum = z.enum([\"member\", \"owner\", \"admin\"]);\n\nexport const RoleSchemaMember = z.union([\n    RoleEnum,\n    z.array(RoleEnum)\n]);"
  },
  {
    "path": "src/components/wrappers/dashboard/organization/settings/settings-organization-members-table.tsx",
    "content": "import {DataTable} from \"@/components/wrappers/common/table/data-table\";\nimport {MemberWithUser, OrganizationWithMembers} from \"@/db/schema/03_organization\";\nimport {\n    organizationMemberColumns\n} from \"@/components/wrappers/dashboard/organization/settings/columns-organization-members\";\n\ninterface SettingsOrganizationMembersTableProps {\n    organization: OrganizationWithMembers\n}\n\nexport const SettingsOrganizationMembersTable = ({organization}: SettingsOrganizationMembersTableProps) => {\n    return (\n        <div className=\"flex flex-col h-full \">\n            <div className=\" h-full\">\n                <DataTable\n                    columns={organizationMemberColumns}\n                    enableSelect={false}\n                    data={organization.members as MemberWithUser[]}/>\n            </div>\n        </div>\n    )\n}"
  },
  {
    "path": "src/components/wrappers/dashboard/organization/settings/update-member.action.ts",
    "content": "\"use server\";\nimport {userAction} from \"@/lib/safe-actions/actions\";\nimport {z} from \"zod\";\nimport {auth} from \"@/lib/auth/auth\";\nimport {ServerActionResult} from \"@/types/action-type\";\nimport {Member} from \"better-auth/plugins\";\nimport {headers} from \"next/headers\";\nimport {RoleSchemaMember} from \"@/components/wrappers/dashboard/organization/settings/member.schema\";\n\n\nexport const updateMemberRoleAction = userAction.schema(\n    z.object({\n        memberId: z.string(),\n        organizationId: z.string(),\n        role: RoleSchemaMember,\n    })\n).action(async ({parsedInput}): Promise<ServerActionResult<Member>> => {\n    try {\n        const updatedMember = await auth.api.updateMemberRole({\n            body: {\n                role: parsedInput.role,\n                memberId: parsedInput.memberId,\n                organizationId: parsedInput.organizationId,\n            },\n            headers: await headers(),\n        });\n\n        return {\n            success: true,\n            value: updatedMember,\n            actionSuccess: {\n                message: \"Member has been successfully updated.\",\n                messageParams: {},\n            },\n        };\n    } catch (error) {\n        return {\n            success: false,\n            actionError: {\n                message: \"Failed to update member role.\",\n                status: 500,\n                cause: error instanceof Error ? error.message : \"Unknown error\",\n                messageParams: {},\n            },\n        };\n    }\n});\n"
  },
  {
    "path": "src/components/wrappers/dashboard/organization/tabs/organization-channels-tab/organization-agents-tab.tsx",
    "content": "import {OrganizationWithMembers} from \"@/db/schema/03_organization\";\nimport {cn} from \"@/lib/utils\";\nimport {Agent} from \"@/db/schema/08_agent\";\nimport {CardsWithPagination} from \"@/components/wrappers/common/cards-with-pagination\";\nimport {AgentCard} from \"@/components/wrappers/dashboard/agent/agent-card/agent-card\";\nimport {AgentDialog} from \"@/features/agents/components/agent.dialog\";\n\nexport type OrganizationAgentsTabProps = {\n    organization: OrganizationWithMembers;\n    agents: Agent[];\n};\n\nexport const OrganizationAgentsTab = ({\n                                             organization,\n                                             agents,\n                                         }: OrganizationAgentsTabProps) => {\n\n    const hasAgent = agents.length > 0;\n    return (\n        <div className=\"flex flex-col gap-y-6 h-full py-4\">\n            <div className=\"h-full flex flex-col gap-y-6\">\n                <div className={cn(\"hidden flex-row justify-between items-start\", hasAgent && \"flex\")}>\n                    <div className=\"max-w-2xl \">\n                        <h3 className=\"text-xl font-semibold text-balance mb-1\">\n                            Agent Settings\n                        </h3>\n                    </div>\n                    <AgentDialog organization={organization} typeTrigger=\"create\"/>\n                </div>\n                {hasAgent ? (\n                    <CardsWithPagination data={agents} organizationView={true} cardItem={AgentCard} cardsPerPage={4} numberOfColumns={1}/>\n                ) : (\n                    <AgentDialog organization={organization} typeTrigger=\"empty\"/>\n                )}\n            </div>\n        </div>\n    );\n};"
  },
  {
    "path": "src/components/wrappers/dashboard/organization/tabs/organization-channels-tab/organization-notifiers-tab.tsx",
    "content": "import {OrganizationWithMembers} from \"@/db/schema/03_organization\";\nimport {NotificationChannel} from \"@/db/schema/09_notification-channel\";\nimport {CardsWithPagination} from \"@/components/wrappers/common/cards-with-pagination\";\nimport {EmptyStatePlaceholder} from \"@/components/wrappers/common/empty-state-placeholder\";\nimport {useState} from \"react\";\nimport {cn} from \"@/lib/utils\";\nimport {ChannelAddEditModal} from \"@/components/wrappers/dashboard/admin/channels/channel/channel-add-edit-modal\";\nimport {ChannelCard} from \"@/components/wrappers/dashboard/admin/channels/channel/channel-card/channel-card\";\n\nexport type OrganizationNotifiersTabProps = {\n    organization: OrganizationWithMembers;\n    notificationChannels: NotificationChannel[];\n};\n\nexport const OrganizationNotifiersTab = ({\n                                             organization,\n                                             notificationChannels,\n                                         }: OrganizationNotifiersTabProps) => {\n    const [isAddModalOpen, setIsAddModalOpen] = useState(false);\n\n    const hasNotifiers = notificationChannels.length > 0;\n    const kind=\"notification\"\n    return (\n        <div className=\"flex flex-col gap-y-6 h-full py-4\">\n            <div className=\"h-full flex flex-col gap-y-6\">\n                <div className={cn(\"hidden flex-row justify-between items-start\", hasNotifiers && \"flex\")}>\n                    <div className=\"max-w-2xl \">\n                        <h3 className=\"text-xl font-semibold text-balance mb-1\">\n                            Notification Settings\n                        </h3>\n                    </div>\n                    <ChannelAddEditModal\n                        kind={kind}\n                        organization={organization}\n                        open={isAddModalOpen}\n                        onOpenChangeAction={setIsAddModalOpen}\n                    />\n                </div>\n                {hasNotifiers ? (\n                    <div className=\"h-full\">\n                        <CardsWithPagination\n                            data={notificationChannels}\n                            cardItem={ChannelCard}\n                            cardsPerPage={8}\n                            numberOfColumns={2}\n                            organization={organization}\n                            kind={kind}\n                        />\n                    </div>\n                ) : (\n                    <EmptyStatePlaceholder\n                        text=\"No notification channels configured yet\"\n                        onClick={() => setIsAddModalOpen(true)}\n                        className=\"h-full\"\n                    />\n                )}\n            </div>\n        </div>\n    );\n};"
  },
  {
    "path": "src/components/wrappers/dashboard/organization/tabs/organization-channels-tab/organization-storages-tab.tsx",
    "content": "import {OrganizationWithMembers} from \"@/db/schema/03_organization\";\nimport {CardsWithPagination} from \"@/components/wrappers/common/cards-with-pagination\";\nimport {EmptyStatePlaceholder} from \"@/components/wrappers/common/empty-state-placeholder\";\nimport {useState} from \"react\";\nimport {cn} from \"@/lib/utils\";\nimport {ChannelAddEditModal} from \"@/components/wrappers/dashboard/admin/channels/channel/channel-add-edit-modal\";\nimport {ChannelCard} from \"@/components/wrappers/dashboard/admin/channels/channel/channel-card/channel-card\";\nimport {StorageChannel} from \"@/db/schema/12_storage-channel\";\n\nexport type OrganizationNotifiersTabProps = {\n    organization: OrganizationWithMembers;\n    storageChannels: StorageChannel[];\n};\n\nexport const OrganizationStoragesTab = ({\n                                            organization,\n                                            storageChannels,\n                                        }: OrganizationNotifiersTabProps) => {\n    const [isAddModalOpen, setIsAddModalOpen] = useState(false);\n\n    const hasNotifiers = storageChannels.length > 0;\n    const kind = \"storage\"\n    return (\n        <div className=\"flex flex-col gap-y-6 h-full py-4\">\n            <div className=\"h-full flex flex-col gap-y-6\">\n                <div className={cn(\"hidden flex-row justify-between items-start\", hasNotifiers && \"flex\")}>\n                    <div className=\"max-w-2xl \">\n                        <h3 className=\"text-xl font-semibold text-balance mb-1\">\n                            Notification Settings\n                        </h3>\n                    </div>\n                    <ChannelAddEditModal\n                        kind={kind}\n                        organization={organization}\n                        open={isAddModalOpen}\n                        onOpenChangeAction={setIsAddModalOpen}\n                    />\n                </div>\n                {hasNotifiers ? (\n                    <div className=\"h-full\">\n                        <CardsWithPagination\n                            data={storageChannels}\n                            cardItem={ChannelCard}\n                            cardsPerPage={8}\n                            numberOfColumns={2}\n                            organization={organization}\n                            kind={kind}\n                        />\n                    </div>\n                ) : (\n                    <EmptyStatePlaceholder\n                        text=\"No storage channels configured yet\"\n                        onClick={() => setIsAddModalOpen(true)}\n                        className=\"h-full\"\n                    />\n                )}\n            </div>\n        </div>\n    );\n};"
  },
  {
    "path": "src/components/wrappers/dashboard/organization/tabs/organization-tabs.tsx",
    "content": "\"use client\";\n\nimport {Tabs, TabsContent, TabsList, TabsTrigger} from \"@/components/ui/tabs\";\nimport {useEffect, useState} from \"react\";\nimport {useRouter, useSearchParams} from \"next/navigation\";\nimport {MemberWithUser, OrganizationWithMembers} from \"@/db/schema/03_organization\";\nimport {NotificationChannel} from \"@/db/schema/09_notification-channel\";\nimport {useOrganizationPermissions} from \"@/hooks/use-organization-permissions\";\nimport {StorageChannel} from \"@/db/schema/12_storage-channel\";\nimport {\n    SettingsOrganizationMembersTable\n} from \"@/components/wrappers/dashboard/organization/settings/settings-organization-members-table\";\nimport {\n    OrganizationNotifiersTab\n} from \"@/components/wrappers/dashboard/organization/tabs/organization-channels-tab/organization-notifiers-tab\";\nimport {\n    OrganizationStoragesTab\n} from \"@/components/wrappers/dashboard/organization/tabs/organization-channels-tab/organization-storages-tab\";\nimport {\n    OrganizationAgentsTab\n} from \"@/components/wrappers/dashboard/organization/tabs/organization-channels-tab/organization-agents-tab\";\nimport {Agent} from \"@/db/schema/08_agent\";\n\nexport type OrganizationTabsProps = {\n    organization: OrganizationWithMembers;\n    notificationChannels: NotificationChannel[];\n    storageChannels: StorageChannel[];\n    activeMember: MemberWithUser;\n    agents: Agent[]\n};\n\nexport const OrganizationTabs = ({\n                                     activeMember,\n                                     organization,\n                                     notificationChannels,\n                                     storageChannels,\n                                     agents\n                                 }: OrganizationTabsProps) => {\n    const router = useRouter();\n    const searchParams = useSearchParams();\n\n    const [tab, setTab] = useState<string>(() => searchParams.get(\"tab\") ?? \"users\");\n\n    const {\n        canManageNotifications,\n        canManageStorages\n    } = useOrganizationPermissions(activeMember);\n\n\n    useEffect(() => {\n        const newTab = searchParams.get(\"tab\") ?? \"users\";\n        setTab(newTab);\n    }, [searchParams]);\n\n    const handleChangeTab = (value: string) => {\n        router.push(`?tab=${value}`);\n    };\n\n\n    return (\n        <div className=\"h-full\">\n            {(canManageNotifications && canManageStorages) ?\n                <Tabs className=\"h-full\" value={tab} onValueChange={handleChangeTab}>\n                    <TabsList className=\"w-full\">\n                        <TabsTrigger\n                            className=\"w-full\"\n                            value=\"users\"\n                        >\n                            Users\n                        </TabsTrigger>\n\n                        <TabsTrigger\n                            className=\"w-full\"\n                            value=\"notifications\"\n                        >\n                            Notifiers\n                        </TabsTrigger>\n                        <TabsTrigger\n                            className=\"w-full\"\n                            value=\"storages\"\n                        >\n                            Storages\n                        </TabsTrigger>\n                        <TabsTrigger\n                            className=\"w-full\"\n                            value=\"agents\"\n                        >\n                            Agents\n                        </TabsTrigger>\n                    </TabsList>\n                    <TabsContent className=\"h-full\" value=\"users\">\n                        <SettingsOrganizationMembersTable organization={organization}/>\n                    </TabsContent>\n                    <TabsContent className=\"h-full\" value=\"notifications\">\n                        <OrganizationNotifiersTab\n                            organization={organization}\n                            notificationChannels={notificationChannels}\n                        />\n                    </TabsContent>\n                    <TabsContent className=\"h-full\" value=\"storages\">\n                        <OrganizationStoragesTab\n                            organization={organization}\n                            storageChannels={storageChannels}\n                        />\n                    </TabsContent>\n                    <TabsContent className=\"h-full\" value=\"agents\">\n                        <OrganizationAgentsTab\n                            organization={organization}\n                            agents={agents}\n                        />\n                    </TabsContent>\n                </Tabs>\n                :\n                <SettingsOrganizationMembersTable organization={organization}/>\n            }\n\n\n        </div>\n\n\n    );\n};\n"
  },
  {
    "path": "src/components/wrappers/dashboard/profile/actions/avatar.action.ts",
    "content": "\"use server\";\nimport { db } from \"@/db\";\nimport {userAction} from \"@/lib/safe-actions/actions\";\nimport { eq } from \"drizzle-orm\";\nimport { z } from \"zod\";\nimport * as drizzleDb from \"@/db\";\n\n\nexport const updateImageUserAction = userAction.schema(z.string()).action(async ({ parsedInput, ctx }) => {\n    const [updatedUser] = await db.update(drizzleDb.schemas.user).set({ image: parsedInput }).where(eq(drizzleDb.schemas.user.id, ctx.user.id)).returning();\n\n    return {\n        data: updatedUser,\n    };\n});\n"
  },
  {
    "path": "src/components/wrappers/dashboard/profile/actions/profile.action.ts",
    "content": "\"use server\";\n\nimport { db } from \"@/db\";\nimport { eq } from \"drizzle-orm\";\nimport { ServerActionResult } from \"@/types/action-type\";\nimport { z } from \"zod\";\nimport { headers } from \"next/headers\";\nimport { auth } from \"@/lib/auth/auth\";\nimport { user } from \"@/db/schema/02_user\";\nimport {userAction} from \"@/lib/safe-actions/actions\";\n\nconst UpdateProfileSchema = z.object({\n    name: z.string().optional(),\n});\n\nexport const updateProfileSettingsAction = userAction.schema(UpdateProfileSchema).action(async ({ parsedInput }): Promise<ServerActionResult<{}>> => {\n    try {\n        const session = await auth.api.getSession({\n            headers: await headers(),\n        });\n\n        if (!session) {\n            return {\n                success: false,\n                actionError: {\n                    message: \"unauthorized\",\n                    cause: \"User not authenticated\",\n                },\n            };\n        }\n\n        await db\n            .update(user)\n            .set({\n                ...(parsedInput.name ? { name: parsedInput.name } : {}),\n            })\n            .where(eq(user.id, session.user.id));\n\n        return {\n            success: true,\n            value: {},\n            actionSuccess: {\n                message: \"profile_updated\",\n            },\n        };\n    } catch (error) {\n        return {\n            success: false,\n            actionError: {\n                message: \"error_updating_profile\",\n                cause: error instanceof Error ? error.message : \"Unknown error\",\n            },\n        };\n    }\n});\n"
  },
  {
    "path": "src/components/wrappers/dashboard/profile/actions/provider.action.ts",
    "content": "\"use server\";\n\nimport { ServerActionResult } from \"@/types/action-type\";\nimport { headers } from \"next/headers\";\nimport { auth } from \"@/lib/auth/auth\";\nimport z from \"zod\";\nimport { zPassword } from \"@/lib/zod\";\nimport {userAction} from \"@/lib/safe-actions/actions\";\n\nexport const linkPasswordProfileProviderAction = userAction\n    .schema(\n        z.object({\n            password: zPassword(),\n        })\n    )\n    .action(async ({ parsedInput }): Promise<ServerActionResult<null>> => {\n        try {\n            const session = await auth.api.getSession({\n                headers: await headers(),\n            });\n\n            if (!session) {\n                return {\n                    success: false,\n                    actionError: {\n                        message: \"unauthorized\",\n                        cause: \"User not authenticated\",\n                    },\n                };\n            }\n\n            await auth.api.setPassword({\n                headers: await headers(),\n                body: {\n                    newPassword: parsedInput.password,\n                },\n            });\n            return {\n                success: true,\n                actionSuccess: {\n                    message: \"profile_updated\",\n                },\n            };\n        } catch (error) {\n            return {\n                success: false,\n                actionError: {\n                    message: \"error_updating_profile\",\n                    cause: error instanceof Error ? error.message : \"Unknown error\",\n                },\n            };\n        }\n    });\n"
  },
  {
    "path": "src/components/wrappers/dashboard/profile/actions/security.action.ts",
    "content": "\"use server\";\n\nimport { ServerActionResult } from \"@/types/action-type\";\nimport { z } from \"zod\";\nimport { headers } from \"next/headers\";\nimport { auth, getPasskeys, revokePasskey } from \"@/lib/auth/auth\";\nimport { userAction } from \"@/lib/safe-actions/actions\";\n\nconst RevokeSessionSchema = z.object({\n    token: z.string(),\n});\n\nconst RevokePasskeySchema = z.object({\n    id: z.string(),\n});\n\n\nexport const revokeSessionAction = userAction.schema(RevokeSessionSchema).action(async ({ parsedInput }): Promise<ServerActionResult<{}>> => {\n    try {\n        const session = await auth.api.getSession({\n            headers: await headers(),\n        });\n\n        if (!session) {\n            return {\n                success: false,\n                actionError: {\n                    message: \"unauthorized\",\n                    cause: \"User not authenticated\",\n                },\n            };\n        }\n\n        await auth.api.revokeSession({\n            body: {\n                token: parsedInput.token,\n            },\n            headers: await headers(),\n        });\n\n        return {\n            success: true,\n            value: {},\n            actionSuccess: {\n                message: \"session_revoked\",\n            },\n        };\n    } catch (error) {\n        return {\n            success: false,\n            actionError: {\n                message: \"error_revoking_session\",\n                cause: error instanceof Error ? error.message : \"Unknown error\",\n            },\n        };\n    }\n});\n\nexport const revokeAllSessionsAction = userAction.action(async (): Promise<ServerActionResult<{}>> => {\n    try {\n        const session = await auth.api.getSession({\n            headers: await headers(),\n        });\n\n        if (!session) {\n            return {\n                success: false,\n                actionError: {\n                    message: \"unauthorized\",\n                    cause: \"User not authenticated\",\n                },\n            };\n        }\n\n        const sessions = await auth.api.listSessions({\n            headers: await headers(),\n        });\n\n        const otherSessions = sessions.filter((s) => s.token !== session.session.token);\n\n        for (const s of otherSessions) {\n            await auth.api.revokeSession({\n                body: {\n                    token: s.token,\n                },\n                headers: await headers(),\n            });\n        }\n\n        return {\n            success: true,\n            value: {},\n            actionSuccess: {\n                message: \"other_sessions_revoked\",\n            },\n        };\n    } catch (error) {\n        return {\n            success: false,\n            actionError: {\n                message: \"error_revoking_other_sessions\",\n                cause: error instanceof Error ? error.message : \"Unknown error\",\n            },\n        };\n    }\n});\n\n\nexport const getPasskeysAction = userAction.action(async (): Promise<ServerActionResult<any[]>> => {\n    try {\n        const passkeys = await getPasskeys();\n        return {\n            success: true,\n            value: passkeys || [],\n            actionSuccess: {\n                message: \"passkeys_fetched\",\n            },\n        };\n    } catch (error) {\n        return {\n            success: false,\n            actionError: {\n                message: \"error_fetching_passkeys\",\n                cause: error instanceof Error ? error.message : \"Unknown error\",\n            },\n        };\n    }\n});\n\nexport const revokePasskeyAction = userAction.schema(RevokePasskeySchema).action(async ({ parsedInput }): Promise<ServerActionResult<{}>> => {\n    try {\n        await revokePasskey(parsedInput.id);\n        return {\n            success: true,\n            value: {},\n            actionSuccess: {\n                message: \"passkey_revoked\",\n            },\n        };\n    } catch (error) {\n        return {\n            success: false,\n            actionError: {\n                message: \"error_revoking_passkey\",\n                cause: error instanceof Error ? error.message : \"Unknown error\",\n            },\n        };\n    }\n});"
  },
  {
    "path": "src/components/wrappers/dashboard/profile/components/avatar-with-upload.tsx",
    "content": "\"use client\";\nimport {Avatar, AvatarFallback, AvatarImage} from \"@/components/ui/avatar\";\nimport {UploadIcon} from \"lucide-react\";\nimport {toast} from \"sonner\";\nimport {uploadUserImageAction} from \"@/features/upload/public/upload.action\";\nimport {useMutation} from \"@tanstack/react-query\";\nimport {updateImageUserAction} from \"@/components/wrappers/dashboard/profile/actions/avatar.action\";\nimport {useRouter} from \"next/navigation\";\nimport {User} from \"@/db/schema/02_user\";\nimport React, {ChangeEvent} from \"react\";\n\nexport type AvatarWithUploadProps = {\n    user: User;\n};\n\nexport const AvatarWithUpload = (props: AvatarWithUploadProps) => {\n    const user = props.user;\n    const router = useRouter();\n\n    const submitImage = useMutation({\n        mutationFn: async (file: File) => {\n            const formData = new FormData();\n            formData.set(\"file\", file);\n            const result = await uploadUserImageAction(formData);\n\n            const inner = result?.data;\n\n            if (inner?.success) {\n\n                const updateUser = await updateImageUserAction(inner.value ?? \"\");\n                const dataUser = updateUser?.data;\n\n                if (updateUser?.serverError || !dataUser) {\n                    toast.error(updateUser?.serverError);\n                    return;\n                }\n\n                toast.success(inner.actionSuccess?.message);\n                router.refresh();\n            } else {\n                toast.error(inner?.actionError?.message);\n            }\n\n\n        },\n    });\n\n    const handleImageUpload = async (event: ChangeEvent<HTMLInputElement>) => {\n        const file = event.target.files?.[0];\n        if (!file) return;\n\n        const allowedFormats = [\"image/jpeg\", \"image/png\", \"image/webp\"];\n\n        if (!allowedFormats.includes(file.type)) {\n            toast.error(\"Only JPG, PNG or WebP images are allowed.\");\n            return;\n        }\n\n        const maxSizeInMB = 5;\n        if (file.size > maxSizeInMB * 1024 * 1024) {\n            toast.error(`Image must be smaller than ${maxSizeInMB}MB.`);\n            return;\n        }\n\n        submitImage.mutate(file);\n    };\n\n\n\n    return (\n        <div className=\"relative \">\n\n            <Avatar className=\"w-24 h-24 lg:w-32 lg:h-32 border-4 border-muted/20\">\n                <AvatarImage className=\"object-cover\" src={user.image || undefined}/>\n                <AvatarFallback className=\"text-3xl\">{user.name.charAt(0).toUpperCase()}</AvatarFallback>\n            </Avatar>\n\n            <div\n                onClick={() => {\n                    const fileInput = document.createElement(\"input\");\n                    fileInput.type = \"file\";\n                    fileInput.accept = \".jpg,.jpeg,.png,.webp\";\n                    // @ts-ignore\n                    fileInput.onchange = handleImageUpload;\n                    fileInput.click();\n                }}\n                className=\"cursor-pointer absolute inset-0 flex justify-center items-center opacity-0 transition-opacity hover:opacity-30 hover:bg-gray-500 hover:bg-opacity-50 rounded-full w-24 h-24 lg:w-32 lg:h-32\"\n            >\n                <UploadIcon className=\"w-12 h-12 lg:w-16 lg:h-16 text-primary\"/>\n            </div>\n        </div>\n    );\n};\n"
  },
  {
    "path": "src/components/wrappers/dashboard/profile/components/backup-codes-list.tsx",
    "content": "\"use client\";\n\nimport { Button } from \"@/components/ui/button\";\nimport { AlertTriangle, Copy, Download } from \"lucide-react\";\nimport { toast } from \"sonner\";\nimport { humanReadableDate } from \"@/utils/date-formatting\";\n\ntype BackupCodesListProps = {\n    codes: string[];\n    className?: string;\n};\n\nexport function BackupCodesList({ codes, className }: BackupCodesListProps) {\n\n    const handleCopyBackupCodes = () => {\n        navigator.clipboard.writeText(codes.join(\"\\n\"));\n        toast.success(\"Backup codes copied to clipboard\");\n    };\n\n    if (!codes.length) return null;\n\n    const handleDownload = () => {\n        const header =\"Your Backup Codes\" + \"\\n\\n\";\n        const content = `Backup Code: ${codes.join(\"\\n\")}`;\n        const footer = \"\\n\\n\" + `Keep these codes in a safe place. They can be used to access your account if you lose access to your authentication device. Generated on ${humanReadableDate(new Date())}.`;\n        const text = header + content + footer;\n\n        const blob = new Blob([text], { type: \"text/plain\" });\n        const url = URL.createObjectURL(blob);\n        const a = document.createElement(\"a\");\n        a.href = url;\n        a.download = `backup-codes.txt`;\n        document.body.appendChild(a);\n        a.click();\n        document.body.removeChild(a);\n        URL.revokeObjectURL(url);\n        toast.success(\"Backup codes downloaded\");\n    };\n\n\n\n    return (\n        <div className={`space-y-4 ${className}`}>\n            <div className=\"space-y-2\">\n                <div className=\"flex items-center justify-between\">\n                    <h4 className=\"text-sm font-medium\">Your Backup Codes</h4>\n                    <Button type=\"button\" variant=\"ghost\" size=\"sm\" onClick={handleCopyBackupCodes} className=\"h-8 text-xs\">\n                        <Copy className=\"h-3 w-3 mr-2\" />\n                        Copy All Codes\n                    </Button>\n                </div>\n                <div className=\"grid grid-cols-2 gap-2 p-4 bg-muted rounded-lg font-mono text-sm border\">\n                    {codes.map((code, i) => (\n                        <div key={i} className=\"text-center tracking-wider\">\n                            {code}\n                        </div>\n                    ))}\n                </div>\n                <p className=\"text-xs text-muted-foreground mt-2 flex items-start gap-1.5\">\n                    <AlertTriangle className=\"w-3 h-3 mt-0.5 text-amber-500 shrink-0\" />\n                    <span>\n                        These codes can only be used once. After using a code, make sure to generate new backup codes to maintain account security.\n                    </span>\n                </p>\n                <Button type=\"button\" variant=\"ghost\" size=\"sm\" onClick={handleDownload} className=\"h-8 text-xs\">\n                    <Download className=\"mr-2 h-4 w-4\" />\n                    Download Backup Codes\n                </Button>\n            </div>\n        </div>\n    );\n}\n"
  },
  {
    "path": "src/components/wrappers/dashboard/profile/form/2fa-form.tsx",
    "content": "\"use client\";\nimport { Button } from \"@/components/ui/button\";\nimport { Form, FormControl, FormField, FormItem, FormMessage, useZodForm } from \"@/components/ui/form\";\nimport { InputOTP, InputOTPGroup, InputOTPSlot } from \"@/components/ui/input-otp\";\nimport { Input } from \"@/components/ui/input\";\nimport { useMutation } from \"@tanstack/react-query\";\nimport { Smartphone, Loader2, FileKey2 } from \"lucide-react\";\nimport { toast } from \"sonner\";\nimport { BackupCodeSchema, OtpSchema, OtpSchemaType } from \"./2fa.schema\";\nimport { authClient } from \"@/lib/auth/auth-client\";\nimport { useState } from \"react\";\n\ntype TwoFactorFormProps = {\n    onSuccess?: (success: boolean) => void;\n    onSuccessData?: (data: any) => void;\n};\n\nexport default function TwoFactorForm({ onSuccess, onSuccessData }: TwoFactorFormProps) {\n\n    const [isBackupCodeMode, setIsBackupCodeMode] = useState(false);\n\n    const otpForm = useZodForm({\n        schema: isBackupCodeMode ? BackupCodeSchema : OtpSchema,\n        defaultValues: {\n            code: \"\",\n        },\n    });\n\n    const { mutate: verifyOtp, isPending: isVerifyingOtp } = useMutation({\n        mutationFn: async (values: OtpSchemaType) => {\n            const { data, error } = await authClient.twoFactor.verifyTotp({\n                code: values.code,\n            });\n            if (error) throw error;\n            return data;\n        },\n        onSuccess: (data) => {\n            toast.success(\"Authentication successful.\");\n            onSuccess?.(true);\n            onSuccessData?.(data);\n        },\n        onError: (e) => {\n            console.error(\"totp\", e);\n            toast.error(\"Incorrect or expired code.\");\n            otpForm.reset();\n            onSuccess?.(false);\n        },\n    });\n\n    const { mutate: verifyBackupCode, isPending: isVerifyingBackupCode } = useMutation({\n        mutationFn: async (values: OtpSchemaType) => {\n            const { data, error } = await authClient.twoFactor.verifyBackupCode({\n                code: values.code,\n            });\n            if (error) throw error;\n            return data;\n        },\n        onSuccess: (data) => {\n            toast.success(\"Backup code accepted successfully.\");\n            onSuccess?.(true);\n            onSuccessData?.(data);\n        },\n        onError: (e) => {\n            console.error(\"bak\", e);\n            toast.error(\"Invalid backup code.\");\n            otpForm.reset();\n            onSuccess?.(false);\n        },\n    });\n\n    const handleSubmit = async (values: OtpSchemaType) => {\n        if (isBackupCodeMode) {\n            verifyBackupCode(values);\n        } else {\n            verifyOtp(values);\n        }\n    };\n\n    const isPending = isVerifyingOtp || isVerifyingBackupCode;\n\n\n\n    return (\n        <Form form={otpForm} onSubmit={handleSubmit}>\n            <div className=\"space-y-6 py-4\">\n                <div className=\"flex flex-col items-center justify-center gap-4 text-center\">\n                    <div className=\"p-3 bg-neutral-50 text-neutral-600 rounded-full transition-all duration-300\">\n                        {isBackupCodeMode ? <FileKey2 className=\"w-8 h-8 text-amber-600\" /> : <Smartphone className=\"w-8 h-8\" />}\n                    </div>\n                    <div className=\"space-y-1 animate-in fade-in slide-in-from-bottom-2 duration-300\">\n                        <h4 className=\"font-medium text-sm\">{isBackupCodeMode ? \"Backup Code Authentication\" : \"Device Authentication\"}</h4>\n                        <p className=\"text-xs text-muted-foreground max-w-[250px] mx-auto\">\n                            {isBackupCodeMode ? \"Please enter one of your backup codes.\" : \"\\\"Please enter the verification code generated by your authentication app.\\\"\"}\n                        </p>\n                    </div>\n                </div>\n\n                <FormField\n                    control={otpForm.control}\n                    name=\"code\"\n                    render={({ field }) => (\n                        <FormItem className=\"flex flex-col items-center\">\n                            <FormControl>\n                                {isBackupCodeMode ? (\n                                    <Input\n                                        {...field}\n                                        placeholder=\"XXXXX-XXXXX\"\n                                        className=\"text-center tracking-widest font-mono\"\n                                        autoComplete=\"off\"\n                                        autoFocus\n                                        onChange={(e) => {\n                                            const value = e.target.value;\n                                            field.onChange(value);\n                                            if (value.replaceAll(\"-\", \"\").length === 10) {\n                                                handleSubmit({ code: value });\n                                            }\n                                        }}\n                                    />\n                                ) : (\n                                    <InputOTP\n                                        maxLength={6}\n                                        {...field}\n                                        autoFocus\n                                        onChange={(value) => {\n                                            field.onChange(value);\n                                            if (value.length === 6) {\n                                                handleSubmit({ code: value });\n                                            }\n                                        }}\n                                    >\n                                        <InputOTPGroup>\n                                            <InputOTPSlot index={0} className=\"uppercase\" />\n                                            <InputOTPSlot index={1} className=\"uppercase\" />\n                                            <InputOTPSlot index={2} className=\"uppercase\" />\n                                            <InputOTPSlot index={3} className=\"uppercase\" />\n                                            <InputOTPSlot index={4} className=\"uppercase\" />\n                                            <InputOTPSlot index={5} className=\"uppercase\" />\n                                        </InputOTPGroup>\n                                    </InputOTP>\n                                )}\n                            </FormControl>\n                            <FormMessage />\n                        </FormItem>\n                    )}\n                />\n\n                <div className=\"flex flex-col gap-3 pt-2\">\n                    <Button type=\"submit\" className=\"h-11\" disabled={isPending}>\n                        {isPending && <Loader2 className=\"mr-2 h-4 w-4 animate-spin\" />}\n                        Verify\n                    </Button>\n\n                    <Button\n                        type=\"button\"\n                        variant=\"link\"\n                        className=\"text-xs text-muted-foreground hover:text-foreground h-auto p-0\"\n                        onClick={() => {\n                            otpForm.reset();\n                            setIsBackupCodeMode(!isBackupCodeMode);\n                        }}\n                    >\n                        {isBackupCodeMode ? \"Use Authentication App\" : \"Use Backup Code\"}\n                    </Button>\n                </div>\n            </div>\n        </Form>\n    );\n}\n"
  },
  {
    "path": "src/components/wrappers/dashboard/profile/form/2fa.schema.ts",
    "content": "import { zString } from \"@/lib/zod\";\nimport { z } from \"zod\";\n\nexport const OtpSchema = z.object({\n    code: zString().min(6, { message: \"Le code doit contenir 6 chiffres\" }),\n});\n\nexport type OtpSchemaType = z.infer<typeof OtpSchema>;\n\nexport const BackupCodeSchema = z.object({\n    code: zString().min(1, \"Le code est requis\"),\n});\n\nexport type BackupCodeSchemaType = z.infer<typeof BackupCodeSchema>;\n"
  },
  {
    "path": "src/components/wrappers/dashboard/profile/form/reset-password-form.tsx",
    "content": "\"use client\";\n\nimport { useState } from \"react\";\nimport { Button } from \"@/components/ui/button\";\nimport { Form, FormControl, FormField, FormItem, FormLabel, useZodForm } from \"@/components/ui/form\";\nimport { Loader2 } from \"lucide-react\";\nimport { PasswordStrengthInput } from \"@/components/ui/password-input-indicator\";\nimport { Alert, AlertDescription } from \"@/components/ui/alert\";\nimport { useMutation } from \"@tanstack/react-query\";\nimport { useRouter } from \"next/navigation\";\nimport { toast } from \"sonner\";\nimport { authClient } from \"@/lib/auth/auth-client\";\nimport { ResetPasswordSecuritySchema, ResetPasswordSecuritySchemaType } from \"../schemas/security.schema\";\nimport {PasswordInput} from \"@/components/ui/password-input\";\n\ntype ResetPasswordFormProps = {\n    onSuccess?: () => void;\n    isDefault?: boolean;\n};\n\nexport default function ResetPasswordForm({ onSuccess, isDefault }: ResetPasswordFormProps) {\n    const router = useRouter();\n\n    const [allowConfirmPassword, setAllowConfirmPassword] = useState(false);\n\n    const form = useZodForm({\n        schema: ResetPasswordSecuritySchema,\n    });\n\n    const { mutate: changePassword, isPending: isChangingPassword } = useMutation({\n        mutationFn: async (values: ResetPasswordSecuritySchemaType) => {\n            const { error } = await authClient.changePassword({\n                currentPassword: values.currentPassword,\n                newPassword: values.newPassword,\n                revokeOtherSessions: true,\n            });\n            // await authClient.updateUser({\n            //     isDefaultPassword: false,\n            // });\n            if (error) throw error;\n        },\n        onSuccess: () => {\n            toast.success(\"Password reset successfully.\");\n            form.reset();\n            router.refresh();\n            setAllowConfirmPassword(false);\n\n            if (onSuccess) {\n                onSuccess();\n            }\n        },\n        onError: () => {\n            toast.error(\"Failed to reset password.\");\n        },\n    });\n\n\n    return (\n        <Form\n            form={form}\n            onSubmit={async (values) => {\n                changePassword(values);\n            }}\n        >\n            {!isDefault && (\n                <Alert>\n                    <AlertDescription>After resetting your password, you will be logged out of all devices.</AlertDescription>\n                </Alert>\n            )}\n\n            <div className=\"space-y-4 py-4\">\n                <FormField\n                    control={form.control}\n                    name=\"currentPassword\"\n                    defaultValue=\"\"\n                    render={({ field }) => (\n                        <FormItem>\n                            <FormLabel>Current password</FormLabel>\n                            <FormControl>\n                                <PasswordInput placeholder={'Fill your current password'} {...field} />\n                            </FormControl>\n                        </FormItem>\n                    )}\n                />\n\n                <FormField\n                    control={form.control}\n                    name=\"newPassword\"\n                    defaultValue=\"\"\n                    render={({ field }) => (\n                        <FormItem>\n                            <PasswordStrengthInput\n                                label={\"New password\"}\n                                field={field}\n                                onValidChange={(valid) => {\n                                    setAllowConfirmPassword(valid);\n                                }}\n                            />\n                        </FormItem>\n                    )}\n                />\n\n                <FormField\n                    control={form.control}\n                    name=\"confirmPassword\"\n                    defaultValue=\"\"\n                    render={({ field }) => (\n                        <FormItem>\n                            <FormControl>\n                                <PasswordStrengthInput label={\"Confirm your password\"} field={field} disabled={!allowConfirmPassword} />\n                            </FormControl>\n                        </FormItem>\n                    )}\n                />\n\n                <div className=\"flex justify-end pt-4\">\n                    <Button disabled={isChangingPassword} type=\"submit\">\n                        {isChangingPassword && <Loader2 className=\"mr-2 h-4 w-4 animate-spin\" />}\n                        Submit\n                    </Button>\n                </div>\n            </div>\n        </Form>\n    );\n}\n\n\n"
  },
  {
    "path": "src/components/wrappers/dashboard/profile/form/set-password-form.tsx",
    "content": "\"use client\";\n\nimport {Button} from \"@/components/ui/button\";\nimport {Form, FormControl, FormField, FormItem, FormLabel, useZodForm} from \"@/components/ui/form\";\nimport {Loader2} from \"lucide-react\";\nimport {PasswordStrengthInput} from \"@/components/ui/password-input-indicator\";\nimport {useMutation} from \"@tanstack/react-query\";\nimport {useRouter} from \"next/navigation\";\nimport {toast} from \"sonner\";\nimport {PasswordProviderSchema, PasswordProviderSchemaType} from \"../schemas/provider.schema\";\nimport {linkPasswordProfileProviderAction} from \"../actions/provider.action\";\nimport {PasswordInput} from \"@/components/ui/password-input\";\n\ntype SetPasswordFormProps = {\n    onSuccess?: () => void;\n};\n\nexport default function SetPasswordForm({onSuccess}: SetPasswordFormProps) {\n    const router = useRouter();\n\n    const form = useZodForm({\n        schema: PasswordProviderSchema,\n    });\n\n    const {mutateAsync: setPasswordMutation, isPending: isSettingPassword} = useMutation({\n        mutationFn: async (values: PasswordProviderSchemaType) => {\n            const result = await linkPasswordProfileProviderAction({\n                password: values.password,\n            });\n            return result?.data;\n        },\n        onSuccess: (data) => {\n            if (data?.success) {\n                toast.success(\"Password set successfully.\");\n                form.reset();\n                router.refresh();\n\n                if (onSuccess) {\n                    onSuccess();\n                }\n            } else {\n                toast.error(\"Failed to set password.\");\n            }\n        },\n        onError: () => {\n            toast.error(\"Failed to set password.\");\n        },\n    });\n\n\n    return (\n        <Form\n            form={form}\n            onSubmit={async (values) => {\n                await setPasswordMutation(values);\n            }}\n        >\n            <div className=\"space-y-4 py-4\">\n                <FormField\n                    control={form.control}\n                    name=\"password\"\n                    defaultValue=\"\"\n                    render={({field}) => (\n                        <FormItem>\n                            <PasswordStrengthInput label={\"Password\"} field={field}/>\n                        </FormItem>\n                    )}\n                />\n                <FormField\n                    control={form.control}\n                    name=\"confirmPassword\"\n                    defaultValue=\"\"\n                    render={({field}) => (\n                        <FormItem>\n                            <FormLabel>Confirm password</FormLabel>\n                            <FormControl>\n                                <PasswordInput placeholder={\"Confirm your new password\"} {...field} />\n                            </FormControl>\n                        </FormItem>\n                    )}\n                />\n\n                <div className=\"flex justify-end pt-4\">\n                    <Button disabled={isSettingPassword} type=\"submit\">\n                        {isSettingPassword && <Loader2 className=\"mr-2 h-4 w-4 animate-spin\"/>}\n                        Set password\n                    </Button>\n                </div>\n            </div>\n        </Form>\n    );\n}\n"
  },
  {
    "path": "src/components/wrappers/dashboard/profile/modal/disable-2fa-modal.tsx",
    "content": "\"use client\";\n\nimport { useState } from \"react\";\nimport { useMutation } from \"@tanstack/react-query\";\nimport { useRouter } from \"next/navigation\";\nimport { toast } from \"sonner\";\nimport { z } from \"zod\";\nimport { Loader2, ShieldX } from \"lucide-react\";\n\nimport { Button } from \"@/components/ui/button\";\nimport { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, DialogTrigger } from \"@/components/ui/dialog\";\nimport { Form, FormControl, FormField, FormItem, FormLabel, FormMessage, useZodForm } from \"@/components/ui/form\";\nimport { authClient } from \"@/lib/auth/auth-client\";\nimport TwoFactorForm from \"../form/2fa-form\";\nimport { zPassword } from \"@/lib/zod\";\nimport {PasswordInput} from \"@/components/ui/password-input\";\n\nconst PasswordSchema = z.object({\n    password: zPassword(),\n});\n\ntype Password = z.infer<typeof PasswordSchema>;\n\ntype Disable2FAModalProps = {\n    onOpenChange: (open: boolean) => void;\n    open: boolean;\n};\n\nexport function Disable2FAProfileProviderModal({ onOpenChange, open }: Disable2FAModalProps) {\n\n    const router = useRouter();\n    const [step, setStep] = useState<\"OTP\" | \"PASSWORD\">(\"OTP\");\n\n    const passwordForm = useZodForm({\n        schema: PasswordSchema,\n        defaultValues: {\n            password: \"\",\n        },\n    });\n\n    const { mutate: disable2FA, isPending: isDisabling } = useMutation({\n        mutationFn: async (values: Password) => {\n            const { data, error } = await authClient.twoFactor.disable({\n                password: values.password,\n            });\n            if (error) throw error;\n            return data;\n        },\n        onSuccess: () => {\n            router.refresh();\n            toast.success(\"Two-factor authentication disabled successfully.\");\n            onOpenChange(false);\n            setStep(\"OTP\");\n            passwordForm.reset();\n        },\n        onError: () => {\n            toast.error(\"Failed to disable two-factor authentication.\");\n        },\n    });\n\n    const handleClose = () => {\n        passwordForm.reset();\n        setStep(\"OTP\");\n        onOpenChange(false);\n    };\n\n\n    return (\n        <Dialog open={open} onOpenChange={(v) => (!v ? handleClose() : onOpenChange(v))}>\n            <DialogTrigger asChild>\n                <Button variant=\"outline\" size=\"sm\" className=\"w-full\">\n                    <ShieldX className=\"w-4 h-4 mr-2\" />\n                    Disable Two-Factor\n                </Button>\n            </DialogTrigger>\n            <DialogContent className=\"max-w-md\">\n                <DialogHeader>\n                    <DialogTitle>Disable Two-Factor Authentication</DialogTitle>\n                    <DialogDescription>Are you sure you want to disable two-factor authentication? This will reduce the security of your account.</DialogDescription>\n                </DialogHeader>\n\n                {step === \"OTP\" && (\n                    <TwoFactorForm\n                        onSuccess={(success) => {\n                            if (success) {\n                                setStep(\"PASSWORD\");\n                            }\n                        }}\n                    />\n                )}\n\n                {step === \"PASSWORD\" && (\n                    <Form form={passwordForm} onSubmit={async (values) => disable2FA(values)}>\n                        <FormField\n                            control={passwordForm.control}\n                            name=\"password\"\n                            render={({ field }) => (\n                                <FormItem>\n                                    <FormLabel>Current Password</FormLabel>\n                                    <FormControl>\n                                        <PasswordInput placeholder={\"Fill your current Password\"} {...field} />\n                                    </FormControl>\n                                    <FormMessage />\n                                </FormItem>\n                            )}\n                        />\n\n                        <div className=\"flex justify-between items-center pt-2\">\n                            <Button type=\"button\" variant=\"ghost\" onClick={() => setStep(\"OTP\")} disabled={isDisabling}>\n                                Cancel\n                            </Button>\n                            <Button type=\"submit\" disabled={isDisabling || !passwordForm.formState.isDirty}>\n                                {isDisabling && <Loader2 className=\"mr-2 h-4 w-4 animate-spin\" />}\n                                Disable\n                            </Button>\n                        </div>\n                    </Form>\n                )}\n            </DialogContent>\n        </Dialog>\n    );\n}\n"
  },
  {
    "path": "src/components/wrappers/dashboard/profile/modal/reset-password-modal.tsx",
    "content": "\"use client\";\n\nimport { Button } from \"@/components/ui/button\";\nimport { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, DialogTrigger } from \"@/components/ui/dialog\";\nimport ResetPasswordForm from \"../form/reset-password-form\";\n\ntype ResetPasswordModalProps = {\n    onOpenChange: (open: boolean) => void;\n    open: boolean;\n};\n\nexport function ResetPasswordProfileProviderModal({ onOpenChange, open }: ResetPasswordModalProps) {\n\n    return (\n        <Dialog open={open} onOpenChange={onOpenChange}>\n            <DialogTrigger asChild>\n                <Button variant=\"outline\" size=\"sm\">\n                    Reset Password\n                </Button>\n            </DialogTrigger>\n            <DialogContent>\n                <DialogHeader>\n                    <DialogTitle>Reset Password</DialogTitle>\n                    <DialogDescription>Enter a new password for your account below.</DialogDescription>\n                </DialogHeader>\n                <ResetPasswordForm onSuccess={() => onOpenChange(false)} />\n            </DialogContent>\n        </Dialog>\n    );\n}\n\n"
  },
  {
    "path": "src/components/wrappers/dashboard/profile/modal/set-password-modal.tsx",
    "content": "\"use client\";\n\nimport { Button } from \"@/components/ui/button\";\nimport { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, DialogTrigger } from \"@/components/ui/dialog\";\nimport SetPasswordForm from \"../form/set-password-form\";\n\ntype SetPasswordModalProps = {\n    onOpenChange: (open: boolean) => void;\n    open: boolean;\n};\n\nexport function SetPasswordProfileProviderModal({ onOpenChange, open }: SetPasswordModalProps) {\n\n    return (\n        <Dialog open={open} onOpenChange={onOpenChange}>\n            <DialogTrigger asChild>\n                <Button variant=\"default\" size=\"sm\">\n                    Set Password\n                </Button>\n            </DialogTrigger>\n            <DialogContent>\n                <DialogHeader>\n                    <DialogTitle>Set Password</DialogTitle>\n                    <DialogDescription>Create a password for your account to enable password-based login.</DialogDescription>\n                </DialogHeader>\n\n                <SetPasswordForm onSuccess={() => onOpenChange(false)} />\n            </DialogContent>\n        </Dialog>\n    );\n}\n\n"
  },
  {
    "path": "src/components/wrappers/dashboard/profile/modal/setup-2fa-modal.tsx",
    "content": "\"use client\";\n\nimport React, {useState} from \"react\";\nimport {Button} from \"@/components/ui/button\";\nimport {\n    Dialog,\n    DialogContent,\n    DialogDescription,\n    DialogHeader,\n    DialogTitle,\n    DialogTrigger\n} from \"@/components/ui/dialog\";\nimport {Form, FormControl, FormField, FormItem, FormLabel, FormMessage, useZodForm} from \"@/components/ui/form\";\nimport {Loader2, Copy, CheckCircle2, ShieldCheck} from \"lucide-react\";\nimport {useMutation} from \"@tanstack/react-query\";\nimport {useRouter} from \"next/navigation\";\nimport {Setup2FASecuritySchema, Setup2FASecuritySchemaType} from \"../schemas/security.schema\";\nimport {toast} from \"sonner\";\nimport {authClient} from \"@/lib/auth/auth-client\";\nimport {Alert, AlertDescription} from \"@/components/ui/alert\";\nimport {InputOTP, InputOTPGroup, InputOTPSlot} from \"@/components/ui/input-otp\";\nimport QRCode from \"react-qr-code\";\nimport z from \"zod\";\nimport {zPassword} from \"@/lib/zod\";\nimport {BackupCodesList} from \"../components/backup-codes-list\";\nimport {PasswordInput} from \"@/components/ui/password-input\";\nimport {Tooltip, TooltipContent, TooltipProvider, TooltipTrigger} from \"@/components/ui/tooltip\";\n\nconst PasswordSchema = z.object({\n    password: zPassword(),\n});\n\ntype Password = z.infer<typeof PasswordSchema>;\n\ntype Setup2FAModalProps = {\n    onOpenChange: (open: boolean) => void;\n    open: boolean;\n    disabled: boolean;\n};\n\nexport function Setup2FAProfileProviderModal({onOpenChange, open, disabled}: Setup2FAModalProps) {\n\n    const router = useRouter();\n    const [step, setStep] = useState<\"PASSWORD\" | \"QR\" | \"BACKUP\">(\"PASSWORD\");\n\n    const [totpURI, setTotpURI] = useState<string>(\"\");\n    const [secret, setSecret] = useState<string>(\"\");\n    const [backupCodes, setBackupCodes] = useState<string[]>([]);\n\n    const form = useZodForm({\n        schema: Setup2FASecuritySchema,\n        defaultValues: {\n            code: \"\",\n        },\n    });\n\n    const passwordForm = useZodForm({\n        schema: PasswordSchema,\n        defaultValues: {\n            password: \"\",\n        },\n    });\n\n    const {mutate: enable2FA, isPending: isEnabling} = useMutation({\n        mutationFn: async (values: Password) => {\n            const {data, error} = await authClient.twoFactor.enable({\n                password: values.password,\n            });\n\n            if (error) throw error;\n            return data;\n        },\n        onSuccess: (data) => {\n            setTotpURI(data.totpURI);\n            setSecret(data.totpURI.split(\"secret=\")[1].split(\"&\")[0]);\n            setBackupCodes(data.backupCodes || []);\n            setStep(\"QR\");\n        },\n        onError: () => {\n            toast.error(\"Failed to enable two-factor authentication.\");\n        },\n    });\n\n    const {mutate: verify2FA, isPending: isVerifying} = useMutation({\n        mutationFn: async (values: Setup2FASecuritySchemaType) => {\n            const {data, error} = await authClient.twoFactor.verifyTotp({\n                code: values.code,\n                trustDevice: true,\n            });\n\n            if (error) throw error;\n            return data;\n        },\n        onSuccess: () => {\n            toast.success(\"Two-factor authentication enabled successfully.\");\n            setStep(\"BACKUP\");\n        },\n        onError: () => {\n            toast.error(\"The provided code is invalid.\");\n            form.reset();\n        },\n    });\n\n    const handleCopySecret = () => {\n        navigator.clipboard.writeText(secret);\n        toast.success(\"Secret copied to clipboard\");\n    };\n\n    const handleClose = () => {\n        router.refresh();\n        onOpenChange(false);\n        setStep(\"PASSWORD\");\n        form.reset();\n        passwordForm.reset();\n    };\n\n\n    return (\n        <Dialog open={open} onOpenChange={(v) => (!v ? handleClose() : onOpenChange(v))}>\n            <DialogTrigger asChild disabled={disabled}>\n                <Button variant=\"outline\" size=\"sm\">\n                    <ShieldCheck className=\"w-4 h-4 mr-2\"/>\n                    Enable Two-Factor\n                </Button>\n            </DialogTrigger>\n            <DialogContent className=\"max-w-md\">\n                <DialogHeader>\n                    <DialogTitle>Enable Two-Factor Authentication</DialogTitle>\n                    <DialogDescription>\n                        {step === \"PASSWORD\" && \"\"}\n                        {step === \"QR\" && \"Scan the QR code below with your authentication app or enter the secret key manually.\"}\n                        {step === \"BACKUP\" && \"Save these backup codes in a secure location. They can be used to access your account if you lose access to your authentication device.\"}\n                    </DialogDescription>\n                </DialogHeader>\n\n                {step === \"PASSWORD\" && (\n                    <Form form={passwordForm} onSubmit={async (values) => enable2FA(values)}>\n                        <div className=\"space-y-4 py-4\">\n                            <div className=\"space-y-2\">\n                                <FormField\n                                    control={passwordForm.control}\n                                    name=\"password\"\n                                    render={({field}) => (\n                                        <FormItem>\n                                            <FormLabel>Current Password</FormLabel>\n                                            <FormControl>\n                                                <PasswordInput placeholder=\"Fill your current password\" {...field} />\n                                            </FormControl>\n                                            <FormMessage/>\n                                        </FormItem>\n                                    )}\n                                />\n                            </div>\n                            <div className=\"flex justify-end\">\n                                <Button type=\"submit\" disabled={isEnabling || !passwordForm.formState.isDirty}>\n                                    {isEnabling && <Loader2 className=\"mr-2 h-4 w-4 animate-spin\"/>}\n                                    Continue\n                                </Button>\n                            </div>\n                        </div>\n                    </Form>\n                )}\n\n                {step === \"QR\" && (\n                    <Form\n                        form={form}\n                        onSubmit={async (values) => {\n                            verify2FA(values);\n                        }}\n                    >\n                        <div className=\"flex flex-col items-center justify-center space-y-6 py-4\">\n                            <div className=\"p-4 bg-white rounded-xl shadow-sm border\">\n                                {totpURI && (\n                                    <QRCode value={totpURI} size={180}\n                                            style={{height: \"auto\", maxWidth: \"100%\", width: \"100%\"}}\n                                            viewBox={`0 0 256 256`}/>\n                                )}\n                            </div>\n\n                            <div className=\"w-full space-y-2\">\n                                <p className=\"text-xs text-muted-foreground text-center\">If you are unable to scan the\n                                    QR code, you can manually enter the secret key into your authentication app :</p>\n                                <div className=\"flex items-center gap-2\">\n                                    <code\n                                        className=\"flex-1 bg-muted p-2 rounded text-xs font-mono break-all text-center\">{secret}</code>\n                                    <Button type=\"button\" size=\"icon\" variant=\"ghost\" onClick={handleCopySecret}>\n                                        <Copy className=\"h-4 w-4\"/>\n                                    </Button>\n                                </div>\n                            </div>\n\n                            <div className=\"w-full border-t pt-4\">\n                                <FormField\n                                    control={form.control}\n                                    name=\"code\"\n                                    render={({field}) => (\n                                        <FormItem className=\"flex flex-col items-center\">\n                                            <FormLabel className=\"mb-2\">Verification Code</FormLabel>\n                                            <FormControl>\n                                                <InputOTP\n                                                    maxLength={6}\n                                                    {...field}\n                                                    autoFocus\n                                                    onChange={(value) => {\n                                                        field.onChange(value);\n                                                        if (value.length === 6) {\n                                                            verify2FA(form.getValues());\n                                                        }\n                                                    }}\n                                                >\n                                                    <InputOTPGroup>\n                                                        <InputOTPSlot index={0}/>\n                                                        <InputOTPSlot index={1}/>\n                                                        <InputOTPSlot index={2}/>\n                                                        <InputOTPSlot index={3}/>\n                                                        <InputOTPSlot index={4}/>\n                                                        <InputOTPSlot index={5}/>\n                                                    </InputOTPGroup>\n                                                </InputOTP>\n                                            </FormControl>\n                                        </FormItem>\n                                    )}\n                                />\n                            </div>\n\n                            <div className=\"flex justify-end w-full\">\n                                <Button disabled={isVerifying} type=\"submit\">\n                                    {isVerifying && <Loader2 className=\"mr-2 h-4 w-4 animate-spin\"/>}\n                                    I've Configured My App\n                                </Button>\n                            </div>\n                        </div>\n                    </Form>\n                )}\n\n                {step === \"BACKUP\" && (\n                    <div className=\"space-y-6 py-4\">\n                        <Alert variant=\"default\"\n                               className=\"border-green-200 bg-green-50 dark:bg-green-900/20 dark:border-green-900\">\n                            <CheckCircle2 className=\"h-4 w-4 text-green-600 dark:text-green-400\"/>\n                            <AlertDescription\n                                className=\"text-green-700 dark:text-green-400\">Two Factor Authentication is now enabled\n                                on your account.</AlertDescription>\n                        </Alert>\n\n                        <BackupCodesList codes={backupCodes}/>\n\n                        <div className=\"flex justify-end pt-2\">\n                            <Button onClick={handleClose}>Finish Setup</Button>\n                        </div>\n                    </div>\n                )}\n            </DialogContent>\n        </Dialog>\n    );\n}\n"
  },
  {
    "path": "src/components/wrappers/dashboard/profile/modal/view-backup-codes-modal.tsx",
    "content": "\"use client\";\n\nimport { useState } from \"react\";\nimport { Button } from \"@/components/ui/button\";\nimport { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, DialogTrigger } from \"@/components/ui/dialog\";\nimport { Form, FormControl, FormField, FormItem, FormLabel, FormMessage, useZodForm } from \"@/components/ui/form\";\nimport { Loader2, FileKey2, RefreshCw, AlertTriangle, Download } from \"lucide-react\";\nimport { useMutation } from \"@tanstack/react-query\";\nimport { authClient } from \"@/lib/auth/auth-client\";\nimport { toast } from \"sonner\";\nimport { z } from \"zod\";\nimport { zPassword } from \"@/lib/zod\";\nimport { BackupCodesList } from \"../components/backup-codes-list\";\nimport { Alert, AlertDescription, AlertTitle } from \"@/components/ui/alert\";\nimport {PasswordInput} from \"@/components/ui/password-input\";\n\nconst PasswordSchema = z.object({\n    password: zPassword(),\n});\n\ntype Password = z.infer<typeof PasswordSchema>;\n\ntype ViewBackupCodesModalProps = {\n    onOpenChange: (open: boolean) => void;\n    open: boolean;\n};\n\nexport function ViewBackupCodesModal({ onOpenChange, open }: ViewBackupCodesModalProps) {\n\n\n    const [step, setStep] = useState<\"PASSWORD\" | \"CODES\">(\"PASSWORD\");\n    const [codes, setCodes] = useState<string[]>([]);\n\n    const form = useZodForm({\n        schema: PasswordSchema,\n        defaultValues: {\n            password: \"\",\n        },\n    });\n\n    const { mutate: generateCodes, isPending } = useMutation({\n        mutationFn: async (values: Password) => {\n            const { data, error } = await authClient.twoFactor.generateBackupCodes({\n                password: values.password,\n            });\n            if (error) throw error;\n            return data;\n        },\n        onSuccess: (data) => {\n            if (data?.backupCodes) {\n                setCodes(data.backupCodes);\n                setStep(\"CODES\");\n                toast.success(\"New backup codes generated successfully.\");\n            }\n        },\n        onError: () => {\n            toast.error(\"Failed to generate backup codes. Your password may be incorrect.\");\n        },\n    });\n\n    const handleClose = () => {\n        form.reset();\n        setStep(\"PASSWORD\");\n        onOpenChange(false);\n    };\n\n    return (\n        <Dialog open={open} onOpenChange={(v) => (!v ? handleClose() : onOpenChange(v))}>\n            <DialogTrigger asChild>\n                <Button variant=\"outline\" size=\"sm\" className=\"w-full\">\n                    <FileKey2 className=\"w-4 h-4 mr-2\" />\n                    Regenerate Backup Codes\n                </Button>\n            </DialogTrigger>\n            <DialogContent className=\"sm:max-w-md\">\n                <DialogHeader>\n                    <DialogTitle>Backup Codes</DialogTitle>\n                    <DialogDescription>{step === \"PASSWORD\" ? \"For security reasons, existing codes are hidden. You must generate a new set to view them.\" : \"Save these codes securely. They will not be shown again once you close this window.\"}</DialogDescription>\n                </DialogHeader>\n\n                {step === \"PASSWORD\" && (\n                    <Form form={form} onSubmit={(values) => generateCodes(values)}>\n                        <div className=\"space-y-4 py-2\">\n                            <Alert variant=\"destructive\" className=\"py-3 w-fit\">\n                                <AlertTriangle className=\"h-4 w-4\" />\n                                <AlertTitle className=\"text-sm font-semibold ml-2\">Important</AlertTitle>\n                                <AlertDescription className=\"text-xs ml-2 mt-1\">Generating new codes will invalidate your existing ones. Make sure to save the new codes securely.</AlertDescription>\n                            </Alert>\n\n                            <FormField\n                                control={form.control}\n                                name=\"password\"\n                                render={({ field }) => (\n                                    <FormItem>\n                                        <FormLabel>Current Password</FormLabel>\n                                        <FormControl>\n                                            <PasswordInput placeholder={\"Fill your current Password\"} {...field} autoFocus />\n                                        </FormControl>\n                                        <FormMessage />\n                                    </FormItem>\n                                )}\n                            />\n\n                            <div className=\"flex justify-end gap-2 pt-2\">\n                                <Button type=\"submit\" disabled={isPending} variant=\"default\">\n                                    {isPending ? <Loader2 className=\"mr-2 h-4 w-4 animate-spin\" /> : <RefreshCw className=\"mr-2 h-4 w-4\" />}\n                                    Generate New Codes\n                                </Button>\n                            </div>\n                        </div>\n                    </Form>\n                )}\n\n                {step === \"CODES\" && (\n                    <div className=\"space-y-6 py-2 animate-in fade-in zoom-in-95 duration-200\">\n                        <BackupCodesList codes={codes} />\n\n                        <div className=\"flex flex-col sm:flex-row justify-between gap-2 pt-2\">\n                            <Button onClick={() => handleClose()} className=\"w-full sm:w-auto\">\n                                I Have Saved My Codes\n                            </Button>\n                        </div>\n                    </div>\n                )}\n            </DialogContent>\n        </Dialog>\n    );\n}\n"
  },
  {
    "path": "src/components/wrappers/dashboard/profile/profile-account.tsx",
    "content": "\"use client\";\n\nimport {Button} from \"@/components/ui/button\";\nimport {Input} from \"@/components/ui/input\";\nimport {AlertCircle, Loader2} from \"lucide-react\";\nimport {useMutation} from \"@tanstack/react-query\";\nimport {toast} from \"sonner\";\nimport {useRouter} from \"next/navigation\";\nimport {authClient} from \"@/lib/auth/auth-client\";\nimport {User} from \"@/db/schema/02_user\";\nimport {Form, FormControl, FormField, FormItem, FormLabel, FormMessage, useZodForm} from \"@/components/ui/form\";\nimport {EmailSchema, EmailSchemaType} from \"./schemas/account.schema\";\nimport {BetterAuthError} from \"@/types/auth\";\n\n\ninterface ProfileAccountProps {\n    user: User;\n}\n\nexport function ProfileAccount({user}: ProfileAccountProps) {\n\n    const router = useRouter();\n\n    const emailForm = useZodForm({\n        schema: EmailSchema,\n        defaultValues: {\n            email: user.email,\n        },\n    });\n\n    const {mutate: updateEmail, isPending: isUpdatingEmail} = useMutation({\n        mutationFn: async (values: EmailSchemaType) => {\n            const {error} = await authClient.changeEmail({\n                newEmail: values.email,\n                callbackURL: window.location.href,\n            });\n\n            if (error) throw error;\n            return values.email;\n        },\n        onSuccess: (newEmail) => {\n            toast.success(\"Email updated successfully.\");\n            emailForm.reset({email: newEmail});\n\n            router.refresh();\n        },\n        onError: (error: BetterAuthError) => {\n            if (error.code === \"USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL\") {\n                toast.error(\"User already exists, use another email address!\");\n                emailForm.reset({email: user.email});\n                router.refresh()\n            } else {\n                toast.error(\"An error occurred while trying to update your password!\");\n            }\n        },\n    });\n\n    const {mutate: resendVerificationEmail, isPending: isResendingVerification} = useMutation({\n        mutationFn: async () => {\n            const currentEmailInput = emailForm.getValues(\"email\");\n\n\n            let error: BetterAuthError | null = null;\n\n            if (currentEmailInput === user.email) {\n                const sendVerification = await authClient.sendVerificationEmail({\n                    email: currentEmailInput,\n                    callbackURL: window.location.href,\n                });\n                error = sendVerification.error;\n            } else {\n                const result = await authClient.changeEmail({\n                    callbackURL: window.location.href,\n                    newEmail: currentEmailInput,\n                });\n                error = result.error;\n            }\n\n            if (error) throw error;\n        },\n        onSuccess: () => {\n            toast.success(\"Verification email resent successfully.\");\n        },\n        onError: (e: BetterAuthError) => {\n            console.error(e);\n            toast.error(\"Failed to resend verification email.\");\n        },\n    });\n\n\n    return (\n        <div className=\"space-y-8 animate-in fade-in-50 duration-300\">\n            <div className=\"mb-6 space-y-1\">\n                <h2 className=\"text-2xl font-semibold tracking-tight\">Account Settings</h2>\n                <p className=\"text-sm text-muted-foreground\">Update your email and preferences.</p>\n            </div>\n\n            <div className=\"space-y-4\">\n                <Form form={emailForm} onSubmit={(values) => updateEmail(values)}>\n                    <div className=\"grid gap-3\">\n                        <FormField\n                            control={emailForm.control}\n                            name=\"email\"\n                            render={({field}) => (\n                                <FormItem>\n                                    <FormLabel>Email Address</FormLabel>\n                                    <div className=\"flex flex-col gap-3\">\n                                        <div className=\"flex flex-col sm:flex-row gap-3 max-w-xl\">\n                                            <FormControl>\n                                                <Input {...field} placeholder=\"Your email address\"/>\n                                            </FormControl>\n\n                                            <div className=\"flex flex-col md:flex-row gap-3\">\n                                                <Button type=\"submit\" variant=\"secondary\"\n                                                        disabled={isUpdatingEmail || !emailForm.formState.isDirty}>\n                                                    {isUpdatingEmail &&\n                                                        <Loader2 className=\"mr-2 h-4 w-4 animate-spin\"/>}\n                                                    {\"Update\"}\n                                                </Button>\n\n                                                {!user.emailVerified && (\n                                                    <Button\n                                                        type=\"button\"\n                                                        variant=\"secondary\"\n                                                        onClick={() => resendVerificationEmail()}\n                                                        disabled={isResendingVerification || emailForm.formState.errors.email !== undefined}\n                                                    >\n                                                        {isResendingVerification &&\n                                                            <Loader2 className=\"mr-2 h-4 w-4 animate-spin\"/>}\n                                                        {\"Resend Verification\"}\n                                                    </Button>\n                                                )}\n                                            </div>\n                                        </div>\n                                        <FormMessage/>\n                                    </div>\n                                </FormItem>\n                            )}\n                        />\n\n                        {!user.emailVerified && (\n                            <div\n                                className=\"flex items-center gap-2 text-sm text-amber-600 bg-amber-50 p-2 rounded-md border border-amber-100 dark:bg-amber-950/30 dark:border-amber-900 dark:text-amber-400 max-w-xl\">\n                                <AlertCircle className=\"w-4 h-4\"/>\n                                <span>Your email is not verified. Please check your inbox.</span>\n                            </div>\n                        )}\n                    </div>\n                </Form>\n            </div>\n        </div>\n    );\n}\n"
  },
  {
    "path": "src/components/wrappers/dashboard/profile/profile-apperance.tsx",
    "content": "\"use client\";\n\nimport React from \"react\";\nimport {cn} from \"@/lib/utils\";\nimport {useTheme} from \"next-themes\";\nimport {authClient} from \"@/lib/auth/auth-client\";\n\nconst themes = [{value: \"light\"}, {value: \"dark\"}, {value: \"system\"}];\n\nexport function ProfileAppearance() {\n\n    return (\n        <div className=\"space-y-8 animate-in fade-in-50 duration-300 \">\n            <div className=\"mb-6 space-y-1\">\n                <h2 className=\"text-2xl font-semibold tracking-tight\">Appearance Settings</h2>\n                <p className=\"text-sm text-muted-foreground\">Customize the look and feel of your dashboard.</p>\n            </div>\n            <ThemeSelector/>\n        </div>\n    );\n}\n\nfunction ThemeSelector() {\n    const {theme} = useTheme();\n\n\n    return (\n        <div className=\"grid grid-cols-1 sm:grid-cols-3 gap-4 max-w-3xl\">\n            {themes.map((item) => {\n                const isDark = item.value === \"dark\";\n                const isSystem = item.value === \"system\";\n                const isActive = theme === item.value;\n\n                return (\n                    <div\n                        key={item.value}\n                        className={cn(\n                            \"border-2 rounded-xl p-1 cursor-pointer transition-all hover:bg-accent/50 space-y-2\",\n                            isActive ? \"border-primary bg-primary/5\" : \"border-muted/40\"\n                        )}\n                        onClick={async () => {\n                            await authClient.updateUser({theme: item.value});\n                        }}\n                    >\n                        <div\n                            className={cn(\n                                \"p-2 rounded-lg aspect-[4/3] flex flex-col gap-2 relative overflow-hidden border\",\n                                isDark ? \"bg-slate-950 border-slate-800\" : \"bg-white border-slate-200\",\n                                isSystem && \"bg-gradient-to-br from-white to-slate-950\"\n                            )}\n                        >\n                            <div\n                                className={cn(\"h-3 w-full rounded-sm shadow-sm opacity-80\", isDark ? \"bg-slate-800\" : \"bg-slate-100\")}/>\n                            <div className=\"flex gap-2 flex-1 relative\">\n                                <div\n                                    className={cn(\"w-1/4 h-full rounded-sm shadow-sm opacity-80\", isDark ? \"bg-slate-800\" : \"bg-slate-100\")}/>\n                                <div className=\"flex-1 flex flex-col gap-2\">\n                                    <div\n                                        className={cn(\"h-3 w-full rounded-sm shadow-sm opacity-80\", isDark ? \"bg-slate-800\" : \"bg-slate-100\")}/>\n                                    <div\n                                        className={cn(\"flex-1 rounded-sm shadow-sm p-1 space-y-2 opacity-50\", isDark ? \"bg-slate-800\" : \"bg-slate-100\")}>\n                                        <div\n                                            className={cn(\"h-2 w-3/4 rounded-full\", isDark ? \"bg-slate-700\" : \"bg-slate-300\")}/>\n                                        <div\n                                            className={cn(\"h-2 w-full rounded-full\", isDark ? \"bg-slate-700\" : \"bg-slate-300\")}/>\n                                    </div>\n                                </div>\n                            </div>\n                        </div>\n\n                        <div className=\"flex items-center justify-between p-1 px-2\">\n                            <span className=\"font-medium text-sm\">{THEME_TEXT[item.value as ThemeKey]}</span>\n                            <div\n                                className={cn(\n                                    \"w-4 h-4 rounded-full border flex items-center justify-center transition-all\",\n                                    isActive ? \"border-primary bg-primary\" : \"border-muted-foreground/30\"\n                                )}\n                            >\n                                {isActive && <div className=\"w-1.5 h-1.5 rounded-full bg-primary-foreground\"/>}\n                            </div>\n                        </div>\n                    </div>\n                );\n            })}\n        </div>\n    );\n}\n\ntype ThemeKey = \"dark\" | \"light\" | \"system\";\n\n\nconst THEME_TEXT: Record<ThemeKey, string> = {\n    dark: \"Dark\",\n    light: \"Light\",\n    system: \"System\",\n};"
  },
  {
    "path": "src/components/wrappers/dashboard/profile/profile-general.tsx",
    "content": "\"use client\";\n\nimport React from \"react\";\nimport {Button} from \"@/components/ui/button\";\nimport {Input} from \"@/components/ui/input\";\nimport {Badge} from \"@/components/ui/badge\";\nimport {Loader2} from \"lucide-react\";\nimport {\n    Form,\n    FormControl,\n    FormDescription,\n    FormField,\n    FormItem,\n    FormLabel,\n    FormMessage,\n    useZodForm\n} from \"@/components/ui/form\";\nimport {useMutation} from \"@tanstack/react-query\";\nimport {toast} from \"sonner\";\nimport {useRouter} from \"next/navigation\";\nimport {updateProfileSettingsAction} from \"./actions/profile.action\";\nimport {User} from \"@/db/schema/02_user\";\nimport {ProfileSchema, ProfileSchemaType} from \"./schemas/general.schema\";\nimport {AvatarWithUpload} from \"@/components/wrappers/dashboard/profile/components/avatar-with-upload\";\n\ninterface ProfileGeneralProps {\n    user: User;\n}\n\nexport function ProfileGeneral({user}: ProfileGeneralProps) {\n    const router = useRouter();\n\n    const profileForm = useZodForm({\n        schema: ProfileSchema,\n        defaultValues: {\n            name: user.name || \"\",\n            role: user.role || \"\",\n        },\n    });\n\n    const {mutate: updateProfile, isPending: isUpdatingProfile} = useMutation({\n        mutationFn: async (values: ProfileSchemaType) => {\n            const result = await updateProfileSettingsAction({name: values.name});\n            const inner = result?.data;\n            if (inner?.success) {\n                toast.success(\"Profile updated successfully.\");\n                router.refresh();\n                profileForm.reset({name: values.name, role: values.role});\n            } else {\n                toast.error(\"Failed to update profile.\");\n            }\n        },\n    });\n\n    return (\n        <div className=\"space-y-8 animate-in fade-in-50 duration-300\">\n            <div className=\"mb-6 space-y-1\">\n                <h2 className=\"text-2xl font-semibold tracking-tight\">Profile Settings</h2>\n                <p className=\"text-sm text-muted-foreground\">Manage your personal information and preferences.</p>\n            </div>\n\n            <div className=\"flex flex-col sm:flex-row gap-8 items-start\">\n                <div className=\"flex flex-col items-center gap-4\">\n                    <AvatarWithUpload\n                        user={user}\n                    />\n                </div>\n\n                <div className=\"flex-1 w-full max-w-lg\">\n                    <Form form={profileForm} onSubmit={(values) => updateProfile(values)}>\n                        <div className=\"space-y-6\">\n                            <FormField\n                                control={profileForm.control}\n                                name=\"name\"\n                                render={({field}) => (\n                                    <FormItem>\n                                        <FormLabel>Display Name</FormLabel>\n                                        <FormControl>\n                                            <Input {...field} />\n                                        </FormControl>\n                                        <FormDescription>This is your public display name</FormDescription>\n                                        <FormMessage/>\n                                    </FormItem>\n                                )}\n                            />\n\n                            <div className=\"grid gap-2\">\n                                <FormField\n                                    control={profileForm.control}\n                                    name={\"role\"}\n                                    render={({field}) => (\n                                        <FormItem>\n                                        <FormLabel\n                                            className=\"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70\">\n                                            Role & Permissions\n                                        </FormLabel>\n                                            <FormControl>\n                                                <div className=\"flex items-center gap-2 pt-1\">\n                                                    <RoleBadge role={field.value || \"undefined\"}/>\n                                                </div>\n                                            </FormControl>\n                                        </FormItem>\n                                    )}\n                                />\n                            </div>\n\n                            <div className=\"flex justify-end\">\n                                <Button type=\"submit\" disabled={isUpdatingProfile || !profileForm.formState.isDirty}>\n                                    {isUpdatingProfile && <Loader2 className=\"mr-2 h-4 w-4 animate-spin\"/>}\n                                    Update\n                                </Button>\n                            </div>\n                        </div>\n                    </Form>\n                </div>\n            </div>\n        </div>\n    );\n}\n\nfunction RoleBadge({role}: { role: string }) {\n\n    const variant = role === \"admin\" ? \"default\" : \"secondary\";\n\n    return (\n        <Badge variant={variant} className=\"capitalize px-2 py-0.5 text-xs\">\n            {role}\n        </Badge>\n    );\n}\n"
  },
  {
    "path": "src/components/wrappers/dashboard/profile/profile-providers.tsx",
    "content": "\"use client\";\n\nimport { useState } from \"react\";\nimport { Button } from \"@/components/ui/button\";\nimport { Badge } from \"@/components/ui/badge\";\nimport { Loader2, AlertTriangle } from \"lucide-react\";\nimport { authClient } from \"@/lib/auth/auth-client\";\nimport { useMutation } from \"@tanstack/react-query\";\nimport { toast } from \"sonner\";\nimport { useRouter } from \"next/navigation\";\nimport {\n  Tooltip,\n  TooltipContent,\n  TooltipTrigger,\n} from \"@/components/ui/tooltip\";\nimport { Alert, AlertDescription } from \"@/components/ui/alert\";\nimport { SetPasswordProfileProviderModal } from \"./modal/set-password-modal\";\nimport { Icon } from \"@iconify/react\";\nimport Image from \"next/image\";\nimport type { AuthProviderConfig } from \"@/lib/auth/config\";\nimport type { Account } from \"@/db/schema/02_user\";\n\ninterface ProfileProviderProps {\n  accounts: Account[];\n  providers: AuthProviderConfig[];\n}\n\nexport function ProfileProviders({\n  accounts,\n  providers,\n}: ProfileProviderProps) {\n  const router = useRouter();\n  const totalConnected = accounts.length;\n  const [loadingProvider, setLoadingProvider] = useState<string | null>(null);\n\n  const [isPasswordDialogOpen, setIsPasswordDialogOpen] = useState(false);\n\n  const { mutate: unlinkAccount } = useMutation({\n    mutationFn: async (providerId: string) => {\n      setLoadingProvider(providerId);\n      const { error } = await authClient.unlinkAccount({ providerId });\n      if (error) throw error;\n    },\n    onSuccess: () => {\n      toast.success(\"Provider successfully unlinked!\");\n      setLoadingProvider(null);\n      router.refresh();\n    },\n    onError: () => {\n      toast.error(\"An error occurred while unlinking provider.\");\n      setLoadingProvider(null);\n    },\n  });\n\n  const { mutate: linkAccount } = useMutation({\n    mutationFn: async (provider: AuthProviderConfig) => {\n      setLoadingProvider(provider.id);\n      if (provider.type === \"social\") {\n        await authClient.linkSocial({\n          provider: provider.id as string,\n          callbackURL: \"/dashboard\",\n        });\n      }\n    },\n    onSuccess: () => {\n      setLoadingProvider(null);\n      router.refresh();\n    },\n    onError: () => {\n      toast.error(\"An error occurred while linking provider.\");\n      setLoadingProvider(null);\n    },\n  });\n\n  const enterpriseProviders = providers.filter(\n    (p) => p.type === \"sso\" && p.id !== \"passkey\" && p.type !== \"credential\",\n  );\n  const otherProviders = providers.filter(\n    (p) => p.type !== \"sso\" && p.id !== \"passkey\" && p.type !== \"credential\",\n  );\n\n  const renderProvider = (provider: AuthProviderConfig) => {\n    const linkedAccount = accounts.find(\n      (acc) => acc.providerId === provider.id,\n    );\n    const isConnected = !!linkedAccount;\n    const canUnlink =\n      totalConnected > 1 || (totalConnected === 1 && !provider.isManual);\n    const isLoading = loadingProvider === provider.id;\n\n    const isUnlinkDisabled =\n      !canUnlink ||\n      provider.allowUnlinking === false ||\n      provider.type === \"sso\";\n\n    const unlinkButton = (\n      <Button\n        variant=\"outline\"\n        size=\"sm\"\n        onClick={() => unlinkAccount(provider.id)}\n        disabled={isUnlinkDisabled || isLoading || provider.isManual}\n        className={isUnlinkDisabled ? \"opacity-50 cursor-not-allowed\" : \"\"}\n      >\n        {isLoading ? <Loader2 className=\"w-4 h-4 animate-spin\" /> : \"Unlink\"}\n      </Button>\n    );\n\n    let actionElement;\n\n    if (provider.type === \"sso\") {\n      actionElement = null;\n    } else if (!isConnected) {\n      actionElement =\n        provider.id === \"credential\" ? (\n          <SetPasswordProfileProviderModal\n            open={isPasswordDialogOpen}\n            onOpenChange={setIsPasswordDialogOpen}\n          />\n        ) : (\n          <Button\n            variant=\"default\"\n            size=\"sm\"\n            onClick={() => linkAccount(provider)}\n            disabled={\n              isLoading || provider.isManual || provider.allowLinking === false\n            }\n          >\n            {isLoading ? <Loader2 className=\"w-4 h-4 animate-spin\" /> : \"Link\"}\n          </Button>\n        );\n    } else if (isUnlinkDisabled) {\n      actionElement = (\n        <Tooltip>\n          <TooltipTrigger asChild>\n            <div tabIndex={0} className=\"inline-block\">\n              {unlinkButton}\n            </div>\n          </TooltipTrigger>\n          <TooltipContent>\n            <p>\n              {provider.allowUnlinking === false\n                ? \"Unlinking is disabled for this provider.\"\n                : \"You cannot unlink your last authentication provider.\"}\n            </p>\n          </TooltipContent>\n        </Tooltip>\n      );\n    } else {\n      actionElement = unlinkButton;\n    }\n\n    return (\n      <div\n        key={provider.id}\n        className=\"flex items-center justify-between p-4 border rounded-lg hover:bg-muted/30 transition-colors\"\n      >\n        <div className=\"flex items-center gap-4\">\n          <div className=\"w-10 h-10 rounded-full bg-muted flex items-center justify-center\">\n            {provider.icon.startsWith(\"/\") ||\n            provider.icon.startsWith(\"http\") ? (\n              <Image\n                src={provider.icon}\n                alt={provider.id}\n                width={20}\n                height={20}\n                className=\"w-5 h-5\"\n                unoptimized={provider.icon.startsWith(\"http\")}\n              />\n            ) : (\n              <Icon icon={provider.icon} className=\"w-5 h-5\" />\n            )}\n          </div>\n          <div className=\"space-y-0.5\">\n            <div className=\"font-medium flex items-center gap-2\">\n              {provider.title || provider.name}\n              {isConnected && (\n                <Badge\n                  variant=\"secondary\"\n                  className=\"text-[10px] h-5 px-1.5 text-green-600 bg-green-500/10 border-0\"\n                >\n                  Active\n                </Badge>\n              )}\n            </div>\n            <div className=\"text-sm text-muted-foreground\">\n              {provider.description}\n            </div>\n          </div>\n        </div>\n\n        <div className=\"flex items-center gap-2\">{actionElement}</div>\n      </div>\n    );\n  };\n\n  return (\n    <div className=\"space-y-8 animate-in fade-in-50 duration-300 pb-10\">\n      <div className=\"mb-6 space-y-1\">\n        <h2 className=\"text-2xl font-semibold tracking-tight\">\n          Authentication\n        </h2>\n        <p className=\"text-sm text-muted-foreground\">\n          Manage how you access your account.\n        </p>\n      </div>\n\n      {enterpriseProviders.length > 0 && (\n        <div className=\"space-y-4\">\n          <h3 className=\"text-sm font-medium text-muted-foreground uppercase tracking-wider\">\n            Enterprise Connection\n          </h3>\n          <div className=\"grid gap-4\">\n            {enterpriseProviders.map(renderProvider)}\n          </div>\n        </div>\n      )}\n\n      <div className=\"space-y-4\">\n        <h3 className=\"text-sm font-medium text-muted-foreground uppercase tracking-wider\">\n          Standard Connections\n        </h3>\n        <div className=\"grid gap-4\">{otherProviders.map(renderProvider)}</div>\n      </div>\n\n      <Alert variant={\"default\"}>\n        <AlertTriangle className=\"w-5 h-5 shrink-0 mt-0.5\" />\n        <AlertDescription>\n          Linked providers allow you to log in to your account using any of\n          these methods.\n        </AlertDescription>\n      </Alert>\n    </div>\n  );\n}\n"
  },
  {
    "path": "src/components/wrappers/dashboard/profile/profile-security.tsx",
    "content": "\"use client\";\n\nimport { useState } from \"react\";\nimport { Button } from \"@/components/ui/button\";\nimport { Separator } from \"@/components/ui/separator\";\nimport { Badge } from \"@/components/ui/badge\";\nimport {\n  Globe,\n  LogOut,\n  Loader2,\n  Fingerprint,\n  Trash2,\n  Plus,\n} from \"lucide-react\";\nimport { useMutation, useQuery } from \"@tanstack/react-query\";\nimport { toast } from \"sonner\";\nimport {\n  revokeAllSessionsAction,\n  revokeSessionAction,\n  getPasskeysAction,\n  revokePasskeyAction,\n} from \"./actions/security.action\";\nimport { useRouter } from \"next/navigation\";\nimport { ResetPasswordProfileProviderModal } from \"./modal/reset-password-modal\";\nimport { SetPasswordProfileProviderModal } from \"./modal/set-password-modal\";\nimport { Setup2FAProfileProviderModal } from \"./modal/setup-2fa-modal\";\nimport { Disable2FAProfileProviderModal } from \"./modal/disable-2fa-modal\";\nimport { ViewBackupCodesModal } from \"./modal/view-backup-codes-modal\";\nimport { getDeviceDetails } from \"@/utils/detection\";\nimport { timeAgo } from \"@/utils/date-formatting\";\nimport { authClient } from \"@/lib/auth/auth-client\";\nimport {\n  Dialog,\n  DialogContent,\n  DialogDescription,\n  DialogFooter,\n  DialogHeader,\n  DialogTitle,\n  DialogTrigger,\n} from \"@/components/ui/dialog\";\nimport { Input } from \"@/components/ui/input\";\nimport { Label } from \"@/components/ui/label\";\nimport { Account, Session, User } from \"@/db/schema/02_user\";\nimport { Icon } from \"@iconify/react\";\nimport Image from \"next/image\";\nimport type { AuthProviderConfig } from \"@/lib/auth/config\";\nimport { is } from \"date-fns/locale\";\n\ninterface ProfileSecurityProps {\n  user: User;\n  sessions: Session[];\n  credentialAccount: Account;\n  currentSession: Session;\n  isPasswordEnabled?: boolean;\n  isPasskeyEnabled?: boolean;\n  providers: AuthProviderConfig[];\n}\n\nexport function ProfileSecurity({\n  user,\n  sessions,\n  credentialAccount,\n  currentSession,\n  isPasswordEnabled = false,\n  isPasskeyEnabled = false,\n  providers,\n}: ProfileSecurityProps) {\n  const router = useRouter();\n\n  const [isBackupCodesDialogOpen, setIsBackupCodesDialogOpen] = useState(false);\n  const [isPasswordDialogOpen, setIsPasswordDialogOpen] = useState(false);\n  const [isSetup2FADialogOpen, setIsSetup2FADialogOpen] = useState(false);\n  const [isDisable2FADialogOpen, setIsDisable2FADialogOpen] = useState(false);\n  const [isAddPasskeyOpen, setIsAddPasskeyOpen] = useState(false);\n  const [passkeyName, setPasskeyName] = useState(\"\");\n\n  const { mutate: revokeSession, isPending: isRevoking } = useMutation({\n    mutationFn: async (token: string) => {\n      const result = await revokeSessionAction({ token });\n      const inner = result?.data;\n      if (inner?.success) {\n        toast.success(\"Session successfully revoked\");\n        router.refresh();\n      } else {\n        toast.error(\"An error occurred while revoking session\");\n      }\n    },\n  });\n\n  const { mutate: revokeOthers, isPending: isRevokingOthers } = useMutation({\n    mutationFn: async () => {\n      const result = await revokeAllSessionsAction();\n      const inner = result?.data;\n      if (inner?.success) {\n        toast.success(\"Revoking all sessions successfully done.\");\n        router.refresh();\n      } else {\n        toast.error(\"An error occurred while revoking all sessions\");\n      }\n    },\n  });\n\n  const {\n    data: passkeys,\n    isLoading: isLoadingPasskeys,\n    refetch: refetchPasskeys,\n  } = useQuery({\n    queryKey: [\"passkeys\"],\n    queryFn: async () => {\n      const result = await getPasskeysAction();\n      if (result?.data?.success) {\n        return result.data.value;\n      }\n      throw new Error(\"Failed to fetch passkeys\");\n    },\n  });\n\n  const { mutate: revokePasskey, isPending: isRevokingPasskey } = useMutation({\n    mutationFn: async (id: string) => {\n      const result = await revokePasskeyAction({ id });\n      if (!result?.data?.success) {\n        throw new Error(\"Failed to revoke passkey\");\n      }\n    },\n    onSuccess: () => {\n      toast.success(\"Passkey revoked successfully\");\n      refetchPasskeys();\n    },\n    onError: () => {\n      toast.error(\"Failed to revoke passkey\");\n    },\n  });\n\n  const { mutate: addPasskey, isPending: isAddingPasskey } = useMutation({\n    mutationFn: async () => {\n      const result = await authClient.passkey.addPasskey({\n        name: passkeyName || \"My Passkey\",\n      });\n      if (result?.error) {\n        throw result.error;\n      }\n      return result;\n    },\n    onSuccess: () => {\n      toast.success(\"Passkey added successfully\");\n      setIsAddPasskeyOpen(false);\n      setPasskeyName(\"\");\n      refetchPasskeys();\n    },\n    onError: (error: any) => {\n      toast.error(error.message || \"Failed to add passkey\");\n    },\n  });\n\n  return (\n    <div className=\"space-y-8 animate-in fade-in-50 duration-300\">\n      <div className=\"mb-6 space-y-1\">\n        <h2 className=\"text-2xl font-semibold tracking-tight\">\n          Security Settings\n        </h2>\n        <p className=\"text-sm text-muted-foreground\">\n          Manage your password, two-factor authentication and sessions.\n        </p>\n      </div>\n\n      {(isPasskeyEnabled || isPasswordEnabled || user.twoFactorEnabled) && (\n        <div className=\"space-y-6\">\n          <h3 className=\"text-lg font-medium\">Authentication</h3>\n          <div className=\"border rounded-lg p-4 space-y-4\">\n            {isPasswordEnabled && (\n              <>\n                <div className=\"flex flex-col sm:flex-row sm:items-center justify-between gap-4\">\n                  <div className=\"space-y-1\">\n                    <div className=\"font-medium\">Password</div>\n                    <div className=\"text-sm text-muted-foreground\">\n                      {user.lastChangedPasswordAt\n                        ? `Last changed ${timeAgo(new Date(user.lastChangedPasswordAt))}`\n                        : \"Never changed\"}\n                    </div>\n                  </div>\n                  {credentialAccount ? (\n                    <ResetPasswordProfileProviderModal\n                      open={isPasswordDialogOpen}\n                      onOpenChange={setIsPasswordDialogOpen}\n                    />\n                  ) : (\n                    <SetPasswordProfileProviderModal\n                      open={isPasswordDialogOpen}\n                      onOpenChange={setIsPasswordDialogOpen}\n                    />\n                  )}\n                </div>\n\n                <Separator />\n              </>\n            )}\n\n            {isPasswordEnabled && (\n              <div className=\"flex flex-col sm:flex-row sm:items-center justify-between gap-4\">\n                <div className=\"space-y-1\">\n                  <div className=\"flex items-center gap-2\">\n                    <div className=\"font-medium\">Two-Factor Authentication</div>\n                    {user.twoFactorEnabled && (\n                      <Badge\n                        variant=\"secondary\"\n                        className=\"text-[10px] h-5 px-1.5 text-green-600 bg-green-500/10 border-0\"\n                      >\n                        Active\n                      </Badge>\n                    )}\n                  </div>\n                  <div className=\"text-sm text-muted-foreground\">\n                    Enhance the security of your account by requiring a second\n                    form of verification during login.\n                  </div>\n                </div>\n\n                {user.twoFactorEnabled ? (\n                  <div className=\"flex flex-col items-center gap-2\">\n                    <ViewBackupCodesModal\n                      open={isBackupCodesDialogOpen}\n                      onOpenChange={setIsBackupCodesDialogOpen}\n                    />\n                    <Disable2FAProfileProviderModal\n                      open={isDisable2FADialogOpen}\n                      onOpenChange={setIsDisable2FADialogOpen}\n                    />\n                  </div>\n                ) : (\n                  <Setup2FAProfileProviderModal\n                    disabled={!credentialAccount}\n                    open={isSetup2FADialogOpen}\n                    onOpenChange={setIsSetup2FADialogOpen}\n                  />\n                )}\n              </div>\n            )}\n          </div>\n        </div>\n      )}\n\n      {isPasskeyEnabled && (\n        <div className=\"space-y-6\">\n          <div className=\"flex items-center justify-between\">\n            <div className=\"space-y-1\">\n              <h3 className=\"text-lg font-medium\">Passkeys</h3>\n              <div className=\"text-sm text-muted-foreground\">\n                Login securely with your fingerprint, face recognition, or\n                hardware key.\n              </div>\n            </div>\n\n            <Dialog open={isAddPasskeyOpen} onOpenChange={setIsAddPasskeyOpen}>\n              <DialogTrigger asChild>\n                <Button variant=\"outline\" size=\"sm\">\n                  <Plus className=\"mr-2 h-4 w-4\" />\n                  Add Passkey\n                </Button>\n              </DialogTrigger>\n              <DialogContent>\n                <DialogHeader>\n                  <DialogTitle>Add New Passkey</DialogTitle>\n                  <DialogDescription>\n                    Create a name for your passkey to identify it later.\n                  </DialogDescription>\n                </DialogHeader>\n                <div className=\"grid gap-4 py-4\">\n                  <div className=\"grid gap-2\">\n                    <Label htmlFor=\"name\">Passkey Name</Label>\n                    <Input\n                      id=\"name\"\n                      placeholder=\"e.g. MacBook Pro, iPhone, YubiKey\"\n                      value={passkeyName}\n                      onChange={(e) => setPasskeyName(e.target.value)}\n                    />\n                  </div>\n                </div>\n                <DialogFooter>\n                  <Button\n                    variant=\"outline\"\n                    onClick={() => setIsAddPasskeyOpen(false)}\n                  >\n                    Cancel\n                  </Button>\n                  <Button\n                    onClick={() => addPasskey()}\n                    disabled={isAddingPasskey}\n                  >\n                    {isAddingPasskey && (\n                      <Loader2 className=\"mr-2 h-4 w-4 animate-spin\" />\n                    )}\n                    Create Passkey\n                  </Button>\n                </DialogFooter>\n              </DialogContent>\n            </Dialog>\n          </div>\n\n          <div className=\"border rounded-lg divide-y\">\n            {isLoadingPasskeys ? (\n              <div className=\"flex items-center justify-center p-4\">\n                <Loader2 className=\"h-6 w-6 animate-spin text-muted-foreground\" />\n              </div>\n            ) : passkeys && passkeys.length > 0 ? (\n              passkeys.map((pk: any) => (\n                <PasskeyRow\n                  key={pk.id}\n                  passkey={pk}\n                  onRevoke={(id) => revokePasskey(id)}\n                  isRevoking={isRevokingPasskey}\n                />\n              ))\n            ) : (\n              <div className=\"p-4 text-center text-muted-foreground\">\n                No passkeys found.\n              </div>\n            )}\n          </div>\n        </div>\n      )}\n\n      <div className=\"space-y-6 pb-10\">\n        <div className=\"flex items-center justify-between\">\n          <h3 className=\"text-lg font-medium\">Active Sessions</h3>\n          {sessions && sessions.length > 1 && (\n            <Button\n              variant=\"ghost\"\n              size=\"sm\"\n              className=\"text-destructive hover:text-destructive hover:bg-destructive/10\"\n              onClick={() => revokeOthers()}\n              disabled={isRevokingOthers || (sessions?.length || 0) <= 1}\n            >\n              {isRevokingOthers && (\n                <Loader2 className=\"mr-2 h-4 w-4 animate-spin\" />\n              )}\n              Revoke All\n            </Button>\n          )}\n        </div>\n        <div className=\"border rounded-lg divide-y\">\n          {sessions && sessions.length > 0 ? (\n            sessions?.map((session) => (\n              <SessionRow\n                key={session.id}\n                session={session}\n                onRevoke={(token) => revokeSession(token)}\n                isRevoking={isRevoking}\n                currentSession={currentSession}\n                providers={providers}\n              />\n            ))\n          ) : (\n            <div className=\"p-4 text-center text-muted-foreground\">\n              No active sessions found.\n            </div>\n          )}\n        </div>\n      </div>\n    </div>\n  );\n}\n\nfunction SessionRow({\n  session,\n  onRevoke,\n  isRevoking,\n  currentSession,\n  providers,\n}: {\n  session: Session;\n  onRevoke: (token: string) => void;\n  isRevoking: boolean;\n  currentSession: Session;\n  providers: AuthProviderConfig[];\n}) {\n  const deviceInfo = getDeviceDetails(session.userAgent);\n  const provider = providers.find((p) => p.id === (session as any).providerId);\n\n  return (\n    <div className=\"flex items-center justify-between p-4\">\n      <div className=\"flex items-center gap-4\">\n        <div className=\"w-10 h-10 rounded-full bg-muted flex items-center justify-center text-muted-foreground relative\">\n          <deviceInfo.Icon className=\"w-5 h-5\" />\n          {provider && (\n            <div className=\"absolute -bottom-1 -right-1 w-5 h-5 rounded-full bg-background border flex items-center justify-center overflow-hidden\">\n              {provider.icon.startsWith(\"/\") ||\n              provider.icon.startsWith(\"http\") ? (\n                <Image\n                  src={provider.icon}\n                  alt={provider.id}\n                  width={12}\n                  height={12}\n                  className=\"w-3 h-3\"\n                  unoptimized={provider.icon.startsWith(\"http\")}\n                />\n              ) : (\n                <Icon icon={provider.icon} className=\"w-3 h-3\" />\n              )}\n            </div>\n          )}\n        </div>\n        <div className=\"space-y-0.5\">\n          <div className=\"text-sm font-medium flex items-center gap-2\">\n            {deviceInfo.os}{\" \"}\n            <span className=\"text-muted-foreground font-normal\">\n              • {deviceInfo.browser}\n            </span>\n            {provider && (\n              <span className=\"text-muted-foreground font-normal\">\n                • {provider.title || provider.name}\n              </span>\n            )}\n            {session.id === currentSession.id && (\n              <Badge\n                variant=\"outline\"\n                className=\"text-[10px] h-5 px-1.5 text-sky-600 bg-sky-50 border-sky-200 dark:bg-sky-900/20 dark:border-sky-800 dark:text-sky-400\"\n              >\n                This device\n              </Badge>\n            )}\n          </div>\n          <div className=\"text-xs text-muted-foreground flex items-center gap-1\">\n            <Globe className=\"w-3 h-3\" /> {session.ipAddress} •\n            <span className=\"ml-1\">\n              {session.id === currentSession.id\n                ? \"Active now\"\n                : `Last active ${timeAgo(new Date(session.createdAt))}`}\n            </span>\n          </div>\n        </div>\n      </div>\n\n      {session.id !== currentSession.id && (\n        <Button\n          variant=\"ghost\"\n          size=\"icon\"\n          className=\"h-8 w-8 text-muted-foreground hover:text-destructive\"\n          onClick={() => onRevoke(session.token)}\n          disabled={isRevoking}\n        >\n          {isRevoking ? (\n            <Loader2 className=\"h-4 w-4 animate-spin\" />\n          ) : (\n            <LogOut className=\"w-4 h-4\" />\n          )}\n          <span className=\"sr-only\">Revoke</span>\n        </Button>\n      )}\n    </div>\n  );\n}\n\nfunction PasskeyRow({\n  passkey,\n  onRevoke,\n  isRevoking,\n}: {\n  passkey: any;\n  onRevoke: (id: string) => void;\n  isRevoking: boolean;\n}) {\n  return (\n    <div className=\"flex items-center justify-between p-4\">\n      <div className=\"flex items-center gap-4\">\n        <div className=\"w-10 h-10 rounded-full bg-muted flex items-center justify-center text-muted-foreground\">\n          <Fingerprint className=\"w-5 h-5\" />\n        </div>\n        <div className=\"space-y-0.5\">\n          <div className=\"font-medium text-sm\">\n            {passkey.name || \"Unnamed Passkey\"}\n          </div>\n          <div className=\"text-xs text-muted-foreground\">\n            Created {timeAgo(new Date(passkey.createdAt))}\n          </div>\n        </div>\n      </div>\n      <Button\n        variant=\"ghost\"\n        size=\"icon\"\n        className=\"h-8 w-8 text-muted-foreground hover:text-destructive\"\n        onClick={() => onRevoke(passkey.id)}\n        disabled={isRevoking}\n      >\n        {isRevoking ? (\n          <Loader2 className=\"h-4 w-4 animate-spin\" />\n        ) : (\n          <Trash2 className=\"w-4 h-4\" />\n        )}\n        <span className=\"sr-only\">Revoke</span>\n      </Button>\n    </div>\n  );\n}\n"
  },
  {
    "path": "src/components/wrappers/dashboard/profile/schemas/account.schema.ts",
    "content": "import z from \"zod\";\nimport {zEmail} from \"@/lib/zod\";\n\nexport const EmailSchema = z.object({\n    email: zEmail(),\n});\n\nexport type EmailSchemaType = z.infer<typeof EmailSchema>;\n"
  },
  {
    "path": "src/components/wrappers/dashboard/profile/schemas/general.schema.ts",
    "content": "import z from \"zod\";\nimport {zString} from \"@/lib/zod\";\n\nexport const ProfileSchema = z.object({\n    name: zString().nonempty(),\n    role: zString().nonempty(),\n});\n\nexport type ProfileSchemaType = z.infer<typeof ProfileSchema>;\n"
  },
  {
    "path": "src/components/wrappers/dashboard/profile/schemas/provider.schema.ts",
    "content": "\"use client\";\n\nimport { zPassword } from \"@/lib/zod\";\nimport z from \"zod\";\n\nexport const PasswordProviderSchema = z.object({\n    password: zPassword(),\n    confirmPassword: zPassword(),\n});\n\nexport type PasswordProviderSchemaType = z.infer<typeof PasswordProviderSchema>;\n"
  },
  {
    "path": "src/components/wrappers/dashboard/profile/schemas/security.schema.ts",
    "content": "\"use client\";\n\nimport z from \"zod\";\nimport {zPassword} from \"@/lib/zod\";\n\nexport const ResetPasswordSecuritySchema = z\n    .object({\n        currentPassword: zPassword(),\n        newPassword: zPassword(),\n        confirmPassword: zPassword(),\n    })\n    .superRefine(({ confirmPassword, newPassword }, ctx) => {\n        if (confirmPassword !== newPassword) {\n            ctx.addIssue({\n                code: \"custom\",\n                message: \"New password does not match\",\n                path: [\"confirmPassword\"],\n            });\n        }\n    });\n\nexport type ResetPasswordSecuritySchemaType = z.infer<typeof ResetPasswordSecuritySchema>;\n\nexport const Setup2FASecuritySchema = z.object({\n    code: z.string().min(6, \"Code need to contain at least 6 characters\"),\n});\n\nexport type Setup2FASecuritySchemaType = z.infer<typeof Setup2FASecuritySchema>;\n"
  },
  {
    "path": "src/components/wrappers/dashboard/projects/button-delete-project/button-delete-project.tsx",
    "content": "\"use client\";\n\nimport {Trash2} from \"lucide-react\";\nimport {ButtonWithConfirm} from \"@/components/wrappers/common/button/button-with-confirm\";\nimport {useMutation} from \"@tanstack/react-query\";\nimport {\n    deleteProjectAction\n} from \"@/components/wrappers/dashboard/projects/button-delete-project/delete-project.action\";\nimport {useRouter} from \"next/navigation\";\nimport {toast} from \"sonner\";\nimport {useIsMobile} from \"@/hooks/use-mobile\";\n\nexport type ButtonDeleteProjectProps = {\n    text?: string;\n    projectId: string;\n};\n\nexport const ButtonDeleteProject = (props: ButtonDeleteProjectProps) => {\n    const router = useRouter();\n    const isMobile = useIsMobile()\n\n    const mutation = useMutation({\n        mutationFn: () => deleteProjectAction(props.projectId),\n        onSuccess: async (result: any) => {\n            if (result.data?.success) {\n                toast.success(result.data.actionSuccess.message);\n                router.push(\"/dashboard/projects\");\n            } else {\n                toast.error(result.data.actionError.message || \"Unknown error occurred.\");\n            }\n        },\n    });\n\n    return (\n\n        <ButtonWithConfirm\n            title={props.text ? props.text : \"\"}\n            description=\"Are you sure you want to delete this project ? This action cannot be undone.\"\n            button={{\n                main: {\n                    text: props.text ? !isMobile ? props.text: \"\" : \"\",\n                    variant: \"outline\",\n                    icon: <Trash2 color=\"red\"/>,\n                },\n                confirm: {\n                    className: \"w-full\",\n                    text: \"Delete\",\n                    icon: <Trash2/>,\n                    variant: \"destructive\",\n                    onClick: () => {\n                        mutation.mutate();\n                    },\n                },\n                cancel: {\n                    className: \"w-full\",\n                    text: \"Cancel\",\n                    icon: <Trash2/>,\n                    variant: \"outline\",\n                },\n            }}\n            isPending={mutation.isPending}\n        />\n    );\n};\n"
  },
  {
    "path": "src/components/wrappers/dashboard/projects/button-delete-project/delete-project.action.ts",
    "content": "\"use server\";\n\nimport {userAction} from \"@/lib/safe-actions/actions\";\nimport {z} from \"zod\";\nimport {v4 as uuidv4} from \"uuid\";\nimport {ServerActionResult} from \"@/types/action-type\";\nimport {and, eq, inArray} from \"drizzle-orm\";\nimport {db} from \"@/db\";\nimport * as drizzleDb from \"@/db\";\n\nexport const deleteProjectAction = userAction.schema(z.string()).action(async ({parsedInput}): Promise<ServerActionResult<typeof drizzleDb.schemas.project.$inferSelect>> => {\n    try {\n        const uuid = uuidv4();\n        const databasesUpdated = await db\n            .update(drizzleDb.schemas.database)\n            .set({\n                projectId: null,\n                backupPolicy: null\n            })\n            .where(eq(drizzleDb.schemas.database.projectId, parsedInput)).returning();\n\n\n        const databasesToRemove = databasesUpdated.map((db) => db.id);\n\n        await db.delete(drizzleDb.schemas.retentionPolicy)\n            .where(inArray(drizzleDb.schemas.retentionPolicy.databaseId, databasesToRemove)).execute();\n\n        const updatedProjects = await db\n            .update(drizzleDb.schemas.project)\n            .set({\n                isArchived: true,\n                slug: uuid,\n                name: uuid,\n            })\n            .where(eq(drizzleDb.schemas.project.id, parsedInput))\n            .returning();\n\n        const updatedProject = updatedProjects[0];\n\n        if (!updatedProject) {\n            throw new Error(\"Project not found or update failed\");\n        }\n\n\n        return {\n            success: true,\n            value: updatedProject,\n            actionSuccess: {\n                message: \"Projects has been successfully archived.\",\n                messageParams: {projectId: parsedInput},\n            },\n        };\n    } catch (error) {\n        console.log(error);\n        return {\n            success: false,\n            actionError: {\n                message: \"Failed to archive Projects.\",\n                status: 500,\n                cause: error instanceof Error ? error.message : \"Unknown error\",\n                messageParams: {projectId: parsedInput},\n            },\n        };\n    }\n});\n"
  },
  {
    "path": "src/components/wrappers/dashboard/projects/database/database-backup-list.tsx",
    "content": "\"use client\"\nimport {backupColumns} from \"@/features/dashboard/backup/columns\";\nimport {DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger} from \"@/components/ui/dropdown-menu\";\nimport {ButtonWithLoading} from \"@/components/wrappers/common/button/button-with-loading\";\nimport {MoreHorizontal, Trash2} from \"lucide-react\";\nimport {FilterItem, FiltersDropdown} from \"@/components/wrappers/common/table/filters\";\nimport {DataTable} from \"@/components/wrappers/common/table/data-table\";\nimport {useMemo, useState} from \"react\";\nimport {Backup, BackupWith, DatabaseWith} from \"@/db/schema/07_database\";\nimport {Setting} from \"@/db/schema/01_setting\";\nimport {useMutation, useQueryClient} from \"@tanstack/react-query\";\nimport {toast} from \"sonner\";\nimport {MemberWithUser} from \"@/db/schema/03_organization\";\nimport {deleteBackupAction} from \"@/components/wrappers/dashboard/database/backup/actions/backup-actions.action\";\nimport {ButtonWithConfirm} from \"@/components/wrappers/common/button/button-with-confirm\";\n\n\ntype DatabaseBackupListProps = {\n    isAlreadyRestore: boolean;\n    settings: Setting;\n    database: DatabaseWith;\n    backups: BackupWith[];\n    activeMember: MemberWithUser\n}\n\n\nexport const DatabaseBackupList = (props: DatabaseBackupListProps) => {\n\n    const items = [\n        {label: \"Deleted\", value: \"deleted\"},\n        {label: \"Available\", value: \"available\"},\n    ]\n\n    const [selectedFilters, setSelectedFilters] = useState<FilterItem[]>([items[1]]);\n    const [isActionsOpen, setIsActionsOpen] = useState(false);\n    const queryClient = useQueryClient();\n\n    const columns = useMemo(() => {\n        return backupColumns(props.isAlreadyRestore, props.settings, props.database, props.activeMember);\n    }, [props.isAlreadyRestore, props.activeMember.id, props.activeMember.role]);\n\n    const filteredBackups = useMemo(() => {\n        if (!props.backups) return [];\n\n        return props.backups.filter(backup => {\n            if (selectedFilters.length > 0) {\n                const selectedValues = selectedFilters.map(f => f.value);\n                const status = backup.deletedAt != null ? \"deleted\" : \"available\";\n                if (!selectedValues.includes(status)) return false;\n            }\n\n            return true;\n        });\n    }, [props.backups, selectedFilters]);\n\n\n    const handleSelectFilter = (item: FilterItem) => {\n        setSelectedFilters(prev =>\n            prev.some(f => f.value === item.value)\n                ? prev.filter(f => f.value !== item.value)\n                : [...prev, item]\n        );\n    };\n\n    const clearFilters = () => setSelectedFilters([]);\n\n\n    const mutationDeleteBackups = useMutation({\n        mutationFn: async (backups: Backup[]) => {\n            const results = await Promise.all(\n                backups.map(async (backup) => {\n                    if (backup.deletedAt == null || backup.status == \"ongoing\") {\n\n                        const backupDeleted = await deleteBackupAction({\n                            databaseId: backup.databaseId,\n                            backupId: backup.id,\n                        })\n                        return {\n                            success: backupDeleted?.data?.success,\n                            message: backupDeleted?.data?.success\n                                ? backupDeleted?.data?.actionSuccess?.message\n                                // @ts-ignore\n                                : restoration?.data?.actionError.message,\n                        };\n                    }\n                    return {\n                        success: true,\n                        message: `Already deleted this backup (ref: ${backup.id}).`,\n                    }\n                })\n            );\n            results.forEach((result) => {\n                if (result.success) {\n                    toast.success(result.message);\n                } else {\n                    toast.error(result.message);\n                }\n            });\n            queryClient.invalidateQueries({queryKey: [\"database-data\", props.database.id]});\n        },\n    });\n\n    const isMember = props.activeMember.role === \"member\";\n\n    return (\n        <DataTable\n            enableSelect={!isMember}\n            columns={columns}\n            data={filteredBackups}\n            enablePagination\n            selectedActions={(rows) => (\n                <>\n                    <div className=\"flex justify-start md:justify-between gap-3 md:gap-0 items-center w-full ml-0\">\n                        <div className=\"flex gap-2\">\n                            {!isMember && (\n                                <DropdownMenu open={isActionsOpen} onOpenChange={setIsActionsOpen}>\n                                    <DropdownMenuTrigger asChild>\n                                        <ButtonWithLoading\n                                            variant=\"outline\"\n                                            onClick={(e) => {\n                                                e.stopPropagation();\n                                                setIsActionsOpen(true);\n                                            }}\n                                            disabled={rows.length === 0 || mutationDeleteBackups.isPending}\n                                            icon={<MoreHorizontal/>}\n                                            isPending={mutationDeleteBackups.isPending}\n                                            size=\"sm\"\n                                            type=\"button\"\n                                        >Actions</ButtonWithLoading>\n                                    </DropdownMenuTrigger>\n                                    <DropdownMenuContent align=\"start\">\n                                        <ButtonWithConfirm\n                                            onConfirm={() => {\n                                                mutationDeleteBackups.mutate(rows);\n                                                setIsActionsOpen(false);\n                                            }}\n                                            onCancel={() => setIsActionsOpen(false)}\n                                            title=\"Delete backups?\"\n                                            description=\"Are you sure you want to delete the selected backups? This action cannot be undone.\"\n                                            confirmButtonText=\"Yes, delete\"\n                                            cancelButtonText=\"Cancel\"\n                                        >\n                                            <DropdownMenuItem onSelect={(e) => e.preventDefault()}>\n                                                <Trash2 className=\"me-2 h-4 w-4 text-red-600\"/>\n                                                <span className=\"text-red-600\">Delete Selected</span>\n                                            </DropdownMenuItem>\n                                        </ButtonWithConfirm>\n                                    </DropdownMenuContent>\n                                </DropdownMenu>\n                            )}\n                            <FiltersDropdown\n                                items={items}\n                                selectedItems={selectedFilters}\n                                onSelect={handleSelectFilter}\n                                clearFilters={clearFilters}\n                            />\n                        </div>\n                    </div>\n\n                </>\n            )}\n        />\n    )\n}"
  },
  {
    "path": "src/components/wrappers/dashboard/projects/database/database-content.tsx",
    "content": "\"use client\";\nimport {DatabaseBackupActionsModal} from \"@/components/wrappers/dashboard/database/backup/actions/backup-actions-modal\";\nimport {DatabaseTabs} from \"@/components/wrappers/dashboard/projects/database/database-tabs\";\nimport {Setting} from \"@/db/schema/01_setting\";\nimport {BackupWith, DatabaseWith, Restoration} from \"@/db/schema/07_database\";\nimport {MemberWithUser} from \"@/db/schema/03_organization\";\nimport {useBackupModal} from \"@/components/wrappers/dashboard/database/backup/backup-modal-context\";\nimport {DatabaseKpi} from \"@/components/wrappers/dashboard/projects/database/database-kpi\";\nimport {useQuery} from \"@tanstack/react-query\";\nimport {getDatabaseDataAction} from \"@/components/wrappers/dashboard/database/backup/actions/get-data.action\";\nimport {\n    PageContent,\n    PageDescription,\n    PageTitle,\n} from \"@/features/layout/page\";\nimport {capitalizeFirstLetter} from \"@/utils/text\";\nimport {RetentionPolicySheet} from \"@/components/wrappers/dashboard/database/retention-policy/retention-policy-sheet\";\nimport {CronButton} from \"@/components/wrappers/dashboard/database/cron-button/cron-button\";\nimport {ChannelPoliciesModal} from \"@/components/wrappers/dashboard/database/channels-policy/policy-modal\";\nimport {HardDrive, Megaphone} from \"lucide-react\";\nimport {ImportModal} from \"@/components/wrappers/dashboard/database/import/import-modal\";\nimport {BackupButton} from \"@/components/wrappers/dashboard/backup/backup-button/backup-button\";\nimport {HealthModal} from \"@/components/wrappers/dashboard/database/health/health-modal\";\nimport {HealthcheckLog} from \"@/db/schema/15_healthcheck-log\";\nimport {Badge} from \"@/components/ui/badge\";\n\nexport type DatabaseContentProps = {\n    settings: Setting;\n    backups: BackupWith[];\n    restorations: Restoration[];\n    isAlreadyRestore: boolean;\n    database: DatabaseWith;\n    activeMember: MemberWithUser;\n    totalBackups: number;\n    availableBackups: number;\n    successRate: number | null;\n    organizationId: string;\n    activeOrganizationChannels: any[];\n    activeOrganizationStorageChannels: any[];\n    databaseHealthLogs: HealthcheckLog[]\n};\n\nexport const DatabaseContent = (props: DatabaseContentProps) => {\n    const {} = useBackupModal();\n\n    const {data} = useQuery({\n        queryKey: [\"database-data\", props.database.id],\n        queryFn: async () => {\n            const result = await getDatabaseDataAction({\n                databaseId: props.database.id,\n            });\n            return result?.data;\n        },\n        initialData: {\n            // TODO : to be patched\n            // @ts-ignore\n            database: {\n                ...props.database,\n                project: props.database.project ?? null,\n            },\n            backups: props.backups,\n            restorations: props.restorations,\n            activeOrganizationChannels: props.activeOrganizationChannels,\n            activeOrganizationStorageChannels:\n            props.activeOrganizationStorageChannels,\n            stats: {\n                totalBackups: props.totalBackups,\n                availableBackups: props.availableBackups,\n                successRate: props.successRate,\n            },\n            health: props.databaseHealthLogs\n        },\n        staleTime: 0,\n        gcTime: 0,\n        refetchInterval: 1000,\n    });\n\n    const database = data?.database ?? props.database;\n    const backups = data?.backups ?? props.backups;\n    const restorations = data?.restorations ?? props.restorations;\n    const activeOrganizationChannels =\n        data?.activeOrganizationChannels ?? props.activeOrganizationChannels;\n    const activeOrganizationStorageChannels =\n        data?.activeOrganizationStorageChannels ??\n        props.activeOrganizationStorageChannels;\n    const stats = data?.stats ?? {\n        totalBackups: props.totalBackups,\n        availableBackups: props.availableBackups,\n        successRate: props.successRate,\n    };\n\n    const isAlreadyRestore = restorations.some((r) => r.status === \"waiting\");\n    const isAlreadyBackup = backups.some(\n        (b) => b.status === \"waiting\" || b.status === \"ongoing\",\n    );\n\n    const isMember = props.activeMember.role === \"member\";\n\n    return (\n        <>\n            <div className=\"justify-between gap-2 sm:flex\">\n                <PageTitle className=\"flex flex-col md:flex-row items-center justify-between w-full \">\n                    <div className=\"flex min-w-full md:min-w-fit justify-between gap-2 items-center \">\n                        {capitalizeFirstLetter(database.name)}\n                        <div className=\" flex items-center justify-center\">\n                            <Badge variant=\"outline\" className=\"bg-orange-400/10 border-orange-600/50 text-orange-600\">\n                                {database.dbms}\n                            </Badge>\n                        </div>\n                    </div>\n                    {!isMember && (\n                        <div className=\"flex items-center gap-2 md:justify-between w-full \">\n                            <div className=\"flex items-center gap-2\">\n                                <RetentionPolicySheet database={database}/>\n                                <CronButton database={database}/>\n                                <ChannelPoliciesModal\n                                    database={database}\n                                    kind={\"notification\"}\n                                    icon={<Megaphone/>}\n                                    channels={activeOrganizationChannels}\n                                    organizationId={props.organizationId}\n                                />\n                                <ChannelPoliciesModal\n                                    database={database}\n                                    icon={<HardDrive/>}\n                                    kind={\"storage\"}\n                                    channels={activeOrganizationStorageChannels}\n                                    organizationId={props.organizationId}\n                                />\n                                <ImportModal database={database}/>\n                                <HealthModal database={database} healthLogs={data?.health ?? []}/>\n                            </div>\n\n\n                            <div className=\"flex items-center gap-2\">\n                                <BackupButton\n                                    disable={isAlreadyBackup || !database.lastContact}\n                                    databaseId={database.id}\n                                />\n                            </div>\n                        </div>\n                    )}\n                </PageTitle>\n            </div>\n\n            {database.description && (\n                <PageDescription className=\"mt-5 sm:mt-0\">\n                    {database.description}\n                </PageDescription>\n            )}\n\n            <PageContent className=\"flex flex-col w-full h-full\">\n                <DatabaseKpi\n                    successRate={stats.successRate}\n                    database={database}\n                    availableBackups={stats.availableBackups}\n                    totalBackups={stats.totalBackups}\n                />\n                <DatabaseBackupActionsModal/>\n                <DatabaseTabs\n                    activeMember={props.activeMember}\n                    settings={props.settings}\n                    database={database}\n                    isAlreadyRestore={isAlreadyRestore}\n                    backups={backups}\n                    restorations={restorations}\n                />\n            </PageContent>\n        </>\n    );\n};\n"
  },
  {
    "path": "src/components/wrappers/dashboard/projects/database/database-kpi.tsx",
    "content": "\"use client\";\n\nimport {Card, CardContent, CardHeader, CardTitle} from \"@/components/ui/card\";\nimport {formatDateLastContact} from \"@/utils/date-formatting\";\nimport {Database} from \"@/db/schema/07_database\";\nimport {DatabaseBackup, Server, CheckCircle, Clock} from \"lucide-react\";\n\nexport type DatabaseKpiPro = {\n    successRate: any;\n    database: Database;\n    totalBackups: number;\n    availableBackups: number;\n};\nexport const DatabaseKpi = (props: DatabaseKpiPro) => {\n    return (\n        <div className=\"flex flex-col sm:flex-row sm:justify-between gap-8 mb-6\">\n            <Card className=\"w-full sm:w-auto flex-1\">\n                <CardHeader className=\"flex flex-row items-center justify-between space-y-0 pb-2\">\n                    <CardTitle className=\"text-sm font-medium\">Available Backups</CardTitle>\n                    <DatabaseBackup className=\"h-4 w-4 text-muted-foreground\"/>\n                </CardHeader>\n                <CardContent>\n                    <div className=\"text-2xl font-bold\">{props.availableBackups}</div>\n                    <p className=\"text-xs text-muted-foreground\">Backups currently available</p>\n                </CardContent>\n            </Card>\n            <Card className=\"w-full sm:w-auto flex-1\">\n                <CardHeader className=\"flex flex-row items-center justify-between space-y-0 pb-2\">\n                    <CardTitle className=\"text-sm font-medium\">Total Backups</CardTitle>\n                    <Server className=\"h-4 w-4 text-muted-foreground\"/>\n                </CardHeader>\n                <CardContent>\n                    <div className=\"text-2xl font-bold\">{props.totalBackups}</div>\n                    <p className=\"text-xs text-muted-foreground\">Total backups recorded</p>\n                </CardContent>\n            </Card>\n            <Card className=\"w-full sm:w-auto flex-1\">\n                <CardHeader className=\"flex flex-row items-center justify-between space-y-0 pb-2\">\n                    <CardTitle className=\"text-sm font-medium\">Success Rate</CardTitle>\n                    <CheckCircle className=\"h-4 w-4 text-muted-foreground\"/>\n                </CardHeader>\n                <CardContent>\n                    <div className=\"text-2xl font-bold\">\n                        {typeof props.successRate === 'number' ? `${props.successRate.toFixed(0)} %` : \"Unavailable\"}\n                    </div>\n                    <p className=\"text-xs text-muted-foreground\">Backup success rate</p>\n                </CardContent>\n            </Card>\n            <Card className=\"w-full sm:w-auto flex-1\">\n                <CardHeader className=\"flex flex-row items-center justify-between space-y-0 pb-2\">\n                    <CardTitle className=\"text-sm font-medium\">Last Contact</CardTitle>\n                    <Clock className=\"h-4 w-4 text-muted-foreground\"/>\n                </CardHeader>\n                <CardContent>\n                    <div className=\"text-2xl font-bold\">\n                        {formatDateLastContact(props.database.lastContact)}\n                    </div>\n                    <p className=\"text-xs text-muted-foreground\">Time of last backup contact</p>\n                </CardContent>\n            </Card>\n        </div>\n    );\n};\n"
  },
  {
    "path": "src/components/wrappers/dashboard/projects/database/database-restore-list.tsx",
    "content": "\"use client\"\nimport {DataTable} from \"@/components/wrappers/common/table/data-table\";\nimport {restoreColumns} from \"@/features/dashboard/restore/columns\";\nimport {DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger} from \"@/components/ui/dropdown-menu\";\nimport {ButtonWithLoading} from \"@/components/wrappers/common/button/button-with-loading\";\nimport {MoreHorizontal, Trash2} from \"lucide-react\";\nimport {Restoration} from \"@/db/schema/07_database\";\nimport {useMutation, useQueryClient} from \"@tanstack/react-query\";\nimport {deleteRestoreAction} from \"@/features/dashboard/restore/restore.action\";\nimport {toast} from \"sonner\";\nimport {MemberWithUser} from \"@/db/schema/03_organization\";\nimport {useMemo, useState} from \"react\";\nimport {ButtonWithConfirm} from \"@/components/wrappers/common/button/button-with-confirm\";\n\n\ntype DatabaseRestoreListProps = {\n    isAlreadyRestore: boolean;\n    restorations: Restoration[];\n    activeMember: MemberWithUser;\n    databaseId: string;\n}\n\nexport const DatabaseRestoreList = (props: DatabaseRestoreListProps) => {\n    const queryClient = useQueryClient();\n    const [isActionsOpen, setIsActionsOpen] = useState(false);\n\n    const columns = useMemo(() => {\n        return restoreColumns(props.isAlreadyRestore, props.activeMember);\n    }, [props.isAlreadyRestore, props.activeMember.id, props.activeMember.role]);\n\n    const mutationDeleteRestorations = useMutation({\n        mutationFn: async (restorations: Restoration[]) => {\n            const results = await Promise.all(\n                restorations.map(async (restoration) => {\n                    const restorationDeleted = await deleteRestoreAction({\n                        restorationId: restoration.id,\n                    });\n                    return {\n                        success: restorationDeleted?.data?.success,\n                        message: restorationDeleted?.data?.success\n                            ? restorationDeleted?.data?.actionSuccess?.message\n                            // @ts-ignore\n                            : restorationDeleted?.data?.actionError.message,\n                    };\n\n\n                })\n            );\n            results.forEach((result) => {\n                if (result.success) {\n                    toast.success(result.message);\n                } else {\n                    toast.error(result.message);\n                }\n            });\n            queryClient.invalidateQueries({queryKey: [\"database-data\", props.databaseId]});\n        },\n    });\n    const isMember = props.activeMember.role === \"member\";\n\n\n    return (\n        <DataTable\n            enableSelect={!isMember}\n            columns={columns}\n            data={props.restorations}\n            enablePagination\n            selectedActions={(rows) => (\n                <>\n                    {!isMember && (\n                        <DropdownMenu open={isActionsOpen} onOpenChange={setIsActionsOpen}>\n                            <DropdownMenuTrigger asChild>\n                                <ButtonWithLoading\n                                    variant=\"outline\"\n                                    onClick={(e) => {\n                                        e.stopPropagation();\n                                        setIsActionsOpen(true);\n                                    }}\n                                    disabled={rows.length === 0 || mutationDeleteRestorations.isPending}\n                                    icon={<MoreHorizontal/>}\n                                    isPending={mutationDeleteRestorations.isPending}\n                                    size=\"sm\"\n                                    type=\"button\"\n                                >Actions</ButtonWithLoading>\n                            </DropdownMenuTrigger>\n                            <DropdownMenuContent align=\"start\">\n                                <ButtonWithConfirm \n                                    onConfirm={() => {\n                                        mutationDeleteRestorations.mutate(rows)\n                                        setIsActionsOpen(false);\n                                    }}\n                                    onCancel={() => setIsActionsOpen(false)}\n                                    title=\"Delete restorations?\"\n                                    description=\"Are you sure you want to delete the selected restorations? This action cannot be undone.\"\n                                    confirmButtonText=\"Yes, delete\"\n                                    cancelButtonText=\"Cancel\"\n                                >\n                                    <DropdownMenuItem\n                                        disabled={props.isAlreadyRestore}\n                                        onSelect={(e) => e.preventDefault()}\n                                        className=\"text-red-600 focus:text-red-700\"\n                                    >\n                                        <Trash2 className=\"w-4 h-4 mr-2\"/>\n                                        Delete Selected\n                                    </DropdownMenuItem>\n                                </ButtonWithConfirm>\n                            </DropdownMenuContent>\n                        </DropdownMenu>\n                    )}\n                </>\n            )}\n        />\n    )\n}"
  },
  {
    "path": "src/components/wrappers/dashboard/projects/database/database-tabs.tsx",
    "content": "\"use client\";\n\nimport {Tabs, TabsContent, TabsList, TabsTrigger} from \"@/components/ui/tabs\";\nimport {useEffect, useState} from \"react\";\nimport {useRouter, useSearchParams} from \"next/navigation\";\nimport {BackupWith, DatabaseWith, Restoration} from \"@/db/schema/07_database\";\nimport {Setting} from \"@/db/schema/01_setting\";\nimport {DatabaseBackupList} from \"@/components/wrappers/dashboard/projects/database/database-backup-list\";\nimport {DatabaseRestoreList} from \"@/components/wrappers/dashboard/projects/database/database-restore-list\";\nimport {MemberWithUser} from \"@/db/schema/03_organization\";\n\nexport type DatabaseTabsProps = {\n    settings: Setting,\n    backups: BackupWith[],\n    restorations: Restoration[],\n    isAlreadyRestore: boolean,\n    database: DatabaseWith,\n    activeMember: MemberWithUser\n};\n\nexport const backupOnly = [\"redis\", \"valkey\"];\n\nexport const DatabaseTabs = (props: DatabaseTabsProps) => {\n    const router = useRouter();\n    const searchParams = useSearchParams();\n\n    const [tab, setTab] = useState<string>(() => searchParams.get(\"tab\") ?? \"backup\");\n\n    useEffect(() => {\n        const newTab = searchParams.get(\"tab\") ?? \"backup\";\n        // eslint-disable-next-line react-hooks/set-state-in-effect\n        setTab(newTab);\n    }, [searchParams]);\n\n    const handleChangeTab = (value: string) => {\n        router.push(`?tab=${value}`);\n    };\n\n\n    const isBackupOnly = backupOnly.some((type) => props.database.dbms === type)\n\n\n    return (\n        <>\n            {isBackupOnly ?\n                <DatabaseBackupList\n                    isAlreadyRestore={props.isAlreadyRestore}\n                    settings={props.settings}\n                    database={props.database}\n                    backups={props.backups}\n                    activeMember={props.activeMember}\n                />\n                :\n                <Tabs className=\"flex flex-col flex-1\" value={tab} onValueChange={handleChangeTab}>\n                    <TabsList className=\"grid w-full grid-cols-2\">\n                        <TabsTrigger value=\"backup\">Backup</TabsTrigger>\n                        <TabsTrigger value=\"restore\">Restoration</TabsTrigger>\n                    </TabsList>\n                    <TabsContent className=\"h-full justify-between\" value=\"backup\">\n                        <DatabaseBackupList\n                            isAlreadyRestore={props.isAlreadyRestore}\n                            settings={props.settings}\n                            database={props.database}\n                            backups={props.backups}\n                            activeMember={props.activeMember}\n                        />\n                    </TabsContent>\n                    <TabsContent className=\"h-full justify-between\" value=\"restore\">\n                        <DatabaseRestoreList\n                            isAlreadyRestore={props.isAlreadyRestore}\n                            restorations={props.restorations}\n                            activeMember={props.activeMember}\n                            databaseId={props.database.id}\n                        />\n                    </TabsContent>\n                </Tabs>\n            }\n\n        </>\n\n    );\n};\n"
  },
  {
    "path": "src/components/wrappers/dashboard/projects/project-card/project-card.tsx",
    "content": "\"use client\";\n\nimport { Card } from \"@/components/ui/card\";\nimport Link from \"next/link\";\nimport {ProjectWith} from \"@/db/schema/06_project\";\nimport {ChevronRight, Folder} from \"lucide-react\";\nimport {Badge} from \"@/components/ui/badge\";\n\nexport type projectCardProps = {\n    data: ProjectWith;\n    organizationSlug?: string;\n};\n\nexport const ProjectCard = (props: projectCardProps) => {\n    const { data: project } = props;\n    const dbCount = project.databases.length;\n\n    return (\n        <Link\n            href={`/dashboard/projects/${project.id}`}\n            className=\"group block transition-all duration-200 outline-none focus-visible:ring-2 focus-visible:ring-orange-500/50 focus-visible:ring-offset-2 rounded-xl\"\n        >\n            <Card className=\"relative h-full flex flex-col p-4 transition-all duration-300 border-border/50 bg-card hover:bg-orange-500/[0.02] hover:border-orange-500/30 group-hover:shadow-md overflow-hidden gap-0\">\n                <div className=\"flex items-start justify-between mb-2\">\n                    <div className=\"flex items-center justify-center w-12 h-12 rounded-xl bg-orange-500/10 text-orange-600 dark:text-orange-400 group-hover:bg-orange-500/20 transition-all duration-300\">\n                        <Folder className=\"w-8 h-8\" />\n                    </div>\n                    <Badge className=\"text-[10px] font-medium px-2 py-1 rounded-lg bg-secondary/50 text-foreground\">{dbCount} {dbCount === 1 ? \"Database\" : \"Databases\"}\n                    </Badge>\n                    \n                </div>\n\n                <div className=\"flex flex-col gap-2 flex-1\">\n                    <h3 className=\"text-lg font-black text-foreground group-hover:text-orange-500 transition-colors line-clamp-1 tracking-tight\">\n                        {project.name}\n                    </h3>\n                    <p className=\"text-xs text-muted-foreground line-clamp-2 leading-relaxed\">\n                        Manage your databases and backup policies for this project.\n                    </p>\n                </div>\n                \n                <div className=\"mt-4 flex items-center justify-between pt-3 border-t border-border/50\">\n                    <span className=\"text-[10px] font-bold uppercase tracking-widest text-orange-500 opacity-0 group-hover:opacity-100 transition-all duration-300 transform translate-x-[-10px] group-hover:translate-x-0\">View Project</span>\n                    <div className=\"flex items-center gap-1 text-muted-foreground group-hover:text-orange-500 transition-colors\">\n                        <span className=\"text-[10px] font-bold uppercase tracking-widest group-hover:hidden\">Details</span>\n                        <ChevronRight className=\"w-3.5 h-3.5 group-hover:translate-x-1 transition-transform\" />\n                    </div>\n                </div>\n            </Card>\n        </Link>\n    );\n};\n"
  },
  {
    "path": "src/components/wrappers/dashboard/projects/project-card/project-database-card.tsx",
    "content": "\"use client\";\n\nimport Link from \"next/link\";\nimport Image from \"next/image\";\nimport {useState} from \"react\";\nimport {Card} from \"@/components/ui/card\";\nimport {ConnectionIndicator} from \"@/components/wrappers/common/connection-indicator\";\nimport {formatDateLastContact} from \"@/utils/date-formatting\";\nimport {Database} from \"@/db/schema/07_database\";\nimport {ChevronRight, Activity, Fingerprint, Copy, Check} from \"lucide-react\";\n\nexport type projectDatabaseCardProps = {\n    data: Database;\n    extendedProps: any;\n    organizationSlug: string;\n};\n\nexport const ProjectDatabaseCard = (props: projectDatabaseCardProps) => {\n    const {data: database, extendedProps: extendedProps} = props;\n\n    return (\n        <Link\n            className=\"group block transition-all duration-200 outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 rounded-xl\"\n            href={`/dashboard/projects/${extendedProps.id}/database/${database.id}`}>\n            <DatabaseCard data={database}/>\n        </Link>\n    );\n};\n\nexport type databaseCardProps = {\n    data: Database;\n    withDetails?: boolean;\n};\n\nexport const DatabaseCard = (props: databaseCardProps) => {\n    const {data: database, withDetails = true} = props;\n    const [isCopied, setIsCopied] = useState(false);\n\n    const handleCopy = (e: React.MouseEvent) => {\n        e.preventDefault();\n        e.stopPropagation();\n        navigator.clipboard.writeText(database.agentDatabaseId);\n        setIsCopied(true);\n        setTimeout(() => setIsCopied(false), 2000);\n    };\n\n    return (\n        <Card\n            className=\"relative h-full flex flex-col p-4 transition-all border-border/50 bg-card hover:bg-accent/50 hover:border-primary/50 group-hover:shadow-lg overflow-hidden gap-0\">\n            <div className=\"flex items-start justify-between mb-2\">\n                <div\n                    className=\"relative w-12 h-12 p-2 bg-background rounded-xl border border-border/50 shadow-sm flex items-center justify-center group-hover:border-primary/30 transition-all duration-300 group-hover:scale-105\">\n                    <Image\n                        src={`/images/${database.dbms}.png`}\n                        alt={`${database.dbms} icon`}\n                        width={32}\n                        height={32}\n                        className=\"object-contain w-full h-full\"\n                    />\n                </div>\n                <div className=\"flex flex-col items-end gap-3\">\n                    <div className=\"scale-100 origin-right\">\n                        <ConnectionIndicator date={database.lastContact}/>\n                    </div>\n                </div>\n            </div>\n\n            <div className=\"flex flex-col gap-2 flex-1\">\n                <h3 className=\"text-lg font-black text-foreground group-hover:text-primary transition-colors truncate tracking-tight\">\n                    {database.name}\n                </h3>\n\n                <div className=\"flex flex-col gap-2\">\n                    <div\n                        className=\"flex items-center gap-2 text-muted-foreground group-hover:text-foreground transition-colors\">\n                        <div className=\"p-1 bg-muted/50 rounded-lg\">\n                            <Fingerprint className=\"w-3.5 h-3.5\"/>\n                        </div>\n                        <span className=\"font-mono text-[10px] font-bold truncate\">\n                            {database.agentDatabaseId}\n                        </span>\n                        <button\n                            onClick={handleCopy}\n                            className=\"ml-1 p-0.5 hover:bg-muted rounded-md transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 z-10\"\n                            title=\"Copy ID\"\n                        >\n                            {isCopied ? <Check className=\"w-2.5 h-2.5 text-green-500\"/> :\n                                <Copy className=\"w-2.5 h-2.5\"/>}\n                        </button>\n                    </div>\n                    <div\n                        className=\"flex items-center gap-2 text-muted-foreground group-hover:text-foreground transition-colors\">\n                        <div className=\"p-1 bg-muted/50 rounded-lg\">\n                            <Activity className=\"w-3.5 h-3.5\"/>\n                        </div>\n                        <span className=\"text-[10px] font-bold uppercase tracking-tight\">\n                            {formatDateLastContact(database.lastContact)}\n                        </span>\n                    </div>\n                </div>\n            </div>\n\n            {withDetails && (\n                <div className=\"mt-4 flex items-center justify-between pt-3 border-t border-border/50\">\n                <span\n                    className=\"text-[10px] font-black uppercase tracking-widest text-primary opacity-0 group-hover:opacity-100 transition-all duration-300 transform translate-x-[-10px] group-hover:translate-x-0\">Open</span>\n                    <div\n                        className=\"flex items-center gap-1 text-muted-foreground group-hover:text-primary transition-colors\">\n                        <span\n                            className=\"text-[10px] font-bold uppercase tracking-widest group-hover:hidden\">Details</span>\n                        <ChevronRight className=\"w-3.5 h-3.5 group-hover:translate-x-1 transition-transform\"/>\n                    </div>\n                </div>\n            )}\n        </Card>\n    );\n};\n"
  },
  {
    "path": "src/components/wrappers/dashboard/statistics/charts/evolution-line-chart.tsx",
    "content": "\"use client\";\n\nimport {ChartConfig, ChartTooltip} from \"@/components/ui/chart\";\nimport {CartesianGrid, TooltipProps, XAxis, YAxis} from \"recharts\";\nimport {formatDayOnly} from \"@/utils/date-formatting\";\nimport {LineChartCustom} from \"@/components/wrappers/dashboard/statistics/charts/line-chart\";\nimport {generateFakeEvolutionData} from \"@/components/wrappers/dashboard/statistics/charts/fake-data\";\n\ntype Data = {\n    createdAt: Date;\n};\n\ntype Payload = {\n    date: string;\n    count: number;\n};\n\ntype LineChartDatum = {\n    date: string\n    count: number\n}\n\nexport type EvolutionLineChartProps = {\n    data: Data[];\n\n};\n\nexport function EvolutionLineChart(props: EvolutionLineChartProps) {\n    const {data} = props;\n\n    // const fakeData = generateFakeEvolutionData(14, 2, 10)\n\n    const dailyData = data\n        .reduce((acc, backup) => {\n            const date = backup.createdAt.toISOString().split(\"T\")[0];\n\n            const existing = acc.find(item => item.date === date);\n\n            if (existing) {\n                existing.count += 1;\n            } else {\n                acc.push({date, count: 1});\n            }\n\n            return acc;\n        }, [] as { date: string; count: number }[]);\n\n\n    const chartConfig = {\n        date: {\n            label: \"Date\",\n        },\n        count: {\n            label: \"Number of backups \",\n        },\n    } satisfies ChartConfig;\n\n    return (\n\n        <LineChartCustom<LineChartDatum>\n            config={chartConfig}\n            data={dailyData}\n            title=\"Evolution of the number of backups\"\n            dataKey=\"count\"\n        >\n            <CartesianGrid vertical={false}/>\n            <XAxis\n                dataKey=\"date\"\n                tickLine={false}\n                axisLine={false}\n                tickMargin={8}\n                tickFormatter={(value) =>\n                    formatDayOnly(new Date(value))\n                }\n            />\n\n            <YAxis tickLine={false}/>\n\n            <ChartTooltip\n                cursor={{strokeDasharray: \"3 3\"}}\n                content={<EvolutionTooltip/>}\n            />\n\n        </LineChartCustom>\n\n\n    );\n}\n\n\nfunction EvolutionTooltip({\n                              active,\n                              payload,\n                          }: TooltipProps<number, string>) {\n    if (!active || !payload || payload.length === 0) return null;\n\n    const data = payload[0].payload as Payload;\n\n    return (\n        <div className=\"rounded-lg border bg-background px-3 py-2 shadow-md\">\n            <p className=\"text-sm font-medium\">\n                {formatDayOnly(new Date(data.date))}\n            </p>\n\n            <div className=\"mt-1 flex items-center gap-2 text-sm\">\n                <span className=\"h-2 w-2 rounded-full bg-[#fc6504]\"/>\n                <span className=\"text-muted-foreground\">Backups :</span>\n                <span className=\"ml-auto font-semibold\">\n          {data.count}\n        </span>\n            </div>\n        </div>\n    );\n}"
  },
  {
    "path": "src/components/wrappers/dashboard/statistics/charts/fake-data.ts",
    "content": "type Data = {\n    createdAt: Date;\n};\n\n/**\n * Generate fake backup events over a time range.\n *\n * @param days        Number of days to generate\n * @param minPerDay   Minimum events per day\n * @param maxPerDay   Maximum events per day\n */\nexport function generateFakeEvolutionData(\n    days: number = 30,\n    minPerDay: number = 1,\n    maxPerDay: number = 8\n): Data[] {\n    const result: Data[] = [];\n    const now = new Date();\n\n    for (let d = 0; d < days; d++) {\n        const day = new Date(now);\n        day.setDate(now.getDate() - d);\n\n        const events =\n            Math.floor(Math.random() * (maxPerDay - minPerDay + 1)) + minPerDay;\n\n        for (let i = 0; i < events; i++) {\n            const createdAt = new Date(day);\n            createdAt.setHours(\n                Math.floor(Math.random() * 24),\n                Math.floor(Math.random() * 60),\n                Math.floor(Math.random() * 60)\n            );\n\n            result.push({ createdAt });\n        }\n    }\n\n    return result.sort(\n        (a, b) => a.createdAt.getTime() - b.createdAt.getTime()\n    );\n}\n"
  },
  {
    "path": "src/components/wrappers/dashboard/statistics/charts/line-chart.tsx",
    "content": "import {ChartConfig, ChartContainer} from \"@/components/ui/chart\";\nimport {Line, LineChart} from \"recharts\";\nimport {ReactNode, useState} from \"react\";\nimport {Card, CardContent, CardHeader, CardTitle} from \"@/components/ui/card\";\nimport {PlaceholderChart} from \"@/components/wrappers/dashboard/statistics/charts/utils/placeholder\";\nimport {Select, SelectContent, SelectItem, SelectTrigger, SelectValue} from \"@/components/ui/select\";\n\ntype LineChartCustomProps<T> = {\n    config: ChartConfig,\n    data: T[],\n    children: ReactNode,\n    title: string,\n    dataKey: string,\n    margin?: { left: number; right: number }\n}\n\n\nexport const LineChartCustom = <T extends { date: string }>({\n                                                                config,\n                                                                title,\n                                                                data,\n                                                                children,\n                                                                dataKey,\n                                                                margin\n                                                            }: LineChartCustomProps<T>) => {\n\n\n    const [timeRange, setTimeRange] = useState(\"7d\")\n    const filteredData = data.filter((item) => {\n        const date = new Date(item.date)\n        const referenceDate = new Date()\n        let daysToSubtract = 90\n        if (timeRange === \"30d\") {\n            daysToSubtract = 30\n        } else if (timeRange === \"7d\") {\n            daysToSubtract = 7\n        }\n        const startDate = new Date(referenceDate)\n        startDate.setDate(startDate.getDate() - daysToSubtract)\n        return date >= startDate\n    })\n\n\n    return (\n        <Card className=\"w-full\">\n            <CardHeader className=\"flex items-center gap-4 space-y-0 border-b py-0 sm:flex-row\">\n                <CardTitle className=\"text-sm md:text-lg\">{title}</CardTitle>\n                <Select value={timeRange} onValueChange={setTimeRange}>\n                    <SelectTrigger\n                        className=\" rounded-lg sm:ml-auto sm:flex\"\n                        aria-label=\"Select a value\"\n                    >\n                        <SelectValue placeholder=\"Last 3 months\"/>\n                    </SelectTrigger>\n                    <SelectContent className=\"rounded-xl\">\n                        <SelectItem value=\"7d\" className=\"rounded-lg\">\n                            Last 7 days\n                        </SelectItem>\n                        <SelectItem value=\"30d\" className=\"rounded-lg\">\n                            Last 30 days\n                        </SelectItem>\n                        <SelectItem value=\"90d\" className=\"rounded-lg\">\n                            Last 3 months\n                        </SelectItem>\n                    </SelectContent>\n                </Select>\n\n            </CardHeader>\n            <CardContent className=\"px-2 pt-4 sm:px-6 sm:pt-6 md:pt-0 md:px-6 h-full w-full\">\n\n                {data.length > 0 ? (\n                    <ChartContainer config={config}>\n                        <LineChart\n                            accessibilityLayer\n                            data={filteredData}\n                            margin={margin ? margin : {\n                                left: -35,\n                                right: 12,\n                            }}\n                        >\n                            {children}\n\n                            <Line\n                                dataKey={dataKey}\n                                type=\"linear\"\n                                strokeWidth={2}\n                                stroke=\"#fc6504\"\n                                dot={false}\n                            />\n                        </LineChart>\n                    </ChartContainer>\n                ) : (\n                    <PlaceholderChart text=\"No data available\"/>\n                )}\n            </CardContent>\n        </Card>\n    )\n}\n\n"
  },
  {
    "path": "src/components/wrappers/dashboard/statistics/charts/percentage-line-chart.tsx",
    "content": "\"use client\";\n\nimport {ChartConfig, ChartTooltip} from \"@/components/ui/chart\";\nimport {EStatusSchema} from \"@/db/schema/types\";\nimport {LineChartCustom} from \"@/components/wrappers/dashboard/statistics/charts/line-chart\";\nimport {CartesianGrid, TooltipProps, XAxis, YAxis} from \"recharts\";\nimport {formatDayOnly} from \"@/utils/date-formatting\";\n\ntype Data = {\n    createdAt: Date;\n    status: EStatusSchema;\n    _count: number;\n};\n\ntype Payload = {\n    date: string\n    successRate: number\n}\n\nexport type percentageLineChartProps = {\n    data: Data[];\n};\n\nexport function PercentageLineChart(props: percentageLineChartProps) {\n    const {data} = props;\n\n\n    const dailyStats = data.reduce(\n        (acc, backup) => {\n            const date = backup.createdAt.toISOString().split(\"T\")[0];\n            const status = backup.status;\n\n            if (!acc[date]) {\n                acc[date] = {success: 0, failed: 0, total: 0};\n            }\n\n            acc[date][status === \"success\" ? \"success\" : \"failed\"] += backup._count;\n            acc[date].total += backup._count;\n\n            return acc;\n        },\n        {} as Record<string, { success: number; failed: number; total: number }>\n    );\n\n    const formattedData = Object.entries(dailyStats).map(([date, stats]) => ({\n        date,\n        successRate: (stats.success / stats.total) * 100,\n    }));\n\n\n    const chartConfig = {\n        date: {\n            label: \"Date\",\n        },\n        successRate: {\n            label: \"Success Rate\",\n        },\n    } satisfies ChartConfig;\n\n    return (\n\n        <LineChartCustom<Payload>\n            title=\"Success rate of backups\"\n            config={chartConfig}\n            data={formattedData}\n            dataKey=\"successRate\"\n            margin={{\n                left: -15,\n                right: 12,\n            }}\n        >\n            {/*<CartesianGrid strokeDasharray=\"3 3\" />*/}\n            <CartesianGrid vertical={false}/>\n            <XAxis\n                dataKey=\"date\"\n                tickLine={false}\n                axisLine={false}\n                tickMargin={8}\n                tickFormatter={(value) =>\n                    formatDayOnly(new Date(value))\n                }\n            />\n            <YAxis\n                tickLine={false}\n                domain={[0, 100]}\n                tickFormatter={(tick) => `${Number(tick).toFixed(0)}%`}\n            />\n            <ChartTooltip\n                defaultIndex={1}\n                cursor={{strokeDasharray: \"3 3\"}}\n                content={<PourcentTooltip/>}\n            />\n        </LineChartCustom>\n    );\n}\n\nfunction PourcentTooltip({\n                             active,\n                             payload,\n                         }: TooltipProps<number, string>) {\n    if (!active || !payload || payload.length === 0) return null;\n\n    const data = payload[0].payload as Payload;\n\n    return (\n        <div className=\"rounded-lg border bg-background px-3 py-2 shadow-md\">\n            <p className=\"text-sm font-medium\">\n                {formatDayOnly(new Date(data.date))}\n            </p>\n\n            <div className=\"mt-1 flex items-center gap-2 text-sm\">\n                <span className=\"h-2 w-2 rounded-full bg-[#fc6504]\"/>\n                <span className=\"text-muted-foreground\">Success Rate :</span>\n                <span className=\"ml-auto font-semibold\">\n          {data.successRate.toFixed(0)} %\n        </span>\n            </div>\n        </div>\n    );\n}\n\n\n"
  },
  {
    "path": "src/components/wrappers/dashboard/statistics/charts/utils/placeholder.tsx",
    "content": "\n\nexport const PlaceholderChart = ({text}: { text: string }) => (\n    <div className=\"flex h-100 w-full items-center justify-center text-sm text-muted-foreground\">{text}</div>\n);"
  },
  {
    "path": "src/db/index.ts",
    "content": "import {drizzle} from \"drizzle-orm/node-postgres\";\n\nimport * as settings from \"./schema/01_setting\";\nimport * as user from \"./schema/02_user\";\nimport * as organisation from \"./schema/03_organization\";\nimport * as invitation from \"./schema/04_member\";\nimport * as member from \"./schema/05_invitation\";\nimport * as project from \"./schema/06_project\";\nimport * as agent from \"./schema/08_agent\";\nimport * as database from \"./schema/07_database\";\nimport * as notificationChannel from \"./schema/09_notification-channel\";\nimport * as organizationNotificationChannel from \"./schema/09_notification-channel\";\nimport * as alertPolicy from \"./schema/10_alert-policy\";\nimport * as notificationLog from \"./schema/11_notification-log\";\nimport * as storageChannel from \"./schema/12_storage-channel\";\nimport * as storagePolicy from \"@/db/schema/13_storage-policy\";\nimport * as backupStorage from \"@/db/schema/14_storage-backup\";\nimport * as healthcheckLog from \"@/db/schema/15_healthcheck-log\";\n\nconst log = logger.child({module: \"db\"});\n\n\nimport {Pool} from \"pg\";\n\n// Do not delete\nimport dotenv from \"dotenv\";\nimport {migrate} from \"drizzle-orm/node-postgres/migrator\";\nimport {logger} from \"@/lib/logger\";\n\ndotenv.config({\n    path: \".env\",\n});\n\nconst pool = new Pool({\n    connectionString: process.env.DATABASE_URL!,\n});\n\nexport const schemas = {\n    ...settings,\n    ...user,\n    ...organisation,\n    ...invitation,\n    ...member,\n    ...project,\n    ...agent,\n    ...database,\n    ...notificationChannel,\n    ...organizationNotificationChannel,\n    ...alertPolicy,\n    ...notificationLog,\n    ...storageChannel,\n    ...storagePolicy,\n    ...backupStorage,\n    ...healthcheckLog\n};\n\nexport const db = drizzle({\n    client: pool,\n    // logger: process.env.NODE_ENV != 'production',\n    schema: schemas,\n\n});\n\nexport async function makeMigration() {\n    if (process.env.NODE_ENV != \"development\") {\n        const pool = new Pool({\n            connectionString: process.env.DATABASE_URL!,\n        });\n\n        const database = drizzle({client: pool});\n\n        log.info(\"Running migrations...\");\n        try {\n            await migrate(database, {migrationsFolder: \"./src/db/migrations\"});\n            log.info(\"Migrations applied successfully.\");\n        } catch (error) {\n            log.error({error: error}, \"Error applying migrations:\");\n        }\n    }\n}\n"
  },
  {
    "path": "src/db/migrations/0000_awesome_nomad.sql",
    "content": "CREATE TYPE \"public\".\"dbms_status\" AS ENUM('postgresql', 'mongodb');--> statement-breakpoint\nCREATE TYPE \"public\".\"status\" AS ENUM('waiting', 'ongoing', 'failed', 'success');--> statement-breakpoint\nCREATE TYPE \"public\".\"type_storage\" AS ENUM('local', 's3');--> statement-breakpoint\nCREATE TABLE \"settings\" (\n\t\"id\" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,\n\t\"storage\" \"type_storage\" DEFAULT 'local' NOT NULL,\n\t\"name\" varchar(255) NOT NULL,\n\t\"s3_endpoint_url\" varchar(255),\n\t\"s3_access_key_id\" varchar(255),\n\t\"s3_secret_access_key\" varchar(255),\n\t\"s3_bucket_name\" varchar(255),\n\t\"smtp_password\" varchar(255),\n\t\"smtp_from\" varchar(255),\n\t\"smtp_host\" varchar(255),\n\t\"smtp_port\" varchar(255),\n\t\"smtp_user\" varchar(255),\n\t\"created_at\" timestamp DEFAULT now() NOT NULL,\n\t\"updated_at\" timestamp,\n\tCONSTRAINT \"settings_name_unique\" UNIQUE(\"name\")\n);\n--> statement-breakpoint\nCREATE TABLE \"account\" (\n\t\"id\" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,\n\t\"account_id\" text NOT NULL,\n\t\"provider_id\" text NOT NULL,\n\t\"user_id\" uuid NOT NULL,\n\t\"access_token\" text,\n\t\"refresh_token\" text,\n\t\"id_token\" text,\n\t\"access_token_expires_at\" timestamp,\n\t\"refresh_token_expires_at\" timestamp,\n\t\"scope\" text,\n\t\"password\" text,\n\t\"created_at\" timestamp DEFAULT now() NOT NULL,\n\t\"updated_at\" timestamp\n);\n--> statement-breakpoint\nCREATE TABLE \"session\" (\n\t\"id\" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,\n\t\"expires_at\" timestamp NOT NULL,\n\t\"token\" text NOT NULL,\n\t\"created_at\" timestamp DEFAULT now() NOT NULL,\n\t\"updated_at\" timestamp,\n\t\"ip_address\" text,\n\t\"user_agent\" text,\n\t\"user_id\" uuid NOT NULL,\n\t\"impersonated_by\" text,\n\t\"active_organization_id\" text,\n\tCONSTRAINT \"session_token_unique\" UNIQUE(\"token\")\n);\n--> statement-breakpoint\nCREATE TABLE \"user\" (\n\t\"id\" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,\n\t\"name\" text NOT NULL,\n\t\"email\" text NOT NULL,\n\t\"email_verified\" boolean NOT NULL,\n\t\"image\" text,\n\t\"created_at\" timestamp DEFAULT now() NOT NULL,\n\t\"updated_at\" timestamp,\n\t\"role\" text,\n\t\"banned\" boolean,\n\t\"ban_reason\" text,\n\t\"ban_expires\" timestamp,\n\t\"deleted_at\" timestamp,\n\tCONSTRAINT \"user_email_unique\" UNIQUE(\"email\")\n);\n--> statement-breakpoint\nCREATE TABLE \"verification\" (\n\t\"id\" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,\n\t\"identifier\" text NOT NULL,\n\t\"value\" text NOT NULL,\n\t\"expires_at\" timestamp NOT NULL,\n\t\"created_at\" timestamp DEFAULT now() NOT NULL,\n\t\"updated_at\" timestamp\n);\n--> statement-breakpoint\nCREATE TABLE \"organization\" (\n\t\"id\" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,\n\t\"name\" text NOT NULL,\n\t\"slug\" text NOT NULL,\n\t\"logo\" text,\n\t\"created_at\" timestamp DEFAULT now() NOT NULL,\n\t\"updated_at\" timestamp,\n\t\"metadata\" text,\n\tCONSTRAINT \"organization_slug_unique\" UNIQUE(\"slug\")\n);\n--> statement-breakpoint\nCREATE TABLE \"member\" (\n\t\"id\" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,\n\t\"organization_id\" uuid NOT NULL,\n\t\"user_id\" uuid NOT NULL,\n\t\"role\" text NOT NULL,\n\t\"created_at\" timestamp DEFAULT now() NOT NULL,\n\t\"updated_at\" timestamp\n);\n--> statement-breakpoint\nCREATE TABLE \"invitation\" (\n\t\"id\" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,\n\t\"organization_id\" uuid NOT NULL,\n\t\"email\" text NOT NULL,\n\t\"role\" text,\n\t\"status\" text NOT NULL,\n\t\"expires_at\" timestamp NOT NULL,\n\t\"inviter_id\" uuid NOT NULL\n);\n--> statement-breakpoint\nCREATE TABLE \"projects\" (\n\t\"id\" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,\n\t\"slug\" text NOT NULL,\n\t\"name\" text NOT NULL,\n\t\"is_archived\" boolean DEFAULT false,\n\t\"created_at\" timestamp DEFAULT now() NOT NULL,\n\t\"updated_at\" timestamp,\n\t\"organization_id\" uuid NOT NULL,\n\tCONSTRAINT \"projects_slug_unique\" UNIQUE(\"slug\")\n);\n--> statement-breakpoint\nCREATE TABLE \"backups\" (\n\t\"id\" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,\n\t\"status\" \"status\" DEFAULT 'waiting' NOT NULL,\n\t\"file\" text,\n\t\"created_at\" timestamp DEFAULT now() NOT NULL,\n\t\"updated_at\" timestamp,\n\t\"database_id\" uuid NOT NULL\n);\n--> statement-breakpoint\nCREATE TABLE \"databases\" (\n\t\"id\" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,\n\t\"agent_database_id\" uuid DEFAULT gen_random_uuid() NOT NULL,\n\t\"name\" text NOT NULL,\n\t\"dbms\" \"dbms_status\" NOT NULL,\n\t\"description\" text,\n\t\"backup_policy\" text,\n\t\"is_waiting_for_backup\" boolean DEFAULT false NOT NULL,\n\t\"backup_to_restore\" text,\n\t\"created_at\" timestamp DEFAULT now() NOT NULL,\n\t\"updated_at\" timestamp,\n\t\"agent_id\" uuid NOT NULL,\n\t\"last_contact\" timestamp,\n\t\"project_id\" uuid\n);\n--> statement-breakpoint\nCREATE TABLE \"restorations\" (\n\t\"id\" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,\n\t\"status\" \"status\" DEFAULT 'waiting' NOT NULL,\n\t\"created_at\" timestamp DEFAULT now() NOT NULL,\n\t\"updated_at\" timestamp,\n\t\"backup_id\" uuid NOT NULL,\n\t\"database_id\" uuid\n);\n--> statement-breakpoint\nCREATE TABLE \"agents\" (\n\t\"id\" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,\n\t\"slug\" text NOT NULL,\n\t\"name\" text NOT NULL,\n\t\"description\" text NOT NULL,\n\t\"created_at\" timestamp DEFAULT now() NOT NULL,\n\t\"updated_at\" timestamp,\n\t\"last_contact\" timestamp,\n\tCONSTRAINT \"agents_slug_unique\" UNIQUE(\"slug\")\n);\n--> statement-breakpoint\nALTER TABLE \"account\" ADD CONSTRAINT \"account_user_id_user_id_fk\" FOREIGN KEY (\"user_id\") REFERENCES \"public\".\"user\"(\"id\") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint\nALTER TABLE \"session\" ADD CONSTRAINT \"session_user_id_user_id_fk\" FOREIGN KEY (\"user_id\") REFERENCES \"public\".\"user\"(\"id\") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint\nALTER TABLE \"member\" ADD CONSTRAINT \"member_organization_id_organization_id_fk\" FOREIGN KEY (\"organization_id\") REFERENCES \"public\".\"organization\"(\"id\") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint\nALTER TABLE \"member\" ADD CONSTRAINT \"member_user_id_user_id_fk\" FOREIGN KEY (\"user_id\") REFERENCES \"public\".\"user\"(\"id\") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint\nALTER TABLE \"invitation\" ADD CONSTRAINT \"invitation_organization_id_organization_id_fk\" FOREIGN KEY (\"organization_id\") REFERENCES \"public\".\"organization\"(\"id\") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint\nALTER TABLE \"invitation\" ADD CONSTRAINT \"invitation_inviter_id_user_id_fk\" FOREIGN KEY (\"inviter_id\") REFERENCES \"public\".\"user\"(\"id\") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint\nALTER TABLE \"projects\" ADD CONSTRAINT \"projects_organization_id_organization_id_fk\" FOREIGN KEY (\"organization_id\") REFERENCES \"public\".\"organization\"(\"id\") ON DELETE no action ON UPDATE no action;--> statement-breakpoint\nALTER TABLE \"backups\" ADD CONSTRAINT \"backups_database_id_databases_id_fk\" FOREIGN KEY (\"database_id\") REFERENCES \"public\".\"databases\"(\"id\") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint\nALTER TABLE \"databases\" ADD CONSTRAINT \"databases_agent_id_agents_id_fk\" FOREIGN KEY (\"agent_id\") REFERENCES \"public\".\"agents\"(\"id\") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint\nALTER TABLE \"databases\" ADD CONSTRAINT \"databases_project_id_projects_id_fk\" FOREIGN KEY (\"project_id\") REFERENCES \"public\".\"projects\"(\"id\") ON DELETE no action ON UPDATE no action;--> statement-breakpoint\nALTER TABLE \"restorations\" ADD CONSTRAINT \"restorations_backup_id_backups_id_fk\" FOREIGN KEY (\"backup_id\") REFERENCES \"public\".\"backups\"(\"id\") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint\nALTER TABLE \"restorations\" ADD CONSTRAINT \"restorations_database_id_databases_id_fk\" FOREIGN KEY (\"database_id\") REFERENCES \"public\".\"databases\"(\"id\") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint\nCREATE UNIQUE INDEX \"database_id_status_unique\" ON \"backups\" USING btree (\"database_id\",\"status\");"
  },
  {
    "path": "src/db/migrations/0001_wealthy_leo.sql",
    "content": "DROP INDEX \"database_id_status_unique\";"
  },
  {
    "path": "src/db/migrations/0002_pink_groot.sql",
    "content": "ALTER TABLE \"agents\" ADD COLUMN \"is_archived\" boolean DEFAULT false;"
  },
  {
    "path": "src/db/migrations/0003_absent_maestro.sql",
    "content": "CREATE TYPE \"public\".\"retention_policy_type\" AS ENUM('count', 'days', 'gfs');--> statement-breakpoint\nCREATE TABLE \"retention_policies\" (\n\t\"id\" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,\n\t\"database_id\" uuid NOT NULL,\n\t\"type\" \"retention_policy_type\" NOT NULL,\n\t\"count\" integer DEFAULT 7,\n\t\"days\" integer DEFAULT 30,\n\t\"gfs_daily\" integer DEFAULT 7,\n\t\"gfs_weekly\" integer DEFAULT 4,\n\t\"gfs_monthly\" integer DEFAULT 12,\n\t\"gfs_yearly\" integer DEFAULT 3,\n\t\"created_at\" timestamp DEFAULT now() NOT NULL,\n\t\"updated_at\" timestamp\n);\n--> statement-breakpoint\nALTER TABLE \"retention_policies\" ADD CONSTRAINT \"retention_policies_database_id_databases_id_fk\" FOREIGN KEY (\"database_id\") REFERENCES \"public\".\"databases\"(\"id\") ON DELETE cascade ON UPDATE no action;"
  },
  {
    "path": "src/db/migrations/0004_dazzling_hawkeye.sql",
    "content": "ALTER TABLE \"settings\" ADD COLUMN \"deleted_at\" timestamp;--> statement-breakpoint\nALTER TABLE \"account\" ADD COLUMN \"deleted_at\" timestamp;--> statement-breakpoint\nALTER TABLE \"session\" ADD COLUMN \"deleted_at\" timestamp;--> statement-breakpoint\nALTER TABLE \"verification\" ADD COLUMN \"deleted_at\" timestamp;--> statement-breakpoint\nALTER TABLE \"organization\" ADD COLUMN \"deleted_at\" timestamp;--> statement-breakpoint\nALTER TABLE \"member\" ADD COLUMN \"deleted_at\" timestamp;--> statement-breakpoint\nALTER TABLE \"invitation\" ADD COLUMN \"updated_at\" timestamp;--> statement-breakpoint\nALTER TABLE \"invitation\" ADD COLUMN \"created_at\" timestamp DEFAULT now() NOT NULL;--> statement-breakpoint\nALTER TABLE \"invitation\" ADD COLUMN \"deleted_at\" timestamp;--> statement-breakpoint\nALTER TABLE \"projects\" ADD COLUMN \"deleted_at\" timestamp;--> statement-breakpoint\nALTER TABLE \"backups\" ADD COLUMN \"deleted_at\" timestamp;--> statement-breakpoint\nALTER TABLE \"databases\" ADD COLUMN \"deleted_at\" timestamp;--> statement-breakpoint\nALTER TABLE \"restorations\" ADD COLUMN \"deleted_at\" timestamp;--> statement-breakpoint\nALTER TABLE \"retention_policies\" ADD COLUMN \"deleted_at\" timestamp;--> statement-breakpoint\nALTER TABLE \"agents\" ADD COLUMN \"deleted_at\" timestamp;"
  },
  {
    "path": "src/db/migrations/0005_old_swarm.sql",
    "content": "ALTER TABLE \"projects\" DROP CONSTRAINT \"projects_organization_id_organization_id_fk\";\n--> statement-breakpoint\nALTER TABLE \"projects\" ADD CONSTRAINT \"projects_organization_id_organization_id_fk\" FOREIGN KEY (\"organization_id\") REFERENCES \"public\".\"organization\"(\"id\") ON DELETE cascade ON UPDATE no action;"
  },
  {
    "path": "src/db/migrations/0006_moaning_pete_wisdom.sql",
    "content": "ALTER TABLE \"databases\" ALTER COLUMN \"dbms\" SET DATA TYPE text;--> statement-breakpoint\nDROP TYPE \"public\".\"dbms_status\";--> statement-breakpoint\nCREATE TYPE \"public\".\"dbms_status\" AS ENUM('postgresql', 'mysql');--> statement-breakpoint\nALTER TABLE \"databases\" ALTER COLUMN \"dbms\" SET DATA TYPE \"public\".\"dbms_status\" USING \"dbms\"::\"public\".\"dbms_status\";"
  },
  {
    "path": "src/db/migrations/0007_last_umar.sql",
    "content": "CREATE TYPE \"public\".\"provider_kind\" AS ENUM('curl', 'slack', 'smtp', 'webhook');--> statement-breakpoint\nCREATE TABLE \"notification_channel\" (\n\t\"id\" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,\n\t\"provider\" \"provider_kind\" NOT NULL,\n\t\"name\" varchar(255) NOT NULL,\n\t\"config\" jsonb NOT NULL,\n\t\"enabled\" boolean DEFAULT false NOT NULL,\n\t\"updated_at\" timestamp,\n\t\"created_at\" timestamp DEFAULT now() NOT NULL,\n\t\"deleted_at\" timestamp\n);\n--> statement-breakpoint\nCREATE TABLE \"organization_notification_channels\" (\n\t\"organization_id\" uuid NOT NULL,\n\t\"notification_channel_id\" uuid NOT NULL,\n\tCONSTRAINT \"organization_notification_channels_organization_id_notification_channel_id_unique\" UNIQUE(\"organization_id\",\"notification_channel_id\")\n);\n--> statement-breakpoint\nALTER TABLE \"organization_notification_channels\" ADD CONSTRAINT \"organization_notification_channels_organization_id_organization_id_fk\" FOREIGN KEY (\"organization_id\") REFERENCES \"public\".\"organization\"(\"id\") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint\nALTER TABLE \"organization_notification_channels\" ADD CONSTRAINT \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\" FOREIGN KEY (\"notification_channel_id\") REFERENCES \"public\".\"notification_channel\"(\"id\") ON DELETE cascade ON UPDATE no action;"
  },
  {
    "path": "src/db/migrations/0008_aberrant_scorpion.sql",
    "content": "CREATE TYPE \"public\".\"event_kind\" AS ENUM('error_backup', 'error_restore', 'success_restore', 'success_backup', 'weekly_report');--> statement-breakpoint\nCREATE TYPE \"public\".\"level\" AS ENUM('critical', 'warning', 'info');--> statement-breakpoint\nCREATE TABLE \"alert_policy\" (\n\t\"id\" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,\n\t\"notification_channel_id\" uuid NOT NULL,\n\t\"event_kind\" \"event_kind\"[] NOT NULL,\n\t\"enabled\" boolean DEFAULT true NOT NULL,\n\t\"database_id\" uuid NOT NULL,\n\t\"updated_at\" timestamp,\n\t\"created_at\" timestamp DEFAULT now() NOT NULL,\n\t\"deleted_at\" timestamp\n);\n--> statement-breakpoint\nCREATE TABLE \"notification_log\" (\n\t\"id\" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,\n\t\"channel_id\" uuid NOT NULL,\n\t\"policy_id\" uuid,\n\t\"organization_id\" uuid,\n\t\"title\" varchar(255) NOT NULL,\n\t\"message\" text NOT NULL,\n\t\"level\" \"level\" NOT NULL,\n\t\"payload\" jsonb,\n\t\"success\" boolean NOT NULL,\n\t\"error\" text,\n\t\"provider_response\" jsonb,\n\t\"sent_at\" timestamp DEFAULT now() NOT NULL,\n\t\"updated_at\" timestamp,\n\t\"created_at\" timestamp DEFAULT now() NOT NULL,\n\t\"deleted_at\" timestamp\n);\n--> statement-breakpoint\nALTER TABLE \"alert_policy\" ADD CONSTRAINT \"alert_policy_notification_channel_id_notification_channel_id_fk\" FOREIGN KEY (\"notification_channel_id\") REFERENCES \"public\".\"notification_channel\"(\"id\") ON DELETE restrict ON UPDATE no action;--> statement-breakpoint\nALTER TABLE \"alert_policy\" ADD CONSTRAINT \"alert_policy_database_id_databases_id_fk\" FOREIGN KEY (\"database_id\") REFERENCES \"public\".\"databases\"(\"id\") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint\nALTER TABLE \"notification_log\" ADD CONSTRAINT \"notification_log_channel_id_notification_channel_id_fk\" FOREIGN KEY (\"channel_id\") REFERENCES \"public\".\"notification_channel\"(\"id\") ON DELETE restrict ON UPDATE no action;--> statement-breakpoint\nALTER TABLE \"notification_log\" ADD CONSTRAINT \"notification_log_policy_id_alert_policy_id_fk\" FOREIGN KEY (\"policy_id\") REFERENCES \"public\".\"alert_policy\"(\"id\") ON DELETE restrict ON UPDATE no action;--> statement-breakpoint\nALTER TABLE \"notification_log\" ADD CONSTRAINT \"notification_log_organization_id_organization_id_fk\" FOREIGN KEY (\"organization_id\") REFERENCES \"public\".\"organization\"(\"id\") ON DELETE set null ON UPDATE no action;"
  },
  {
    "path": "src/db/migrations/0009_lucky_edwin_jarvis.sql",
    "content": "ALTER TABLE \"alert_policy\" DROP CONSTRAINT \"alert_policy_notification_channel_id_notification_channel_id_fk\";\n--> statement-breakpoint\nALTER TABLE \"alert_policy\" ADD CONSTRAINT \"alert_policy_notification_channel_id_notification_channel_id_fk\" FOREIGN KEY (\"notification_channel_id\") REFERENCES \"public\".\"notification_channel\"(\"id\") ON DELETE cascade ON UPDATE no action;"
  },
  {
    "path": "src/db/migrations/0010_past_trauma.sql",
    "content": "ALTER TABLE \"notification_channel\" ALTER COLUMN \"provider\" SET DATA TYPE text;--> statement-breakpoint\nDROP TYPE \"public\".\"provider_kind\";--> statement-breakpoint\nCREATE TYPE \"public\".\"provider_kind\" AS ENUM('slack', 'smtp');--> statement-breakpoint\nALTER TABLE \"notification_channel\" ALTER COLUMN \"provider\" SET DATA TYPE \"public\".\"provider_kind\" USING \"provider\"::\"public\".\"provider_kind\";"
  },
  {
    "path": "src/db/migrations/0011_outgoing_blob.sql",
    "content": "ALTER TABLE \"notification_log\" DROP CONSTRAINT \"notification_log_channel_id_notification_channel_id_fk\";\n--> statement-breakpoint\nALTER TABLE \"notification_log\" DROP CONSTRAINT \"notification_log_policy_id_alert_policy_id_fk\";\n--> statement-breakpoint\nALTER TABLE \"notification_log\" DROP CONSTRAINT \"notification_log_organization_id_organization_id_fk\";\n--> statement-breakpoint\nALTER TABLE \"notification_log\" ADD COLUMN \"event\" text;--> statement-breakpoint\nALTER TABLE \"notification_log\" ADD COLUMN \"provider\" text NOT NULL;--> statement-breakpoint\nALTER TABLE \"notification_log\" ADD COLUMN \"provider_name\" text NOT NULL;"
  },
  {
    "path": "src/db/migrations/0012_peaceful_leopardon.sql",
    "content": "ALTER TABLE \"agents\" ADD COLUMN \"version\" text;"
  },
  {
    "path": "src/db/migrations/0013_past_logan.sql",
    "content": "ALTER TABLE \"user\" ADD COLUMN \"lastChangedPasswordAt\" timestamp;--> statement-breakpoint\nALTER TABLE \"user\" ADD COLUMN \"two_factor_enabled\" boolean DEFAULT false;"
  },
  {
    "path": "src/db/migrations/0014_strong_galactus.sql",
    "content": "CREATE TABLE \"passkey\" (\n\t\"id\" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,\n\t\"name\" text,\n\t\"publicKey\" text NOT NULL,\n\t\"userId\" uuid NOT NULL,\n\t\"credentialId\" text NOT NULL,\n\t\"counter\" integer NOT NULL,\n\t\"deviceType\" text NOT NULL,\n\t\"backedUp\" boolean NOT NULL,\n\t\"transports\" text,\n\t\"updated_at\" timestamp,\n\t\"created_at\" timestamp DEFAULT now() NOT NULL,\n\t\"deleted_at\" timestamp\n);\n--> statement-breakpoint\nCREATE TABLE \"two_factor\" (\n\t\"id\" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,\n\t\"secret\" text NOT NULL,\n\t\"backup_codes\" text NOT NULL,\n\t\"user_id\" uuid NOT NULL\n);\n--> statement-breakpoint\nALTER TABLE \"passkey\" ADD CONSTRAINT \"passkey_userId_user_id_fk\" FOREIGN KEY (\"userId\") REFERENCES \"public\".\"user\"(\"id\") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint\nALTER TABLE \"two_factor\" ADD CONSTRAINT \"two_factor_user_id_user_id_fk\" FOREIGN KEY (\"user_id\") REFERENCES \"public\".\"user\"(\"id\") ON DELETE cascade ON UPDATE no action;"
  },
  {
    "path": "src/db/migrations/0015_absurd_next_avengers.sql",
    "content": "CREATE TYPE \"public\".\"user_themes\" AS ENUM('light', 'dark', 'system');--> statement-breakpoint\nALTER TABLE \"user\" ADD COLUMN \"theme\" \"user_themes\" DEFAULT 'light' NOT NULL;"
  },
  {
    "path": "src/db/migrations/0016_broken_morgan_stark.sql",
    "content": "ALTER TABLE \"backups\" ADD COLUMN \"file_size\" integer;"
  },
  {
    "path": "src/db/migrations/0017_wild_purple_man.sql",
    "content": "ALTER TYPE \"public\".\"provider_kind\" ADD VALUE 'discord';--> statement-breakpoint\nALTER TYPE \"public\".\"provider_kind\" ADD VALUE 'telegram';"
  },
  {
    "path": "src/db/migrations/0018_smiling_mole_man.sql",
    "content": "ALTER TYPE \"public\".\"provider_kind\" ADD VALUE 'gotify';--> statement-breakpoint\nALTER TYPE \"public\".\"provider_kind\" ADD VALUE 'ntfy';"
  },
  {
    "path": "src/db/migrations/0019_overjoyed_butterfly.sql",
    "content": "ALTER TYPE \"public\".\"provider_kind\" ADD VALUE 'webhook';"
  },
  {
    "path": "src/db/migrations/0020_low_giant_girl.sql",
    "content": "ALTER TABLE \"user\" ADD COLUMN \"lastConnectedAt\" timestamp;"
  },
  {
    "path": "src/db/migrations/0020_thankful_sunspot.sql",
    "content": "CREATE TYPE \"public\".\"provider_storage_kind\" AS ENUM('local', 's3');--> statement-breakpoint\nCREATE TABLE \"organization_storage_channels\" (\n\t\"organization_id\" uuid NOT NULL,\n\t\"storage_channel_id\" uuid NOT NULL,\n\tCONSTRAINT \"organization_storage_channels_organization_id_storage_channel_id_unique\" UNIQUE(\"organization_id\",\"storage_channel_id\")\n);\n--> statement-breakpoint\nCREATE TABLE \"storage_channel\" (\n\t\"id\" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,\n\t\"provider\" \"provider_storage_kind\" NOT NULL,\n\t\"name\" varchar(255) NOT NULL,\n\t\"config\" jsonb NOT NULL,\n\t\"enabled\" boolean DEFAULT false NOT NULL,\n\t\"updated_at\" timestamp,\n\t\"created_at\" timestamp DEFAULT now() NOT NULL,\n\t\"deleted_at\" timestamp\n);\n--> statement-breakpoint\nALTER TABLE \"organization_storage_channels\" ADD CONSTRAINT \"organization_storage_channels_organization_id_organization_id_fk\" FOREIGN KEY (\"organization_id\") REFERENCES \"public\".\"organization\"(\"id\") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint\nALTER TABLE \"organization_storage_channels\" ADD CONSTRAINT \"organization_storage_channels_storage_channel_id_storage_channel_id_fk\" FOREIGN KEY (\"storage_channel_id\") REFERENCES \"public\".\"storage_channel\"(\"id\") ON DELETE cascade ON UPDATE no action;"
  },
  {
    "path": "src/db/migrations/0021_soft_blockbuster.sql",
    "content": "CREATE TABLE \"storage_policy\" (\n\t\"id\" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,\n\t\"storage_channel_id\" uuid NOT NULL,\n\t\"enabled\" boolean DEFAULT true NOT NULL,\n\t\"database_id\" uuid NOT NULL,\n\t\"updated_at\" timestamp,\n\t\"created_at\" timestamp DEFAULT now() NOT NULL,\n\t\"deleted_at\" timestamp\n);\n--> statement-breakpoint\nALTER TABLE \"storage_policy\" ADD CONSTRAINT \"storage_policy_storage_channel_id_storage_channel_id_fk\" FOREIGN KEY (\"storage_channel_id\") REFERENCES \"public\".\"storage_channel\"(\"id\") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint\nALTER TABLE \"storage_policy\" ADD CONSTRAINT \"storage_policy_database_id_databases_id_fk\" FOREIGN KEY (\"database_id\") REFERENCES \"public\".\"databases\"(\"id\") ON DELETE cascade ON UPDATE no action;"
  },
  {
    "path": "src/db/migrations/0022_purple_retro_girl.sql",
    "content": "CREATE TYPE \"public\".\"backup_storage_status\" AS ENUM('pending', 'success', 'failed');--> statement-breakpoint\nCREATE TABLE \"backup_storage\" (\n\t\"id\" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,\n\t\"backup_id\" uuid NOT NULL,\n\t\"storage_channel_id\" uuid NOT NULL,\n\t\"status\" \"backup_storage_status\" DEFAULT 'pending' NOT NULL,\n\t\"path\" text,\n\t\"size\" integer,\n\t\"checksum\" text,\n\t\"updated_at\" timestamp,\n\t\"created_at\" timestamp DEFAULT now() NOT NULL,\n\t\"deleted_at\" timestamp\n);\n--> statement-breakpoint\nALTER TABLE \"backup_storage\" ADD CONSTRAINT \"backup_storage_backup_id_backups_id_fk\" FOREIGN KEY (\"backup_id\") REFERENCES \"public\".\"backups\"(\"id\") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint\nALTER TABLE \"backup_storage\" ADD CONSTRAINT \"backup_storage_storage_channel_id_storage_channel_id_fk\" FOREIGN KEY (\"storage_channel_id\") REFERENCES \"public\".\"storage_channel\"(\"id\") ON DELETE cascade ON UPDATE no action;"
  },
  {
    "path": "src/db/migrations/0023_common_the_captain.sql",
    "content": "ALTER TABLE \"storage_channel\" ADD COLUMN \"organization_id\" uuid;--> statement-breakpoint\nALTER TABLE \"storage_channel\" ADD CONSTRAINT \"storage_channel_organization_id_organization_id_fk\" FOREIGN KEY (\"organization_id\") REFERENCES \"public\".\"organization\"(\"id\") ON DELETE cascade ON UPDATE no action;"
  },
  {
    "path": "src/db/migrations/0024_lush_blindfold.sql",
    "content": "ALTER TABLE \"notification_channel\" ADD COLUMN \"organization_id\" uuid;--> statement-breakpoint\nALTER TABLE \"notification_channel\" ADD CONSTRAINT \"notification_channel_organization_id_organization_id_fk\" FOREIGN KEY (\"organization_id\") REFERENCES \"public\".\"organization\"(\"id\") ON DELETE cascade ON UPDATE no action;"
  },
  {
    "path": "src/db/migrations/0025_past_franklin_richards.sql",
    "content": "ALTER TABLE \"settings\" ADD COLUMN \"default_storage_channel_id\" uuid;--> statement-breakpoint\nALTER TABLE \"settings\" ADD CONSTRAINT \"settings_default_storage_channel_id_storage_channel_id_fk\" FOREIGN KEY (\"default_storage_channel_id\") REFERENCES \"public\".\"storage_channel\"(\"id\") ON DELETE set null ON UPDATE no action;"
  },
  {
    "path": "src/db/migrations/0026_storage-backend.sql",
    "content": "-- Custom SQL Migration: Create Storage Channel and Populate Backup Storage\nCREATE EXTENSION IF NOT EXISTS \"pgcrypto\";\n\n\n -- Add column\nALTER TABLE public.restorations\n    ADD COLUMN backup_storage_id uuid;\n\n-- Add foreign key\nALTER TABLE public.restorations\n    ADD CONSTRAINT restorations_backup_storage_id_fk\n        FOREIGN KEY (backup_storage_id)\n            REFERENCES public.backup_storage(id)\n            ON DELETE CASCADE\n            ON UPDATE NO ACTION;\n\n\nDO $$\n    DECLARE\n        s RECORD;\n        channel_id UUID;\n        existing_local RECORD;\n        p RECORD;\n        d RECORD;\n        b RECORD;\n    BEGIN\n        -- Get current settings (assume single row)\n        SELECT * INTO s FROM settings LIMIT 1;\n\n        -- Create S3 or Local storage channel\n        IF s.storage = 's3' THEN\n            BEGIN\n                INSERT INTO storage_channel (\n                    id, organization_id, provider, name, config, enabled, created_at, updated_at\n                )\n                VALUES (\n                           gen_random_uuid(),\n                           NULL,\n                           's3',\n                           'Default S3 Channel',\n                           jsonb_build_object(\n                                   'endPointUrl', s.s3_endpoint_url,\n                                   'accessKey', s.s3_access_key_id,\n                                   'secretKey', s.s3_secret_access_key,\n                                   'bucketName', s.s3_bucket_name\n                           ),\n                           true,\n                           NOW(),\n                           NOW()\n                       )\n                RETURNING id INTO channel_id;\n            EXCEPTION WHEN OTHERS THEN\n                RAISE NOTICE 'Failed to create S3 storage_channel: %', SQLERRM;\n                -- Try to fallback to existing S3 channel\n                SELECT id INTO channel_id FROM storage_channel WHERE provider = 's3' LIMIT 1;\n            END;\n        ELSE\n            SELECT * INTO existing_local\n            FROM storage_channel\n            WHERE provider = 'local'\n            LIMIT 1;\n\n            IF existing_local IS NULL THEN\n                INSERT INTO storage_channel (\n                    id, organization_id, provider, name, config, enabled, created_at, updated_at\n                )\n                VALUES (\n                           gen_random_uuid(),\n                           NULL,\n                           'local',\n                           'System',\n                           '{}'::jsonb,\n                           true,\n                           NOW(),\n                           NOW()\n                       )\n                RETURNING id INTO channel_id;\n            ELSE\n                UPDATE storage_channel\n                SET name = 'System',\n                    config = '{}'::jsonb,\n                    enabled = true,\n                    updated_at = NOW()\n                WHERE id = existing_local.id\n                RETURNING id INTO channel_id;\n            END IF;\n        END IF;\n\n        -- Safety check\n        IF channel_id IS NULL THEN\n            RAISE EXCEPTION 'channel_id is NULL. Cannot proceed with backup_storage inserts.';\n        END IF;\n\n        -- Update settings with default storage channel\n        UPDATE settings\n        SET default_storage_channel_id = channel_id\n        WHERE id = s.id;\n\n        -- Loop over projects -> databases -> backups\n        FOR p IN SELECT id, slug FROM projects LOOP\n                RAISE NOTICE 'Processing project: %', p.slug;\n\n                FOR d IN SELECT id FROM databases WHERE project_id = p.id LOOP\n                        RAISE NOTICE ' Database ID: %', d.id;\n\n                        FOR b IN SELECT id, file AS file_name, file_size FROM backups WHERE database_id = d.id LOOP\n                                RAISE NOTICE '  Backup: %', b.file_name;\n                                BEGIN\n                                    INSERT INTO backup_storage (\n                                        id,\n                                        backup_id,\n                                        storage_channel_id,\n                                        status,\n                                        path,\n                                        size,\n                                        checksum,\n                                        created_at,\n                                        updated_at\n                                    )\n                                    VALUES (\n                                               gen_random_uuid(),\n                                               b.id,\n                                               channel_id,\n                                               'success',\n                                               format('backups/%s/%s', p.slug, b.file_name),\n                                               b.file_size,\n                                               NULL,\n                                               NOW(),\n                                               NOW()\n                                           );\n                                EXCEPTION WHEN OTHERS THEN\n                                    RAISE NOTICE 'Failed to insert backup_storage for backup %: %', b.id, SQLERRM;\n                                END;\n                            END LOOP;\n                    END LOOP;\n            END LOOP;\n\n    END $$;\n"
  },
  {
    "path": "src/db/migrations/0027_special_the_santerians.sql",
    "content": "ALTER TABLE \"backups\" ADD COLUMN \"imported\" boolean DEFAULT false;"
  },
  {
    "path": "src/db/migrations/0028_graceful_ben_parker.sql",
    "content": "ALTER TABLE \"settings\" DROP COLUMN \"storage\";--> statement-breakpoint\nALTER TABLE \"settings\" DROP COLUMN \"s3_endpoint_url\";--> statement-breakpoint\nALTER TABLE \"settings\" DROP COLUMN \"s3_access_key_id\";--> statement-breakpoint\nALTER TABLE \"settings\" DROP COLUMN \"s3_secret_access_key\";--> statement-breakpoint\nALTER TABLE \"settings\" DROP COLUMN \"s3_bucket_name\";"
  },
  {
    "path": "src/db/migrations/0029_lowly_white_tiger.sql",
    "content": "ALTER TABLE \"user\" ADD COLUMN \"lastConnectedAt\" timestamp;"
  },
  {
    "path": "src/db/migrations/0030_dizzy_morlocks.sql",
    "content": "ALTER TYPE \"public\".\"dbms_status\" ADD VALUE 'mongodb';"
  },
  {
    "path": "src/db/migrations/0031_chemical_edwin_jarvis.sql",
    "content": "ALTER TABLE \"settings\" ADD COLUMN \"smtp_secure\" boolean;"
  },
  {
    "path": "src/db/migrations/0032_sparkling_thunderbolt_ross.sql",
    "content": "ALTER TYPE \"public\".\"provider_storage_kind\" ADD VALUE 'google-drive';"
  },
  {
    "path": "src/db/migrations/0033_handy_valeria_richards.sql",
    "content": "ALTER TABLE \"settings\" ADD COLUMN \"encryption\" boolean DEFAULT false;"
  },
  {
    "path": "src/db/migrations/0034_lush_speed.sql",
    "content": "ALTER TYPE \"public\".\"dbms_status\" ADD VALUE 'sqlite';"
  },
  {
    "path": "src/db/migrations/0035_late_young_avengers.sql",
    "content": "CREATE TABLE \"sso_provider\" (\n\t\"id\" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,\n\t\"issuer\" text NOT NULL,\n\t\"oidc_config\" json,\n\t\"saml_config\" json,\n\t\"user_id\" uuid,\n\t\"provider_id\" text NOT NULL,\n\t\"organization_id\" text,\n\t\"domain\" text NOT NULL,\n\tCONSTRAINT \"sso_provider_provider_id_unique\" UNIQUE(\"provider_id\")\n);\n--> statement-breakpoint\nALTER TABLE \"passkey\" DROP CONSTRAINT \"passkey_userId_user_id_fk\";\n--> statement-breakpoint\nALTER TABLE \"passkey\" ADD COLUMN \"public_key\" text NOT NULL;--> statement-breakpoint\nALTER TABLE \"passkey\" ADD COLUMN \"user_id\" uuid NOT NULL;--> statement-breakpoint\nALTER TABLE \"passkey\" ADD COLUMN \"credential_id\" text NOT NULL;--> statement-breakpoint\nALTER TABLE \"passkey\" ADD COLUMN \"device_type\" text NOT NULL;--> statement-breakpoint\nALTER TABLE \"passkey\" ADD COLUMN \"backed_up\" boolean NOT NULL;--> statement-breakpoint\nALTER TABLE \"passkey\" ADD COLUMN \"aaguid\" text;--> statement-breakpoint\nALTER TABLE \"session\" ADD COLUMN \"provider_id\" text;--> statement-breakpoint\nALTER TABLE \"sso_provider\" ADD CONSTRAINT \"sso_provider_user_id_user_id_fk\" FOREIGN KEY (\"user_id\") REFERENCES \"public\".\"user\"(\"id\") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint\nALTER TABLE \"passkey\" ADD CONSTRAINT \"passkey_user_id_user_id_fk\" FOREIGN KEY (\"user_id\") REFERENCES \"public\".\"user\"(\"id\") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint\nALTER TABLE \"passkey\" DROP COLUMN \"publicKey\";--> statement-breakpoint\nALTER TABLE \"passkey\" DROP COLUMN \"userId\";--> statement-breakpoint\nALTER TABLE \"passkey\" DROP COLUMN \"credentialId\";--> statement-breakpoint\nALTER TABLE \"passkey\" DROP COLUMN \"deviceType\";--> statement-breakpoint\nALTER TABLE \"passkey\" DROP COLUMN \"backedUp\";"
  },
  {
    "path": "src/db/migrations/0036_chief_night_thrasher.sql",
    "content": "ALTER TABLE \"passkey\" RENAME COLUMN \"public_key\" TO \"publicKey\";--> statement-breakpoint\nALTER TABLE \"passkey\" RENAME COLUMN \"credential_id\" TO \"credentialId\";--> statement-breakpoint\nALTER TABLE \"passkey\" RENAME COLUMN \"device_type\" TO \"deviceType\";--> statement-breakpoint\nALTER TABLE \"passkey\" RENAME COLUMN \"backed_up\" TO \"backedUp\";"
  },
  {
    "path": "src/db/migrations/0037_neat_talon.sql",
    "content": "ALTER TABLE \"passkey\" RENAME COLUMN \"credentialId\" TO \"credentialID\";"
  },
  {
    "path": "src/db/migrations/0038_misty_red_hulk.sql",
    "content": "ALTER TYPE \"public\".\"dbms_status\" ADD VALUE 'redis';"
  },
  {
    "path": "src/db/migrations/0039_conscious_solo.sql",
    "content": "ALTER TYPE \"public\".\"dbms_status\" ADD VALUE 'valkey';"
  },
  {
    "path": "src/db/migrations/0040_quick_lester.sql",
    "content": "CREATE TYPE \"public\".\"healthcheck_status\" AS ENUM('success', 'failed');--> statement-breakpoint\nCREATE TYPE \"public\".\"healthcheck_kind\" AS ENUM('database', 'agent');--> statement-breakpoint\nCREATE TABLE \"healthcheck_log\" (\n\t\"id\" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,\n\t\"kind\" \"healthcheck_kind\" NOT NULL,\n\t\"date\" timestamp,\n\t\"status\" \"healthcheck_status\",\n\t\"object_id\" uuid,\n\t\"updated_at\" timestamp,\n\t\"created_at\" timestamp DEFAULT now() NOT NULL,\n\t\"deleted_at\" timestamp\n);\n"
  },
  {
    "path": "src/db/migrations/0041_spooky_radioactive_man.sql",
    "content": "ALTER TABLE \"healthcheck_log\" ALTER COLUMN \"date\" SET NOT NULL;--> statement-breakpoint\nALTER TABLE \"healthcheck_log\" ALTER COLUMN \"status\" SET NOT NULL;--> statement-breakpoint\nALTER TABLE \"healthcheck_log\" ALTER COLUMN \"object_id\" SET NOT NULL;"
  },
  {
    "path": "src/db/migrations/0042_breezy_namora.sql",
    "content": "ALTER TABLE \"settings\" ADD COLUMN \"default_notification_channel_id\" uuid;--> statement-breakpoint\nALTER TABLE \"settings\" ADD CONSTRAINT \"settings_default_notification_channel_id_notification_channel_id_fk\" FOREIGN KEY (\"default_notification_channel_id\") REFERENCES \"public\".\"notification_channel\"(\"id\") ON DELETE set null ON UPDATE no action;"
  },
  {
    "path": "src/db/migrations/0043_peaceful_chat.sql",
    "content": "ALTER TABLE \"agents\" ADD COLUMN \"health_error_count\" integer;"
  },
  {
    "path": "src/db/migrations/0044_steep_wiccan.sql",
    "content": "ALTER TYPE \"public\".\"event_kind\" ADD VALUE 'error_health_agent';"
  },
  {
    "path": "src/db/migrations/0045_needy_martin_li.sql",
    "content": "ALTER TYPE \"public\".\"event_kind\" ADD VALUE 'error_health_database';"
  },
  {
    "path": "src/db/migrations/0046_mysterious_menace.sql",
    "content": "ALTER TABLE \"databases\" ADD COLUMN \"health_error_count\" integer;"
  },
  {
    "path": "src/db/migrations/0047_wet_carnage.sql",
    "content": "ALTER TYPE \"public\".\"dbms_status\" ADD VALUE 'mariadb' BEFORE 'mongodb';"
  },
  {
    "path": "src/db/migrations/0048_yellow_eddie_brock.sql",
    "content": "ALTER TYPE \"public\".\"dbms_status\" ADD VALUE 'firebird';"
  },
  {
    "path": "src/db/migrations/0049_chief_terrax.sql",
    "content": "CREATE TABLE \"organization_agents\" (\n\t\"organization_id\" uuid NOT NULL,\n\t\"agent_id\" uuid NOT NULL,\n\tCONSTRAINT \"organization_agents_organization_id_agent_id_unique\" UNIQUE(\"organization_id\",\"agent_id\")\n);\n--> statement-breakpoint\nALTER TABLE \"agents\" ADD COLUMN \"organization_id\" uuid;--> statement-breakpoint\nALTER TABLE \"organization_agents\" ADD CONSTRAINT \"organization_agents_organization_id_organization_id_fk\" FOREIGN KEY (\"organization_id\") REFERENCES \"public\".\"organization\"(\"id\") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint\nALTER TABLE \"organization_agents\" ADD CONSTRAINT \"organization_agents_agent_id_agents_id_fk\" FOREIGN KEY (\"agent_id\") REFERENCES \"public\".\"agents\"(\"id\") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint\nALTER TABLE \"agents\" ADD CONSTRAINT \"agents_organization_id_organization_id_fk\" FOREIGN KEY (\"organization_id\") REFERENCES \"public\".\"organization\"(\"id\") ON DELETE cascade ON UPDATE no action;"
  },
  {
    "path": "src/db/migrations/0050_dark_saracen.sql",
    "content": "-- Custom SQL migration file, put your code below! --\n\n\nDO $$\n    DECLARE\n        org RECORD;\n        proj RECORD;\n        db RECORD;\n    BEGIN\n        FOR org IN SELECT id FROM organization LOOP\n                FOR proj IN\n                    SELECT id FROM projects WHERE organization_id = org.id\n                    LOOP\n                        FOR db IN\n                            SELECT agent_id FROM databases WHERE project_id = proj.id\n                            LOOP\n                                IF db.agent_id IS NOT NULL THEN\n                                    INSERT INTO organization_agents (\n                                        organization_id,\n                                        agent_id\n                                    )\n                                    VALUES (\n                                               org.id,\n                                               db.agent_id\n                                           )\n                                    ON CONFLICT (organization_id, agent_id) DO NOTHING;\n                                END IF;\n                            END LOOP;\n                    END LOOP;\n            END LOOP;\n    END $$;"
  },
  {
    "path": "src/db/migrations/0051_young_senator_kelly.sql",
    "content": "ALTER TABLE \"organization_agents\" ADD COLUMN \"updated_at\" timestamp;--> statement-breakpoint\nALTER TABLE \"organization_agents\" ADD COLUMN \"created_at\" timestamp DEFAULT now() NOT NULL;--> statement-breakpoint\nALTER TABLE \"organization_agents\" ADD COLUMN \"deleted_at\" timestamp;"
  },
  {
    "path": "src/db/migrations/0052_cute_punisher.sql",
    "content": "ALTER TABLE \"two_factor\" ADD COLUMN IF NOT EXISTS \"verified\" boolean DEFAULT false;\nUPDATE \"two_factor\" SET \"verified\" = true WHERE \"verified\" = false;\nALTER TABLE \"two_factor\" ALTER COLUMN \"verified\" SET NOT NULL;\nALTER TABLE \"two_factor\" ALTER COLUMN \"verified\" DROP DEFAULT;\n"
  },
  {
    "path": "src/db/migrations/0053_lyrical_union_jack.sql",
    "content": "ALTER TABLE \"backups\" ADD COLUMN \"migrated\" boolean DEFAULT false;"
  },
  {
    "path": "src/db/migrations/meta/0000_snapshot.json",
    "content": "{\n  \"id\": \"3d165821-b11d-4be7-b3fb-83c4485e44a8\",\n  \"prevId\": \"00000000-0000-0000-0000-000000000000\",\n  \"version\": \"7\",\n  \"dialect\": \"postgresql\",\n  \"tables\": {\n    \"public.settings\": {\n      \"name\": \"settings\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"storage\": {\n          \"name\": \"storage\",\n          \"type\": \"type_storage\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'local'\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"s3_endpoint_url\": {\n          \"name\": \"s3_endpoint_url\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_access_key_id\": {\n          \"name\": \"s3_access_key_id\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_secret_access_key\": {\n          \"name\": \"s3_secret_access_key\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_bucket_name\": {\n          \"name\": \"s3_bucket_name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_password\": {\n          \"name\": \"smtp_password\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_from\": {\n          \"name\": \"smtp_from\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_host\": {\n          \"name\": \"smtp_host\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_port\": {\n          \"name\": \"smtp_port\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_user\": {\n          \"name\": \"smtp_user\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"settings_name_unique\": {\n          \"name\": \"settings_name_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"name\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.account\": {\n      \"name\": \"account\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"account_id\": {\n          \"name\": \"account_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"access_token\": {\n          \"name\": \"access_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token\": {\n          \"name\": \"refresh_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"id_token\": {\n          \"name\": \"id_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"access_token_expires_at\": {\n          \"name\": \"access_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token_expires_at\": {\n          \"name\": \"refresh_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"scope\": {\n          \"name\": \"scope\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"password\": {\n          \"name\": \"password\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"account_user_id_user_id_fk\": {\n          \"name\": \"account_user_id_user_id_fk\",\n          \"tableFrom\": \"account\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.session\": {\n      \"name\": \"session\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"token\": {\n          \"name\": \"token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ip_address\": {\n          \"name\": \"ip_address\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_agent\": {\n          \"name\": \"user_agent\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"impersonated_by\": {\n          \"name\": \"impersonated_by\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"active_organization_id\": {\n          \"name\": \"active_organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"session_user_id_user_id_fk\": {\n          \"name\": \"session_user_id_user_id_fk\",\n          \"tableFrom\": \"session\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"session_token_unique\": {\n          \"name\": \"session_token_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"token\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.user\": {\n      \"name\": \"user\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email_verified\": {\n          \"name\": \"email_verified\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"image\": {\n          \"name\": \"image\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"banned\": {\n          \"name\": \"banned\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_reason\": {\n          \"name\": \"ban_reason\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_expires\": {\n          \"name\": \"ban_expires\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"user_email_unique\": {\n          \"name\": \"user_email_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"email\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.verification\": {\n      \"name\": \"verification\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"identifier\": {\n          \"name\": \"identifier\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"value\": {\n          \"name\": \"value\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization\": {\n      \"name\": \"organization\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"logo\": {\n          \"name\": \"logo\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"metadata\": {\n          \"name\": \"metadata\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_slug_unique\": {\n          \"name\": \"organization_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.member\": {\n      \"name\": \"member\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"member_organization_id_organization_id_fk\": {\n          \"name\": \"member_organization_id_organization_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"member_user_id_user_id_fk\": {\n          \"name\": \"member_user_id_user_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.invitation\": {\n      \"name\": \"invitation\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"inviter_id\": {\n          \"name\": \"inviter_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"invitation_organization_id_organization_id_fk\": {\n          \"name\": \"invitation_organization_id_organization_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"invitation_inviter_id_user_id_fk\": {\n          \"name\": \"invitation_inviter_id_user_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"inviter_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.projects\": {\n      \"name\": \"projects\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"projects_organization_id_organization_id_fk\": {\n          \"name\": \"projects_organization_id_organization_id_fk\",\n          \"tableFrom\": \"projects\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"no action\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"projects_slug_unique\": {\n          \"name\": \"projects_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backups\": {\n      \"name\": \"backups\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"file\": {\n          \"name\": \"file\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {\n        \"database_id_status_unique\": {\n          \"name\": \"database_id_status_unique\",\n          \"columns\": [\n            {\n              \"expression\": \"database_id\",\n              \"isExpression\": false,\n              \"asc\": true,\n              \"nulls\": \"last\"\n            },\n            {\n              \"expression\": \"status\",\n              \"isExpression\": false,\n              \"asc\": true,\n              \"nulls\": \"last\"\n            }\n          ],\n          \"isUnique\": true,\n          \"concurrently\": false,\n          \"method\": \"btree\",\n          \"with\": {}\n        }\n      },\n      \"foreignKeys\": {\n        \"backups_database_id_databases_id_fk\": {\n          \"name\": \"backups_database_id_databases_id_fk\",\n          \"tableFrom\": \"backups\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.databases\": {\n      \"name\": \"databases\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"agent_database_id\": {\n          \"name\": \"agent_database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"dbms\": {\n          \"name\": \"dbms\",\n          \"type\": \"dbms_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_policy\": {\n          \"name\": \"backup_policy\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"is_waiting_for_backup\": {\n          \"name\": \"is_waiting_for_backup\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"backup_to_restore\": {\n          \"name\": \"backup_to_restore\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"agent_id\": {\n          \"name\": \"agent_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"project_id\": {\n          \"name\": \"project_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"databases_agent_id_agents_id_fk\": {\n          \"name\": \"databases_agent_id_agents_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"agents\",\n          \"columnsFrom\": [\n            \"agent_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"databases_project_id_projects_id_fk\": {\n          \"name\": \"databases_project_id_projects_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"projects\",\n          \"columnsFrom\": [\n            \"project_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"no action\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.restorations\": {\n      \"name\": \"restorations\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"restorations_backup_id_backups_id_fk\": {\n          \"name\": \"restorations_backup_id_backups_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_database_id_databases_id_fk\": {\n          \"name\": \"restorations_database_id_databases_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.agents\": {\n      \"name\": \"agents\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"agents_slug_unique\": {\n          \"name\": \"agents_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    }\n  },\n  \"enums\": {\n    \"public.dbms_status\": {\n      \"name\": \"dbms_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"postgresql\",\n        \"mongodb\"\n      ]\n    },\n    \"public.status\": {\n      \"name\": \"status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"waiting\",\n        \"ongoing\",\n        \"failed\",\n        \"success\"\n      ]\n    },\n    \"public.type_storage\": {\n      \"name\": \"type_storage\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\"\n      ]\n    }\n  },\n  \"schemas\": {},\n  \"sequences\": {},\n  \"roles\": {},\n  \"policies\": {},\n  \"views\": {},\n  \"_meta\": {\n    \"columns\": {},\n    \"schemas\": {},\n    \"tables\": {}\n  }\n}"
  },
  {
    "path": "src/db/migrations/meta/0001_snapshot.json",
    "content": "{\n  \"id\": \"d782a269-0b75-41b0-b70e-e3bf214f4f80\",\n  \"prevId\": \"3d165821-b11d-4be7-b3fb-83c4485e44a8\",\n  \"version\": \"7\",\n  \"dialect\": \"postgresql\",\n  \"tables\": {\n    \"public.settings\": {\n      \"name\": \"settings\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"storage\": {\n          \"name\": \"storage\",\n          \"type\": \"type_storage\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'local'\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"s3_endpoint_url\": {\n          \"name\": \"s3_endpoint_url\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_access_key_id\": {\n          \"name\": \"s3_access_key_id\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_secret_access_key\": {\n          \"name\": \"s3_secret_access_key\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_bucket_name\": {\n          \"name\": \"s3_bucket_name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_password\": {\n          \"name\": \"smtp_password\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_from\": {\n          \"name\": \"smtp_from\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_host\": {\n          \"name\": \"smtp_host\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_port\": {\n          \"name\": \"smtp_port\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_user\": {\n          \"name\": \"smtp_user\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"settings_name_unique\": {\n          \"name\": \"settings_name_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"name\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.account\": {\n      \"name\": \"account\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"account_id\": {\n          \"name\": \"account_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"access_token\": {\n          \"name\": \"access_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token\": {\n          \"name\": \"refresh_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"id_token\": {\n          \"name\": \"id_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"access_token_expires_at\": {\n          \"name\": \"access_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token_expires_at\": {\n          \"name\": \"refresh_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"scope\": {\n          \"name\": \"scope\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"password\": {\n          \"name\": \"password\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"account_user_id_user_id_fk\": {\n          \"name\": \"account_user_id_user_id_fk\",\n          \"tableFrom\": \"account\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.session\": {\n      \"name\": \"session\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"token\": {\n          \"name\": \"token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ip_address\": {\n          \"name\": \"ip_address\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_agent\": {\n          \"name\": \"user_agent\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"impersonated_by\": {\n          \"name\": \"impersonated_by\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"active_organization_id\": {\n          \"name\": \"active_organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"session_user_id_user_id_fk\": {\n          \"name\": \"session_user_id_user_id_fk\",\n          \"tableFrom\": \"session\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"session_token_unique\": {\n          \"name\": \"session_token_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"token\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.user\": {\n      \"name\": \"user\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email_verified\": {\n          \"name\": \"email_verified\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"image\": {\n          \"name\": \"image\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"banned\": {\n          \"name\": \"banned\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_reason\": {\n          \"name\": \"ban_reason\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_expires\": {\n          \"name\": \"ban_expires\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"user_email_unique\": {\n          \"name\": \"user_email_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"email\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.verification\": {\n      \"name\": \"verification\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"identifier\": {\n          \"name\": \"identifier\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"value\": {\n          \"name\": \"value\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization\": {\n      \"name\": \"organization\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"logo\": {\n          \"name\": \"logo\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"metadata\": {\n          \"name\": \"metadata\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_slug_unique\": {\n          \"name\": \"organization_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.member\": {\n      \"name\": \"member\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"member_organization_id_organization_id_fk\": {\n          \"name\": \"member_organization_id_organization_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"member_user_id_user_id_fk\": {\n          \"name\": \"member_user_id_user_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.invitation\": {\n      \"name\": \"invitation\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"inviter_id\": {\n          \"name\": \"inviter_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"invitation_organization_id_organization_id_fk\": {\n          \"name\": \"invitation_organization_id_organization_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"invitation_inviter_id_user_id_fk\": {\n          \"name\": \"invitation_inviter_id_user_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"inviter_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.projects\": {\n      \"name\": \"projects\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"projects_organization_id_organization_id_fk\": {\n          \"name\": \"projects_organization_id_organization_id_fk\",\n          \"tableFrom\": \"projects\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"no action\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"projects_slug_unique\": {\n          \"name\": \"projects_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backups\": {\n      \"name\": \"backups\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"file\": {\n          \"name\": \"file\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backups_database_id_databases_id_fk\": {\n          \"name\": \"backups_database_id_databases_id_fk\",\n          \"tableFrom\": \"backups\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.databases\": {\n      \"name\": \"databases\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"agent_database_id\": {\n          \"name\": \"agent_database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"dbms\": {\n          \"name\": \"dbms\",\n          \"type\": \"dbms_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_policy\": {\n          \"name\": \"backup_policy\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"is_waiting_for_backup\": {\n          \"name\": \"is_waiting_for_backup\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"backup_to_restore\": {\n          \"name\": \"backup_to_restore\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"agent_id\": {\n          \"name\": \"agent_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"project_id\": {\n          \"name\": \"project_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"databases_agent_id_agents_id_fk\": {\n          \"name\": \"databases_agent_id_agents_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"agents\",\n          \"columnsFrom\": [\n            \"agent_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"databases_project_id_projects_id_fk\": {\n          \"name\": \"databases_project_id_projects_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"projects\",\n          \"columnsFrom\": [\n            \"project_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"no action\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.restorations\": {\n      \"name\": \"restorations\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"restorations_backup_id_backups_id_fk\": {\n          \"name\": \"restorations_backup_id_backups_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_database_id_databases_id_fk\": {\n          \"name\": \"restorations_database_id_databases_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.agents\": {\n      \"name\": \"agents\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"agents_slug_unique\": {\n          \"name\": \"agents_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    }\n  },\n  \"enums\": {\n    \"public.dbms_status\": {\n      \"name\": \"dbms_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"postgresql\",\n        \"mongodb\"\n      ]\n    },\n    \"public.status\": {\n      \"name\": \"status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"waiting\",\n        \"ongoing\",\n        \"failed\",\n        \"success\"\n      ]\n    },\n    \"public.type_storage\": {\n      \"name\": \"type_storage\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\"\n      ]\n    }\n  },\n  \"schemas\": {},\n  \"sequences\": {},\n  \"roles\": {},\n  \"policies\": {},\n  \"views\": {},\n  \"_meta\": {\n    \"columns\": {},\n    \"schemas\": {},\n    \"tables\": {}\n  }\n}"
  },
  {
    "path": "src/db/migrations/meta/0002_snapshot.json",
    "content": "{\n  \"id\": \"ca73d698-19da-458a-b07d-887f32f581d4\",\n  \"prevId\": \"d782a269-0b75-41b0-b70e-e3bf214f4f80\",\n  \"version\": \"7\",\n  \"dialect\": \"postgresql\",\n  \"tables\": {\n    \"public.settings\": {\n      \"name\": \"settings\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"storage\": {\n          \"name\": \"storage\",\n          \"type\": \"type_storage\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'local'\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"s3_endpoint_url\": {\n          \"name\": \"s3_endpoint_url\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_access_key_id\": {\n          \"name\": \"s3_access_key_id\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_secret_access_key\": {\n          \"name\": \"s3_secret_access_key\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_bucket_name\": {\n          \"name\": \"s3_bucket_name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_password\": {\n          \"name\": \"smtp_password\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_from\": {\n          \"name\": \"smtp_from\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_host\": {\n          \"name\": \"smtp_host\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_port\": {\n          \"name\": \"smtp_port\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_user\": {\n          \"name\": \"smtp_user\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"settings_name_unique\": {\n          \"name\": \"settings_name_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"name\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.account\": {\n      \"name\": \"account\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"account_id\": {\n          \"name\": \"account_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"access_token\": {\n          \"name\": \"access_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token\": {\n          \"name\": \"refresh_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"id_token\": {\n          \"name\": \"id_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"access_token_expires_at\": {\n          \"name\": \"access_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token_expires_at\": {\n          \"name\": \"refresh_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"scope\": {\n          \"name\": \"scope\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"password\": {\n          \"name\": \"password\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"account_user_id_user_id_fk\": {\n          \"name\": \"account_user_id_user_id_fk\",\n          \"tableFrom\": \"account\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.session\": {\n      \"name\": \"session\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"token\": {\n          \"name\": \"token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ip_address\": {\n          \"name\": \"ip_address\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_agent\": {\n          \"name\": \"user_agent\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"impersonated_by\": {\n          \"name\": \"impersonated_by\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"active_organization_id\": {\n          \"name\": \"active_organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"session_user_id_user_id_fk\": {\n          \"name\": \"session_user_id_user_id_fk\",\n          \"tableFrom\": \"session\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"session_token_unique\": {\n          \"name\": \"session_token_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"token\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.user\": {\n      \"name\": \"user\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email_verified\": {\n          \"name\": \"email_verified\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"image\": {\n          \"name\": \"image\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"banned\": {\n          \"name\": \"banned\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_reason\": {\n          \"name\": \"ban_reason\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_expires\": {\n          \"name\": \"ban_expires\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"user_email_unique\": {\n          \"name\": \"user_email_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"email\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.verification\": {\n      \"name\": \"verification\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"identifier\": {\n          \"name\": \"identifier\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"value\": {\n          \"name\": \"value\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization\": {\n      \"name\": \"organization\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"logo\": {\n          \"name\": \"logo\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"metadata\": {\n          \"name\": \"metadata\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_slug_unique\": {\n          \"name\": \"organization_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.member\": {\n      \"name\": \"member\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"member_organization_id_organization_id_fk\": {\n          \"name\": \"member_organization_id_organization_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"member_user_id_user_id_fk\": {\n          \"name\": \"member_user_id_user_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.invitation\": {\n      \"name\": \"invitation\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"inviter_id\": {\n          \"name\": \"inviter_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"invitation_organization_id_organization_id_fk\": {\n          \"name\": \"invitation_organization_id_organization_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"invitation_inviter_id_user_id_fk\": {\n          \"name\": \"invitation_inviter_id_user_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"inviter_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.projects\": {\n      \"name\": \"projects\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"projects_organization_id_organization_id_fk\": {\n          \"name\": \"projects_organization_id_organization_id_fk\",\n          \"tableFrom\": \"projects\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"no action\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"projects_slug_unique\": {\n          \"name\": \"projects_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backups\": {\n      \"name\": \"backups\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"file\": {\n          \"name\": \"file\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backups_database_id_databases_id_fk\": {\n          \"name\": \"backups_database_id_databases_id_fk\",\n          \"tableFrom\": \"backups\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.databases\": {\n      \"name\": \"databases\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"agent_database_id\": {\n          \"name\": \"agent_database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"dbms\": {\n          \"name\": \"dbms\",\n          \"type\": \"dbms_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_policy\": {\n          \"name\": \"backup_policy\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"is_waiting_for_backup\": {\n          \"name\": \"is_waiting_for_backup\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"backup_to_restore\": {\n          \"name\": \"backup_to_restore\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"agent_id\": {\n          \"name\": \"agent_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"project_id\": {\n          \"name\": \"project_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"databases_agent_id_agents_id_fk\": {\n          \"name\": \"databases_agent_id_agents_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"agents\",\n          \"columnsFrom\": [\n            \"agent_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"databases_project_id_projects_id_fk\": {\n          \"name\": \"databases_project_id_projects_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"projects\",\n          \"columnsFrom\": [\n            \"project_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"no action\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.restorations\": {\n      \"name\": \"restorations\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"restorations_backup_id_backups_id_fk\": {\n          \"name\": \"restorations_backup_id_backups_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_database_id_databases_id_fk\": {\n          \"name\": \"restorations_database_id_databases_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.agents\": {\n      \"name\": \"agents\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"agents_slug_unique\": {\n          \"name\": \"agents_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    }\n  },\n  \"enums\": {\n    \"public.dbms_status\": {\n      \"name\": \"dbms_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"postgresql\",\n        \"mongodb\"\n      ]\n    },\n    \"public.status\": {\n      \"name\": \"status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"waiting\",\n        \"ongoing\",\n        \"failed\",\n        \"success\"\n      ]\n    },\n    \"public.type_storage\": {\n      \"name\": \"type_storage\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\"\n      ]\n    }\n  },\n  \"schemas\": {},\n  \"sequences\": {},\n  \"roles\": {},\n  \"policies\": {},\n  \"views\": {},\n  \"_meta\": {\n    \"columns\": {},\n    \"schemas\": {},\n    \"tables\": {}\n  }\n}"
  },
  {
    "path": "src/db/migrations/meta/0003_snapshot.json",
    "content": "{\n  \"id\": \"8237f895-ee7c-4d2c-8890-c5b088e46d63\",\n  \"prevId\": \"ca73d698-19da-458a-b07d-887f32f581d4\",\n  \"version\": \"7\",\n  \"dialect\": \"postgresql\",\n  \"tables\": {\n    \"public.settings\": {\n      \"name\": \"settings\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"storage\": {\n          \"name\": \"storage\",\n          \"type\": \"type_storage\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'local'\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"s3_endpoint_url\": {\n          \"name\": \"s3_endpoint_url\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_access_key_id\": {\n          \"name\": \"s3_access_key_id\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_secret_access_key\": {\n          \"name\": \"s3_secret_access_key\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_bucket_name\": {\n          \"name\": \"s3_bucket_name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_password\": {\n          \"name\": \"smtp_password\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_from\": {\n          \"name\": \"smtp_from\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_host\": {\n          \"name\": \"smtp_host\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_port\": {\n          \"name\": \"smtp_port\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_user\": {\n          \"name\": \"smtp_user\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"settings_name_unique\": {\n          \"name\": \"settings_name_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"name\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.account\": {\n      \"name\": \"account\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"account_id\": {\n          \"name\": \"account_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"access_token\": {\n          \"name\": \"access_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token\": {\n          \"name\": \"refresh_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"id_token\": {\n          \"name\": \"id_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"access_token_expires_at\": {\n          \"name\": \"access_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token_expires_at\": {\n          \"name\": \"refresh_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"scope\": {\n          \"name\": \"scope\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"password\": {\n          \"name\": \"password\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"account_user_id_user_id_fk\": {\n          \"name\": \"account_user_id_user_id_fk\",\n          \"tableFrom\": \"account\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.session\": {\n      \"name\": \"session\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"token\": {\n          \"name\": \"token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ip_address\": {\n          \"name\": \"ip_address\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_agent\": {\n          \"name\": \"user_agent\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"impersonated_by\": {\n          \"name\": \"impersonated_by\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"active_organization_id\": {\n          \"name\": \"active_organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"session_user_id_user_id_fk\": {\n          \"name\": \"session_user_id_user_id_fk\",\n          \"tableFrom\": \"session\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"session_token_unique\": {\n          \"name\": \"session_token_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"token\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.user\": {\n      \"name\": \"user\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email_verified\": {\n          \"name\": \"email_verified\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"image\": {\n          \"name\": \"image\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"banned\": {\n          \"name\": \"banned\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_reason\": {\n          \"name\": \"ban_reason\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_expires\": {\n          \"name\": \"ban_expires\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"user_email_unique\": {\n          \"name\": \"user_email_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"email\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.verification\": {\n      \"name\": \"verification\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"identifier\": {\n          \"name\": \"identifier\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"value\": {\n          \"name\": \"value\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization\": {\n      \"name\": \"organization\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"logo\": {\n          \"name\": \"logo\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"metadata\": {\n          \"name\": \"metadata\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_slug_unique\": {\n          \"name\": \"organization_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.member\": {\n      \"name\": \"member\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"member_organization_id_organization_id_fk\": {\n          \"name\": \"member_organization_id_organization_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"member_user_id_user_id_fk\": {\n          \"name\": \"member_user_id_user_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.invitation\": {\n      \"name\": \"invitation\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"inviter_id\": {\n          \"name\": \"inviter_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"invitation_organization_id_organization_id_fk\": {\n          \"name\": \"invitation_organization_id_organization_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"invitation_inviter_id_user_id_fk\": {\n          \"name\": \"invitation_inviter_id_user_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"inviter_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.projects\": {\n      \"name\": \"projects\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"projects_organization_id_organization_id_fk\": {\n          \"name\": \"projects_organization_id_organization_id_fk\",\n          \"tableFrom\": \"projects\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"no action\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"projects_slug_unique\": {\n          \"name\": \"projects_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backups\": {\n      \"name\": \"backups\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"file\": {\n          \"name\": \"file\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backups_database_id_databases_id_fk\": {\n          \"name\": \"backups_database_id_databases_id_fk\",\n          \"tableFrom\": \"backups\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.databases\": {\n      \"name\": \"databases\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"agent_database_id\": {\n          \"name\": \"agent_database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"dbms\": {\n          \"name\": \"dbms\",\n          \"type\": \"dbms_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_policy\": {\n          \"name\": \"backup_policy\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"is_waiting_for_backup\": {\n          \"name\": \"is_waiting_for_backup\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"backup_to_restore\": {\n          \"name\": \"backup_to_restore\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"agent_id\": {\n          \"name\": \"agent_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"project_id\": {\n          \"name\": \"project_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"databases_agent_id_agents_id_fk\": {\n          \"name\": \"databases_agent_id_agents_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"agents\",\n          \"columnsFrom\": [\n            \"agent_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"databases_project_id_projects_id_fk\": {\n          \"name\": \"databases_project_id_projects_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"projects\",\n          \"columnsFrom\": [\n            \"project_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"no action\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.restorations\": {\n      \"name\": \"restorations\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"restorations_backup_id_backups_id_fk\": {\n          \"name\": \"restorations_backup_id_backups_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_database_id_databases_id_fk\": {\n          \"name\": \"restorations_database_id_databases_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.retention_policies\": {\n      \"name\": \"retention_policies\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"type\": {\n          \"name\": \"type\",\n          \"type\": \"retention_policy_type\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"count\": {\n          \"name\": \"count\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"days\": {\n          \"name\": \"days\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 30\n        },\n        \"gfs_daily\": {\n          \"name\": \"gfs_daily\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"gfs_weekly\": {\n          \"name\": \"gfs_weekly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 4\n        },\n        \"gfs_monthly\": {\n          \"name\": \"gfs_monthly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 12\n        },\n        \"gfs_yearly\": {\n          \"name\": \"gfs_yearly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 3\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"retention_policies_database_id_databases_id_fk\": {\n          \"name\": \"retention_policies_database_id_databases_id_fk\",\n          \"tableFrom\": \"retention_policies\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.agents\": {\n      \"name\": \"agents\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"agents_slug_unique\": {\n          \"name\": \"agents_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    }\n  },\n  \"enums\": {\n    \"public.retention_policy_type\": {\n      \"name\": \"retention_policy_type\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"count\",\n        \"days\",\n        \"gfs\"\n      ]\n    },\n    \"public.dbms_status\": {\n      \"name\": \"dbms_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"postgresql\",\n        \"mongodb\"\n      ]\n    },\n    \"public.status\": {\n      \"name\": \"status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"waiting\",\n        \"ongoing\",\n        \"failed\",\n        \"success\"\n      ]\n    },\n    \"public.type_storage\": {\n      \"name\": \"type_storage\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\"\n      ]\n    }\n  },\n  \"schemas\": {},\n  \"sequences\": {},\n  \"roles\": {},\n  \"policies\": {},\n  \"views\": {},\n  \"_meta\": {\n    \"columns\": {},\n    \"schemas\": {},\n    \"tables\": {}\n  }\n}"
  },
  {
    "path": "src/db/migrations/meta/0004_snapshot.json",
    "content": "{\n  \"id\": \"d4bb4ba2-45ee-4e43-a340-80dd8fc4f8c7\",\n  \"prevId\": \"8237f895-ee7c-4d2c-8890-c5b088e46d63\",\n  \"version\": \"7\",\n  \"dialect\": \"postgresql\",\n  \"tables\": {\n    \"public.settings\": {\n      \"name\": \"settings\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"storage\": {\n          \"name\": \"storage\",\n          \"type\": \"type_storage\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'local'\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"s3_endpoint_url\": {\n          \"name\": \"s3_endpoint_url\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_access_key_id\": {\n          \"name\": \"s3_access_key_id\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_secret_access_key\": {\n          \"name\": \"s3_secret_access_key\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_bucket_name\": {\n          \"name\": \"s3_bucket_name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_password\": {\n          \"name\": \"smtp_password\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_from\": {\n          \"name\": \"smtp_from\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_host\": {\n          \"name\": \"smtp_host\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_port\": {\n          \"name\": \"smtp_port\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_user\": {\n          \"name\": \"smtp_user\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"settings_name_unique\": {\n          \"name\": \"settings_name_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"name\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.account\": {\n      \"name\": \"account\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"account_id\": {\n          \"name\": \"account_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"access_token\": {\n          \"name\": \"access_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token\": {\n          \"name\": \"refresh_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"id_token\": {\n          \"name\": \"id_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"access_token_expires_at\": {\n          \"name\": \"access_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token_expires_at\": {\n          \"name\": \"refresh_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"scope\": {\n          \"name\": \"scope\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"password\": {\n          \"name\": \"password\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"account_user_id_user_id_fk\": {\n          \"name\": \"account_user_id_user_id_fk\",\n          \"tableFrom\": \"account\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.session\": {\n      \"name\": \"session\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"token\": {\n          \"name\": \"token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"ip_address\": {\n          \"name\": \"ip_address\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_agent\": {\n          \"name\": \"user_agent\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"impersonated_by\": {\n          \"name\": \"impersonated_by\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"active_organization_id\": {\n          \"name\": \"active_organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"session_user_id_user_id_fk\": {\n          \"name\": \"session_user_id_user_id_fk\",\n          \"tableFrom\": \"session\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"session_token_unique\": {\n          \"name\": \"session_token_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"token\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.user\": {\n      \"name\": \"user\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email_verified\": {\n          \"name\": \"email_verified\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"image\": {\n          \"name\": \"image\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"banned\": {\n          \"name\": \"banned\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_reason\": {\n          \"name\": \"ban_reason\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_expires\": {\n          \"name\": \"ban_expires\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"user_email_unique\": {\n          \"name\": \"user_email_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"email\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.verification\": {\n      \"name\": \"verification\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"identifier\": {\n          \"name\": \"identifier\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"value\": {\n          \"name\": \"value\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization\": {\n      \"name\": \"organization\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"logo\": {\n          \"name\": \"logo\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"metadata\": {\n          \"name\": \"metadata\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_slug_unique\": {\n          \"name\": \"organization_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.member\": {\n      \"name\": \"member\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"member_organization_id_organization_id_fk\": {\n          \"name\": \"member_organization_id_organization_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"member_user_id_user_id_fk\": {\n          \"name\": \"member_user_id_user_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.invitation\": {\n      \"name\": \"invitation\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"inviter_id\": {\n          \"name\": \"inviter_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"invitation_organization_id_organization_id_fk\": {\n          \"name\": \"invitation_organization_id_organization_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"invitation_inviter_id_user_id_fk\": {\n          \"name\": \"invitation_inviter_id_user_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"inviter_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.projects\": {\n      \"name\": \"projects\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"projects_organization_id_organization_id_fk\": {\n          \"name\": \"projects_organization_id_organization_id_fk\",\n          \"tableFrom\": \"projects\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"no action\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"projects_slug_unique\": {\n          \"name\": \"projects_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backups\": {\n      \"name\": \"backups\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"file\": {\n          \"name\": \"file\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backups_database_id_databases_id_fk\": {\n          \"name\": \"backups_database_id_databases_id_fk\",\n          \"tableFrom\": \"backups\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.databases\": {\n      \"name\": \"databases\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"agent_database_id\": {\n          \"name\": \"agent_database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"dbms\": {\n          \"name\": \"dbms\",\n          \"type\": \"dbms_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_policy\": {\n          \"name\": \"backup_policy\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"is_waiting_for_backup\": {\n          \"name\": \"is_waiting_for_backup\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"backup_to_restore\": {\n          \"name\": \"backup_to_restore\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"agent_id\": {\n          \"name\": \"agent_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"project_id\": {\n          \"name\": \"project_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"databases_agent_id_agents_id_fk\": {\n          \"name\": \"databases_agent_id_agents_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"agents\",\n          \"columnsFrom\": [\n            \"agent_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"databases_project_id_projects_id_fk\": {\n          \"name\": \"databases_project_id_projects_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"projects\",\n          \"columnsFrom\": [\n            \"project_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"no action\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.restorations\": {\n      \"name\": \"restorations\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"restorations_backup_id_backups_id_fk\": {\n          \"name\": \"restorations_backup_id_backups_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_database_id_databases_id_fk\": {\n          \"name\": \"restorations_database_id_databases_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.retention_policies\": {\n      \"name\": \"retention_policies\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"type\": {\n          \"name\": \"type\",\n          \"type\": \"retention_policy_type\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"count\": {\n          \"name\": \"count\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"days\": {\n          \"name\": \"days\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 30\n        },\n        \"gfs_daily\": {\n          \"name\": \"gfs_daily\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"gfs_weekly\": {\n          \"name\": \"gfs_weekly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 4\n        },\n        \"gfs_monthly\": {\n          \"name\": \"gfs_monthly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 12\n        },\n        \"gfs_yearly\": {\n          \"name\": \"gfs_yearly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 3\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"retention_policies_database_id_databases_id_fk\": {\n          \"name\": \"retention_policies_database_id_databases_id_fk\",\n          \"tableFrom\": \"retention_policies\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.agents\": {\n      \"name\": \"agents\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"agents_slug_unique\": {\n          \"name\": \"agents_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    }\n  },\n  \"enums\": {\n    \"public.retention_policy_type\": {\n      \"name\": \"retention_policy_type\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"count\",\n        \"days\",\n        \"gfs\"\n      ]\n    },\n    \"public.dbms_status\": {\n      \"name\": \"dbms_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"postgresql\",\n        \"mongodb\"\n      ]\n    },\n    \"public.status\": {\n      \"name\": \"status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"waiting\",\n        \"ongoing\",\n        \"failed\",\n        \"success\"\n      ]\n    },\n    \"public.type_storage\": {\n      \"name\": \"type_storage\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\"\n      ]\n    }\n  },\n  \"schemas\": {},\n  \"sequences\": {},\n  \"roles\": {},\n  \"policies\": {},\n  \"views\": {},\n  \"_meta\": {\n    \"columns\": {},\n    \"schemas\": {},\n    \"tables\": {}\n  }\n}"
  },
  {
    "path": "src/db/migrations/meta/0005_snapshot.json",
    "content": "{\n  \"id\": \"6586f8b1-3b59-411b-8aef-1531e3ff2a9f\",\n  \"prevId\": \"d4bb4ba2-45ee-4e43-a340-80dd8fc4f8c7\",\n  \"version\": \"7\",\n  \"dialect\": \"postgresql\",\n  \"tables\": {\n    \"public.settings\": {\n      \"name\": \"settings\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"storage\": {\n          \"name\": \"storage\",\n          \"type\": \"type_storage\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'local'\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"s3_endpoint_url\": {\n          \"name\": \"s3_endpoint_url\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_access_key_id\": {\n          \"name\": \"s3_access_key_id\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_secret_access_key\": {\n          \"name\": \"s3_secret_access_key\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_bucket_name\": {\n          \"name\": \"s3_bucket_name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_password\": {\n          \"name\": \"smtp_password\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_from\": {\n          \"name\": \"smtp_from\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_host\": {\n          \"name\": \"smtp_host\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_port\": {\n          \"name\": \"smtp_port\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_user\": {\n          \"name\": \"smtp_user\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"settings_name_unique\": {\n          \"name\": \"settings_name_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"name\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.account\": {\n      \"name\": \"account\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"account_id\": {\n          \"name\": \"account_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"access_token\": {\n          \"name\": \"access_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token\": {\n          \"name\": \"refresh_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"id_token\": {\n          \"name\": \"id_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"access_token_expires_at\": {\n          \"name\": \"access_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token_expires_at\": {\n          \"name\": \"refresh_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"scope\": {\n          \"name\": \"scope\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"password\": {\n          \"name\": \"password\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"account_user_id_user_id_fk\": {\n          \"name\": \"account_user_id_user_id_fk\",\n          \"tableFrom\": \"account\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.session\": {\n      \"name\": \"session\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"token\": {\n          \"name\": \"token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"ip_address\": {\n          \"name\": \"ip_address\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_agent\": {\n          \"name\": \"user_agent\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"impersonated_by\": {\n          \"name\": \"impersonated_by\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"active_organization_id\": {\n          \"name\": \"active_organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"session_user_id_user_id_fk\": {\n          \"name\": \"session_user_id_user_id_fk\",\n          \"tableFrom\": \"session\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"session_token_unique\": {\n          \"name\": \"session_token_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"token\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.user\": {\n      \"name\": \"user\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email_verified\": {\n          \"name\": \"email_verified\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"image\": {\n          \"name\": \"image\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"banned\": {\n          \"name\": \"banned\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_reason\": {\n          \"name\": \"ban_reason\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_expires\": {\n          \"name\": \"ban_expires\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"user_email_unique\": {\n          \"name\": \"user_email_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"email\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.verification\": {\n      \"name\": \"verification\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"identifier\": {\n          \"name\": \"identifier\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"value\": {\n          \"name\": \"value\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization\": {\n      \"name\": \"organization\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"logo\": {\n          \"name\": \"logo\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"metadata\": {\n          \"name\": \"metadata\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_slug_unique\": {\n          \"name\": \"organization_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.member\": {\n      \"name\": \"member\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"member_organization_id_organization_id_fk\": {\n          \"name\": \"member_organization_id_organization_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"member_user_id_user_id_fk\": {\n          \"name\": \"member_user_id_user_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.invitation\": {\n      \"name\": \"invitation\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"inviter_id\": {\n          \"name\": \"inviter_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"invitation_organization_id_organization_id_fk\": {\n          \"name\": \"invitation_organization_id_organization_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"invitation_inviter_id_user_id_fk\": {\n          \"name\": \"invitation_inviter_id_user_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"inviter_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.projects\": {\n      \"name\": \"projects\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"projects_organization_id_organization_id_fk\": {\n          \"name\": \"projects_organization_id_organization_id_fk\",\n          \"tableFrom\": \"projects\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"projects_slug_unique\": {\n          \"name\": \"projects_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backups\": {\n      \"name\": \"backups\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"file\": {\n          \"name\": \"file\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backups_database_id_databases_id_fk\": {\n          \"name\": \"backups_database_id_databases_id_fk\",\n          \"tableFrom\": \"backups\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.databases\": {\n      \"name\": \"databases\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"agent_database_id\": {\n          \"name\": \"agent_database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"dbms\": {\n          \"name\": \"dbms\",\n          \"type\": \"dbms_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_policy\": {\n          \"name\": \"backup_policy\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"is_waiting_for_backup\": {\n          \"name\": \"is_waiting_for_backup\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"backup_to_restore\": {\n          \"name\": \"backup_to_restore\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"agent_id\": {\n          \"name\": \"agent_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"project_id\": {\n          \"name\": \"project_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"databases_agent_id_agents_id_fk\": {\n          \"name\": \"databases_agent_id_agents_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"agents\",\n          \"columnsFrom\": [\n            \"agent_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"databases_project_id_projects_id_fk\": {\n          \"name\": \"databases_project_id_projects_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"projects\",\n          \"columnsFrom\": [\n            \"project_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"no action\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.restorations\": {\n      \"name\": \"restorations\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"restorations_backup_id_backups_id_fk\": {\n          \"name\": \"restorations_backup_id_backups_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_database_id_databases_id_fk\": {\n          \"name\": \"restorations_database_id_databases_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.retention_policies\": {\n      \"name\": \"retention_policies\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"type\": {\n          \"name\": \"type\",\n          \"type\": \"retention_policy_type\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"count\": {\n          \"name\": \"count\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"days\": {\n          \"name\": \"days\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 30\n        },\n        \"gfs_daily\": {\n          \"name\": \"gfs_daily\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"gfs_weekly\": {\n          \"name\": \"gfs_weekly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 4\n        },\n        \"gfs_monthly\": {\n          \"name\": \"gfs_monthly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 12\n        },\n        \"gfs_yearly\": {\n          \"name\": \"gfs_yearly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 3\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"retention_policies_database_id_databases_id_fk\": {\n          \"name\": \"retention_policies_database_id_databases_id_fk\",\n          \"tableFrom\": \"retention_policies\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.agents\": {\n      \"name\": \"agents\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"agents_slug_unique\": {\n          \"name\": \"agents_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    }\n  },\n  \"enums\": {\n    \"public.retention_policy_type\": {\n      \"name\": \"retention_policy_type\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"count\",\n        \"days\",\n        \"gfs\"\n      ]\n    },\n    \"public.dbms_status\": {\n      \"name\": \"dbms_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"postgresql\",\n        \"mongodb\"\n      ]\n    },\n    \"public.status\": {\n      \"name\": \"status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"waiting\",\n        \"ongoing\",\n        \"failed\",\n        \"success\"\n      ]\n    },\n    \"public.type_storage\": {\n      \"name\": \"type_storage\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\"\n      ]\n    }\n  },\n  \"schemas\": {},\n  \"sequences\": {},\n  \"roles\": {},\n  \"policies\": {},\n  \"views\": {},\n  \"_meta\": {\n    \"columns\": {},\n    \"schemas\": {},\n    \"tables\": {}\n  }\n}"
  },
  {
    "path": "src/db/migrations/meta/0006_snapshot.json",
    "content": "{\n  \"id\": \"8a29a2f2-5ed1-4b3f-99af-80d57573e919\",\n  \"prevId\": \"6586f8b1-3b59-411b-8aef-1531e3ff2a9f\",\n  \"version\": \"7\",\n  \"dialect\": \"postgresql\",\n  \"tables\": {\n    \"public.settings\": {\n      \"name\": \"settings\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"storage\": {\n          \"name\": \"storage\",\n          \"type\": \"type_storage\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'local'\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"s3_endpoint_url\": {\n          \"name\": \"s3_endpoint_url\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_access_key_id\": {\n          \"name\": \"s3_access_key_id\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_secret_access_key\": {\n          \"name\": \"s3_secret_access_key\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_bucket_name\": {\n          \"name\": \"s3_bucket_name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_password\": {\n          \"name\": \"smtp_password\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_from\": {\n          \"name\": \"smtp_from\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_host\": {\n          \"name\": \"smtp_host\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_port\": {\n          \"name\": \"smtp_port\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_user\": {\n          \"name\": \"smtp_user\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"settings_name_unique\": {\n          \"name\": \"settings_name_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"name\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.account\": {\n      \"name\": \"account\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"account_id\": {\n          \"name\": \"account_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"access_token\": {\n          \"name\": \"access_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token\": {\n          \"name\": \"refresh_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"id_token\": {\n          \"name\": \"id_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"access_token_expires_at\": {\n          \"name\": \"access_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token_expires_at\": {\n          \"name\": \"refresh_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"scope\": {\n          \"name\": \"scope\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"password\": {\n          \"name\": \"password\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"account_user_id_user_id_fk\": {\n          \"name\": \"account_user_id_user_id_fk\",\n          \"tableFrom\": \"account\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.session\": {\n      \"name\": \"session\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"token\": {\n          \"name\": \"token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"ip_address\": {\n          \"name\": \"ip_address\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_agent\": {\n          \"name\": \"user_agent\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"impersonated_by\": {\n          \"name\": \"impersonated_by\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"active_organization_id\": {\n          \"name\": \"active_organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"session_user_id_user_id_fk\": {\n          \"name\": \"session_user_id_user_id_fk\",\n          \"tableFrom\": \"session\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"session_token_unique\": {\n          \"name\": \"session_token_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"token\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.user\": {\n      \"name\": \"user\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email_verified\": {\n          \"name\": \"email_verified\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"image\": {\n          \"name\": \"image\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"banned\": {\n          \"name\": \"banned\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_reason\": {\n          \"name\": \"ban_reason\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_expires\": {\n          \"name\": \"ban_expires\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"user_email_unique\": {\n          \"name\": \"user_email_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"email\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.verification\": {\n      \"name\": \"verification\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"identifier\": {\n          \"name\": \"identifier\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"value\": {\n          \"name\": \"value\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization\": {\n      \"name\": \"organization\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"logo\": {\n          \"name\": \"logo\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"metadata\": {\n          \"name\": \"metadata\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_slug_unique\": {\n          \"name\": \"organization_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.member\": {\n      \"name\": \"member\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"member_organization_id_organization_id_fk\": {\n          \"name\": \"member_organization_id_organization_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"member_user_id_user_id_fk\": {\n          \"name\": \"member_user_id_user_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.invitation\": {\n      \"name\": \"invitation\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"inviter_id\": {\n          \"name\": \"inviter_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"invitation_organization_id_organization_id_fk\": {\n          \"name\": \"invitation_organization_id_organization_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"invitation_inviter_id_user_id_fk\": {\n          \"name\": \"invitation_inviter_id_user_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"inviter_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.projects\": {\n      \"name\": \"projects\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"projects_organization_id_organization_id_fk\": {\n          \"name\": \"projects_organization_id_organization_id_fk\",\n          \"tableFrom\": \"projects\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"projects_slug_unique\": {\n          \"name\": \"projects_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backups\": {\n      \"name\": \"backups\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"file\": {\n          \"name\": \"file\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backups_database_id_databases_id_fk\": {\n          \"name\": \"backups_database_id_databases_id_fk\",\n          \"tableFrom\": \"backups\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.databases\": {\n      \"name\": \"databases\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"agent_database_id\": {\n          \"name\": \"agent_database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"dbms\": {\n          \"name\": \"dbms\",\n          \"type\": \"dbms_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_policy\": {\n          \"name\": \"backup_policy\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"is_waiting_for_backup\": {\n          \"name\": \"is_waiting_for_backup\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"backup_to_restore\": {\n          \"name\": \"backup_to_restore\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"agent_id\": {\n          \"name\": \"agent_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"project_id\": {\n          \"name\": \"project_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"databases_agent_id_agents_id_fk\": {\n          \"name\": \"databases_agent_id_agents_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"agents\",\n          \"columnsFrom\": [\n            \"agent_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"databases_project_id_projects_id_fk\": {\n          \"name\": \"databases_project_id_projects_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"projects\",\n          \"columnsFrom\": [\n            \"project_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"no action\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.restorations\": {\n      \"name\": \"restorations\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"restorations_backup_id_backups_id_fk\": {\n          \"name\": \"restorations_backup_id_backups_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_database_id_databases_id_fk\": {\n          \"name\": \"restorations_database_id_databases_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.retention_policies\": {\n      \"name\": \"retention_policies\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"type\": {\n          \"name\": \"type\",\n          \"type\": \"retention_policy_type\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"count\": {\n          \"name\": \"count\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"days\": {\n          \"name\": \"days\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 30\n        },\n        \"gfs_daily\": {\n          \"name\": \"gfs_daily\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"gfs_weekly\": {\n          \"name\": \"gfs_weekly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 4\n        },\n        \"gfs_monthly\": {\n          \"name\": \"gfs_monthly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 12\n        },\n        \"gfs_yearly\": {\n          \"name\": \"gfs_yearly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 3\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"retention_policies_database_id_databases_id_fk\": {\n          \"name\": \"retention_policies_database_id_databases_id_fk\",\n          \"tableFrom\": \"retention_policies\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.agents\": {\n      \"name\": \"agents\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"agents_slug_unique\": {\n          \"name\": \"agents_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    }\n  },\n  \"enums\": {\n    \"public.retention_policy_type\": {\n      \"name\": \"retention_policy_type\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"count\",\n        \"days\",\n        \"gfs\"\n      ]\n    },\n    \"public.dbms_status\": {\n      \"name\": \"dbms_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"postgresql\",\n        \"mysql\"\n      ]\n    },\n    \"public.status\": {\n      \"name\": \"status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"waiting\",\n        \"ongoing\",\n        \"failed\",\n        \"success\"\n      ]\n    },\n    \"public.type_storage\": {\n      \"name\": \"type_storage\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\"\n      ]\n    }\n  },\n  \"schemas\": {},\n  \"sequences\": {},\n  \"roles\": {},\n  \"policies\": {},\n  \"views\": {},\n  \"_meta\": {\n    \"columns\": {},\n    \"schemas\": {},\n    \"tables\": {}\n  }\n}"
  },
  {
    "path": "src/db/migrations/meta/0007_snapshot.json",
    "content": "{\n  \"id\": \"ddb3770e-4785-4c3e-b20a-202ac01999ad\",\n  \"prevId\": \"8a29a2f2-5ed1-4b3f-99af-80d57573e919\",\n  \"version\": \"7\",\n  \"dialect\": \"postgresql\",\n  \"tables\": {\n    \"public.settings\": {\n      \"name\": \"settings\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"storage\": {\n          \"name\": \"storage\",\n          \"type\": \"type_storage\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'local'\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"s3_endpoint_url\": {\n          \"name\": \"s3_endpoint_url\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_access_key_id\": {\n          \"name\": \"s3_access_key_id\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_secret_access_key\": {\n          \"name\": \"s3_secret_access_key\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_bucket_name\": {\n          \"name\": \"s3_bucket_name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_password\": {\n          \"name\": \"smtp_password\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_from\": {\n          \"name\": \"smtp_from\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_host\": {\n          \"name\": \"smtp_host\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_port\": {\n          \"name\": \"smtp_port\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_user\": {\n          \"name\": \"smtp_user\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"settings_name_unique\": {\n          \"name\": \"settings_name_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"name\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.account\": {\n      \"name\": \"account\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"account_id\": {\n          \"name\": \"account_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"access_token\": {\n          \"name\": \"access_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token\": {\n          \"name\": \"refresh_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"id_token\": {\n          \"name\": \"id_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"access_token_expires_at\": {\n          \"name\": \"access_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token_expires_at\": {\n          \"name\": \"refresh_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"scope\": {\n          \"name\": \"scope\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"password\": {\n          \"name\": \"password\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"account_user_id_user_id_fk\": {\n          \"name\": \"account_user_id_user_id_fk\",\n          \"tableFrom\": \"account\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.session\": {\n      \"name\": \"session\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"token\": {\n          \"name\": \"token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"ip_address\": {\n          \"name\": \"ip_address\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_agent\": {\n          \"name\": \"user_agent\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"impersonated_by\": {\n          \"name\": \"impersonated_by\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"active_organization_id\": {\n          \"name\": \"active_organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"session_user_id_user_id_fk\": {\n          \"name\": \"session_user_id_user_id_fk\",\n          \"tableFrom\": \"session\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"session_token_unique\": {\n          \"name\": \"session_token_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"token\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.user\": {\n      \"name\": \"user\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email_verified\": {\n          \"name\": \"email_verified\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"image\": {\n          \"name\": \"image\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"banned\": {\n          \"name\": \"banned\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_reason\": {\n          \"name\": \"ban_reason\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_expires\": {\n          \"name\": \"ban_expires\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"user_email_unique\": {\n          \"name\": \"user_email_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"email\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.verification\": {\n      \"name\": \"verification\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"identifier\": {\n          \"name\": \"identifier\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"value\": {\n          \"name\": \"value\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization\": {\n      \"name\": \"organization\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"logo\": {\n          \"name\": \"logo\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"metadata\": {\n          \"name\": \"metadata\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_slug_unique\": {\n          \"name\": \"organization_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.member\": {\n      \"name\": \"member\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"member_organization_id_organization_id_fk\": {\n          \"name\": \"member_organization_id_organization_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"member_user_id_user_id_fk\": {\n          \"name\": \"member_user_id_user_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.invitation\": {\n      \"name\": \"invitation\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"inviter_id\": {\n          \"name\": \"inviter_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"invitation_organization_id_organization_id_fk\": {\n          \"name\": \"invitation_organization_id_organization_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"invitation_inviter_id_user_id_fk\": {\n          \"name\": \"invitation_inviter_id_user_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"inviter_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.projects\": {\n      \"name\": \"projects\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"projects_organization_id_organization_id_fk\": {\n          \"name\": \"projects_organization_id_organization_id_fk\",\n          \"tableFrom\": \"projects\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"projects_slug_unique\": {\n          \"name\": \"projects_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backups\": {\n      \"name\": \"backups\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"file\": {\n          \"name\": \"file\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backups_database_id_databases_id_fk\": {\n          \"name\": \"backups_database_id_databases_id_fk\",\n          \"tableFrom\": \"backups\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.databases\": {\n      \"name\": \"databases\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"agent_database_id\": {\n          \"name\": \"agent_database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"dbms\": {\n          \"name\": \"dbms\",\n          \"type\": \"dbms_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_policy\": {\n          \"name\": \"backup_policy\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"is_waiting_for_backup\": {\n          \"name\": \"is_waiting_for_backup\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"backup_to_restore\": {\n          \"name\": \"backup_to_restore\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"agent_id\": {\n          \"name\": \"agent_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"project_id\": {\n          \"name\": \"project_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"databases_agent_id_agents_id_fk\": {\n          \"name\": \"databases_agent_id_agents_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"agents\",\n          \"columnsFrom\": [\n            \"agent_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"databases_project_id_projects_id_fk\": {\n          \"name\": \"databases_project_id_projects_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"projects\",\n          \"columnsFrom\": [\n            \"project_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"no action\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.restorations\": {\n      \"name\": \"restorations\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"restorations_backup_id_backups_id_fk\": {\n          \"name\": \"restorations_backup_id_backups_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_database_id_databases_id_fk\": {\n          \"name\": \"restorations_database_id_databases_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.retention_policies\": {\n      \"name\": \"retention_policies\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"type\": {\n          \"name\": \"type\",\n          \"type\": \"retention_policy_type\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"count\": {\n          \"name\": \"count\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"days\": {\n          \"name\": \"days\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 30\n        },\n        \"gfs_daily\": {\n          \"name\": \"gfs_daily\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"gfs_weekly\": {\n          \"name\": \"gfs_weekly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 4\n        },\n        \"gfs_monthly\": {\n          \"name\": \"gfs_monthly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 12\n        },\n        \"gfs_yearly\": {\n          \"name\": \"gfs_yearly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 3\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"retention_policies_database_id_databases_id_fk\": {\n          \"name\": \"retention_policies_database_id_databases_id_fk\",\n          \"tableFrom\": \"retention_policies\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.agents\": {\n      \"name\": \"agents\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"agents_slug_unique\": {\n          \"name\": \"agents_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_channel\": {\n      \"name\": \"notification_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_notification_channels\": {\n      \"name\": \"organization_notification_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_notification_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_notification_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_notification_channels_organization_id_notification_channel_id_unique\": {\n          \"name\": \"organization_notification_channels_organization_id_notification_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"notification_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    }\n  },\n  \"enums\": {\n    \"public.retention_policy_type\": {\n      \"name\": \"retention_policy_type\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"count\",\n        \"days\",\n        \"gfs\"\n      ]\n    },\n    \"public.provider_kind\": {\n      \"name\": \"provider_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"curl\",\n        \"slack\",\n        \"smtp\",\n        \"webhook\"\n      ]\n    },\n    \"public.dbms_status\": {\n      \"name\": \"dbms_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"postgresql\",\n        \"mysql\"\n      ]\n    },\n    \"public.status\": {\n      \"name\": \"status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"waiting\",\n        \"ongoing\",\n        \"failed\",\n        \"success\"\n      ]\n    },\n    \"public.type_storage\": {\n      \"name\": \"type_storage\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\"\n      ]\n    }\n  },\n  \"schemas\": {},\n  \"sequences\": {},\n  \"roles\": {},\n  \"policies\": {},\n  \"views\": {},\n  \"_meta\": {\n    \"columns\": {},\n    \"schemas\": {},\n    \"tables\": {}\n  }\n}"
  },
  {
    "path": "src/db/migrations/meta/0008_snapshot.json",
    "content": "{\n  \"id\": \"4bc1b8d8-deda-4cd1-a30d-b6166fb636d5\",\n  \"prevId\": \"ddb3770e-4785-4c3e-b20a-202ac01999ad\",\n  \"version\": \"7\",\n  \"dialect\": \"postgresql\",\n  \"tables\": {\n    \"public.settings\": {\n      \"name\": \"settings\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"storage\": {\n          \"name\": \"storage\",\n          \"type\": \"type_storage\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'local'\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"s3_endpoint_url\": {\n          \"name\": \"s3_endpoint_url\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_access_key_id\": {\n          \"name\": \"s3_access_key_id\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_secret_access_key\": {\n          \"name\": \"s3_secret_access_key\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_bucket_name\": {\n          \"name\": \"s3_bucket_name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_password\": {\n          \"name\": \"smtp_password\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_from\": {\n          \"name\": \"smtp_from\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_host\": {\n          \"name\": \"smtp_host\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_port\": {\n          \"name\": \"smtp_port\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_user\": {\n          \"name\": \"smtp_user\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"settings_name_unique\": {\n          \"name\": \"settings_name_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"name\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.account\": {\n      \"name\": \"account\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"account_id\": {\n          \"name\": \"account_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"access_token\": {\n          \"name\": \"access_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token\": {\n          \"name\": \"refresh_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"id_token\": {\n          \"name\": \"id_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"access_token_expires_at\": {\n          \"name\": \"access_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token_expires_at\": {\n          \"name\": \"refresh_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"scope\": {\n          \"name\": \"scope\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"password\": {\n          \"name\": \"password\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"account_user_id_user_id_fk\": {\n          \"name\": \"account_user_id_user_id_fk\",\n          \"tableFrom\": \"account\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.session\": {\n      \"name\": \"session\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"token\": {\n          \"name\": \"token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"ip_address\": {\n          \"name\": \"ip_address\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_agent\": {\n          \"name\": \"user_agent\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"impersonated_by\": {\n          \"name\": \"impersonated_by\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"active_organization_id\": {\n          \"name\": \"active_organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"session_user_id_user_id_fk\": {\n          \"name\": \"session_user_id_user_id_fk\",\n          \"tableFrom\": \"session\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"session_token_unique\": {\n          \"name\": \"session_token_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"token\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.user\": {\n      \"name\": \"user\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email_verified\": {\n          \"name\": \"email_verified\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"image\": {\n          \"name\": \"image\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"banned\": {\n          \"name\": \"banned\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_reason\": {\n          \"name\": \"ban_reason\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_expires\": {\n          \"name\": \"ban_expires\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"user_email_unique\": {\n          \"name\": \"user_email_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"email\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.verification\": {\n      \"name\": \"verification\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"identifier\": {\n          \"name\": \"identifier\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"value\": {\n          \"name\": \"value\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization\": {\n      \"name\": \"organization\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"logo\": {\n          \"name\": \"logo\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"metadata\": {\n          \"name\": \"metadata\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_slug_unique\": {\n          \"name\": \"organization_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.member\": {\n      \"name\": \"member\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"member_organization_id_organization_id_fk\": {\n          \"name\": \"member_organization_id_organization_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"member_user_id_user_id_fk\": {\n          \"name\": \"member_user_id_user_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.invitation\": {\n      \"name\": \"invitation\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"inviter_id\": {\n          \"name\": \"inviter_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"invitation_organization_id_organization_id_fk\": {\n          \"name\": \"invitation_organization_id_organization_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"invitation_inviter_id_user_id_fk\": {\n          \"name\": \"invitation_inviter_id_user_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"inviter_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.projects\": {\n      \"name\": \"projects\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"projects_organization_id_organization_id_fk\": {\n          \"name\": \"projects_organization_id_organization_id_fk\",\n          \"tableFrom\": \"projects\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"projects_slug_unique\": {\n          \"name\": \"projects_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backups\": {\n      \"name\": \"backups\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"file\": {\n          \"name\": \"file\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backups_database_id_databases_id_fk\": {\n          \"name\": \"backups_database_id_databases_id_fk\",\n          \"tableFrom\": \"backups\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.databases\": {\n      \"name\": \"databases\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"agent_database_id\": {\n          \"name\": \"agent_database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"dbms\": {\n          \"name\": \"dbms\",\n          \"type\": \"dbms_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_policy\": {\n          \"name\": \"backup_policy\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"is_waiting_for_backup\": {\n          \"name\": \"is_waiting_for_backup\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"backup_to_restore\": {\n          \"name\": \"backup_to_restore\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"agent_id\": {\n          \"name\": \"agent_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"project_id\": {\n          \"name\": \"project_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"databases_agent_id_agents_id_fk\": {\n          \"name\": \"databases_agent_id_agents_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"agents\",\n          \"columnsFrom\": [\n            \"agent_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"databases_project_id_projects_id_fk\": {\n          \"name\": \"databases_project_id_projects_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"projects\",\n          \"columnsFrom\": [\n            \"project_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"no action\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.restorations\": {\n      \"name\": \"restorations\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"restorations_backup_id_backups_id_fk\": {\n          \"name\": \"restorations_backup_id_backups_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_database_id_databases_id_fk\": {\n          \"name\": \"restorations_database_id_databases_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.retention_policies\": {\n      \"name\": \"retention_policies\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"type\": {\n          \"name\": \"type\",\n          \"type\": \"retention_policy_type\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"count\": {\n          \"name\": \"count\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"days\": {\n          \"name\": \"days\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 30\n        },\n        \"gfs_daily\": {\n          \"name\": \"gfs_daily\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"gfs_weekly\": {\n          \"name\": \"gfs_weekly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 4\n        },\n        \"gfs_monthly\": {\n          \"name\": \"gfs_monthly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 12\n        },\n        \"gfs_yearly\": {\n          \"name\": \"gfs_yearly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 3\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"retention_policies_database_id_databases_id_fk\": {\n          \"name\": \"retention_policies_database_id_databases_id_fk\",\n          \"tableFrom\": \"retention_policies\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.agents\": {\n      \"name\": \"agents\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"agents_slug_unique\": {\n          \"name\": \"agents_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_channel\": {\n      \"name\": \"notification_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_notification_channels\": {\n      \"name\": \"organization_notification_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_notification_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_notification_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_notification_channels_organization_id_notification_channel_id_unique\": {\n          \"name\": \"organization_notification_channels_organization_id_notification_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"notification_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.alert_policy\": {\n      \"name\": \"alert_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"event_kind\": {\n          \"name\": \"event_kind\",\n          \"type\": \"event_kind[]\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"alert_policy_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"alert_policy_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"restrict\",\n          \"onUpdate\": \"no action\"\n        },\n        \"alert_policy_database_id_databases_id_fk\": {\n          \"name\": \"alert_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_log\": {\n      \"name\": \"notification_log\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"channel_id\": {\n          \"name\": \"channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"policy_id\": {\n          \"name\": \"policy_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"title\": {\n          \"name\": \"title\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"message\": {\n          \"name\": \"message\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"level\": {\n          \"name\": \"level\",\n          \"type\": \"level\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"payload\": {\n          \"name\": \"payload\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"success\": {\n          \"name\": \"success\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"error\": {\n          \"name\": \"error\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider_response\": {\n          \"name\": \"provider_response\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"sent_at\": {\n          \"name\": \"sent_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"notification_log_channel_id_notification_channel_id_fk\": {\n          \"name\": \"notification_log_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"notification_log\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"restrict\",\n          \"onUpdate\": \"no action\"\n        },\n        \"notification_log_policy_id_alert_policy_id_fk\": {\n          \"name\": \"notification_log_policy_id_alert_policy_id_fk\",\n          \"tableFrom\": \"notification_log\",\n          \"tableTo\": \"alert_policy\",\n          \"columnsFrom\": [\n            \"policy_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"restrict\",\n          \"onUpdate\": \"no action\"\n        },\n        \"notification_log_organization_id_organization_id_fk\": {\n          \"name\": \"notification_log_organization_id_organization_id_fk\",\n          \"tableFrom\": \"notification_log\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"set null\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    }\n  },\n  \"enums\": {\n    \"public.retention_policy_type\": {\n      \"name\": \"retention_policy_type\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"count\",\n        \"days\",\n        \"gfs\"\n      ]\n    },\n    \"public.provider_kind\": {\n      \"name\": \"provider_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"curl\",\n        \"slack\",\n        \"smtp\",\n        \"webhook\"\n      ]\n    },\n    \"public.event_kind\": {\n      \"name\": \"event_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"error_backup\",\n        \"error_restore\",\n        \"success_restore\",\n        \"success_backup\",\n        \"weekly_report\"\n      ]\n    },\n    \"public.level\": {\n      \"name\": \"level\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"critical\",\n        \"warning\",\n        \"info\"\n      ]\n    },\n    \"public.dbms_status\": {\n      \"name\": \"dbms_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"postgresql\",\n        \"mysql\"\n      ]\n    },\n    \"public.status\": {\n      \"name\": \"status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"waiting\",\n        \"ongoing\",\n        \"failed\",\n        \"success\"\n      ]\n    },\n    \"public.type_storage\": {\n      \"name\": \"type_storage\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\"\n      ]\n    }\n  },\n  \"schemas\": {},\n  \"sequences\": {},\n  \"roles\": {},\n  \"policies\": {},\n  \"views\": {},\n  \"_meta\": {\n    \"columns\": {},\n    \"schemas\": {},\n    \"tables\": {}\n  }\n}"
  },
  {
    "path": "src/db/migrations/meta/0009_snapshot.json",
    "content": "{\n  \"id\": \"44705529-9598-42e6-9aed-e411a92433e7\",\n  \"prevId\": \"4bc1b8d8-deda-4cd1-a30d-b6166fb636d5\",\n  \"version\": \"7\",\n  \"dialect\": \"postgresql\",\n  \"tables\": {\n    \"public.settings\": {\n      \"name\": \"settings\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"storage\": {\n          \"name\": \"storage\",\n          \"type\": \"type_storage\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'local'\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"s3_endpoint_url\": {\n          \"name\": \"s3_endpoint_url\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_access_key_id\": {\n          \"name\": \"s3_access_key_id\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_secret_access_key\": {\n          \"name\": \"s3_secret_access_key\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_bucket_name\": {\n          \"name\": \"s3_bucket_name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_password\": {\n          \"name\": \"smtp_password\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_from\": {\n          \"name\": \"smtp_from\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_host\": {\n          \"name\": \"smtp_host\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_port\": {\n          \"name\": \"smtp_port\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_user\": {\n          \"name\": \"smtp_user\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"settings_name_unique\": {\n          \"name\": \"settings_name_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"name\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.account\": {\n      \"name\": \"account\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"account_id\": {\n          \"name\": \"account_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"access_token\": {\n          \"name\": \"access_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token\": {\n          \"name\": \"refresh_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"id_token\": {\n          \"name\": \"id_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"access_token_expires_at\": {\n          \"name\": \"access_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token_expires_at\": {\n          \"name\": \"refresh_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"scope\": {\n          \"name\": \"scope\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"password\": {\n          \"name\": \"password\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"account_user_id_user_id_fk\": {\n          \"name\": \"account_user_id_user_id_fk\",\n          \"tableFrom\": \"account\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.session\": {\n      \"name\": \"session\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"token\": {\n          \"name\": \"token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"ip_address\": {\n          \"name\": \"ip_address\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_agent\": {\n          \"name\": \"user_agent\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"impersonated_by\": {\n          \"name\": \"impersonated_by\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"active_organization_id\": {\n          \"name\": \"active_organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"session_user_id_user_id_fk\": {\n          \"name\": \"session_user_id_user_id_fk\",\n          \"tableFrom\": \"session\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"session_token_unique\": {\n          \"name\": \"session_token_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"token\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.user\": {\n      \"name\": \"user\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email_verified\": {\n          \"name\": \"email_verified\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"image\": {\n          \"name\": \"image\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"banned\": {\n          \"name\": \"banned\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_reason\": {\n          \"name\": \"ban_reason\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_expires\": {\n          \"name\": \"ban_expires\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"user_email_unique\": {\n          \"name\": \"user_email_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"email\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.verification\": {\n      \"name\": \"verification\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"identifier\": {\n          \"name\": \"identifier\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"value\": {\n          \"name\": \"value\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization\": {\n      \"name\": \"organization\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"logo\": {\n          \"name\": \"logo\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"metadata\": {\n          \"name\": \"metadata\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_slug_unique\": {\n          \"name\": \"organization_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.member\": {\n      \"name\": \"member\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"member_organization_id_organization_id_fk\": {\n          \"name\": \"member_organization_id_organization_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"member_user_id_user_id_fk\": {\n          \"name\": \"member_user_id_user_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.invitation\": {\n      \"name\": \"invitation\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"inviter_id\": {\n          \"name\": \"inviter_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"invitation_organization_id_organization_id_fk\": {\n          \"name\": \"invitation_organization_id_organization_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"invitation_inviter_id_user_id_fk\": {\n          \"name\": \"invitation_inviter_id_user_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"inviter_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.projects\": {\n      \"name\": \"projects\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"projects_organization_id_organization_id_fk\": {\n          \"name\": \"projects_organization_id_organization_id_fk\",\n          \"tableFrom\": \"projects\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"projects_slug_unique\": {\n          \"name\": \"projects_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backups\": {\n      \"name\": \"backups\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"file\": {\n          \"name\": \"file\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backups_database_id_databases_id_fk\": {\n          \"name\": \"backups_database_id_databases_id_fk\",\n          \"tableFrom\": \"backups\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.databases\": {\n      \"name\": \"databases\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"agent_database_id\": {\n          \"name\": \"agent_database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"dbms\": {\n          \"name\": \"dbms\",\n          \"type\": \"dbms_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_policy\": {\n          \"name\": \"backup_policy\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"is_waiting_for_backup\": {\n          \"name\": \"is_waiting_for_backup\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"backup_to_restore\": {\n          \"name\": \"backup_to_restore\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"agent_id\": {\n          \"name\": \"agent_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"project_id\": {\n          \"name\": \"project_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"databases_agent_id_agents_id_fk\": {\n          \"name\": \"databases_agent_id_agents_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"agents\",\n          \"columnsFrom\": [\n            \"agent_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"databases_project_id_projects_id_fk\": {\n          \"name\": \"databases_project_id_projects_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"projects\",\n          \"columnsFrom\": [\n            \"project_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"no action\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.restorations\": {\n      \"name\": \"restorations\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"restorations_backup_id_backups_id_fk\": {\n          \"name\": \"restorations_backup_id_backups_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_database_id_databases_id_fk\": {\n          \"name\": \"restorations_database_id_databases_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.retention_policies\": {\n      \"name\": \"retention_policies\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"type\": {\n          \"name\": \"type\",\n          \"type\": \"retention_policy_type\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"count\": {\n          \"name\": \"count\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"days\": {\n          \"name\": \"days\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 30\n        },\n        \"gfs_daily\": {\n          \"name\": \"gfs_daily\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"gfs_weekly\": {\n          \"name\": \"gfs_weekly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 4\n        },\n        \"gfs_monthly\": {\n          \"name\": \"gfs_monthly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 12\n        },\n        \"gfs_yearly\": {\n          \"name\": \"gfs_yearly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 3\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"retention_policies_database_id_databases_id_fk\": {\n          \"name\": \"retention_policies_database_id_databases_id_fk\",\n          \"tableFrom\": \"retention_policies\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.agents\": {\n      \"name\": \"agents\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"agents_slug_unique\": {\n          \"name\": \"agents_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_channel\": {\n      \"name\": \"notification_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_notification_channels\": {\n      \"name\": \"organization_notification_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_notification_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_notification_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_notification_channels_organization_id_notification_channel_id_unique\": {\n          \"name\": \"organization_notification_channels_organization_id_notification_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"notification_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.alert_policy\": {\n      \"name\": \"alert_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"event_kind\": {\n          \"name\": \"event_kind\",\n          \"type\": \"event_kind[]\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"alert_policy_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"alert_policy_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"alert_policy_database_id_databases_id_fk\": {\n          \"name\": \"alert_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_log\": {\n      \"name\": \"notification_log\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"channel_id\": {\n          \"name\": \"channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"policy_id\": {\n          \"name\": \"policy_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"title\": {\n          \"name\": \"title\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"message\": {\n          \"name\": \"message\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"level\": {\n          \"name\": \"level\",\n          \"type\": \"level\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"payload\": {\n          \"name\": \"payload\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"success\": {\n          \"name\": \"success\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"error\": {\n          \"name\": \"error\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider_response\": {\n          \"name\": \"provider_response\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"sent_at\": {\n          \"name\": \"sent_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"notification_log_channel_id_notification_channel_id_fk\": {\n          \"name\": \"notification_log_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"notification_log\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"restrict\",\n          \"onUpdate\": \"no action\"\n        },\n        \"notification_log_policy_id_alert_policy_id_fk\": {\n          \"name\": \"notification_log_policy_id_alert_policy_id_fk\",\n          \"tableFrom\": \"notification_log\",\n          \"tableTo\": \"alert_policy\",\n          \"columnsFrom\": [\n            \"policy_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"restrict\",\n          \"onUpdate\": \"no action\"\n        },\n        \"notification_log_organization_id_organization_id_fk\": {\n          \"name\": \"notification_log_organization_id_organization_id_fk\",\n          \"tableFrom\": \"notification_log\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"set null\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    }\n  },\n  \"enums\": {\n    \"public.retention_policy_type\": {\n      \"name\": \"retention_policy_type\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"count\",\n        \"days\",\n        \"gfs\"\n      ]\n    },\n    \"public.provider_kind\": {\n      \"name\": \"provider_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"curl\",\n        \"slack\",\n        \"smtp\",\n        \"webhook\"\n      ]\n    },\n    \"public.event_kind\": {\n      \"name\": \"event_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"error_backup\",\n        \"error_restore\",\n        \"success_restore\",\n        \"success_backup\",\n        \"weekly_report\"\n      ]\n    },\n    \"public.level\": {\n      \"name\": \"level\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"critical\",\n        \"warning\",\n        \"info\"\n      ]\n    },\n    \"public.dbms_status\": {\n      \"name\": \"dbms_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"postgresql\",\n        \"mysql\"\n      ]\n    },\n    \"public.status\": {\n      \"name\": \"status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"waiting\",\n        \"ongoing\",\n        \"failed\",\n        \"success\"\n      ]\n    },\n    \"public.type_storage\": {\n      \"name\": \"type_storage\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\"\n      ]\n    }\n  },\n  \"schemas\": {},\n  \"sequences\": {},\n  \"roles\": {},\n  \"policies\": {},\n  \"views\": {},\n  \"_meta\": {\n    \"columns\": {},\n    \"schemas\": {},\n    \"tables\": {}\n  }\n}"
  },
  {
    "path": "src/db/migrations/meta/0010_snapshot.json",
    "content": "{\n  \"id\": \"058bc2a4-988c-4134-a234-8cce726575a6\",\n  \"prevId\": \"44705529-9598-42e6-9aed-e411a92433e7\",\n  \"version\": \"7\",\n  \"dialect\": \"postgresql\",\n  \"tables\": {\n    \"public.settings\": {\n      \"name\": \"settings\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"storage\": {\n          \"name\": \"storage\",\n          \"type\": \"type_storage\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'local'\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"s3_endpoint_url\": {\n          \"name\": \"s3_endpoint_url\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_access_key_id\": {\n          \"name\": \"s3_access_key_id\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_secret_access_key\": {\n          \"name\": \"s3_secret_access_key\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_bucket_name\": {\n          \"name\": \"s3_bucket_name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_password\": {\n          \"name\": \"smtp_password\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_from\": {\n          \"name\": \"smtp_from\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_host\": {\n          \"name\": \"smtp_host\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_port\": {\n          \"name\": \"smtp_port\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_user\": {\n          \"name\": \"smtp_user\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"settings_name_unique\": {\n          \"name\": \"settings_name_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"name\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.account\": {\n      \"name\": \"account\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"account_id\": {\n          \"name\": \"account_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"access_token\": {\n          \"name\": \"access_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token\": {\n          \"name\": \"refresh_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"id_token\": {\n          \"name\": \"id_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"access_token_expires_at\": {\n          \"name\": \"access_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token_expires_at\": {\n          \"name\": \"refresh_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"scope\": {\n          \"name\": \"scope\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"password\": {\n          \"name\": \"password\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"account_user_id_user_id_fk\": {\n          \"name\": \"account_user_id_user_id_fk\",\n          \"tableFrom\": \"account\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.session\": {\n      \"name\": \"session\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"token\": {\n          \"name\": \"token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"ip_address\": {\n          \"name\": \"ip_address\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_agent\": {\n          \"name\": \"user_agent\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"impersonated_by\": {\n          \"name\": \"impersonated_by\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"active_organization_id\": {\n          \"name\": \"active_organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"session_user_id_user_id_fk\": {\n          \"name\": \"session_user_id_user_id_fk\",\n          \"tableFrom\": \"session\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"session_token_unique\": {\n          \"name\": \"session_token_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"token\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.user\": {\n      \"name\": \"user\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email_verified\": {\n          \"name\": \"email_verified\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"image\": {\n          \"name\": \"image\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"banned\": {\n          \"name\": \"banned\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_reason\": {\n          \"name\": \"ban_reason\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_expires\": {\n          \"name\": \"ban_expires\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"user_email_unique\": {\n          \"name\": \"user_email_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"email\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.verification\": {\n      \"name\": \"verification\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"identifier\": {\n          \"name\": \"identifier\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"value\": {\n          \"name\": \"value\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization\": {\n      \"name\": \"organization\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"logo\": {\n          \"name\": \"logo\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"metadata\": {\n          \"name\": \"metadata\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_slug_unique\": {\n          \"name\": \"organization_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.member\": {\n      \"name\": \"member\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"member_organization_id_organization_id_fk\": {\n          \"name\": \"member_organization_id_organization_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"member_user_id_user_id_fk\": {\n          \"name\": \"member_user_id_user_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.invitation\": {\n      \"name\": \"invitation\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"inviter_id\": {\n          \"name\": \"inviter_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"invitation_organization_id_organization_id_fk\": {\n          \"name\": \"invitation_organization_id_organization_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"invitation_inviter_id_user_id_fk\": {\n          \"name\": \"invitation_inviter_id_user_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"inviter_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.projects\": {\n      \"name\": \"projects\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"projects_organization_id_organization_id_fk\": {\n          \"name\": \"projects_organization_id_organization_id_fk\",\n          \"tableFrom\": \"projects\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"projects_slug_unique\": {\n          \"name\": \"projects_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backups\": {\n      \"name\": \"backups\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"file\": {\n          \"name\": \"file\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backups_database_id_databases_id_fk\": {\n          \"name\": \"backups_database_id_databases_id_fk\",\n          \"tableFrom\": \"backups\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.databases\": {\n      \"name\": \"databases\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"agent_database_id\": {\n          \"name\": \"agent_database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"dbms\": {\n          \"name\": \"dbms\",\n          \"type\": \"dbms_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_policy\": {\n          \"name\": \"backup_policy\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"is_waiting_for_backup\": {\n          \"name\": \"is_waiting_for_backup\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"backup_to_restore\": {\n          \"name\": \"backup_to_restore\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"agent_id\": {\n          \"name\": \"agent_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"project_id\": {\n          \"name\": \"project_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"databases_agent_id_agents_id_fk\": {\n          \"name\": \"databases_agent_id_agents_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"agents\",\n          \"columnsFrom\": [\n            \"agent_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"databases_project_id_projects_id_fk\": {\n          \"name\": \"databases_project_id_projects_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"projects\",\n          \"columnsFrom\": [\n            \"project_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"no action\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.restorations\": {\n      \"name\": \"restorations\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"restorations_backup_id_backups_id_fk\": {\n          \"name\": \"restorations_backup_id_backups_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_database_id_databases_id_fk\": {\n          \"name\": \"restorations_database_id_databases_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.retention_policies\": {\n      \"name\": \"retention_policies\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"type\": {\n          \"name\": \"type\",\n          \"type\": \"retention_policy_type\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"count\": {\n          \"name\": \"count\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"days\": {\n          \"name\": \"days\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 30\n        },\n        \"gfs_daily\": {\n          \"name\": \"gfs_daily\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"gfs_weekly\": {\n          \"name\": \"gfs_weekly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 4\n        },\n        \"gfs_monthly\": {\n          \"name\": \"gfs_monthly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 12\n        },\n        \"gfs_yearly\": {\n          \"name\": \"gfs_yearly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 3\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"retention_policies_database_id_databases_id_fk\": {\n          \"name\": \"retention_policies_database_id_databases_id_fk\",\n          \"tableFrom\": \"retention_policies\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.agents\": {\n      \"name\": \"agents\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"agents_slug_unique\": {\n          \"name\": \"agents_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_channel\": {\n      \"name\": \"notification_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_notification_channels\": {\n      \"name\": \"organization_notification_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_notification_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_notification_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_notification_channels_organization_id_notification_channel_id_unique\": {\n          \"name\": \"organization_notification_channels_organization_id_notification_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"notification_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.alert_policy\": {\n      \"name\": \"alert_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"event_kind\": {\n          \"name\": \"event_kind\",\n          \"type\": \"event_kind[]\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"alert_policy_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"alert_policy_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"alert_policy_database_id_databases_id_fk\": {\n          \"name\": \"alert_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_log\": {\n      \"name\": \"notification_log\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"channel_id\": {\n          \"name\": \"channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"policy_id\": {\n          \"name\": \"policy_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"title\": {\n          \"name\": \"title\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"message\": {\n          \"name\": \"message\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"level\": {\n          \"name\": \"level\",\n          \"type\": \"level\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"payload\": {\n          \"name\": \"payload\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"success\": {\n          \"name\": \"success\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"error\": {\n          \"name\": \"error\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider_response\": {\n          \"name\": \"provider_response\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"sent_at\": {\n          \"name\": \"sent_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"notification_log_channel_id_notification_channel_id_fk\": {\n          \"name\": \"notification_log_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"notification_log\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"restrict\",\n          \"onUpdate\": \"no action\"\n        },\n        \"notification_log_policy_id_alert_policy_id_fk\": {\n          \"name\": \"notification_log_policy_id_alert_policy_id_fk\",\n          \"tableFrom\": \"notification_log\",\n          \"tableTo\": \"alert_policy\",\n          \"columnsFrom\": [\n            \"policy_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"restrict\",\n          \"onUpdate\": \"no action\"\n        },\n        \"notification_log_organization_id_organization_id_fk\": {\n          \"name\": \"notification_log_organization_id_organization_id_fk\",\n          \"tableFrom\": \"notification_log\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"set null\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    }\n  },\n  \"enums\": {\n    \"public.retention_policy_type\": {\n      \"name\": \"retention_policy_type\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"count\",\n        \"days\",\n        \"gfs\"\n      ]\n    },\n    \"public.provider_kind\": {\n      \"name\": \"provider_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"slack\",\n        \"smtp\"\n      ]\n    },\n    \"public.event_kind\": {\n      \"name\": \"event_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"error_backup\",\n        \"error_restore\",\n        \"success_restore\",\n        \"success_backup\",\n        \"weekly_report\"\n      ]\n    },\n    \"public.level\": {\n      \"name\": \"level\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"critical\",\n        \"warning\",\n        \"info\"\n      ]\n    },\n    \"public.dbms_status\": {\n      \"name\": \"dbms_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"postgresql\",\n        \"mysql\"\n      ]\n    },\n    \"public.status\": {\n      \"name\": \"status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"waiting\",\n        \"ongoing\",\n        \"failed\",\n        \"success\"\n      ]\n    },\n    \"public.type_storage\": {\n      \"name\": \"type_storage\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\"\n      ]\n    }\n  },\n  \"schemas\": {},\n  \"sequences\": {},\n  \"roles\": {},\n  \"policies\": {},\n  \"views\": {},\n  \"_meta\": {\n    \"columns\": {},\n    \"schemas\": {},\n    \"tables\": {}\n  }\n}"
  },
  {
    "path": "src/db/migrations/meta/0011_snapshot.json",
    "content": "{\n  \"id\": \"cecea4fb-d704-4872-9ba1-210d8872f9f8\",\n  \"prevId\": \"058bc2a4-988c-4134-a234-8cce726575a6\",\n  \"version\": \"7\",\n  \"dialect\": \"postgresql\",\n  \"tables\": {\n    \"public.settings\": {\n      \"name\": \"settings\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"storage\": {\n          \"name\": \"storage\",\n          \"type\": \"type_storage\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'local'\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"s3_endpoint_url\": {\n          \"name\": \"s3_endpoint_url\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_access_key_id\": {\n          \"name\": \"s3_access_key_id\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_secret_access_key\": {\n          \"name\": \"s3_secret_access_key\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_bucket_name\": {\n          \"name\": \"s3_bucket_name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_password\": {\n          \"name\": \"smtp_password\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_from\": {\n          \"name\": \"smtp_from\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_host\": {\n          \"name\": \"smtp_host\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_port\": {\n          \"name\": \"smtp_port\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_user\": {\n          \"name\": \"smtp_user\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"settings_name_unique\": {\n          \"name\": \"settings_name_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"name\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.account\": {\n      \"name\": \"account\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"account_id\": {\n          \"name\": \"account_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"access_token\": {\n          \"name\": \"access_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token\": {\n          \"name\": \"refresh_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"id_token\": {\n          \"name\": \"id_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"access_token_expires_at\": {\n          \"name\": \"access_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token_expires_at\": {\n          \"name\": \"refresh_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"scope\": {\n          \"name\": \"scope\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"password\": {\n          \"name\": \"password\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"account_user_id_user_id_fk\": {\n          \"name\": \"account_user_id_user_id_fk\",\n          \"tableFrom\": \"account\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.session\": {\n      \"name\": \"session\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"token\": {\n          \"name\": \"token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"ip_address\": {\n          \"name\": \"ip_address\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_agent\": {\n          \"name\": \"user_agent\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"impersonated_by\": {\n          \"name\": \"impersonated_by\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"active_organization_id\": {\n          \"name\": \"active_organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"session_user_id_user_id_fk\": {\n          \"name\": \"session_user_id_user_id_fk\",\n          \"tableFrom\": \"session\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"session_token_unique\": {\n          \"name\": \"session_token_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"token\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.user\": {\n      \"name\": \"user\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email_verified\": {\n          \"name\": \"email_verified\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"image\": {\n          \"name\": \"image\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"banned\": {\n          \"name\": \"banned\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_reason\": {\n          \"name\": \"ban_reason\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_expires\": {\n          \"name\": \"ban_expires\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"user_email_unique\": {\n          \"name\": \"user_email_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"email\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.verification\": {\n      \"name\": \"verification\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"identifier\": {\n          \"name\": \"identifier\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"value\": {\n          \"name\": \"value\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization\": {\n      \"name\": \"organization\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"logo\": {\n          \"name\": \"logo\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"metadata\": {\n          \"name\": \"metadata\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_slug_unique\": {\n          \"name\": \"organization_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.member\": {\n      \"name\": \"member\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"member_organization_id_organization_id_fk\": {\n          \"name\": \"member_organization_id_organization_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"member_user_id_user_id_fk\": {\n          \"name\": \"member_user_id_user_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.invitation\": {\n      \"name\": \"invitation\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"inviter_id\": {\n          \"name\": \"inviter_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"invitation_organization_id_organization_id_fk\": {\n          \"name\": \"invitation_organization_id_organization_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"invitation_inviter_id_user_id_fk\": {\n          \"name\": \"invitation_inviter_id_user_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"inviter_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.projects\": {\n      \"name\": \"projects\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"projects_organization_id_organization_id_fk\": {\n          \"name\": \"projects_organization_id_organization_id_fk\",\n          \"tableFrom\": \"projects\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"projects_slug_unique\": {\n          \"name\": \"projects_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backups\": {\n      \"name\": \"backups\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"file\": {\n          \"name\": \"file\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backups_database_id_databases_id_fk\": {\n          \"name\": \"backups_database_id_databases_id_fk\",\n          \"tableFrom\": \"backups\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.databases\": {\n      \"name\": \"databases\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"agent_database_id\": {\n          \"name\": \"agent_database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"dbms\": {\n          \"name\": \"dbms\",\n          \"type\": \"dbms_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_policy\": {\n          \"name\": \"backup_policy\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"is_waiting_for_backup\": {\n          \"name\": \"is_waiting_for_backup\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"backup_to_restore\": {\n          \"name\": \"backup_to_restore\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"agent_id\": {\n          \"name\": \"agent_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"project_id\": {\n          \"name\": \"project_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"databases_agent_id_agents_id_fk\": {\n          \"name\": \"databases_agent_id_agents_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"agents\",\n          \"columnsFrom\": [\n            \"agent_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"databases_project_id_projects_id_fk\": {\n          \"name\": \"databases_project_id_projects_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"projects\",\n          \"columnsFrom\": [\n            \"project_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"no action\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.restorations\": {\n      \"name\": \"restorations\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"restorations_backup_id_backups_id_fk\": {\n          \"name\": \"restorations_backup_id_backups_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_database_id_databases_id_fk\": {\n          \"name\": \"restorations_database_id_databases_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.retention_policies\": {\n      \"name\": \"retention_policies\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"type\": {\n          \"name\": \"type\",\n          \"type\": \"retention_policy_type\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"count\": {\n          \"name\": \"count\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"days\": {\n          \"name\": \"days\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 30\n        },\n        \"gfs_daily\": {\n          \"name\": \"gfs_daily\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"gfs_weekly\": {\n          \"name\": \"gfs_weekly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 4\n        },\n        \"gfs_monthly\": {\n          \"name\": \"gfs_monthly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 12\n        },\n        \"gfs_yearly\": {\n          \"name\": \"gfs_yearly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 3\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"retention_policies_database_id_databases_id_fk\": {\n          \"name\": \"retention_policies_database_id_databases_id_fk\",\n          \"tableFrom\": \"retention_policies\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.agents\": {\n      \"name\": \"agents\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"agents_slug_unique\": {\n          \"name\": \"agents_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_channel\": {\n      \"name\": \"notification_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_notification_channels\": {\n      \"name\": \"organization_notification_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_notification_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_notification_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_notification_channels_organization_id_notification_channel_id_unique\": {\n          \"name\": \"organization_notification_channels_organization_id_notification_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"notification_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.alert_policy\": {\n      \"name\": \"alert_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"event_kind\": {\n          \"name\": \"event_kind\",\n          \"type\": \"event_kind[]\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"alert_policy_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"alert_policy_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"alert_policy_database_id_databases_id_fk\": {\n          \"name\": \"alert_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_log\": {\n      \"name\": \"notification_log\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"channel_id\": {\n          \"name\": \"channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"policy_id\": {\n          \"name\": \"policy_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"event\": {\n          \"name\": \"event\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_name\": {\n          \"name\": \"provider_name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"title\": {\n          \"name\": \"title\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"message\": {\n          \"name\": \"message\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"level\": {\n          \"name\": \"level\",\n          \"type\": \"level\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"payload\": {\n          \"name\": \"payload\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"success\": {\n          \"name\": \"success\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"error\": {\n          \"name\": \"error\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider_response\": {\n          \"name\": \"provider_response\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"sent_at\": {\n          \"name\": \"sent_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    }\n  },\n  \"enums\": {\n    \"public.retention_policy_type\": {\n      \"name\": \"retention_policy_type\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"count\",\n        \"days\",\n        \"gfs\"\n      ]\n    },\n    \"public.provider_kind\": {\n      \"name\": \"provider_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"slack\",\n        \"smtp\"\n      ]\n    },\n    \"public.event_kind\": {\n      \"name\": \"event_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"error_backup\",\n        \"error_restore\",\n        \"success_restore\",\n        \"success_backup\",\n        \"weekly_report\"\n      ]\n    },\n    \"public.level\": {\n      \"name\": \"level\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"critical\",\n        \"warning\",\n        \"info\"\n      ]\n    },\n    \"public.dbms_status\": {\n      \"name\": \"dbms_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"postgresql\",\n        \"mysql\"\n      ]\n    },\n    \"public.status\": {\n      \"name\": \"status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"waiting\",\n        \"ongoing\",\n        \"failed\",\n        \"success\"\n      ]\n    },\n    \"public.type_storage\": {\n      \"name\": \"type_storage\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\"\n      ]\n    }\n  },\n  \"schemas\": {},\n  \"sequences\": {},\n  \"roles\": {},\n  \"policies\": {},\n  \"views\": {},\n  \"_meta\": {\n    \"columns\": {},\n    \"schemas\": {},\n    \"tables\": {}\n  }\n}"
  },
  {
    "path": "src/db/migrations/meta/0012_snapshot.json",
    "content": "{\n  \"id\": \"05a7de9f-f36d-47d1-b66c-0ef01d476b44\",\n  \"prevId\": \"cecea4fb-d704-4872-9ba1-210d8872f9f8\",\n  \"version\": \"7\",\n  \"dialect\": \"postgresql\",\n  \"tables\": {\n    \"public.settings\": {\n      \"name\": \"settings\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"storage\": {\n          \"name\": \"storage\",\n          \"type\": \"type_storage\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'local'\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"s3_endpoint_url\": {\n          \"name\": \"s3_endpoint_url\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_access_key_id\": {\n          \"name\": \"s3_access_key_id\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_secret_access_key\": {\n          \"name\": \"s3_secret_access_key\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_bucket_name\": {\n          \"name\": \"s3_bucket_name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_password\": {\n          \"name\": \"smtp_password\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_from\": {\n          \"name\": \"smtp_from\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_host\": {\n          \"name\": \"smtp_host\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_port\": {\n          \"name\": \"smtp_port\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_user\": {\n          \"name\": \"smtp_user\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"settings_name_unique\": {\n          \"name\": \"settings_name_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"name\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.account\": {\n      \"name\": \"account\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"account_id\": {\n          \"name\": \"account_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"access_token\": {\n          \"name\": \"access_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token\": {\n          \"name\": \"refresh_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"id_token\": {\n          \"name\": \"id_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"access_token_expires_at\": {\n          \"name\": \"access_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token_expires_at\": {\n          \"name\": \"refresh_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"scope\": {\n          \"name\": \"scope\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"password\": {\n          \"name\": \"password\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"account_user_id_user_id_fk\": {\n          \"name\": \"account_user_id_user_id_fk\",\n          \"tableFrom\": \"account\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.session\": {\n      \"name\": \"session\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"token\": {\n          \"name\": \"token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"ip_address\": {\n          \"name\": \"ip_address\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_agent\": {\n          \"name\": \"user_agent\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"impersonated_by\": {\n          \"name\": \"impersonated_by\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"active_organization_id\": {\n          \"name\": \"active_organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"session_user_id_user_id_fk\": {\n          \"name\": \"session_user_id_user_id_fk\",\n          \"tableFrom\": \"session\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"session_token_unique\": {\n          \"name\": \"session_token_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"token\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.user\": {\n      \"name\": \"user\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email_verified\": {\n          \"name\": \"email_verified\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"image\": {\n          \"name\": \"image\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"banned\": {\n          \"name\": \"banned\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_reason\": {\n          \"name\": \"ban_reason\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_expires\": {\n          \"name\": \"ban_expires\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"user_email_unique\": {\n          \"name\": \"user_email_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"email\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.verification\": {\n      \"name\": \"verification\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"identifier\": {\n          \"name\": \"identifier\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"value\": {\n          \"name\": \"value\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization\": {\n      \"name\": \"organization\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"logo\": {\n          \"name\": \"logo\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"metadata\": {\n          \"name\": \"metadata\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_slug_unique\": {\n          \"name\": \"organization_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.member\": {\n      \"name\": \"member\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"member_organization_id_organization_id_fk\": {\n          \"name\": \"member_organization_id_organization_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"member_user_id_user_id_fk\": {\n          \"name\": \"member_user_id_user_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.invitation\": {\n      \"name\": \"invitation\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"inviter_id\": {\n          \"name\": \"inviter_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"invitation_organization_id_organization_id_fk\": {\n          \"name\": \"invitation_organization_id_organization_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"invitation_inviter_id_user_id_fk\": {\n          \"name\": \"invitation_inviter_id_user_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"inviter_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.projects\": {\n      \"name\": \"projects\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"projects_organization_id_organization_id_fk\": {\n          \"name\": \"projects_organization_id_organization_id_fk\",\n          \"tableFrom\": \"projects\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"projects_slug_unique\": {\n          \"name\": \"projects_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backups\": {\n      \"name\": \"backups\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"file\": {\n          \"name\": \"file\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backups_database_id_databases_id_fk\": {\n          \"name\": \"backups_database_id_databases_id_fk\",\n          \"tableFrom\": \"backups\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.databases\": {\n      \"name\": \"databases\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"agent_database_id\": {\n          \"name\": \"agent_database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"dbms\": {\n          \"name\": \"dbms\",\n          \"type\": \"dbms_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_policy\": {\n          \"name\": \"backup_policy\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"is_waiting_for_backup\": {\n          \"name\": \"is_waiting_for_backup\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"backup_to_restore\": {\n          \"name\": \"backup_to_restore\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"agent_id\": {\n          \"name\": \"agent_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"project_id\": {\n          \"name\": \"project_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"databases_agent_id_agents_id_fk\": {\n          \"name\": \"databases_agent_id_agents_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"agents\",\n          \"columnsFrom\": [\n            \"agent_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"databases_project_id_projects_id_fk\": {\n          \"name\": \"databases_project_id_projects_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"projects\",\n          \"columnsFrom\": [\n            \"project_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"no action\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.restorations\": {\n      \"name\": \"restorations\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"restorations_backup_id_backups_id_fk\": {\n          \"name\": \"restorations_backup_id_backups_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_database_id_databases_id_fk\": {\n          \"name\": \"restorations_database_id_databases_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.retention_policies\": {\n      \"name\": \"retention_policies\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"type\": {\n          \"name\": \"type\",\n          \"type\": \"retention_policy_type\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"count\": {\n          \"name\": \"count\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"days\": {\n          \"name\": \"days\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 30\n        },\n        \"gfs_daily\": {\n          \"name\": \"gfs_daily\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"gfs_weekly\": {\n          \"name\": \"gfs_weekly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 4\n        },\n        \"gfs_monthly\": {\n          \"name\": \"gfs_monthly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 12\n        },\n        \"gfs_yearly\": {\n          \"name\": \"gfs_yearly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 3\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"retention_policies_database_id_databases_id_fk\": {\n          \"name\": \"retention_policies_database_id_databases_id_fk\",\n          \"tableFrom\": \"retention_policies\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.agents\": {\n      \"name\": \"agents\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"version\": {\n          \"name\": \"version\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"agents_slug_unique\": {\n          \"name\": \"agents_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_channel\": {\n      \"name\": \"notification_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_notification_channels\": {\n      \"name\": \"organization_notification_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_notification_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_notification_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_notification_channels_organization_id_notification_channel_id_unique\": {\n          \"name\": \"organization_notification_channels_organization_id_notification_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"notification_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.alert_policy\": {\n      \"name\": \"alert_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"event_kind\": {\n          \"name\": \"event_kind\",\n          \"type\": \"event_kind[]\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"alert_policy_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"alert_policy_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"alert_policy_database_id_databases_id_fk\": {\n          \"name\": \"alert_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_log\": {\n      \"name\": \"notification_log\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"channel_id\": {\n          \"name\": \"channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"policy_id\": {\n          \"name\": \"policy_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"event\": {\n          \"name\": \"event\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_name\": {\n          \"name\": \"provider_name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"title\": {\n          \"name\": \"title\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"message\": {\n          \"name\": \"message\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"level\": {\n          \"name\": \"level\",\n          \"type\": \"level\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"payload\": {\n          \"name\": \"payload\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"success\": {\n          \"name\": \"success\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"error\": {\n          \"name\": \"error\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider_response\": {\n          \"name\": \"provider_response\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"sent_at\": {\n          \"name\": \"sent_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    }\n  },\n  \"enums\": {\n    \"public.retention_policy_type\": {\n      \"name\": \"retention_policy_type\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"count\",\n        \"days\",\n        \"gfs\"\n      ]\n    },\n    \"public.provider_kind\": {\n      \"name\": \"provider_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"slack\",\n        \"smtp\"\n      ]\n    },\n    \"public.event_kind\": {\n      \"name\": \"event_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"error_backup\",\n        \"error_restore\",\n        \"success_restore\",\n        \"success_backup\",\n        \"weekly_report\"\n      ]\n    },\n    \"public.level\": {\n      \"name\": \"level\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"critical\",\n        \"warning\",\n        \"info\"\n      ]\n    },\n    \"public.dbms_status\": {\n      \"name\": \"dbms_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"postgresql\",\n        \"mysql\"\n      ]\n    },\n    \"public.status\": {\n      \"name\": \"status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"waiting\",\n        \"ongoing\",\n        \"failed\",\n        \"success\"\n      ]\n    },\n    \"public.type_storage\": {\n      \"name\": \"type_storage\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\"\n      ]\n    }\n  },\n  \"schemas\": {},\n  \"sequences\": {},\n  \"roles\": {},\n  \"policies\": {},\n  \"views\": {},\n  \"_meta\": {\n    \"columns\": {},\n    \"schemas\": {},\n    \"tables\": {}\n  }\n}"
  },
  {
    "path": "src/db/migrations/meta/0013_snapshot.json",
    "content": "{\n  \"id\": \"111a7060-826c-4df7-bc2a-320b6e477ac1\",\n  \"prevId\": \"05a7de9f-f36d-47d1-b66c-0ef01d476b44\",\n  \"version\": \"7\",\n  \"dialect\": \"postgresql\",\n  \"tables\": {\n    \"public.settings\": {\n      \"name\": \"settings\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"storage\": {\n          \"name\": \"storage\",\n          \"type\": \"type_storage\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'local'\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"s3_endpoint_url\": {\n          \"name\": \"s3_endpoint_url\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_access_key_id\": {\n          \"name\": \"s3_access_key_id\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_secret_access_key\": {\n          \"name\": \"s3_secret_access_key\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_bucket_name\": {\n          \"name\": \"s3_bucket_name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_password\": {\n          \"name\": \"smtp_password\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_from\": {\n          \"name\": \"smtp_from\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_host\": {\n          \"name\": \"smtp_host\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_port\": {\n          \"name\": \"smtp_port\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_user\": {\n          \"name\": \"smtp_user\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"settings_name_unique\": {\n          \"name\": \"settings_name_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"name\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.account\": {\n      \"name\": \"account\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"account_id\": {\n          \"name\": \"account_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"access_token\": {\n          \"name\": \"access_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token\": {\n          \"name\": \"refresh_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"id_token\": {\n          \"name\": \"id_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"access_token_expires_at\": {\n          \"name\": \"access_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token_expires_at\": {\n          \"name\": \"refresh_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"scope\": {\n          \"name\": \"scope\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"password\": {\n          \"name\": \"password\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"account_user_id_user_id_fk\": {\n          \"name\": \"account_user_id_user_id_fk\",\n          \"tableFrom\": \"account\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.session\": {\n      \"name\": \"session\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"token\": {\n          \"name\": \"token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"ip_address\": {\n          \"name\": \"ip_address\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_agent\": {\n          \"name\": \"user_agent\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"impersonated_by\": {\n          \"name\": \"impersonated_by\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"active_organization_id\": {\n          \"name\": \"active_organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"session_user_id_user_id_fk\": {\n          \"name\": \"session_user_id_user_id_fk\",\n          \"tableFrom\": \"session\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"session_token_unique\": {\n          \"name\": \"session_token_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"token\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.user\": {\n      \"name\": \"user\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email_verified\": {\n          \"name\": \"email_verified\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"image\": {\n          \"name\": \"image\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"banned\": {\n          \"name\": \"banned\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_reason\": {\n          \"name\": \"ban_reason\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_expires\": {\n          \"name\": \"ban_expires\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"lastChangedPasswordAt\": {\n          \"name\": \"lastChangedPasswordAt\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"two_factor_enabled\": {\n          \"name\": \"two_factor_enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"user_email_unique\": {\n          \"name\": \"user_email_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"email\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.verification\": {\n      \"name\": \"verification\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"identifier\": {\n          \"name\": \"identifier\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"value\": {\n          \"name\": \"value\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization\": {\n      \"name\": \"organization\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"logo\": {\n          \"name\": \"logo\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"metadata\": {\n          \"name\": \"metadata\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_slug_unique\": {\n          \"name\": \"organization_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.member\": {\n      \"name\": \"member\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"member_organization_id_organization_id_fk\": {\n          \"name\": \"member_organization_id_organization_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"member_user_id_user_id_fk\": {\n          \"name\": \"member_user_id_user_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.invitation\": {\n      \"name\": \"invitation\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"inviter_id\": {\n          \"name\": \"inviter_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"invitation_organization_id_organization_id_fk\": {\n          \"name\": \"invitation_organization_id_organization_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"invitation_inviter_id_user_id_fk\": {\n          \"name\": \"invitation_inviter_id_user_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"inviter_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.projects\": {\n      \"name\": \"projects\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"projects_organization_id_organization_id_fk\": {\n          \"name\": \"projects_organization_id_organization_id_fk\",\n          \"tableFrom\": \"projects\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"projects_slug_unique\": {\n          \"name\": \"projects_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backups\": {\n      \"name\": \"backups\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"file\": {\n          \"name\": \"file\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backups_database_id_databases_id_fk\": {\n          \"name\": \"backups_database_id_databases_id_fk\",\n          \"tableFrom\": \"backups\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.databases\": {\n      \"name\": \"databases\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"agent_database_id\": {\n          \"name\": \"agent_database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"dbms\": {\n          \"name\": \"dbms\",\n          \"type\": \"dbms_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_policy\": {\n          \"name\": \"backup_policy\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"is_waiting_for_backup\": {\n          \"name\": \"is_waiting_for_backup\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"backup_to_restore\": {\n          \"name\": \"backup_to_restore\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"agent_id\": {\n          \"name\": \"agent_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"project_id\": {\n          \"name\": \"project_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"databases_agent_id_agents_id_fk\": {\n          \"name\": \"databases_agent_id_agents_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"agents\",\n          \"columnsFrom\": [\n            \"agent_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"databases_project_id_projects_id_fk\": {\n          \"name\": \"databases_project_id_projects_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"projects\",\n          \"columnsFrom\": [\n            \"project_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"no action\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.restorations\": {\n      \"name\": \"restorations\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"restorations_backup_id_backups_id_fk\": {\n          \"name\": \"restorations_backup_id_backups_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_database_id_databases_id_fk\": {\n          \"name\": \"restorations_database_id_databases_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.retention_policies\": {\n      \"name\": \"retention_policies\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"type\": {\n          \"name\": \"type\",\n          \"type\": \"retention_policy_type\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"count\": {\n          \"name\": \"count\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"days\": {\n          \"name\": \"days\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 30\n        },\n        \"gfs_daily\": {\n          \"name\": \"gfs_daily\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"gfs_weekly\": {\n          \"name\": \"gfs_weekly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 4\n        },\n        \"gfs_monthly\": {\n          \"name\": \"gfs_monthly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 12\n        },\n        \"gfs_yearly\": {\n          \"name\": \"gfs_yearly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 3\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"retention_policies_database_id_databases_id_fk\": {\n          \"name\": \"retention_policies_database_id_databases_id_fk\",\n          \"tableFrom\": \"retention_policies\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.agents\": {\n      \"name\": \"agents\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"version\": {\n          \"name\": \"version\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"agents_slug_unique\": {\n          \"name\": \"agents_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_channel\": {\n      \"name\": \"notification_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_notification_channels\": {\n      \"name\": \"organization_notification_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_notification_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_notification_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_notification_channels_organization_id_notification_channel_id_unique\": {\n          \"name\": \"organization_notification_channels_organization_id_notification_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"notification_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.alert_policy\": {\n      \"name\": \"alert_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"event_kind\": {\n          \"name\": \"event_kind\",\n          \"type\": \"event_kind[]\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"alert_policy_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"alert_policy_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"alert_policy_database_id_databases_id_fk\": {\n          \"name\": \"alert_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_log\": {\n      \"name\": \"notification_log\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"channel_id\": {\n          \"name\": \"channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"policy_id\": {\n          \"name\": \"policy_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"event\": {\n          \"name\": \"event\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_name\": {\n          \"name\": \"provider_name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"title\": {\n          \"name\": \"title\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"message\": {\n          \"name\": \"message\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"level\": {\n          \"name\": \"level\",\n          \"type\": \"level\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"payload\": {\n          \"name\": \"payload\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"success\": {\n          \"name\": \"success\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"error\": {\n          \"name\": \"error\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider_response\": {\n          \"name\": \"provider_response\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"sent_at\": {\n          \"name\": \"sent_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    }\n  },\n  \"enums\": {\n    \"public.retention_policy_type\": {\n      \"name\": \"retention_policy_type\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"count\",\n        \"days\",\n        \"gfs\"\n      ]\n    },\n    \"public.provider_kind\": {\n      \"name\": \"provider_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"slack\",\n        \"smtp\"\n      ]\n    },\n    \"public.event_kind\": {\n      \"name\": \"event_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"error_backup\",\n        \"error_restore\",\n        \"success_restore\",\n        \"success_backup\",\n        \"weekly_report\"\n      ]\n    },\n    \"public.level\": {\n      \"name\": \"level\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"critical\",\n        \"warning\",\n        \"info\"\n      ]\n    },\n    \"public.dbms_status\": {\n      \"name\": \"dbms_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"postgresql\",\n        \"mysql\"\n      ]\n    },\n    \"public.status\": {\n      \"name\": \"status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"waiting\",\n        \"ongoing\",\n        \"failed\",\n        \"success\"\n      ]\n    },\n    \"public.type_storage\": {\n      \"name\": \"type_storage\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\"\n      ]\n    }\n  },\n  \"schemas\": {},\n  \"sequences\": {},\n  \"roles\": {},\n  \"policies\": {},\n  \"views\": {},\n  \"_meta\": {\n    \"columns\": {},\n    \"schemas\": {},\n    \"tables\": {}\n  }\n}"
  },
  {
    "path": "src/db/migrations/meta/0014_snapshot.json",
    "content": "{\n  \"id\": \"e98067be-d80b-415e-81bb-a9af5fe4ae09\",\n  \"prevId\": \"111a7060-826c-4df7-bc2a-320b6e477ac1\",\n  \"version\": \"7\",\n  \"dialect\": \"postgresql\",\n  \"tables\": {\n    \"public.settings\": {\n      \"name\": \"settings\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"storage\": {\n          \"name\": \"storage\",\n          \"type\": \"type_storage\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'local'\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"s3_endpoint_url\": {\n          \"name\": \"s3_endpoint_url\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_access_key_id\": {\n          \"name\": \"s3_access_key_id\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_secret_access_key\": {\n          \"name\": \"s3_secret_access_key\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_bucket_name\": {\n          \"name\": \"s3_bucket_name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_password\": {\n          \"name\": \"smtp_password\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_from\": {\n          \"name\": \"smtp_from\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_host\": {\n          \"name\": \"smtp_host\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_port\": {\n          \"name\": \"smtp_port\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_user\": {\n          \"name\": \"smtp_user\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"settings_name_unique\": {\n          \"name\": \"settings_name_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"name\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.account\": {\n      \"name\": \"account\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"account_id\": {\n          \"name\": \"account_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"access_token\": {\n          \"name\": \"access_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token\": {\n          \"name\": \"refresh_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"id_token\": {\n          \"name\": \"id_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"access_token_expires_at\": {\n          \"name\": \"access_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token_expires_at\": {\n          \"name\": \"refresh_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"scope\": {\n          \"name\": \"scope\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"password\": {\n          \"name\": \"password\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"account_user_id_user_id_fk\": {\n          \"name\": \"account_user_id_user_id_fk\",\n          \"tableFrom\": \"account\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.passkey\": {\n      \"name\": \"passkey\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"publicKey\": {\n          \"name\": \"publicKey\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"userId\": {\n          \"name\": \"userId\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"credentialId\": {\n          \"name\": \"credentialId\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"counter\": {\n          \"name\": \"counter\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"deviceType\": {\n          \"name\": \"deviceType\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backedUp\": {\n          \"name\": \"backedUp\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"transports\": {\n          \"name\": \"transports\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"passkey_userId_user_id_fk\": {\n          \"name\": \"passkey_userId_user_id_fk\",\n          \"tableFrom\": \"passkey\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"userId\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.session\": {\n      \"name\": \"session\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"token\": {\n          \"name\": \"token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"ip_address\": {\n          \"name\": \"ip_address\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_agent\": {\n          \"name\": \"user_agent\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"impersonated_by\": {\n          \"name\": \"impersonated_by\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"active_organization_id\": {\n          \"name\": \"active_organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"session_user_id_user_id_fk\": {\n          \"name\": \"session_user_id_user_id_fk\",\n          \"tableFrom\": \"session\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"session_token_unique\": {\n          \"name\": \"session_token_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"token\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.two_factor\": {\n      \"name\": \"two_factor\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"secret\": {\n          \"name\": \"secret\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backup_codes\": {\n          \"name\": \"backup_codes\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"two_factor_user_id_user_id_fk\": {\n          \"name\": \"two_factor_user_id_user_id_fk\",\n          \"tableFrom\": \"two_factor\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.user\": {\n      \"name\": \"user\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email_verified\": {\n          \"name\": \"email_verified\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"image\": {\n          \"name\": \"image\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"banned\": {\n          \"name\": \"banned\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_reason\": {\n          \"name\": \"ban_reason\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_expires\": {\n          \"name\": \"ban_expires\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"lastChangedPasswordAt\": {\n          \"name\": \"lastChangedPasswordAt\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"two_factor_enabled\": {\n          \"name\": \"two_factor_enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"user_email_unique\": {\n          \"name\": \"user_email_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"email\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.verification\": {\n      \"name\": \"verification\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"identifier\": {\n          \"name\": \"identifier\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"value\": {\n          \"name\": \"value\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization\": {\n      \"name\": \"organization\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"logo\": {\n          \"name\": \"logo\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"metadata\": {\n          \"name\": \"metadata\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_slug_unique\": {\n          \"name\": \"organization_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.member\": {\n      \"name\": \"member\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"member_organization_id_organization_id_fk\": {\n          \"name\": \"member_organization_id_organization_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"member_user_id_user_id_fk\": {\n          \"name\": \"member_user_id_user_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.invitation\": {\n      \"name\": \"invitation\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"inviter_id\": {\n          \"name\": \"inviter_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"invitation_organization_id_organization_id_fk\": {\n          \"name\": \"invitation_organization_id_organization_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"invitation_inviter_id_user_id_fk\": {\n          \"name\": \"invitation_inviter_id_user_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"inviter_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.projects\": {\n      \"name\": \"projects\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"projects_organization_id_organization_id_fk\": {\n          \"name\": \"projects_organization_id_organization_id_fk\",\n          \"tableFrom\": \"projects\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"projects_slug_unique\": {\n          \"name\": \"projects_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backups\": {\n      \"name\": \"backups\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"file\": {\n          \"name\": \"file\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backups_database_id_databases_id_fk\": {\n          \"name\": \"backups_database_id_databases_id_fk\",\n          \"tableFrom\": \"backups\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.databases\": {\n      \"name\": \"databases\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"agent_database_id\": {\n          \"name\": \"agent_database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"dbms\": {\n          \"name\": \"dbms\",\n          \"type\": \"dbms_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_policy\": {\n          \"name\": \"backup_policy\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"is_waiting_for_backup\": {\n          \"name\": \"is_waiting_for_backup\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"backup_to_restore\": {\n          \"name\": \"backup_to_restore\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"agent_id\": {\n          \"name\": \"agent_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"project_id\": {\n          \"name\": \"project_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"databases_agent_id_agents_id_fk\": {\n          \"name\": \"databases_agent_id_agents_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"agents\",\n          \"columnsFrom\": [\n            \"agent_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"databases_project_id_projects_id_fk\": {\n          \"name\": \"databases_project_id_projects_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"projects\",\n          \"columnsFrom\": [\n            \"project_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"no action\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.restorations\": {\n      \"name\": \"restorations\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"restorations_backup_id_backups_id_fk\": {\n          \"name\": \"restorations_backup_id_backups_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_database_id_databases_id_fk\": {\n          \"name\": \"restorations_database_id_databases_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.retention_policies\": {\n      \"name\": \"retention_policies\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"type\": {\n          \"name\": \"type\",\n          \"type\": \"retention_policy_type\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"count\": {\n          \"name\": \"count\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"days\": {\n          \"name\": \"days\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 30\n        },\n        \"gfs_daily\": {\n          \"name\": \"gfs_daily\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"gfs_weekly\": {\n          \"name\": \"gfs_weekly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 4\n        },\n        \"gfs_monthly\": {\n          \"name\": \"gfs_monthly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 12\n        },\n        \"gfs_yearly\": {\n          \"name\": \"gfs_yearly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 3\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"retention_policies_database_id_databases_id_fk\": {\n          \"name\": \"retention_policies_database_id_databases_id_fk\",\n          \"tableFrom\": \"retention_policies\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.agents\": {\n      \"name\": \"agents\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"version\": {\n          \"name\": \"version\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"agents_slug_unique\": {\n          \"name\": \"agents_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_channel\": {\n      \"name\": \"notification_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_notification_channels\": {\n      \"name\": \"organization_notification_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_notification_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_notification_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_notification_channels_organization_id_notification_channel_id_unique\": {\n          \"name\": \"organization_notification_channels_organization_id_notification_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"notification_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.alert_policy\": {\n      \"name\": \"alert_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"event_kind\": {\n          \"name\": \"event_kind\",\n          \"type\": \"event_kind[]\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"alert_policy_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"alert_policy_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"alert_policy_database_id_databases_id_fk\": {\n          \"name\": \"alert_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_log\": {\n      \"name\": \"notification_log\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"channel_id\": {\n          \"name\": \"channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"policy_id\": {\n          \"name\": \"policy_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"event\": {\n          \"name\": \"event\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_name\": {\n          \"name\": \"provider_name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"title\": {\n          \"name\": \"title\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"message\": {\n          \"name\": \"message\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"level\": {\n          \"name\": \"level\",\n          \"type\": \"level\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"payload\": {\n          \"name\": \"payload\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"success\": {\n          \"name\": \"success\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"error\": {\n          \"name\": \"error\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider_response\": {\n          \"name\": \"provider_response\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"sent_at\": {\n          \"name\": \"sent_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    }\n  },\n  \"enums\": {\n    \"public.retention_policy_type\": {\n      \"name\": \"retention_policy_type\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"count\",\n        \"days\",\n        \"gfs\"\n      ]\n    },\n    \"public.provider_kind\": {\n      \"name\": \"provider_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"slack\",\n        \"smtp\"\n      ]\n    },\n    \"public.event_kind\": {\n      \"name\": \"event_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"error_backup\",\n        \"error_restore\",\n        \"success_restore\",\n        \"success_backup\",\n        \"weekly_report\"\n      ]\n    },\n    \"public.level\": {\n      \"name\": \"level\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"critical\",\n        \"warning\",\n        \"info\"\n      ]\n    },\n    \"public.dbms_status\": {\n      \"name\": \"dbms_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"postgresql\",\n        \"mysql\"\n      ]\n    },\n    \"public.status\": {\n      \"name\": \"status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"waiting\",\n        \"ongoing\",\n        \"failed\",\n        \"success\"\n      ]\n    },\n    \"public.type_storage\": {\n      \"name\": \"type_storage\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\"\n      ]\n    }\n  },\n  \"schemas\": {},\n  \"sequences\": {},\n  \"roles\": {},\n  \"policies\": {},\n  \"views\": {},\n  \"_meta\": {\n    \"columns\": {},\n    \"schemas\": {},\n    \"tables\": {}\n  }\n}"
  },
  {
    "path": "src/db/migrations/meta/0015_snapshot.json",
    "content": "{\n  \"id\": \"b2cdb1ae-2dc0-4b40-a31c-865ec71db5cf\",\n  \"prevId\": \"e98067be-d80b-415e-81bb-a9af5fe4ae09\",\n  \"version\": \"7\",\n  \"dialect\": \"postgresql\",\n  \"tables\": {\n    \"public.settings\": {\n      \"name\": \"settings\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"storage\": {\n          \"name\": \"storage\",\n          \"type\": \"type_storage\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'local'\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"s3_endpoint_url\": {\n          \"name\": \"s3_endpoint_url\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_access_key_id\": {\n          \"name\": \"s3_access_key_id\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_secret_access_key\": {\n          \"name\": \"s3_secret_access_key\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_bucket_name\": {\n          \"name\": \"s3_bucket_name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_password\": {\n          \"name\": \"smtp_password\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_from\": {\n          \"name\": \"smtp_from\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_host\": {\n          \"name\": \"smtp_host\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_port\": {\n          \"name\": \"smtp_port\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_user\": {\n          \"name\": \"smtp_user\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"settings_name_unique\": {\n          \"name\": \"settings_name_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"name\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.account\": {\n      \"name\": \"account\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"account_id\": {\n          \"name\": \"account_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"access_token\": {\n          \"name\": \"access_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token\": {\n          \"name\": \"refresh_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"id_token\": {\n          \"name\": \"id_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"access_token_expires_at\": {\n          \"name\": \"access_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token_expires_at\": {\n          \"name\": \"refresh_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"scope\": {\n          \"name\": \"scope\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"password\": {\n          \"name\": \"password\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"account_user_id_user_id_fk\": {\n          \"name\": \"account_user_id_user_id_fk\",\n          \"tableFrom\": \"account\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.passkey\": {\n      \"name\": \"passkey\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"publicKey\": {\n          \"name\": \"publicKey\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"userId\": {\n          \"name\": \"userId\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"credentialId\": {\n          \"name\": \"credentialId\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"counter\": {\n          \"name\": \"counter\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"deviceType\": {\n          \"name\": \"deviceType\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backedUp\": {\n          \"name\": \"backedUp\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"transports\": {\n          \"name\": \"transports\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"passkey_userId_user_id_fk\": {\n          \"name\": \"passkey_userId_user_id_fk\",\n          \"tableFrom\": \"passkey\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"userId\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.session\": {\n      \"name\": \"session\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"token\": {\n          \"name\": \"token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"ip_address\": {\n          \"name\": \"ip_address\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_agent\": {\n          \"name\": \"user_agent\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"impersonated_by\": {\n          \"name\": \"impersonated_by\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"active_organization_id\": {\n          \"name\": \"active_organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"session_user_id_user_id_fk\": {\n          \"name\": \"session_user_id_user_id_fk\",\n          \"tableFrom\": \"session\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"session_token_unique\": {\n          \"name\": \"session_token_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"token\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.two_factor\": {\n      \"name\": \"two_factor\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"secret\": {\n          \"name\": \"secret\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backup_codes\": {\n          \"name\": \"backup_codes\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"two_factor_user_id_user_id_fk\": {\n          \"name\": \"two_factor_user_id_user_id_fk\",\n          \"tableFrom\": \"two_factor\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.user\": {\n      \"name\": \"user\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email_verified\": {\n          \"name\": \"email_verified\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"image\": {\n          \"name\": \"image\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"theme\": {\n          \"name\": \"theme\",\n          \"type\": \"user_themes\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'light'\"\n        },\n        \"banned\": {\n          \"name\": \"banned\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_reason\": {\n          \"name\": \"ban_reason\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_expires\": {\n          \"name\": \"ban_expires\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"lastChangedPasswordAt\": {\n          \"name\": \"lastChangedPasswordAt\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"two_factor_enabled\": {\n          \"name\": \"two_factor_enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"user_email_unique\": {\n          \"name\": \"user_email_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"email\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.verification\": {\n      \"name\": \"verification\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"identifier\": {\n          \"name\": \"identifier\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"value\": {\n          \"name\": \"value\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization\": {\n      \"name\": \"organization\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"logo\": {\n          \"name\": \"logo\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"metadata\": {\n          \"name\": \"metadata\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_slug_unique\": {\n          \"name\": \"organization_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.member\": {\n      \"name\": \"member\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"member_organization_id_organization_id_fk\": {\n          \"name\": \"member_organization_id_organization_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"member_user_id_user_id_fk\": {\n          \"name\": \"member_user_id_user_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.invitation\": {\n      \"name\": \"invitation\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"inviter_id\": {\n          \"name\": \"inviter_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"invitation_organization_id_organization_id_fk\": {\n          \"name\": \"invitation_organization_id_organization_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"invitation_inviter_id_user_id_fk\": {\n          \"name\": \"invitation_inviter_id_user_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"inviter_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.projects\": {\n      \"name\": \"projects\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"projects_organization_id_organization_id_fk\": {\n          \"name\": \"projects_organization_id_organization_id_fk\",\n          \"tableFrom\": \"projects\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"projects_slug_unique\": {\n          \"name\": \"projects_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backups\": {\n      \"name\": \"backups\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"file\": {\n          \"name\": \"file\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backups_database_id_databases_id_fk\": {\n          \"name\": \"backups_database_id_databases_id_fk\",\n          \"tableFrom\": \"backups\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.databases\": {\n      \"name\": \"databases\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"agent_database_id\": {\n          \"name\": \"agent_database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"dbms\": {\n          \"name\": \"dbms\",\n          \"type\": \"dbms_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_policy\": {\n          \"name\": \"backup_policy\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"is_waiting_for_backup\": {\n          \"name\": \"is_waiting_for_backup\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"backup_to_restore\": {\n          \"name\": \"backup_to_restore\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"agent_id\": {\n          \"name\": \"agent_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"project_id\": {\n          \"name\": \"project_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"databases_agent_id_agents_id_fk\": {\n          \"name\": \"databases_agent_id_agents_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"agents\",\n          \"columnsFrom\": [\n            \"agent_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"databases_project_id_projects_id_fk\": {\n          \"name\": \"databases_project_id_projects_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"projects\",\n          \"columnsFrom\": [\n            \"project_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"no action\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.restorations\": {\n      \"name\": \"restorations\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"restorations_backup_id_backups_id_fk\": {\n          \"name\": \"restorations_backup_id_backups_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_database_id_databases_id_fk\": {\n          \"name\": \"restorations_database_id_databases_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.retention_policies\": {\n      \"name\": \"retention_policies\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"type\": {\n          \"name\": \"type\",\n          \"type\": \"retention_policy_type\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"count\": {\n          \"name\": \"count\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"days\": {\n          \"name\": \"days\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 30\n        },\n        \"gfs_daily\": {\n          \"name\": \"gfs_daily\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"gfs_weekly\": {\n          \"name\": \"gfs_weekly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 4\n        },\n        \"gfs_monthly\": {\n          \"name\": \"gfs_monthly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 12\n        },\n        \"gfs_yearly\": {\n          \"name\": \"gfs_yearly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 3\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"retention_policies_database_id_databases_id_fk\": {\n          \"name\": \"retention_policies_database_id_databases_id_fk\",\n          \"tableFrom\": \"retention_policies\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.agents\": {\n      \"name\": \"agents\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"version\": {\n          \"name\": \"version\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"agents_slug_unique\": {\n          \"name\": \"agents_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_channel\": {\n      \"name\": \"notification_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_notification_channels\": {\n      \"name\": \"organization_notification_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_notification_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_notification_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_notification_channels_organization_id_notification_channel_id_unique\": {\n          \"name\": \"organization_notification_channels_organization_id_notification_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"notification_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.alert_policy\": {\n      \"name\": \"alert_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"event_kind\": {\n          \"name\": \"event_kind\",\n          \"type\": \"event_kind[]\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"alert_policy_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"alert_policy_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"alert_policy_database_id_databases_id_fk\": {\n          \"name\": \"alert_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_log\": {\n      \"name\": \"notification_log\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"channel_id\": {\n          \"name\": \"channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"policy_id\": {\n          \"name\": \"policy_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"event\": {\n          \"name\": \"event\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_name\": {\n          \"name\": \"provider_name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"title\": {\n          \"name\": \"title\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"message\": {\n          \"name\": \"message\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"level\": {\n          \"name\": \"level\",\n          \"type\": \"level\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"payload\": {\n          \"name\": \"payload\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"success\": {\n          \"name\": \"success\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"error\": {\n          \"name\": \"error\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider_response\": {\n          \"name\": \"provider_response\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"sent_at\": {\n          \"name\": \"sent_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    }\n  },\n  \"enums\": {\n    \"public.user_themes\": {\n      \"name\": \"user_themes\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"light\",\n        \"dark\",\n        \"system\"\n      ]\n    },\n    \"public.retention_policy_type\": {\n      \"name\": \"retention_policy_type\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"count\",\n        \"days\",\n        \"gfs\"\n      ]\n    },\n    \"public.provider_kind\": {\n      \"name\": \"provider_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"slack\",\n        \"smtp\"\n      ]\n    },\n    \"public.event_kind\": {\n      \"name\": \"event_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"error_backup\",\n        \"error_restore\",\n        \"success_restore\",\n        \"success_backup\",\n        \"weekly_report\"\n      ]\n    },\n    \"public.level\": {\n      \"name\": \"level\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"critical\",\n        \"warning\",\n        \"info\"\n      ]\n    },\n    \"public.dbms_status\": {\n      \"name\": \"dbms_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"postgresql\",\n        \"mysql\"\n      ]\n    },\n    \"public.status\": {\n      \"name\": \"status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"waiting\",\n        \"ongoing\",\n        \"failed\",\n        \"success\"\n      ]\n    },\n    \"public.type_storage\": {\n      \"name\": \"type_storage\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\"\n      ]\n    }\n  },\n  \"schemas\": {},\n  \"sequences\": {},\n  \"roles\": {},\n  \"policies\": {},\n  \"views\": {},\n  \"_meta\": {\n    \"columns\": {},\n    \"schemas\": {},\n    \"tables\": {}\n  }\n}"
  },
  {
    "path": "src/db/migrations/meta/0016_snapshot.json",
    "content": "{\n  \"id\": \"58db92ea-a576-4567-a949-e8bc695af368\",\n  \"prevId\": \"b2cdb1ae-2dc0-4b40-a31c-865ec71db5cf\",\n  \"version\": \"7\",\n  \"dialect\": \"postgresql\",\n  \"tables\": {\n    \"public.settings\": {\n      \"name\": \"settings\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"storage\": {\n          \"name\": \"storage\",\n          \"type\": \"type_storage\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'local'\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"s3_endpoint_url\": {\n          \"name\": \"s3_endpoint_url\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_access_key_id\": {\n          \"name\": \"s3_access_key_id\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_secret_access_key\": {\n          \"name\": \"s3_secret_access_key\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_bucket_name\": {\n          \"name\": \"s3_bucket_name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_password\": {\n          \"name\": \"smtp_password\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_from\": {\n          \"name\": \"smtp_from\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_host\": {\n          \"name\": \"smtp_host\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_port\": {\n          \"name\": \"smtp_port\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_user\": {\n          \"name\": \"smtp_user\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"settings_name_unique\": {\n          \"name\": \"settings_name_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"name\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.account\": {\n      \"name\": \"account\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"account_id\": {\n          \"name\": \"account_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"access_token\": {\n          \"name\": \"access_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token\": {\n          \"name\": \"refresh_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"id_token\": {\n          \"name\": \"id_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"access_token_expires_at\": {\n          \"name\": \"access_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token_expires_at\": {\n          \"name\": \"refresh_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"scope\": {\n          \"name\": \"scope\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"password\": {\n          \"name\": \"password\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"account_user_id_user_id_fk\": {\n          \"name\": \"account_user_id_user_id_fk\",\n          \"tableFrom\": \"account\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.passkey\": {\n      \"name\": \"passkey\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"publicKey\": {\n          \"name\": \"publicKey\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"userId\": {\n          \"name\": \"userId\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"credentialId\": {\n          \"name\": \"credentialId\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"counter\": {\n          \"name\": \"counter\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"deviceType\": {\n          \"name\": \"deviceType\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backedUp\": {\n          \"name\": \"backedUp\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"transports\": {\n          \"name\": \"transports\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"passkey_userId_user_id_fk\": {\n          \"name\": \"passkey_userId_user_id_fk\",\n          \"tableFrom\": \"passkey\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"userId\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.session\": {\n      \"name\": \"session\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"token\": {\n          \"name\": \"token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"ip_address\": {\n          \"name\": \"ip_address\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_agent\": {\n          \"name\": \"user_agent\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"impersonated_by\": {\n          \"name\": \"impersonated_by\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"active_organization_id\": {\n          \"name\": \"active_organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"session_user_id_user_id_fk\": {\n          \"name\": \"session_user_id_user_id_fk\",\n          \"tableFrom\": \"session\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"session_token_unique\": {\n          \"name\": \"session_token_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"token\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.two_factor\": {\n      \"name\": \"two_factor\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"secret\": {\n          \"name\": \"secret\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backup_codes\": {\n          \"name\": \"backup_codes\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"two_factor_user_id_user_id_fk\": {\n          \"name\": \"two_factor_user_id_user_id_fk\",\n          \"tableFrom\": \"two_factor\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.user\": {\n      \"name\": \"user\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email_verified\": {\n          \"name\": \"email_verified\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"image\": {\n          \"name\": \"image\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"theme\": {\n          \"name\": \"theme\",\n          \"type\": \"user_themes\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'light'\"\n        },\n        \"banned\": {\n          \"name\": \"banned\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_reason\": {\n          \"name\": \"ban_reason\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_expires\": {\n          \"name\": \"ban_expires\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"lastChangedPasswordAt\": {\n          \"name\": \"lastChangedPasswordAt\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"two_factor_enabled\": {\n          \"name\": \"two_factor_enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"user_email_unique\": {\n          \"name\": \"user_email_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"email\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.verification\": {\n      \"name\": \"verification\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"identifier\": {\n          \"name\": \"identifier\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"value\": {\n          \"name\": \"value\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization\": {\n      \"name\": \"organization\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"logo\": {\n          \"name\": \"logo\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"metadata\": {\n          \"name\": \"metadata\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_slug_unique\": {\n          \"name\": \"organization_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.member\": {\n      \"name\": \"member\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"member_organization_id_organization_id_fk\": {\n          \"name\": \"member_organization_id_organization_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"member_user_id_user_id_fk\": {\n          \"name\": \"member_user_id_user_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.invitation\": {\n      \"name\": \"invitation\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"inviter_id\": {\n          \"name\": \"inviter_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"invitation_organization_id_organization_id_fk\": {\n          \"name\": \"invitation_organization_id_organization_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"invitation_inviter_id_user_id_fk\": {\n          \"name\": \"invitation_inviter_id_user_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"inviter_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.projects\": {\n      \"name\": \"projects\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"projects_organization_id_organization_id_fk\": {\n          \"name\": \"projects_organization_id_organization_id_fk\",\n          \"tableFrom\": \"projects\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"projects_slug_unique\": {\n          \"name\": \"projects_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backups\": {\n      \"name\": \"backups\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"file\": {\n          \"name\": \"file\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"file_size\": {\n          \"name\": \"file_size\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backups_database_id_databases_id_fk\": {\n          \"name\": \"backups_database_id_databases_id_fk\",\n          \"tableFrom\": \"backups\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.databases\": {\n      \"name\": \"databases\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"agent_database_id\": {\n          \"name\": \"agent_database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"dbms\": {\n          \"name\": \"dbms\",\n          \"type\": \"dbms_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_policy\": {\n          \"name\": \"backup_policy\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"is_waiting_for_backup\": {\n          \"name\": \"is_waiting_for_backup\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"backup_to_restore\": {\n          \"name\": \"backup_to_restore\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"agent_id\": {\n          \"name\": \"agent_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"project_id\": {\n          \"name\": \"project_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"databases_agent_id_agents_id_fk\": {\n          \"name\": \"databases_agent_id_agents_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"agents\",\n          \"columnsFrom\": [\n            \"agent_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"databases_project_id_projects_id_fk\": {\n          \"name\": \"databases_project_id_projects_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"projects\",\n          \"columnsFrom\": [\n            \"project_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"no action\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.restorations\": {\n      \"name\": \"restorations\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"restorations_backup_id_backups_id_fk\": {\n          \"name\": \"restorations_backup_id_backups_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_database_id_databases_id_fk\": {\n          \"name\": \"restorations_database_id_databases_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.retention_policies\": {\n      \"name\": \"retention_policies\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"type\": {\n          \"name\": \"type\",\n          \"type\": \"retention_policy_type\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"count\": {\n          \"name\": \"count\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"days\": {\n          \"name\": \"days\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 30\n        },\n        \"gfs_daily\": {\n          \"name\": \"gfs_daily\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"gfs_weekly\": {\n          \"name\": \"gfs_weekly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 4\n        },\n        \"gfs_monthly\": {\n          \"name\": \"gfs_monthly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 12\n        },\n        \"gfs_yearly\": {\n          \"name\": \"gfs_yearly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 3\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"retention_policies_database_id_databases_id_fk\": {\n          \"name\": \"retention_policies_database_id_databases_id_fk\",\n          \"tableFrom\": \"retention_policies\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.agents\": {\n      \"name\": \"agents\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"version\": {\n          \"name\": \"version\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"agents_slug_unique\": {\n          \"name\": \"agents_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_channel\": {\n      \"name\": \"notification_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_notification_channels\": {\n      \"name\": \"organization_notification_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_notification_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_notification_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_notification_channels_organization_id_notification_channel_id_unique\": {\n          \"name\": \"organization_notification_channels_organization_id_notification_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"notification_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.alert_policy\": {\n      \"name\": \"alert_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"event_kind\": {\n          \"name\": \"event_kind\",\n          \"type\": \"event_kind[]\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"alert_policy_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"alert_policy_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"alert_policy_database_id_databases_id_fk\": {\n          \"name\": \"alert_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_log\": {\n      \"name\": \"notification_log\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"channel_id\": {\n          \"name\": \"channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"policy_id\": {\n          \"name\": \"policy_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"event\": {\n          \"name\": \"event\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_name\": {\n          \"name\": \"provider_name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"title\": {\n          \"name\": \"title\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"message\": {\n          \"name\": \"message\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"level\": {\n          \"name\": \"level\",\n          \"type\": \"level\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"payload\": {\n          \"name\": \"payload\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"success\": {\n          \"name\": \"success\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"error\": {\n          \"name\": \"error\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider_response\": {\n          \"name\": \"provider_response\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"sent_at\": {\n          \"name\": \"sent_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    }\n  },\n  \"enums\": {\n    \"public.user_themes\": {\n      \"name\": \"user_themes\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"light\",\n        \"dark\",\n        \"system\"\n      ]\n    },\n    \"public.retention_policy_type\": {\n      \"name\": \"retention_policy_type\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"count\",\n        \"days\",\n        \"gfs\"\n      ]\n    },\n    \"public.provider_kind\": {\n      \"name\": \"provider_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"slack\",\n        \"smtp\"\n      ]\n    },\n    \"public.event_kind\": {\n      \"name\": \"event_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"error_backup\",\n        \"error_restore\",\n        \"success_restore\",\n        \"success_backup\",\n        \"weekly_report\"\n      ]\n    },\n    \"public.level\": {\n      \"name\": \"level\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"critical\",\n        \"warning\",\n        \"info\"\n      ]\n    },\n    \"public.dbms_status\": {\n      \"name\": \"dbms_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"postgresql\",\n        \"mysql\"\n      ]\n    },\n    \"public.status\": {\n      \"name\": \"status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"waiting\",\n        \"ongoing\",\n        \"failed\",\n        \"success\"\n      ]\n    },\n    \"public.type_storage\": {\n      \"name\": \"type_storage\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\"\n      ]\n    }\n  },\n  \"schemas\": {},\n  \"sequences\": {},\n  \"roles\": {},\n  \"policies\": {},\n  \"views\": {},\n  \"_meta\": {\n    \"columns\": {},\n    \"schemas\": {},\n    \"tables\": {}\n  }\n}"
  },
  {
    "path": "src/db/migrations/meta/0017_snapshot.json",
    "content": "{\n  \"id\": \"dedd1331-415d-4193-9ea2-3c0486fee2ca\",\n  \"prevId\": \"58db92ea-a576-4567-a949-e8bc695af368\",\n  \"version\": \"7\",\n  \"dialect\": \"postgresql\",\n  \"tables\": {\n    \"public.settings\": {\n      \"name\": \"settings\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"storage\": {\n          \"name\": \"storage\",\n          \"type\": \"type_storage\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'local'\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"s3_endpoint_url\": {\n          \"name\": \"s3_endpoint_url\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_access_key_id\": {\n          \"name\": \"s3_access_key_id\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_secret_access_key\": {\n          \"name\": \"s3_secret_access_key\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_bucket_name\": {\n          \"name\": \"s3_bucket_name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_password\": {\n          \"name\": \"smtp_password\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_from\": {\n          \"name\": \"smtp_from\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_host\": {\n          \"name\": \"smtp_host\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_port\": {\n          \"name\": \"smtp_port\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_user\": {\n          \"name\": \"smtp_user\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"settings_name_unique\": {\n          \"name\": \"settings_name_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"name\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.account\": {\n      \"name\": \"account\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"account_id\": {\n          \"name\": \"account_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"access_token\": {\n          \"name\": \"access_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token\": {\n          \"name\": \"refresh_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"id_token\": {\n          \"name\": \"id_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"access_token_expires_at\": {\n          \"name\": \"access_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token_expires_at\": {\n          \"name\": \"refresh_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"scope\": {\n          \"name\": \"scope\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"password\": {\n          \"name\": \"password\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"account_user_id_user_id_fk\": {\n          \"name\": \"account_user_id_user_id_fk\",\n          \"tableFrom\": \"account\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.passkey\": {\n      \"name\": \"passkey\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"publicKey\": {\n          \"name\": \"publicKey\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"userId\": {\n          \"name\": \"userId\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"credentialId\": {\n          \"name\": \"credentialId\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"counter\": {\n          \"name\": \"counter\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"deviceType\": {\n          \"name\": \"deviceType\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backedUp\": {\n          \"name\": \"backedUp\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"transports\": {\n          \"name\": \"transports\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"passkey_userId_user_id_fk\": {\n          \"name\": \"passkey_userId_user_id_fk\",\n          \"tableFrom\": \"passkey\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"userId\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.session\": {\n      \"name\": \"session\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"token\": {\n          \"name\": \"token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"ip_address\": {\n          \"name\": \"ip_address\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_agent\": {\n          \"name\": \"user_agent\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"impersonated_by\": {\n          \"name\": \"impersonated_by\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"active_organization_id\": {\n          \"name\": \"active_organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"session_user_id_user_id_fk\": {\n          \"name\": \"session_user_id_user_id_fk\",\n          \"tableFrom\": \"session\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"session_token_unique\": {\n          \"name\": \"session_token_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"token\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.two_factor\": {\n      \"name\": \"two_factor\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"secret\": {\n          \"name\": \"secret\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backup_codes\": {\n          \"name\": \"backup_codes\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"two_factor_user_id_user_id_fk\": {\n          \"name\": \"two_factor_user_id_user_id_fk\",\n          \"tableFrom\": \"two_factor\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.user\": {\n      \"name\": \"user\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email_verified\": {\n          \"name\": \"email_verified\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"image\": {\n          \"name\": \"image\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"theme\": {\n          \"name\": \"theme\",\n          \"type\": \"user_themes\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'light'\"\n        },\n        \"banned\": {\n          \"name\": \"banned\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_reason\": {\n          \"name\": \"ban_reason\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_expires\": {\n          \"name\": \"ban_expires\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"lastChangedPasswordAt\": {\n          \"name\": \"lastChangedPasswordAt\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"two_factor_enabled\": {\n          \"name\": \"two_factor_enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"user_email_unique\": {\n          \"name\": \"user_email_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"email\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.verification\": {\n      \"name\": \"verification\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"identifier\": {\n          \"name\": \"identifier\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"value\": {\n          \"name\": \"value\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization\": {\n      \"name\": \"organization\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"logo\": {\n          \"name\": \"logo\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"metadata\": {\n          \"name\": \"metadata\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_slug_unique\": {\n          \"name\": \"organization_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.member\": {\n      \"name\": \"member\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"member_organization_id_organization_id_fk\": {\n          \"name\": \"member_organization_id_organization_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"member_user_id_user_id_fk\": {\n          \"name\": \"member_user_id_user_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.invitation\": {\n      \"name\": \"invitation\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"inviter_id\": {\n          \"name\": \"inviter_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"invitation_organization_id_organization_id_fk\": {\n          \"name\": \"invitation_organization_id_organization_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"invitation_inviter_id_user_id_fk\": {\n          \"name\": \"invitation_inviter_id_user_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"inviter_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.projects\": {\n      \"name\": \"projects\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"projects_organization_id_organization_id_fk\": {\n          \"name\": \"projects_organization_id_organization_id_fk\",\n          \"tableFrom\": \"projects\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"projects_slug_unique\": {\n          \"name\": \"projects_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backups\": {\n      \"name\": \"backups\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"file\": {\n          \"name\": \"file\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"file_size\": {\n          \"name\": \"file_size\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backups_database_id_databases_id_fk\": {\n          \"name\": \"backups_database_id_databases_id_fk\",\n          \"tableFrom\": \"backups\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.databases\": {\n      \"name\": \"databases\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"agent_database_id\": {\n          \"name\": \"agent_database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"dbms\": {\n          \"name\": \"dbms\",\n          \"type\": \"dbms_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_policy\": {\n          \"name\": \"backup_policy\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"is_waiting_for_backup\": {\n          \"name\": \"is_waiting_for_backup\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"backup_to_restore\": {\n          \"name\": \"backup_to_restore\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"agent_id\": {\n          \"name\": \"agent_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"project_id\": {\n          \"name\": \"project_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"databases_agent_id_agents_id_fk\": {\n          \"name\": \"databases_agent_id_agents_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"agents\",\n          \"columnsFrom\": [\n            \"agent_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"databases_project_id_projects_id_fk\": {\n          \"name\": \"databases_project_id_projects_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"projects\",\n          \"columnsFrom\": [\n            \"project_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"no action\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.restorations\": {\n      \"name\": \"restorations\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"restorations_backup_id_backups_id_fk\": {\n          \"name\": \"restorations_backup_id_backups_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_database_id_databases_id_fk\": {\n          \"name\": \"restorations_database_id_databases_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.retention_policies\": {\n      \"name\": \"retention_policies\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"type\": {\n          \"name\": \"type\",\n          \"type\": \"retention_policy_type\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"count\": {\n          \"name\": \"count\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"days\": {\n          \"name\": \"days\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 30\n        },\n        \"gfs_daily\": {\n          \"name\": \"gfs_daily\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"gfs_weekly\": {\n          \"name\": \"gfs_weekly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 4\n        },\n        \"gfs_monthly\": {\n          \"name\": \"gfs_monthly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 12\n        },\n        \"gfs_yearly\": {\n          \"name\": \"gfs_yearly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 3\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"retention_policies_database_id_databases_id_fk\": {\n          \"name\": \"retention_policies_database_id_databases_id_fk\",\n          \"tableFrom\": \"retention_policies\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.agents\": {\n      \"name\": \"agents\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"version\": {\n          \"name\": \"version\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"agents_slug_unique\": {\n          \"name\": \"agents_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_channel\": {\n      \"name\": \"notification_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_notification_channels\": {\n      \"name\": \"organization_notification_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_notification_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_notification_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_notification_channels_organization_id_notification_channel_id_unique\": {\n          \"name\": \"organization_notification_channels_organization_id_notification_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"notification_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.alert_policy\": {\n      \"name\": \"alert_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"event_kind\": {\n          \"name\": \"event_kind\",\n          \"type\": \"event_kind[]\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"alert_policy_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"alert_policy_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"alert_policy_database_id_databases_id_fk\": {\n          \"name\": \"alert_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_log\": {\n      \"name\": \"notification_log\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"channel_id\": {\n          \"name\": \"channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"policy_id\": {\n          \"name\": \"policy_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"event\": {\n          \"name\": \"event\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_name\": {\n          \"name\": \"provider_name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"title\": {\n          \"name\": \"title\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"message\": {\n          \"name\": \"message\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"level\": {\n          \"name\": \"level\",\n          \"type\": \"level\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"payload\": {\n          \"name\": \"payload\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"success\": {\n          \"name\": \"success\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"error\": {\n          \"name\": \"error\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider_response\": {\n          \"name\": \"provider_response\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"sent_at\": {\n          \"name\": \"sent_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    }\n  },\n  \"enums\": {\n    \"public.user_themes\": {\n      \"name\": \"user_themes\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"light\",\n        \"dark\",\n        \"system\"\n      ]\n    },\n    \"public.retention_policy_type\": {\n      \"name\": \"retention_policy_type\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"count\",\n        \"days\",\n        \"gfs\"\n      ]\n    },\n    \"public.provider_kind\": {\n      \"name\": \"provider_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"slack\",\n        \"smtp\",\n        \"discord\",\n        \"telegram\"\n      ]\n    },\n    \"public.event_kind\": {\n      \"name\": \"event_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"error_backup\",\n        \"error_restore\",\n        \"success_restore\",\n        \"success_backup\",\n        \"weekly_report\"\n      ]\n    },\n    \"public.level\": {\n      \"name\": \"level\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"critical\",\n        \"warning\",\n        \"info\"\n      ]\n    },\n    \"public.dbms_status\": {\n      \"name\": \"dbms_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"postgresql\",\n        \"mysql\"\n      ]\n    },\n    \"public.status\": {\n      \"name\": \"status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"waiting\",\n        \"ongoing\",\n        \"failed\",\n        \"success\"\n      ]\n    },\n    \"public.type_storage\": {\n      \"name\": \"type_storage\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\"\n      ]\n    }\n  },\n  \"schemas\": {},\n  \"sequences\": {},\n  \"roles\": {},\n  \"policies\": {},\n  \"views\": {},\n  \"_meta\": {\n    \"columns\": {},\n    \"schemas\": {},\n    \"tables\": {}\n  }\n}"
  },
  {
    "path": "src/db/migrations/meta/0018_snapshot.json",
    "content": "{\n  \"id\": \"5e1b8d85-a6a6-4336-9ed5-03f88bee7401\",\n  \"prevId\": \"dedd1331-415d-4193-9ea2-3c0486fee2ca\",\n  \"version\": \"7\",\n  \"dialect\": \"postgresql\",\n  \"tables\": {\n    \"public.settings\": {\n      \"name\": \"settings\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"storage\": {\n          \"name\": \"storage\",\n          \"type\": \"type_storage\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'local'\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"s3_endpoint_url\": {\n          \"name\": \"s3_endpoint_url\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_access_key_id\": {\n          \"name\": \"s3_access_key_id\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_secret_access_key\": {\n          \"name\": \"s3_secret_access_key\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_bucket_name\": {\n          \"name\": \"s3_bucket_name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_password\": {\n          \"name\": \"smtp_password\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_from\": {\n          \"name\": \"smtp_from\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_host\": {\n          \"name\": \"smtp_host\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_port\": {\n          \"name\": \"smtp_port\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_user\": {\n          \"name\": \"smtp_user\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"settings_name_unique\": {\n          \"name\": \"settings_name_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"name\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.account\": {\n      \"name\": \"account\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"account_id\": {\n          \"name\": \"account_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"access_token\": {\n          \"name\": \"access_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token\": {\n          \"name\": \"refresh_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"id_token\": {\n          \"name\": \"id_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"access_token_expires_at\": {\n          \"name\": \"access_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token_expires_at\": {\n          \"name\": \"refresh_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"scope\": {\n          \"name\": \"scope\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"password\": {\n          \"name\": \"password\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"account_user_id_user_id_fk\": {\n          \"name\": \"account_user_id_user_id_fk\",\n          \"tableFrom\": \"account\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.passkey\": {\n      \"name\": \"passkey\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"publicKey\": {\n          \"name\": \"publicKey\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"userId\": {\n          \"name\": \"userId\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"credentialId\": {\n          \"name\": \"credentialId\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"counter\": {\n          \"name\": \"counter\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"deviceType\": {\n          \"name\": \"deviceType\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backedUp\": {\n          \"name\": \"backedUp\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"transports\": {\n          \"name\": \"transports\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"passkey_userId_user_id_fk\": {\n          \"name\": \"passkey_userId_user_id_fk\",\n          \"tableFrom\": \"passkey\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"userId\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.session\": {\n      \"name\": \"session\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"token\": {\n          \"name\": \"token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"ip_address\": {\n          \"name\": \"ip_address\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_agent\": {\n          \"name\": \"user_agent\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"impersonated_by\": {\n          \"name\": \"impersonated_by\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"active_organization_id\": {\n          \"name\": \"active_organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"session_user_id_user_id_fk\": {\n          \"name\": \"session_user_id_user_id_fk\",\n          \"tableFrom\": \"session\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"session_token_unique\": {\n          \"name\": \"session_token_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"token\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.two_factor\": {\n      \"name\": \"two_factor\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"secret\": {\n          \"name\": \"secret\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backup_codes\": {\n          \"name\": \"backup_codes\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"two_factor_user_id_user_id_fk\": {\n          \"name\": \"two_factor_user_id_user_id_fk\",\n          \"tableFrom\": \"two_factor\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.user\": {\n      \"name\": \"user\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email_verified\": {\n          \"name\": \"email_verified\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"image\": {\n          \"name\": \"image\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"theme\": {\n          \"name\": \"theme\",\n          \"type\": \"user_themes\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'light'\"\n        },\n        \"banned\": {\n          \"name\": \"banned\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_reason\": {\n          \"name\": \"ban_reason\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_expires\": {\n          \"name\": \"ban_expires\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"lastChangedPasswordAt\": {\n          \"name\": \"lastChangedPasswordAt\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"two_factor_enabled\": {\n          \"name\": \"two_factor_enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"user_email_unique\": {\n          \"name\": \"user_email_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"email\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.verification\": {\n      \"name\": \"verification\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"identifier\": {\n          \"name\": \"identifier\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"value\": {\n          \"name\": \"value\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization\": {\n      \"name\": \"organization\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"logo\": {\n          \"name\": \"logo\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"metadata\": {\n          \"name\": \"metadata\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_slug_unique\": {\n          \"name\": \"organization_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.member\": {\n      \"name\": \"member\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"member_organization_id_organization_id_fk\": {\n          \"name\": \"member_organization_id_organization_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"member_user_id_user_id_fk\": {\n          \"name\": \"member_user_id_user_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.invitation\": {\n      \"name\": \"invitation\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"inviter_id\": {\n          \"name\": \"inviter_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"invitation_organization_id_organization_id_fk\": {\n          \"name\": \"invitation_organization_id_organization_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"invitation_inviter_id_user_id_fk\": {\n          \"name\": \"invitation_inviter_id_user_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"inviter_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.projects\": {\n      \"name\": \"projects\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"projects_organization_id_organization_id_fk\": {\n          \"name\": \"projects_organization_id_organization_id_fk\",\n          \"tableFrom\": \"projects\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"projects_slug_unique\": {\n          \"name\": \"projects_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backups\": {\n      \"name\": \"backups\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"file\": {\n          \"name\": \"file\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"file_size\": {\n          \"name\": \"file_size\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backups_database_id_databases_id_fk\": {\n          \"name\": \"backups_database_id_databases_id_fk\",\n          \"tableFrom\": \"backups\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.databases\": {\n      \"name\": \"databases\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"agent_database_id\": {\n          \"name\": \"agent_database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"dbms\": {\n          \"name\": \"dbms\",\n          \"type\": \"dbms_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_policy\": {\n          \"name\": \"backup_policy\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"is_waiting_for_backup\": {\n          \"name\": \"is_waiting_for_backup\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"backup_to_restore\": {\n          \"name\": \"backup_to_restore\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"agent_id\": {\n          \"name\": \"agent_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"project_id\": {\n          \"name\": \"project_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"databases_agent_id_agents_id_fk\": {\n          \"name\": \"databases_agent_id_agents_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"agents\",\n          \"columnsFrom\": [\n            \"agent_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"databases_project_id_projects_id_fk\": {\n          \"name\": \"databases_project_id_projects_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"projects\",\n          \"columnsFrom\": [\n            \"project_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"no action\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.restorations\": {\n      \"name\": \"restorations\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"restorations_backup_id_backups_id_fk\": {\n          \"name\": \"restorations_backup_id_backups_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_database_id_databases_id_fk\": {\n          \"name\": \"restorations_database_id_databases_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.retention_policies\": {\n      \"name\": \"retention_policies\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"type\": {\n          \"name\": \"type\",\n          \"type\": \"retention_policy_type\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"count\": {\n          \"name\": \"count\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"days\": {\n          \"name\": \"days\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 30\n        },\n        \"gfs_daily\": {\n          \"name\": \"gfs_daily\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"gfs_weekly\": {\n          \"name\": \"gfs_weekly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 4\n        },\n        \"gfs_monthly\": {\n          \"name\": \"gfs_monthly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 12\n        },\n        \"gfs_yearly\": {\n          \"name\": \"gfs_yearly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 3\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"retention_policies_database_id_databases_id_fk\": {\n          \"name\": \"retention_policies_database_id_databases_id_fk\",\n          \"tableFrom\": \"retention_policies\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.agents\": {\n      \"name\": \"agents\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"version\": {\n          \"name\": \"version\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"agents_slug_unique\": {\n          \"name\": \"agents_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_channel\": {\n      \"name\": \"notification_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_notification_channels\": {\n      \"name\": \"organization_notification_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_notification_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_notification_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_notification_channels_organization_id_notification_channel_id_unique\": {\n          \"name\": \"organization_notification_channels_organization_id_notification_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"notification_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.alert_policy\": {\n      \"name\": \"alert_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"event_kind\": {\n          \"name\": \"event_kind\",\n          \"type\": \"event_kind[]\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"alert_policy_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"alert_policy_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"alert_policy_database_id_databases_id_fk\": {\n          \"name\": \"alert_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_log\": {\n      \"name\": \"notification_log\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"channel_id\": {\n          \"name\": \"channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"policy_id\": {\n          \"name\": \"policy_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"event\": {\n          \"name\": \"event\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_name\": {\n          \"name\": \"provider_name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"title\": {\n          \"name\": \"title\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"message\": {\n          \"name\": \"message\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"level\": {\n          \"name\": \"level\",\n          \"type\": \"level\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"payload\": {\n          \"name\": \"payload\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"success\": {\n          \"name\": \"success\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"error\": {\n          \"name\": \"error\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider_response\": {\n          \"name\": \"provider_response\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"sent_at\": {\n          \"name\": \"sent_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    }\n  },\n  \"enums\": {\n    \"public.user_themes\": {\n      \"name\": \"user_themes\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"light\",\n        \"dark\",\n        \"system\"\n      ]\n    },\n    \"public.retention_policy_type\": {\n      \"name\": \"retention_policy_type\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"count\",\n        \"days\",\n        \"gfs\"\n      ]\n    },\n    \"public.provider_kind\": {\n      \"name\": \"provider_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"slack\",\n        \"smtp\",\n        \"discord\",\n        \"telegram\",\n        \"gotify\",\n        \"ntfy\"\n      ]\n    },\n    \"public.event_kind\": {\n      \"name\": \"event_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"error_backup\",\n        \"error_restore\",\n        \"success_restore\",\n        \"success_backup\",\n        \"weekly_report\"\n      ]\n    },\n    \"public.level\": {\n      \"name\": \"level\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"critical\",\n        \"warning\",\n        \"info\"\n      ]\n    },\n    \"public.dbms_status\": {\n      \"name\": \"dbms_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"postgresql\",\n        \"mysql\"\n      ]\n    },\n    \"public.status\": {\n      \"name\": \"status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"waiting\",\n        \"ongoing\",\n        \"failed\",\n        \"success\"\n      ]\n    },\n    \"public.type_storage\": {\n      \"name\": \"type_storage\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\"\n      ]\n    }\n  },\n  \"schemas\": {},\n  \"sequences\": {},\n  \"roles\": {},\n  \"policies\": {},\n  \"views\": {},\n  \"_meta\": {\n    \"columns\": {},\n    \"schemas\": {},\n    \"tables\": {}\n  }\n}"
  },
  {
    "path": "src/db/migrations/meta/0019_snapshot.json",
    "content": "{\n  \"id\": \"b29ada25-33dd-4a7d-b2b0-9b17743bfe55\",\n  \"prevId\": \"5e1b8d85-a6a6-4336-9ed5-03f88bee7401\",\n  \"version\": \"7\",\n  \"dialect\": \"postgresql\",\n  \"tables\": {\n    \"public.settings\": {\n      \"name\": \"settings\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"storage\": {\n          \"name\": \"storage\",\n          \"type\": \"type_storage\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'local'\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"s3_endpoint_url\": {\n          \"name\": \"s3_endpoint_url\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_access_key_id\": {\n          \"name\": \"s3_access_key_id\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_secret_access_key\": {\n          \"name\": \"s3_secret_access_key\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_bucket_name\": {\n          \"name\": \"s3_bucket_name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_password\": {\n          \"name\": \"smtp_password\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_from\": {\n          \"name\": \"smtp_from\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_host\": {\n          \"name\": \"smtp_host\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_port\": {\n          \"name\": \"smtp_port\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_user\": {\n          \"name\": \"smtp_user\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"settings_name_unique\": {\n          \"name\": \"settings_name_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"name\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.account\": {\n      \"name\": \"account\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"account_id\": {\n          \"name\": \"account_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"access_token\": {\n          \"name\": \"access_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token\": {\n          \"name\": \"refresh_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"id_token\": {\n          \"name\": \"id_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"access_token_expires_at\": {\n          \"name\": \"access_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token_expires_at\": {\n          \"name\": \"refresh_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"scope\": {\n          \"name\": \"scope\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"password\": {\n          \"name\": \"password\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"account_user_id_user_id_fk\": {\n          \"name\": \"account_user_id_user_id_fk\",\n          \"tableFrom\": \"account\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.passkey\": {\n      \"name\": \"passkey\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"publicKey\": {\n          \"name\": \"publicKey\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"userId\": {\n          \"name\": \"userId\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"credentialId\": {\n          \"name\": \"credentialId\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"counter\": {\n          \"name\": \"counter\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"deviceType\": {\n          \"name\": \"deviceType\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backedUp\": {\n          \"name\": \"backedUp\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"transports\": {\n          \"name\": \"transports\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"passkey_userId_user_id_fk\": {\n          \"name\": \"passkey_userId_user_id_fk\",\n          \"tableFrom\": \"passkey\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"userId\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.session\": {\n      \"name\": \"session\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"token\": {\n          \"name\": \"token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"ip_address\": {\n          \"name\": \"ip_address\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_agent\": {\n          \"name\": \"user_agent\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"impersonated_by\": {\n          \"name\": \"impersonated_by\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"active_organization_id\": {\n          \"name\": \"active_organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"session_user_id_user_id_fk\": {\n          \"name\": \"session_user_id_user_id_fk\",\n          \"tableFrom\": \"session\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"session_token_unique\": {\n          \"name\": \"session_token_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"token\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.two_factor\": {\n      \"name\": \"two_factor\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"secret\": {\n          \"name\": \"secret\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backup_codes\": {\n          \"name\": \"backup_codes\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"two_factor_user_id_user_id_fk\": {\n          \"name\": \"two_factor_user_id_user_id_fk\",\n          \"tableFrom\": \"two_factor\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.user\": {\n      \"name\": \"user\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email_verified\": {\n          \"name\": \"email_verified\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"image\": {\n          \"name\": \"image\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"theme\": {\n          \"name\": \"theme\",\n          \"type\": \"user_themes\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'light'\"\n        },\n        \"banned\": {\n          \"name\": \"banned\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_reason\": {\n          \"name\": \"ban_reason\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_expires\": {\n          \"name\": \"ban_expires\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"lastChangedPasswordAt\": {\n          \"name\": \"lastChangedPasswordAt\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"two_factor_enabled\": {\n          \"name\": \"two_factor_enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"user_email_unique\": {\n          \"name\": \"user_email_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"email\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.verification\": {\n      \"name\": \"verification\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"identifier\": {\n          \"name\": \"identifier\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"value\": {\n          \"name\": \"value\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization\": {\n      \"name\": \"organization\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"logo\": {\n          \"name\": \"logo\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"metadata\": {\n          \"name\": \"metadata\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_slug_unique\": {\n          \"name\": \"organization_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.member\": {\n      \"name\": \"member\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"member_organization_id_organization_id_fk\": {\n          \"name\": \"member_organization_id_organization_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"member_user_id_user_id_fk\": {\n          \"name\": \"member_user_id_user_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.invitation\": {\n      \"name\": \"invitation\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"inviter_id\": {\n          \"name\": \"inviter_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"invitation_organization_id_organization_id_fk\": {\n          \"name\": \"invitation_organization_id_organization_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"invitation_inviter_id_user_id_fk\": {\n          \"name\": \"invitation_inviter_id_user_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"inviter_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.projects\": {\n      \"name\": \"projects\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"projects_organization_id_organization_id_fk\": {\n          \"name\": \"projects_organization_id_organization_id_fk\",\n          \"tableFrom\": \"projects\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"projects_slug_unique\": {\n          \"name\": \"projects_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backups\": {\n      \"name\": \"backups\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"file\": {\n          \"name\": \"file\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"file_size\": {\n          \"name\": \"file_size\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backups_database_id_databases_id_fk\": {\n          \"name\": \"backups_database_id_databases_id_fk\",\n          \"tableFrom\": \"backups\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.databases\": {\n      \"name\": \"databases\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"agent_database_id\": {\n          \"name\": \"agent_database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"dbms\": {\n          \"name\": \"dbms\",\n          \"type\": \"dbms_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_policy\": {\n          \"name\": \"backup_policy\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"is_waiting_for_backup\": {\n          \"name\": \"is_waiting_for_backup\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"backup_to_restore\": {\n          \"name\": \"backup_to_restore\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"agent_id\": {\n          \"name\": \"agent_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"project_id\": {\n          \"name\": \"project_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"databases_agent_id_agents_id_fk\": {\n          \"name\": \"databases_agent_id_agents_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"agents\",\n          \"columnsFrom\": [\n            \"agent_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"databases_project_id_projects_id_fk\": {\n          \"name\": \"databases_project_id_projects_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"projects\",\n          \"columnsFrom\": [\n            \"project_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"no action\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.restorations\": {\n      \"name\": \"restorations\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"restorations_backup_id_backups_id_fk\": {\n          \"name\": \"restorations_backup_id_backups_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_database_id_databases_id_fk\": {\n          \"name\": \"restorations_database_id_databases_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.retention_policies\": {\n      \"name\": \"retention_policies\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"type\": {\n          \"name\": \"type\",\n          \"type\": \"retention_policy_type\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"count\": {\n          \"name\": \"count\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"days\": {\n          \"name\": \"days\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 30\n        },\n        \"gfs_daily\": {\n          \"name\": \"gfs_daily\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"gfs_weekly\": {\n          \"name\": \"gfs_weekly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 4\n        },\n        \"gfs_monthly\": {\n          \"name\": \"gfs_monthly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 12\n        },\n        \"gfs_yearly\": {\n          \"name\": \"gfs_yearly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 3\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"retention_policies_database_id_databases_id_fk\": {\n          \"name\": \"retention_policies_database_id_databases_id_fk\",\n          \"tableFrom\": \"retention_policies\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.agents\": {\n      \"name\": \"agents\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"version\": {\n          \"name\": \"version\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"agents_slug_unique\": {\n          \"name\": \"agents_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_channel\": {\n      \"name\": \"notification_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_notification_channels\": {\n      \"name\": \"organization_notification_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_notification_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_notification_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_notification_channels_organization_id_notification_channel_id_unique\": {\n          \"name\": \"organization_notification_channels_organization_id_notification_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"notification_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.alert_policy\": {\n      \"name\": \"alert_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"event_kind\": {\n          \"name\": \"event_kind\",\n          \"type\": \"event_kind[]\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"alert_policy_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"alert_policy_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"alert_policy_database_id_databases_id_fk\": {\n          \"name\": \"alert_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_log\": {\n      \"name\": \"notification_log\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"channel_id\": {\n          \"name\": \"channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"policy_id\": {\n          \"name\": \"policy_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"event\": {\n          \"name\": \"event\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_name\": {\n          \"name\": \"provider_name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"title\": {\n          \"name\": \"title\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"message\": {\n          \"name\": \"message\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"level\": {\n          \"name\": \"level\",\n          \"type\": \"level\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"payload\": {\n          \"name\": \"payload\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"success\": {\n          \"name\": \"success\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"error\": {\n          \"name\": \"error\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider_response\": {\n          \"name\": \"provider_response\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"sent_at\": {\n          \"name\": \"sent_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    }\n  },\n  \"enums\": {\n    \"public.user_themes\": {\n      \"name\": \"user_themes\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"light\",\n        \"dark\",\n        \"system\"\n      ]\n    },\n    \"public.retention_policy_type\": {\n      \"name\": \"retention_policy_type\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"count\",\n        \"days\",\n        \"gfs\"\n      ]\n    },\n    \"public.provider_kind\": {\n      \"name\": \"provider_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"slack\",\n        \"smtp\",\n        \"discord\",\n        \"telegram\",\n        \"gotify\",\n        \"ntfy\",\n        \"webhook\"\n      ]\n    },\n    \"public.event_kind\": {\n      \"name\": \"event_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"error_backup\",\n        \"error_restore\",\n        \"success_restore\",\n        \"success_backup\",\n        \"weekly_report\"\n      ]\n    },\n    \"public.level\": {\n      \"name\": \"level\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"critical\",\n        \"warning\",\n        \"info\"\n      ]\n    },\n    \"public.dbms_status\": {\n      \"name\": \"dbms_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"postgresql\",\n        \"mysql\"\n      ]\n    },\n    \"public.status\": {\n      \"name\": \"status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"waiting\",\n        \"ongoing\",\n        \"failed\",\n        \"success\"\n      ]\n    },\n    \"public.type_storage\": {\n      \"name\": \"type_storage\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\"\n      ]\n    }\n  },\n  \"schemas\": {},\n  \"sequences\": {},\n  \"roles\": {},\n  \"policies\": {},\n  \"views\": {},\n  \"_meta\": {\n    \"columns\": {},\n    \"schemas\": {},\n    \"tables\": {}\n  }\n}"
  },
  {
    "path": "src/db/migrations/meta/0020_snapshot.json",
    "content": "{\n  \"id\": \"b6099494-2995-4a3a-ba81-2fcf1d82551a\",\n  \"prevId\": \"b29ada25-33dd-4a7d-b2b0-9b17743bfe55\",\n  \"version\": \"7\",\n  \"dialect\": \"postgresql\",\n  \"tables\": {\n    \"public.settings\": {\n      \"name\": \"settings\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"storage\": {\n          \"name\": \"storage\",\n          \"type\": \"type_storage\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'local'\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"s3_endpoint_url\": {\n          \"name\": \"s3_endpoint_url\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_access_key_id\": {\n          \"name\": \"s3_access_key_id\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_secret_access_key\": {\n          \"name\": \"s3_secret_access_key\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_bucket_name\": {\n          \"name\": \"s3_bucket_name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_password\": {\n          \"name\": \"smtp_password\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_from\": {\n          \"name\": \"smtp_from\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_host\": {\n          \"name\": \"smtp_host\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_port\": {\n          \"name\": \"smtp_port\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_user\": {\n          \"name\": \"smtp_user\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"settings_name_unique\": {\n          \"name\": \"settings_name_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"name\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.account\": {\n      \"name\": \"account\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"account_id\": {\n          \"name\": \"account_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"access_token\": {\n          \"name\": \"access_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token\": {\n          \"name\": \"refresh_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"id_token\": {\n          \"name\": \"id_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"access_token_expires_at\": {\n          \"name\": \"access_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token_expires_at\": {\n          \"name\": \"refresh_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"scope\": {\n          \"name\": \"scope\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"password\": {\n          \"name\": \"password\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"account_user_id_user_id_fk\": {\n          \"name\": \"account_user_id_user_id_fk\",\n          \"tableFrom\": \"account\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.passkey\": {\n      \"name\": \"passkey\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"publicKey\": {\n          \"name\": \"publicKey\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"userId\": {\n          \"name\": \"userId\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"credentialId\": {\n          \"name\": \"credentialId\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"counter\": {\n          \"name\": \"counter\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"deviceType\": {\n          \"name\": \"deviceType\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backedUp\": {\n          \"name\": \"backedUp\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"transports\": {\n          \"name\": \"transports\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"passkey_userId_user_id_fk\": {\n          \"name\": \"passkey_userId_user_id_fk\",\n          \"tableFrom\": \"passkey\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"userId\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.session\": {\n      \"name\": \"session\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"token\": {\n          \"name\": \"token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"ip_address\": {\n          \"name\": \"ip_address\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_agent\": {\n          \"name\": \"user_agent\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"impersonated_by\": {\n          \"name\": \"impersonated_by\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"active_organization_id\": {\n          \"name\": \"active_organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"session_user_id_user_id_fk\": {\n          \"name\": \"session_user_id_user_id_fk\",\n          \"tableFrom\": \"session\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"session_token_unique\": {\n          \"name\": \"session_token_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"token\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.two_factor\": {\n      \"name\": \"two_factor\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"secret\": {\n          \"name\": \"secret\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backup_codes\": {\n          \"name\": \"backup_codes\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"two_factor_user_id_user_id_fk\": {\n          \"name\": \"two_factor_user_id_user_id_fk\",\n          \"tableFrom\": \"two_factor\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.user\": {\n      \"name\": \"user\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email_verified\": {\n          \"name\": \"email_verified\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"image\": {\n          \"name\": \"image\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"theme\": {\n          \"name\": \"theme\",\n          \"type\": \"user_themes\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'light'\"\n        },\n        \"banned\": {\n          \"name\": \"banned\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_reason\": {\n          \"name\": \"ban_reason\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_expires\": {\n          \"name\": \"ban_expires\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"lastChangedPasswordAt\": {\n          \"name\": \"lastChangedPasswordAt\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"two_factor_enabled\": {\n          \"name\": \"two_factor_enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"user_email_unique\": {\n          \"name\": \"user_email_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"email\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.verification\": {\n      \"name\": \"verification\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"identifier\": {\n          \"name\": \"identifier\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"value\": {\n          \"name\": \"value\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization\": {\n      \"name\": \"organization\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"logo\": {\n          \"name\": \"logo\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"metadata\": {\n          \"name\": \"metadata\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_slug_unique\": {\n          \"name\": \"organization_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.member\": {\n      \"name\": \"member\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"member_organization_id_organization_id_fk\": {\n          \"name\": \"member_organization_id_organization_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"member_user_id_user_id_fk\": {\n          \"name\": \"member_user_id_user_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.invitation\": {\n      \"name\": \"invitation\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"inviter_id\": {\n          \"name\": \"inviter_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"invitation_organization_id_organization_id_fk\": {\n          \"name\": \"invitation_organization_id_organization_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"invitation_inviter_id_user_id_fk\": {\n          \"name\": \"invitation_inviter_id_user_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"inviter_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.projects\": {\n      \"name\": \"projects\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"projects_organization_id_organization_id_fk\": {\n          \"name\": \"projects_organization_id_organization_id_fk\",\n          \"tableFrom\": \"projects\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"projects_slug_unique\": {\n          \"name\": \"projects_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backups\": {\n      \"name\": \"backups\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"file\": {\n          \"name\": \"file\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"file_size\": {\n          \"name\": \"file_size\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backups_database_id_databases_id_fk\": {\n          \"name\": \"backups_database_id_databases_id_fk\",\n          \"tableFrom\": \"backups\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.databases\": {\n      \"name\": \"databases\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"agent_database_id\": {\n          \"name\": \"agent_database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"dbms\": {\n          \"name\": \"dbms\",\n          \"type\": \"dbms_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_policy\": {\n          \"name\": \"backup_policy\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"is_waiting_for_backup\": {\n          \"name\": \"is_waiting_for_backup\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"backup_to_restore\": {\n          \"name\": \"backup_to_restore\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"agent_id\": {\n          \"name\": \"agent_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"project_id\": {\n          \"name\": \"project_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"databases_agent_id_agents_id_fk\": {\n          \"name\": \"databases_agent_id_agents_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"agents\",\n          \"columnsFrom\": [\n            \"agent_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"databases_project_id_projects_id_fk\": {\n          \"name\": \"databases_project_id_projects_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"projects\",\n          \"columnsFrom\": [\n            \"project_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"no action\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.restorations\": {\n      \"name\": \"restorations\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"restorations_backup_id_backups_id_fk\": {\n          \"name\": \"restorations_backup_id_backups_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_database_id_databases_id_fk\": {\n          \"name\": \"restorations_database_id_databases_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.retention_policies\": {\n      \"name\": \"retention_policies\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"type\": {\n          \"name\": \"type\",\n          \"type\": \"retention_policy_type\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"count\": {\n          \"name\": \"count\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"days\": {\n          \"name\": \"days\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 30\n        },\n        \"gfs_daily\": {\n          \"name\": \"gfs_daily\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"gfs_weekly\": {\n          \"name\": \"gfs_weekly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 4\n        },\n        \"gfs_monthly\": {\n          \"name\": \"gfs_monthly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 12\n        },\n        \"gfs_yearly\": {\n          \"name\": \"gfs_yearly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 3\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"retention_policies_database_id_databases_id_fk\": {\n          \"name\": \"retention_policies_database_id_databases_id_fk\",\n          \"tableFrom\": \"retention_policies\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.agents\": {\n      \"name\": \"agents\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"version\": {\n          \"name\": \"version\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"agents_slug_unique\": {\n          \"name\": \"agents_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_channel\": {\n      \"name\": \"notification_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_notification_channels\": {\n      \"name\": \"organization_notification_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_notification_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_notification_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_notification_channels_organization_id_notification_channel_id_unique\": {\n          \"name\": \"organization_notification_channels_organization_id_notification_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"notification_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.alert_policy\": {\n      \"name\": \"alert_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"event_kind\": {\n          \"name\": \"event_kind\",\n          \"type\": \"event_kind[]\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"alert_policy_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"alert_policy_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"alert_policy_database_id_databases_id_fk\": {\n          \"name\": \"alert_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_log\": {\n      \"name\": \"notification_log\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"channel_id\": {\n          \"name\": \"channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"policy_id\": {\n          \"name\": \"policy_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"event\": {\n          \"name\": \"event\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_name\": {\n          \"name\": \"provider_name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"title\": {\n          \"name\": \"title\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"message\": {\n          \"name\": \"message\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"level\": {\n          \"name\": \"level\",\n          \"type\": \"level\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"payload\": {\n          \"name\": \"payload\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"success\": {\n          \"name\": \"success\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"error\": {\n          \"name\": \"error\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider_response\": {\n          \"name\": \"provider_response\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"sent_at\": {\n          \"name\": \"sent_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_storage_channels\": {\n      \"name\": \"organization_storage_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_storage_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_storage_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_storage_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_storage_channels_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"organization_storage_channels_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"organization_storage_channels\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_storage_channels_organization_id_storage_channel_id_unique\": {\n          \"name\": \"organization_storage_channels_organization_id_storage_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"storage_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.storage_channel\": {\n      \"name\": \"storage_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_storage_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    }\n  },\n  \"enums\": {\n    \"public.user_themes\": {\n      \"name\": \"user_themes\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"light\",\n        \"dark\",\n        \"system\"\n      ]\n    },\n    \"public.retention_policy_type\": {\n      \"name\": \"retention_policy_type\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"count\",\n        \"days\",\n        \"gfs\"\n      ]\n    },\n    \"public.provider_kind\": {\n      \"name\": \"provider_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"slack\",\n        \"smtp\",\n        \"discord\",\n        \"telegram\",\n        \"gotify\",\n        \"ntfy\",\n        \"webhook\"\n      ]\n    },\n    \"public.event_kind\": {\n      \"name\": \"event_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"error_backup\",\n        \"error_restore\",\n        \"success_restore\",\n        \"success_backup\",\n        \"weekly_report\"\n      ]\n    },\n    \"public.level\": {\n      \"name\": \"level\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"critical\",\n        \"warning\",\n        \"info\"\n      ]\n    },\n    \"public.provider_storage_kind\": {\n      \"name\": \"provider_storage_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\"\n      ]\n    },\n    \"public.dbms_status\": {\n      \"name\": \"dbms_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"postgresql\",\n        \"mysql\"\n      ]\n    },\n    \"public.status\": {\n      \"name\": \"status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"waiting\",\n        \"ongoing\",\n        \"failed\",\n        \"success\"\n      ]\n    },\n    \"public.type_storage\": {\n      \"name\": \"type_storage\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\"\n      ]\n    }\n  },\n  \"schemas\": {},\n  \"sequences\": {},\n  \"roles\": {},\n  \"policies\": {},\n  \"views\": {},\n  \"_meta\": {\n    \"columns\": {},\n    \"schemas\": {},\n    \"tables\": {}\n  }\n}"
  },
  {
    "path": "src/db/migrations/meta/0021_snapshot.json",
    "content": "{\n  \"id\": \"d5d260b2-43f3-4283-9c20-ba40c79e79cd\",\n  \"prevId\": \"b6099494-2995-4a3a-ba81-2fcf1d82551a\",\n  \"version\": \"7\",\n  \"dialect\": \"postgresql\",\n  \"tables\": {\n    \"public.settings\": {\n      \"name\": \"settings\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"storage\": {\n          \"name\": \"storage\",\n          \"type\": \"type_storage\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'local'\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"s3_endpoint_url\": {\n          \"name\": \"s3_endpoint_url\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_access_key_id\": {\n          \"name\": \"s3_access_key_id\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_secret_access_key\": {\n          \"name\": \"s3_secret_access_key\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_bucket_name\": {\n          \"name\": \"s3_bucket_name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_password\": {\n          \"name\": \"smtp_password\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_from\": {\n          \"name\": \"smtp_from\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_host\": {\n          \"name\": \"smtp_host\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_port\": {\n          \"name\": \"smtp_port\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_user\": {\n          \"name\": \"smtp_user\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"settings_name_unique\": {\n          \"name\": \"settings_name_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"name\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.account\": {\n      \"name\": \"account\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"account_id\": {\n          \"name\": \"account_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"access_token\": {\n          \"name\": \"access_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token\": {\n          \"name\": \"refresh_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"id_token\": {\n          \"name\": \"id_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"access_token_expires_at\": {\n          \"name\": \"access_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token_expires_at\": {\n          \"name\": \"refresh_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"scope\": {\n          \"name\": \"scope\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"password\": {\n          \"name\": \"password\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"account_user_id_user_id_fk\": {\n          \"name\": \"account_user_id_user_id_fk\",\n          \"tableFrom\": \"account\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.passkey\": {\n      \"name\": \"passkey\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"publicKey\": {\n          \"name\": \"publicKey\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"userId\": {\n          \"name\": \"userId\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"credentialId\": {\n          \"name\": \"credentialId\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"counter\": {\n          \"name\": \"counter\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"deviceType\": {\n          \"name\": \"deviceType\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backedUp\": {\n          \"name\": \"backedUp\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"transports\": {\n          \"name\": \"transports\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"passkey_userId_user_id_fk\": {\n          \"name\": \"passkey_userId_user_id_fk\",\n          \"tableFrom\": \"passkey\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"userId\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.session\": {\n      \"name\": \"session\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"token\": {\n          \"name\": \"token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"ip_address\": {\n          \"name\": \"ip_address\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_agent\": {\n          \"name\": \"user_agent\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"impersonated_by\": {\n          \"name\": \"impersonated_by\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"active_organization_id\": {\n          \"name\": \"active_organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"session_user_id_user_id_fk\": {\n          \"name\": \"session_user_id_user_id_fk\",\n          \"tableFrom\": \"session\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"session_token_unique\": {\n          \"name\": \"session_token_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"token\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.two_factor\": {\n      \"name\": \"two_factor\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"secret\": {\n          \"name\": \"secret\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backup_codes\": {\n          \"name\": \"backup_codes\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"two_factor_user_id_user_id_fk\": {\n          \"name\": \"two_factor_user_id_user_id_fk\",\n          \"tableFrom\": \"two_factor\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.user\": {\n      \"name\": \"user\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email_verified\": {\n          \"name\": \"email_verified\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"image\": {\n          \"name\": \"image\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"theme\": {\n          \"name\": \"theme\",\n          \"type\": \"user_themes\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'light'\"\n        },\n        \"banned\": {\n          \"name\": \"banned\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_reason\": {\n          \"name\": \"ban_reason\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_expires\": {\n          \"name\": \"ban_expires\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"lastChangedPasswordAt\": {\n          \"name\": \"lastChangedPasswordAt\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"two_factor_enabled\": {\n          \"name\": \"two_factor_enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"user_email_unique\": {\n          \"name\": \"user_email_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"email\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.verification\": {\n      \"name\": \"verification\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"identifier\": {\n          \"name\": \"identifier\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"value\": {\n          \"name\": \"value\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization\": {\n      \"name\": \"organization\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"logo\": {\n          \"name\": \"logo\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"metadata\": {\n          \"name\": \"metadata\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_slug_unique\": {\n          \"name\": \"organization_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.member\": {\n      \"name\": \"member\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"member_organization_id_organization_id_fk\": {\n          \"name\": \"member_organization_id_organization_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"member_user_id_user_id_fk\": {\n          \"name\": \"member_user_id_user_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.invitation\": {\n      \"name\": \"invitation\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"inviter_id\": {\n          \"name\": \"inviter_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"invitation_organization_id_organization_id_fk\": {\n          \"name\": \"invitation_organization_id_organization_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"invitation_inviter_id_user_id_fk\": {\n          \"name\": \"invitation_inviter_id_user_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"inviter_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.projects\": {\n      \"name\": \"projects\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"projects_organization_id_organization_id_fk\": {\n          \"name\": \"projects_organization_id_organization_id_fk\",\n          \"tableFrom\": \"projects\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"projects_slug_unique\": {\n          \"name\": \"projects_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backups\": {\n      \"name\": \"backups\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"file\": {\n          \"name\": \"file\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"file_size\": {\n          \"name\": \"file_size\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backups_database_id_databases_id_fk\": {\n          \"name\": \"backups_database_id_databases_id_fk\",\n          \"tableFrom\": \"backups\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.databases\": {\n      \"name\": \"databases\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"agent_database_id\": {\n          \"name\": \"agent_database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"dbms\": {\n          \"name\": \"dbms\",\n          \"type\": \"dbms_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_policy\": {\n          \"name\": \"backup_policy\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"is_waiting_for_backup\": {\n          \"name\": \"is_waiting_for_backup\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"backup_to_restore\": {\n          \"name\": \"backup_to_restore\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"agent_id\": {\n          \"name\": \"agent_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"project_id\": {\n          \"name\": \"project_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"databases_agent_id_agents_id_fk\": {\n          \"name\": \"databases_agent_id_agents_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"agents\",\n          \"columnsFrom\": [\n            \"agent_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"databases_project_id_projects_id_fk\": {\n          \"name\": \"databases_project_id_projects_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"projects\",\n          \"columnsFrom\": [\n            \"project_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"no action\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.restorations\": {\n      \"name\": \"restorations\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"restorations_backup_id_backups_id_fk\": {\n          \"name\": \"restorations_backup_id_backups_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_database_id_databases_id_fk\": {\n          \"name\": \"restorations_database_id_databases_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.retention_policies\": {\n      \"name\": \"retention_policies\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"type\": {\n          \"name\": \"type\",\n          \"type\": \"retention_policy_type\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"count\": {\n          \"name\": \"count\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"days\": {\n          \"name\": \"days\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 30\n        },\n        \"gfs_daily\": {\n          \"name\": \"gfs_daily\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"gfs_weekly\": {\n          \"name\": \"gfs_weekly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 4\n        },\n        \"gfs_monthly\": {\n          \"name\": \"gfs_monthly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 12\n        },\n        \"gfs_yearly\": {\n          \"name\": \"gfs_yearly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 3\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"retention_policies_database_id_databases_id_fk\": {\n          \"name\": \"retention_policies_database_id_databases_id_fk\",\n          \"tableFrom\": \"retention_policies\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.agents\": {\n      \"name\": \"agents\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"version\": {\n          \"name\": \"version\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"agents_slug_unique\": {\n          \"name\": \"agents_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_channel\": {\n      \"name\": \"notification_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_notification_channels\": {\n      \"name\": \"organization_notification_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_notification_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_notification_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_notification_channels_organization_id_notification_channel_id_unique\": {\n          \"name\": \"organization_notification_channels_organization_id_notification_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"notification_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.alert_policy\": {\n      \"name\": \"alert_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"event_kind\": {\n          \"name\": \"event_kind\",\n          \"type\": \"event_kind[]\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"alert_policy_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"alert_policy_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"alert_policy_database_id_databases_id_fk\": {\n          \"name\": \"alert_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_log\": {\n      \"name\": \"notification_log\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"channel_id\": {\n          \"name\": \"channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"policy_id\": {\n          \"name\": \"policy_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"event\": {\n          \"name\": \"event\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_name\": {\n          \"name\": \"provider_name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"title\": {\n          \"name\": \"title\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"message\": {\n          \"name\": \"message\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"level\": {\n          \"name\": \"level\",\n          \"type\": \"level\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"payload\": {\n          \"name\": \"payload\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"success\": {\n          \"name\": \"success\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"error\": {\n          \"name\": \"error\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider_response\": {\n          \"name\": \"provider_response\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"sent_at\": {\n          \"name\": \"sent_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_storage_channels\": {\n      \"name\": \"organization_storage_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_storage_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_storage_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_storage_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_storage_channels_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"organization_storage_channels_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"organization_storage_channels\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_storage_channels_organization_id_storage_channel_id_unique\": {\n          \"name\": \"organization_storage_channels_organization_id_storage_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"storage_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.storage_channel\": {\n      \"name\": \"storage_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_storage_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.storage_policy\": {\n      \"name\": \"storage_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"storage_policy_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"storage_policy_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"storage_policy\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"storage_policy_database_id_databases_id_fk\": {\n          \"name\": \"storage_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"storage_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    }\n  },\n  \"enums\": {\n    \"public.user_themes\": {\n      \"name\": \"user_themes\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"light\",\n        \"dark\",\n        \"system\"\n      ]\n    },\n    \"public.retention_policy_type\": {\n      \"name\": \"retention_policy_type\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"count\",\n        \"days\",\n        \"gfs\"\n      ]\n    },\n    \"public.provider_kind\": {\n      \"name\": \"provider_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"slack\",\n        \"smtp\",\n        \"discord\",\n        \"telegram\",\n        \"gotify\",\n        \"ntfy\",\n        \"webhook\"\n      ]\n    },\n    \"public.event_kind\": {\n      \"name\": \"event_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"error_backup\",\n        \"error_restore\",\n        \"success_restore\",\n        \"success_backup\",\n        \"weekly_report\"\n      ]\n    },\n    \"public.level\": {\n      \"name\": \"level\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"critical\",\n        \"warning\",\n        \"info\"\n      ]\n    },\n    \"public.provider_storage_kind\": {\n      \"name\": \"provider_storage_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\"\n      ]\n    },\n    \"public.dbms_status\": {\n      \"name\": \"dbms_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"postgresql\",\n        \"mysql\"\n      ]\n    },\n    \"public.status\": {\n      \"name\": \"status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"waiting\",\n        \"ongoing\",\n        \"failed\",\n        \"success\"\n      ]\n    },\n    \"public.type_storage\": {\n      \"name\": \"type_storage\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\"\n      ]\n    }\n  },\n  \"schemas\": {},\n  \"sequences\": {},\n  \"roles\": {},\n  \"policies\": {},\n  \"views\": {},\n  \"_meta\": {\n    \"columns\": {},\n    \"schemas\": {},\n    \"tables\": {}\n  }\n}"
  },
  {
    "path": "src/db/migrations/meta/0022_snapshot.json",
    "content": "{\n  \"id\": \"bcefb1a0-f948-472a-95bd-4ed8da0106ae\",\n  \"prevId\": \"d5d260b2-43f3-4283-9c20-ba40c79e79cd\",\n  \"version\": \"7\",\n  \"dialect\": \"postgresql\",\n  \"tables\": {\n    \"public.settings\": {\n      \"name\": \"settings\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"storage\": {\n          \"name\": \"storage\",\n          \"type\": \"type_storage\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'local'\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"s3_endpoint_url\": {\n          \"name\": \"s3_endpoint_url\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_access_key_id\": {\n          \"name\": \"s3_access_key_id\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_secret_access_key\": {\n          \"name\": \"s3_secret_access_key\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_bucket_name\": {\n          \"name\": \"s3_bucket_name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_password\": {\n          \"name\": \"smtp_password\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_from\": {\n          \"name\": \"smtp_from\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_host\": {\n          \"name\": \"smtp_host\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_port\": {\n          \"name\": \"smtp_port\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_user\": {\n          \"name\": \"smtp_user\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"settings_name_unique\": {\n          \"name\": \"settings_name_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"name\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.account\": {\n      \"name\": \"account\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"account_id\": {\n          \"name\": \"account_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"access_token\": {\n          \"name\": \"access_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token\": {\n          \"name\": \"refresh_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"id_token\": {\n          \"name\": \"id_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"access_token_expires_at\": {\n          \"name\": \"access_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token_expires_at\": {\n          \"name\": \"refresh_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"scope\": {\n          \"name\": \"scope\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"password\": {\n          \"name\": \"password\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"account_user_id_user_id_fk\": {\n          \"name\": \"account_user_id_user_id_fk\",\n          \"tableFrom\": \"account\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.passkey\": {\n      \"name\": \"passkey\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"publicKey\": {\n          \"name\": \"publicKey\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"userId\": {\n          \"name\": \"userId\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"credentialId\": {\n          \"name\": \"credentialId\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"counter\": {\n          \"name\": \"counter\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"deviceType\": {\n          \"name\": \"deviceType\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backedUp\": {\n          \"name\": \"backedUp\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"transports\": {\n          \"name\": \"transports\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"passkey_userId_user_id_fk\": {\n          \"name\": \"passkey_userId_user_id_fk\",\n          \"tableFrom\": \"passkey\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"userId\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.session\": {\n      \"name\": \"session\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"token\": {\n          \"name\": \"token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"ip_address\": {\n          \"name\": \"ip_address\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_agent\": {\n          \"name\": \"user_agent\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"impersonated_by\": {\n          \"name\": \"impersonated_by\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"active_organization_id\": {\n          \"name\": \"active_organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"session_user_id_user_id_fk\": {\n          \"name\": \"session_user_id_user_id_fk\",\n          \"tableFrom\": \"session\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"session_token_unique\": {\n          \"name\": \"session_token_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"token\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.two_factor\": {\n      \"name\": \"two_factor\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"secret\": {\n          \"name\": \"secret\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backup_codes\": {\n          \"name\": \"backup_codes\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"two_factor_user_id_user_id_fk\": {\n          \"name\": \"two_factor_user_id_user_id_fk\",\n          \"tableFrom\": \"two_factor\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.user\": {\n      \"name\": \"user\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email_verified\": {\n          \"name\": \"email_verified\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"image\": {\n          \"name\": \"image\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"theme\": {\n          \"name\": \"theme\",\n          \"type\": \"user_themes\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'light'\"\n        },\n        \"banned\": {\n          \"name\": \"banned\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_reason\": {\n          \"name\": \"ban_reason\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_expires\": {\n          \"name\": \"ban_expires\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"lastChangedPasswordAt\": {\n          \"name\": \"lastChangedPasswordAt\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"two_factor_enabled\": {\n          \"name\": \"two_factor_enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"user_email_unique\": {\n          \"name\": \"user_email_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"email\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.verification\": {\n      \"name\": \"verification\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"identifier\": {\n          \"name\": \"identifier\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"value\": {\n          \"name\": \"value\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization\": {\n      \"name\": \"organization\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"logo\": {\n          \"name\": \"logo\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"metadata\": {\n          \"name\": \"metadata\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_slug_unique\": {\n          \"name\": \"organization_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.member\": {\n      \"name\": \"member\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"member_organization_id_organization_id_fk\": {\n          \"name\": \"member_organization_id_organization_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"member_user_id_user_id_fk\": {\n          \"name\": \"member_user_id_user_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.invitation\": {\n      \"name\": \"invitation\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"inviter_id\": {\n          \"name\": \"inviter_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"invitation_organization_id_organization_id_fk\": {\n          \"name\": \"invitation_organization_id_organization_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"invitation_inviter_id_user_id_fk\": {\n          \"name\": \"invitation_inviter_id_user_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"inviter_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.projects\": {\n      \"name\": \"projects\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"projects_organization_id_organization_id_fk\": {\n          \"name\": \"projects_organization_id_organization_id_fk\",\n          \"tableFrom\": \"projects\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"projects_slug_unique\": {\n          \"name\": \"projects_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backups\": {\n      \"name\": \"backups\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"file\": {\n          \"name\": \"file\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"file_size\": {\n          \"name\": \"file_size\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backups_database_id_databases_id_fk\": {\n          \"name\": \"backups_database_id_databases_id_fk\",\n          \"tableFrom\": \"backups\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.databases\": {\n      \"name\": \"databases\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"agent_database_id\": {\n          \"name\": \"agent_database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"dbms\": {\n          \"name\": \"dbms\",\n          \"type\": \"dbms_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_policy\": {\n          \"name\": \"backup_policy\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"is_waiting_for_backup\": {\n          \"name\": \"is_waiting_for_backup\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"backup_to_restore\": {\n          \"name\": \"backup_to_restore\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"agent_id\": {\n          \"name\": \"agent_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"project_id\": {\n          \"name\": \"project_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"databases_agent_id_agents_id_fk\": {\n          \"name\": \"databases_agent_id_agents_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"agents\",\n          \"columnsFrom\": [\n            \"agent_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"databases_project_id_projects_id_fk\": {\n          \"name\": \"databases_project_id_projects_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"projects\",\n          \"columnsFrom\": [\n            \"project_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"no action\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.restorations\": {\n      \"name\": \"restorations\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"restorations_backup_id_backups_id_fk\": {\n          \"name\": \"restorations_backup_id_backups_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_database_id_databases_id_fk\": {\n          \"name\": \"restorations_database_id_databases_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.retention_policies\": {\n      \"name\": \"retention_policies\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"type\": {\n          \"name\": \"type\",\n          \"type\": \"retention_policy_type\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"count\": {\n          \"name\": \"count\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"days\": {\n          \"name\": \"days\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 30\n        },\n        \"gfs_daily\": {\n          \"name\": \"gfs_daily\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"gfs_weekly\": {\n          \"name\": \"gfs_weekly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 4\n        },\n        \"gfs_monthly\": {\n          \"name\": \"gfs_monthly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 12\n        },\n        \"gfs_yearly\": {\n          \"name\": \"gfs_yearly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 3\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"retention_policies_database_id_databases_id_fk\": {\n          \"name\": \"retention_policies_database_id_databases_id_fk\",\n          \"tableFrom\": \"retention_policies\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.agents\": {\n      \"name\": \"agents\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"version\": {\n          \"name\": \"version\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"agents_slug_unique\": {\n          \"name\": \"agents_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_channel\": {\n      \"name\": \"notification_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_notification_channels\": {\n      \"name\": \"organization_notification_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_notification_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_notification_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_notification_channels_organization_id_notification_channel_id_unique\": {\n          \"name\": \"organization_notification_channels_organization_id_notification_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"notification_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.alert_policy\": {\n      \"name\": \"alert_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"event_kind\": {\n          \"name\": \"event_kind\",\n          \"type\": \"event_kind[]\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"alert_policy_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"alert_policy_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"alert_policy_database_id_databases_id_fk\": {\n          \"name\": \"alert_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_log\": {\n      \"name\": \"notification_log\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"channel_id\": {\n          \"name\": \"channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"policy_id\": {\n          \"name\": \"policy_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"event\": {\n          \"name\": \"event\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_name\": {\n          \"name\": \"provider_name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"title\": {\n          \"name\": \"title\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"message\": {\n          \"name\": \"message\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"level\": {\n          \"name\": \"level\",\n          \"type\": \"level\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"payload\": {\n          \"name\": \"payload\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"success\": {\n          \"name\": \"success\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"error\": {\n          \"name\": \"error\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider_response\": {\n          \"name\": \"provider_response\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"sent_at\": {\n          \"name\": \"sent_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_storage_channels\": {\n      \"name\": \"organization_storage_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_storage_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_storage_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_storage_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_storage_channels_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"organization_storage_channels_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"organization_storage_channels\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_storage_channels_organization_id_storage_channel_id_unique\": {\n          \"name\": \"organization_storage_channels_organization_id_storage_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"storage_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.storage_channel\": {\n      \"name\": \"storage_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_storage_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.storage_policy\": {\n      \"name\": \"storage_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"storage_policy_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"storage_policy_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"storage_policy\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"storage_policy_database_id_databases_id_fk\": {\n          \"name\": \"storage_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"storage_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backup_storage\": {\n      \"name\": \"backup_storage\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"backup_storage_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'pending'\"\n        },\n        \"path\": {\n          \"name\": \"path\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"size\": {\n          \"name\": \"size\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"checksum\": {\n          \"name\": \"checksum\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backup_storage_backup_id_backups_id_fk\": {\n          \"name\": \"backup_storage_backup_id_backups_id_fk\",\n          \"tableFrom\": \"backup_storage\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"backup_storage_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"backup_storage_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"backup_storage\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    }\n  },\n  \"enums\": {\n    \"public.user_themes\": {\n      \"name\": \"user_themes\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"light\",\n        \"dark\",\n        \"system\"\n      ]\n    },\n    \"public.retention_policy_type\": {\n      \"name\": \"retention_policy_type\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"count\",\n        \"days\",\n        \"gfs\"\n      ]\n    },\n    \"public.provider_kind\": {\n      \"name\": \"provider_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"slack\",\n        \"smtp\",\n        \"discord\",\n        \"telegram\",\n        \"gotify\",\n        \"ntfy\",\n        \"webhook\"\n      ]\n    },\n    \"public.event_kind\": {\n      \"name\": \"event_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"error_backup\",\n        \"error_restore\",\n        \"success_restore\",\n        \"success_backup\",\n        \"weekly_report\"\n      ]\n    },\n    \"public.level\": {\n      \"name\": \"level\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"critical\",\n        \"warning\",\n        \"info\"\n      ]\n    },\n    \"public.provider_storage_kind\": {\n      \"name\": \"provider_storage_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\"\n      ]\n    },\n    \"public.backup_storage_status\": {\n      \"name\": \"backup_storage_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"pending\",\n        \"success\",\n        \"failed\"\n      ]\n    },\n    \"public.dbms_status\": {\n      \"name\": \"dbms_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"postgresql\",\n        \"mysql\"\n      ]\n    },\n    \"public.status\": {\n      \"name\": \"status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"waiting\",\n        \"ongoing\",\n        \"failed\",\n        \"success\"\n      ]\n    },\n    \"public.type_storage\": {\n      \"name\": \"type_storage\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\"\n      ]\n    }\n  },\n  \"schemas\": {},\n  \"sequences\": {},\n  \"roles\": {},\n  \"policies\": {},\n  \"views\": {},\n  \"_meta\": {\n    \"columns\": {},\n    \"schemas\": {},\n    \"tables\": {}\n  }\n}"
  },
  {
    "path": "src/db/migrations/meta/0023_snapshot.json",
    "content": "{\n  \"id\": \"56b2efa4-0b30-4647-87a9-dd94fc7ebcbb\",\n  \"prevId\": \"bcefb1a0-f948-472a-95bd-4ed8da0106ae\",\n  \"version\": \"7\",\n  \"dialect\": \"postgresql\",\n  \"tables\": {\n    \"public.settings\": {\n      \"name\": \"settings\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"storage\": {\n          \"name\": \"storage\",\n          \"type\": \"type_storage\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'local'\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"s3_endpoint_url\": {\n          \"name\": \"s3_endpoint_url\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_access_key_id\": {\n          \"name\": \"s3_access_key_id\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_secret_access_key\": {\n          \"name\": \"s3_secret_access_key\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_bucket_name\": {\n          \"name\": \"s3_bucket_name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_password\": {\n          \"name\": \"smtp_password\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_from\": {\n          \"name\": \"smtp_from\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_host\": {\n          \"name\": \"smtp_host\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_port\": {\n          \"name\": \"smtp_port\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_user\": {\n          \"name\": \"smtp_user\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"settings_name_unique\": {\n          \"name\": \"settings_name_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"name\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.account\": {\n      \"name\": \"account\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"account_id\": {\n          \"name\": \"account_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"access_token\": {\n          \"name\": \"access_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token\": {\n          \"name\": \"refresh_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"id_token\": {\n          \"name\": \"id_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"access_token_expires_at\": {\n          \"name\": \"access_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token_expires_at\": {\n          \"name\": \"refresh_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"scope\": {\n          \"name\": \"scope\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"password\": {\n          \"name\": \"password\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"account_user_id_user_id_fk\": {\n          \"name\": \"account_user_id_user_id_fk\",\n          \"tableFrom\": \"account\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.passkey\": {\n      \"name\": \"passkey\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"publicKey\": {\n          \"name\": \"publicKey\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"userId\": {\n          \"name\": \"userId\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"credentialId\": {\n          \"name\": \"credentialId\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"counter\": {\n          \"name\": \"counter\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"deviceType\": {\n          \"name\": \"deviceType\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backedUp\": {\n          \"name\": \"backedUp\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"transports\": {\n          \"name\": \"transports\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"passkey_userId_user_id_fk\": {\n          \"name\": \"passkey_userId_user_id_fk\",\n          \"tableFrom\": \"passkey\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"userId\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.session\": {\n      \"name\": \"session\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"token\": {\n          \"name\": \"token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"ip_address\": {\n          \"name\": \"ip_address\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_agent\": {\n          \"name\": \"user_agent\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"impersonated_by\": {\n          \"name\": \"impersonated_by\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"active_organization_id\": {\n          \"name\": \"active_organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"session_user_id_user_id_fk\": {\n          \"name\": \"session_user_id_user_id_fk\",\n          \"tableFrom\": \"session\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"session_token_unique\": {\n          \"name\": \"session_token_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"token\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.two_factor\": {\n      \"name\": \"two_factor\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"secret\": {\n          \"name\": \"secret\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backup_codes\": {\n          \"name\": \"backup_codes\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"two_factor_user_id_user_id_fk\": {\n          \"name\": \"two_factor_user_id_user_id_fk\",\n          \"tableFrom\": \"two_factor\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.user\": {\n      \"name\": \"user\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email_verified\": {\n          \"name\": \"email_verified\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"image\": {\n          \"name\": \"image\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"theme\": {\n          \"name\": \"theme\",\n          \"type\": \"user_themes\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'light'\"\n        },\n        \"banned\": {\n          \"name\": \"banned\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_reason\": {\n          \"name\": \"ban_reason\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_expires\": {\n          \"name\": \"ban_expires\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"lastChangedPasswordAt\": {\n          \"name\": \"lastChangedPasswordAt\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"two_factor_enabled\": {\n          \"name\": \"two_factor_enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"user_email_unique\": {\n          \"name\": \"user_email_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"email\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.verification\": {\n      \"name\": \"verification\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"identifier\": {\n          \"name\": \"identifier\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"value\": {\n          \"name\": \"value\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization\": {\n      \"name\": \"organization\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"logo\": {\n          \"name\": \"logo\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"metadata\": {\n          \"name\": \"metadata\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_slug_unique\": {\n          \"name\": \"organization_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.member\": {\n      \"name\": \"member\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"member_organization_id_organization_id_fk\": {\n          \"name\": \"member_organization_id_organization_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"member_user_id_user_id_fk\": {\n          \"name\": \"member_user_id_user_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.invitation\": {\n      \"name\": \"invitation\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"inviter_id\": {\n          \"name\": \"inviter_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"invitation_organization_id_organization_id_fk\": {\n          \"name\": \"invitation_organization_id_organization_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"invitation_inviter_id_user_id_fk\": {\n          \"name\": \"invitation_inviter_id_user_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"inviter_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.projects\": {\n      \"name\": \"projects\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"projects_organization_id_organization_id_fk\": {\n          \"name\": \"projects_organization_id_organization_id_fk\",\n          \"tableFrom\": \"projects\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"projects_slug_unique\": {\n          \"name\": \"projects_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backups\": {\n      \"name\": \"backups\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"file\": {\n          \"name\": \"file\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"file_size\": {\n          \"name\": \"file_size\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backups_database_id_databases_id_fk\": {\n          \"name\": \"backups_database_id_databases_id_fk\",\n          \"tableFrom\": \"backups\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.databases\": {\n      \"name\": \"databases\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"agent_database_id\": {\n          \"name\": \"agent_database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"dbms\": {\n          \"name\": \"dbms\",\n          \"type\": \"dbms_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_policy\": {\n          \"name\": \"backup_policy\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"is_waiting_for_backup\": {\n          \"name\": \"is_waiting_for_backup\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"backup_to_restore\": {\n          \"name\": \"backup_to_restore\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"agent_id\": {\n          \"name\": \"agent_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"project_id\": {\n          \"name\": \"project_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"databases_agent_id_agents_id_fk\": {\n          \"name\": \"databases_agent_id_agents_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"agents\",\n          \"columnsFrom\": [\n            \"agent_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"databases_project_id_projects_id_fk\": {\n          \"name\": \"databases_project_id_projects_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"projects\",\n          \"columnsFrom\": [\n            \"project_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"no action\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.restorations\": {\n      \"name\": \"restorations\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"restorations_backup_id_backups_id_fk\": {\n          \"name\": \"restorations_backup_id_backups_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_database_id_databases_id_fk\": {\n          \"name\": \"restorations_database_id_databases_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.retention_policies\": {\n      \"name\": \"retention_policies\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"type\": {\n          \"name\": \"type\",\n          \"type\": \"retention_policy_type\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"count\": {\n          \"name\": \"count\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"days\": {\n          \"name\": \"days\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 30\n        },\n        \"gfs_daily\": {\n          \"name\": \"gfs_daily\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"gfs_weekly\": {\n          \"name\": \"gfs_weekly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 4\n        },\n        \"gfs_monthly\": {\n          \"name\": \"gfs_monthly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 12\n        },\n        \"gfs_yearly\": {\n          \"name\": \"gfs_yearly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 3\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"retention_policies_database_id_databases_id_fk\": {\n          \"name\": \"retention_policies_database_id_databases_id_fk\",\n          \"tableFrom\": \"retention_policies\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.agents\": {\n      \"name\": \"agents\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"version\": {\n          \"name\": \"version\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"agents_slug_unique\": {\n          \"name\": \"agents_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_channel\": {\n      \"name\": \"notification_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_notification_channels\": {\n      \"name\": \"organization_notification_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_notification_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_notification_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_notification_channels_organization_id_notification_channel_id_unique\": {\n          \"name\": \"organization_notification_channels_organization_id_notification_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"notification_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.alert_policy\": {\n      \"name\": \"alert_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"event_kind\": {\n          \"name\": \"event_kind\",\n          \"type\": \"event_kind[]\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"alert_policy_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"alert_policy_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"alert_policy_database_id_databases_id_fk\": {\n          \"name\": \"alert_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_log\": {\n      \"name\": \"notification_log\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"channel_id\": {\n          \"name\": \"channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"policy_id\": {\n          \"name\": \"policy_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"event\": {\n          \"name\": \"event\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_name\": {\n          \"name\": \"provider_name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"title\": {\n          \"name\": \"title\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"message\": {\n          \"name\": \"message\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"level\": {\n          \"name\": \"level\",\n          \"type\": \"level\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"payload\": {\n          \"name\": \"payload\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"success\": {\n          \"name\": \"success\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"error\": {\n          \"name\": \"error\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider_response\": {\n          \"name\": \"provider_response\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"sent_at\": {\n          \"name\": \"sent_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_storage_channels\": {\n      \"name\": \"organization_storage_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_storage_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_storage_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_storage_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_storage_channels_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"organization_storage_channels_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"organization_storage_channels\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_storage_channels_organization_id_storage_channel_id_unique\": {\n          \"name\": \"organization_storage_channels_organization_id_storage_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"storage_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.storage_channel\": {\n      \"name\": \"storage_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_storage_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"storage_channel_organization_id_organization_id_fk\": {\n          \"name\": \"storage_channel_organization_id_organization_id_fk\",\n          \"tableFrom\": \"storage_channel\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.storage_policy\": {\n      \"name\": \"storage_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"storage_policy_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"storage_policy_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"storage_policy\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"storage_policy_database_id_databases_id_fk\": {\n          \"name\": \"storage_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"storage_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backup_storage\": {\n      \"name\": \"backup_storage\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"backup_storage_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'pending'\"\n        },\n        \"path\": {\n          \"name\": \"path\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"size\": {\n          \"name\": \"size\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"checksum\": {\n          \"name\": \"checksum\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backup_storage_backup_id_backups_id_fk\": {\n          \"name\": \"backup_storage_backup_id_backups_id_fk\",\n          \"tableFrom\": \"backup_storage\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"backup_storage_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"backup_storage_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"backup_storage\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    }\n  },\n  \"enums\": {\n    \"public.user_themes\": {\n      \"name\": \"user_themes\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"light\",\n        \"dark\",\n        \"system\"\n      ]\n    },\n    \"public.retention_policy_type\": {\n      \"name\": \"retention_policy_type\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"count\",\n        \"days\",\n        \"gfs\"\n      ]\n    },\n    \"public.provider_kind\": {\n      \"name\": \"provider_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"slack\",\n        \"smtp\",\n        \"discord\",\n        \"telegram\",\n        \"gotify\",\n        \"ntfy\",\n        \"webhook\"\n      ]\n    },\n    \"public.event_kind\": {\n      \"name\": \"event_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"error_backup\",\n        \"error_restore\",\n        \"success_restore\",\n        \"success_backup\",\n        \"weekly_report\"\n      ]\n    },\n    \"public.level\": {\n      \"name\": \"level\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"critical\",\n        \"warning\",\n        \"info\"\n      ]\n    },\n    \"public.provider_storage_kind\": {\n      \"name\": \"provider_storage_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\"\n      ]\n    },\n    \"public.backup_storage_status\": {\n      \"name\": \"backup_storage_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"pending\",\n        \"success\",\n        \"failed\"\n      ]\n    },\n    \"public.dbms_status\": {\n      \"name\": \"dbms_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"postgresql\",\n        \"mysql\"\n      ]\n    },\n    \"public.status\": {\n      \"name\": \"status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"waiting\",\n        \"ongoing\",\n        \"failed\",\n        \"success\"\n      ]\n    },\n    \"public.type_storage\": {\n      \"name\": \"type_storage\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\"\n      ]\n    }\n  },\n  \"schemas\": {},\n  \"sequences\": {},\n  \"roles\": {},\n  \"policies\": {},\n  \"views\": {},\n  \"_meta\": {\n    \"columns\": {},\n    \"schemas\": {},\n    \"tables\": {}\n  }\n}"
  },
  {
    "path": "src/db/migrations/meta/0024_snapshot.json",
    "content": "{\n  \"id\": \"ffe4212b-0817-415c-9c6e-73e0b200c5a3\",\n  \"prevId\": \"56b2efa4-0b30-4647-87a9-dd94fc7ebcbb\",\n  \"version\": \"7\",\n  \"dialect\": \"postgresql\",\n  \"tables\": {\n    \"public.settings\": {\n      \"name\": \"settings\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"storage\": {\n          \"name\": \"storage\",\n          \"type\": \"type_storage\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'local'\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"s3_endpoint_url\": {\n          \"name\": \"s3_endpoint_url\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_access_key_id\": {\n          \"name\": \"s3_access_key_id\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_secret_access_key\": {\n          \"name\": \"s3_secret_access_key\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_bucket_name\": {\n          \"name\": \"s3_bucket_name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_password\": {\n          \"name\": \"smtp_password\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_from\": {\n          \"name\": \"smtp_from\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_host\": {\n          \"name\": \"smtp_host\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_port\": {\n          \"name\": \"smtp_port\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_user\": {\n          \"name\": \"smtp_user\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"settings_name_unique\": {\n          \"name\": \"settings_name_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"name\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.account\": {\n      \"name\": \"account\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"account_id\": {\n          \"name\": \"account_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"access_token\": {\n          \"name\": \"access_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token\": {\n          \"name\": \"refresh_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"id_token\": {\n          \"name\": \"id_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"access_token_expires_at\": {\n          \"name\": \"access_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token_expires_at\": {\n          \"name\": \"refresh_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"scope\": {\n          \"name\": \"scope\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"password\": {\n          \"name\": \"password\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"account_user_id_user_id_fk\": {\n          \"name\": \"account_user_id_user_id_fk\",\n          \"tableFrom\": \"account\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.passkey\": {\n      \"name\": \"passkey\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"publicKey\": {\n          \"name\": \"publicKey\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"userId\": {\n          \"name\": \"userId\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"credentialId\": {\n          \"name\": \"credentialId\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"counter\": {\n          \"name\": \"counter\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"deviceType\": {\n          \"name\": \"deviceType\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backedUp\": {\n          \"name\": \"backedUp\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"transports\": {\n          \"name\": \"transports\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"passkey_userId_user_id_fk\": {\n          \"name\": \"passkey_userId_user_id_fk\",\n          \"tableFrom\": \"passkey\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"userId\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.session\": {\n      \"name\": \"session\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"token\": {\n          \"name\": \"token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"ip_address\": {\n          \"name\": \"ip_address\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_agent\": {\n          \"name\": \"user_agent\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"impersonated_by\": {\n          \"name\": \"impersonated_by\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"active_organization_id\": {\n          \"name\": \"active_organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"session_user_id_user_id_fk\": {\n          \"name\": \"session_user_id_user_id_fk\",\n          \"tableFrom\": \"session\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"session_token_unique\": {\n          \"name\": \"session_token_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"token\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.two_factor\": {\n      \"name\": \"two_factor\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"secret\": {\n          \"name\": \"secret\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backup_codes\": {\n          \"name\": \"backup_codes\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"two_factor_user_id_user_id_fk\": {\n          \"name\": \"two_factor_user_id_user_id_fk\",\n          \"tableFrom\": \"two_factor\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.user\": {\n      \"name\": \"user\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email_verified\": {\n          \"name\": \"email_verified\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"image\": {\n          \"name\": \"image\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"theme\": {\n          \"name\": \"theme\",\n          \"type\": \"user_themes\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'light'\"\n        },\n        \"banned\": {\n          \"name\": \"banned\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_reason\": {\n          \"name\": \"ban_reason\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_expires\": {\n          \"name\": \"ban_expires\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"lastChangedPasswordAt\": {\n          \"name\": \"lastChangedPasswordAt\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"two_factor_enabled\": {\n          \"name\": \"two_factor_enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"user_email_unique\": {\n          \"name\": \"user_email_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"email\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.verification\": {\n      \"name\": \"verification\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"identifier\": {\n          \"name\": \"identifier\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"value\": {\n          \"name\": \"value\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization\": {\n      \"name\": \"organization\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"logo\": {\n          \"name\": \"logo\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"metadata\": {\n          \"name\": \"metadata\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_slug_unique\": {\n          \"name\": \"organization_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.member\": {\n      \"name\": \"member\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"member_organization_id_organization_id_fk\": {\n          \"name\": \"member_organization_id_organization_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"member_user_id_user_id_fk\": {\n          \"name\": \"member_user_id_user_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.invitation\": {\n      \"name\": \"invitation\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"inviter_id\": {\n          \"name\": \"inviter_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"invitation_organization_id_organization_id_fk\": {\n          \"name\": \"invitation_organization_id_organization_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"invitation_inviter_id_user_id_fk\": {\n          \"name\": \"invitation_inviter_id_user_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"inviter_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.projects\": {\n      \"name\": \"projects\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"projects_organization_id_organization_id_fk\": {\n          \"name\": \"projects_organization_id_organization_id_fk\",\n          \"tableFrom\": \"projects\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"projects_slug_unique\": {\n          \"name\": \"projects_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backups\": {\n      \"name\": \"backups\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"file\": {\n          \"name\": \"file\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"file_size\": {\n          \"name\": \"file_size\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backups_database_id_databases_id_fk\": {\n          \"name\": \"backups_database_id_databases_id_fk\",\n          \"tableFrom\": \"backups\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.databases\": {\n      \"name\": \"databases\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"agent_database_id\": {\n          \"name\": \"agent_database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"dbms\": {\n          \"name\": \"dbms\",\n          \"type\": \"dbms_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_policy\": {\n          \"name\": \"backup_policy\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"is_waiting_for_backup\": {\n          \"name\": \"is_waiting_for_backup\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"backup_to_restore\": {\n          \"name\": \"backup_to_restore\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"agent_id\": {\n          \"name\": \"agent_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"project_id\": {\n          \"name\": \"project_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"databases_agent_id_agents_id_fk\": {\n          \"name\": \"databases_agent_id_agents_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"agents\",\n          \"columnsFrom\": [\n            \"agent_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"databases_project_id_projects_id_fk\": {\n          \"name\": \"databases_project_id_projects_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"projects\",\n          \"columnsFrom\": [\n            \"project_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"no action\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.restorations\": {\n      \"name\": \"restorations\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"restorations_backup_id_backups_id_fk\": {\n          \"name\": \"restorations_backup_id_backups_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_database_id_databases_id_fk\": {\n          \"name\": \"restorations_database_id_databases_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.retention_policies\": {\n      \"name\": \"retention_policies\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"type\": {\n          \"name\": \"type\",\n          \"type\": \"retention_policy_type\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"count\": {\n          \"name\": \"count\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"days\": {\n          \"name\": \"days\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 30\n        },\n        \"gfs_daily\": {\n          \"name\": \"gfs_daily\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"gfs_weekly\": {\n          \"name\": \"gfs_weekly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 4\n        },\n        \"gfs_monthly\": {\n          \"name\": \"gfs_monthly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 12\n        },\n        \"gfs_yearly\": {\n          \"name\": \"gfs_yearly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 3\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"retention_policies_database_id_databases_id_fk\": {\n          \"name\": \"retention_policies_database_id_databases_id_fk\",\n          \"tableFrom\": \"retention_policies\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.agents\": {\n      \"name\": \"agents\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"version\": {\n          \"name\": \"version\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"agents_slug_unique\": {\n          \"name\": \"agents_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_channel\": {\n      \"name\": \"notification_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"notification_channel_organization_id_organization_id_fk\": {\n          \"name\": \"notification_channel_organization_id_organization_id_fk\",\n          \"tableFrom\": \"notification_channel\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_notification_channels\": {\n      \"name\": \"organization_notification_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_notification_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_notification_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_notification_channels_organization_id_notification_channel_id_unique\": {\n          \"name\": \"organization_notification_channels_organization_id_notification_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"notification_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.alert_policy\": {\n      \"name\": \"alert_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"event_kind\": {\n          \"name\": \"event_kind\",\n          \"type\": \"event_kind[]\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"alert_policy_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"alert_policy_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"alert_policy_database_id_databases_id_fk\": {\n          \"name\": \"alert_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_log\": {\n      \"name\": \"notification_log\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"channel_id\": {\n          \"name\": \"channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"policy_id\": {\n          \"name\": \"policy_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"event\": {\n          \"name\": \"event\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_name\": {\n          \"name\": \"provider_name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"title\": {\n          \"name\": \"title\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"message\": {\n          \"name\": \"message\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"level\": {\n          \"name\": \"level\",\n          \"type\": \"level\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"payload\": {\n          \"name\": \"payload\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"success\": {\n          \"name\": \"success\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"error\": {\n          \"name\": \"error\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider_response\": {\n          \"name\": \"provider_response\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"sent_at\": {\n          \"name\": \"sent_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_storage_channels\": {\n      \"name\": \"organization_storage_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_storage_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_storage_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_storage_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_storage_channels_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"organization_storage_channels_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"organization_storage_channels\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_storage_channels_organization_id_storage_channel_id_unique\": {\n          \"name\": \"organization_storage_channels_organization_id_storage_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"storage_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.storage_channel\": {\n      \"name\": \"storage_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_storage_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"storage_channel_organization_id_organization_id_fk\": {\n          \"name\": \"storage_channel_organization_id_organization_id_fk\",\n          \"tableFrom\": \"storage_channel\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.storage_policy\": {\n      \"name\": \"storage_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"storage_policy_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"storage_policy_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"storage_policy\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"storage_policy_database_id_databases_id_fk\": {\n          \"name\": \"storage_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"storage_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backup_storage\": {\n      \"name\": \"backup_storage\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"backup_storage_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'pending'\"\n        },\n        \"path\": {\n          \"name\": \"path\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"size\": {\n          \"name\": \"size\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"checksum\": {\n          \"name\": \"checksum\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backup_storage_backup_id_backups_id_fk\": {\n          \"name\": \"backup_storage_backup_id_backups_id_fk\",\n          \"tableFrom\": \"backup_storage\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"backup_storage_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"backup_storage_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"backup_storage\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    }\n  },\n  \"enums\": {\n    \"public.user_themes\": {\n      \"name\": \"user_themes\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"light\",\n        \"dark\",\n        \"system\"\n      ]\n    },\n    \"public.retention_policy_type\": {\n      \"name\": \"retention_policy_type\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"count\",\n        \"days\",\n        \"gfs\"\n      ]\n    },\n    \"public.provider_kind\": {\n      \"name\": \"provider_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"slack\",\n        \"smtp\",\n        \"discord\",\n        \"telegram\",\n        \"gotify\",\n        \"ntfy\",\n        \"webhook\"\n      ]\n    },\n    \"public.event_kind\": {\n      \"name\": \"event_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"error_backup\",\n        \"error_restore\",\n        \"success_restore\",\n        \"success_backup\",\n        \"weekly_report\"\n      ]\n    },\n    \"public.level\": {\n      \"name\": \"level\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"critical\",\n        \"warning\",\n        \"info\"\n      ]\n    },\n    \"public.provider_storage_kind\": {\n      \"name\": \"provider_storage_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\"\n      ]\n    },\n    \"public.backup_storage_status\": {\n      \"name\": \"backup_storage_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"pending\",\n        \"success\",\n        \"failed\"\n      ]\n    },\n    \"public.dbms_status\": {\n      \"name\": \"dbms_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"postgresql\",\n        \"mysql\"\n      ]\n    },\n    \"public.status\": {\n      \"name\": \"status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"waiting\",\n        \"ongoing\",\n        \"failed\",\n        \"success\"\n      ]\n    },\n    \"public.type_storage\": {\n      \"name\": \"type_storage\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\"\n      ]\n    }\n  },\n  \"schemas\": {},\n  \"sequences\": {},\n  \"roles\": {},\n  \"policies\": {},\n  \"views\": {},\n  \"_meta\": {\n    \"columns\": {},\n    \"schemas\": {},\n    \"tables\": {}\n  }\n}"
  },
  {
    "path": "src/db/migrations/meta/0025_snapshot.json",
    "content": "{\n  \"id\": \"a9aa4c81-9ca9-413f-89cb-37361d26927c\",\n  \"prevId\": \"ffe4212b-0817-415c-9c6e-73e0b200c5a3\",\n  \"version\": \"7\",\n  \"dialect\": \"postgresql\",\n  \"tables\": {\n    \"public.settings\": {\n      \"name\": \"settings\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"storage\": {\n          \"name\": \"storage\",\n          \"type\": \"type_storage\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'local'\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"s3_endpoint_url\": {\n          \"name\": \"s3_endpoint_url\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_access_key_id\": {\n          \"name\": \"s3_access_key_id\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_secret_access_key\": {\n          \"name\": \"s3_secret_access_key\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_bucket_name\": {\n          \"name\": \"s3_bucket_name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_password\": {\n          \"name\": \"smtp_password\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_from\": {\n          \"name\": \"smtp_from\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_host\": {\n          \"name\": \"smtp_host\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_port\": {\n          \"name\": \"smtp_port\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_user\": {\n          \"name\": \"smtp_user\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"default_storage_channel_id\": {\n          \"name\": \"default_storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"settings_default_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"settings_default_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"settings\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"default_storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"set null\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"settings_name_unique\": {\n          \"name\": \"settings_name_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"name\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.account\": {\n      \"name\": \"account\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"account_id\": {\n          \"name\": \"account_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"access_token\": {\n          \"name\": \"access_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token\": {\n          \"name\": \"refresh_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"id_token\": {\n          \"name\": \"id_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"access_token_expires_at\": {\n          \"name\": \"access_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token_expires_at\": {\n          \"name\": \"refresh_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"scope\": {\n          \"name\": \"scope\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"password\": {\n          \"name\": \"password\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"account_user_id_user_id_fk\": {\n          \"name\": \"account_user_id_user_id_fk\",\n          \"tableFrom\": \"account\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.passkey\": {\n      \"name\": \"passkey\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"publicKey\": {\n          \"name\": \"publicKey\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"userId\": {\n          \"name\": \"userId\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"credentialId\": {\n          \"name\": \"credentialId\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"counter\": {\n          \"name\": \"counter\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"deviceType\": {\n          \"name\": \"deviceType\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backedUp\": {\n          \"name\": \"backedUp\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"transports\": {\n          \"name\": \"transports\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"passkey_userId_user_id_fk\": {\n          \"name\": \"passkey_userId_user_id_fk\",\n          \"tableFrom\": \"passkey\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"userId\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.session\": {\n      \"name\": \"session\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"token\": {\n          \"name\": \"token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"ip_address\": {\n          \"name\": \"ip_address\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_agent\": {\n          \"name\": \"user_agent\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"impersonated_by\": {\n          \"name\": \"impersonated_by\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"active_organization_id\": {\n          \"name\": \"active_organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"session_user_id_user_id_fk\": {\n          \"name\": \"session_user_id_user_id_fk\",\n          \"tableFrom\": \"session\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"session_token_unique\": {\n          \"name\": \"session_token_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"token\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.two_factor\": {\n      \"name\": \"two_factor\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"secret\": {\n          \"name\": \"secret\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backup_codes\": {\n          \"name\": \"backup_codes\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"two_factor_user_id_user_id_fk\": {\n          \"name\": \"two_factor_user_id_user_id_fk\",\n          \"tableFrom\": \"two_factor\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.user\": {\n      \"name\": \"user\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email_verified\": {\n          \"name\": \"email_verified\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"image\": {\n          \"name\": \"image\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"theme\": {\n          \"name\": \"theme\",\n          \"type\": \"user_themes\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'light'\"\n        },\n        \"banned\": {\n          \"name\": \"banned\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_reason\": {\n          \"name\": \"ban_reason\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_expires\": {\n          \"name\": \"ban_expires\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"lastChangedPasswordAt\": {\n          \"name\": \"lastChangedPasswordAt\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"two_factor_enabled\": {\n          \"name\": \"two_factor_enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"user_email_unique\": {\n          \"name\": \"user_email_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"email\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.verification\": {\n      \"name\": \"verification\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"identifier\": {\n          \"name\": \"identifier\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"value\": {\n          \"name\": \"value\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization\": {\n      \"name\": \"organization\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"logo\": {\n          \"name\": \"logo\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"metadata\": {\n          \"name\": \"metadata\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_slug_unique\": {\n          \"name\": \"organization_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.member\": {\n      \"name\": \"member\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"member_organization_id_organization_id_fk\": {\n          \"name\": \"member_organization_id_organization_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"member_user_id_user_id_fk\": {\n          \"name\": \"member_user_id_user_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.invitation\": {\n      \"name\": \"invitation\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"inviter_id\": {\n          \"name\": \"inviter_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"invitation_organization_id_organization_id_fk\": {\n          \"name\": \"invitation_organization_id_organization_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"invitation_inviter_id_user_id_fk\": {\n          \"name\": \"invitation_inviter_id_user_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"inviter_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.projects\": {\n      \"name\": \"projects\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"projects_organization_id_organization_id_fk\": {\n          \"name\": \"projects_organization_id_organization_id_fk\",\n          \"tableFrom\": \"projects\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"projects_slug_unique\": {\n          \"name\": \"projects_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backups\": {\n      \"name\": \"backups\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"file\": {\n          \"name\": \"file\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"file_size\": {\n          \"name\": \"file_size\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backups_database_id_databases_id_fk\": {\n          \"name\": \"backups_database_id_databases_id_fk\",\n          \"tableFrom\": \"backups\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.databases\": {\n      \"name\": \"databases\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"agent_database_id\": {\n          \"name\": \"agent_database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"dbms\": {\n          \"name\": \"dbms\",\n          \"type\": \"dbms_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_policy\": {\n          \"name\": \"backup_policy\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"is_waiting_for_backup\": {\n          \"name\": \"is_waiting_for_backup\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"backup_to_restore\": {\n          \"name\": \"backup_to_restore\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"agent_id\": {\n          \"name\": \"agent_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"project_id\": {\n          \"name\": \"project_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"databases_agent_id_agents_id_fk\": {\n          \"name\": \"databases_agent_id_agents_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"agents\",\n          \"columnsFrom\": [\n            \"agent_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"databases_project_id_projects_id_fk\": {\n          \"name\": \"databases_project_id_projects_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"projects\",\n          \"columnsFrom\": [\n            \"project_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"no action\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.restorations\": {\n      \"name\": \"restorations\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"restorations_backup_id_backups_id_fk\": {\n          \"name\": \"restorations_backup_id_backups_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_database_id_databases_id_fk\": {\n          \"name\": \"restorations_database_id_databases_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.retention_policies\": {\n      \"name\": \"retention_policies\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"type\": {\n          \"name\": \"type\",\n          \"type\": \"retention_policy_type\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"count\": {\n          \"name\": \"count\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"days\": {\n          \"name\": \"days\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 30\n        },\n        \"gfs_daily\": {\n          \"name\": \"gfs_daily\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"gfs_weekly\": {\n          \"name\": \"gfs_weekly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 4\n        },\n        \"gfs_monthly\": {\n          \"name\": \"gfs_monthly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 12\n        },\n        \"gfs_yearly\": {\n          \"name\": \"gfs_yearly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 3\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"retention_policies_database_id_databases_id_fk\": {\n          \"name\": \"retention_policies_database_id_databases_id_fk\",\n          \"tableFrom\": \"retention_policies\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.agents\": {\n      \"name\": \"agents\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"version\": {\n          \"name\": \"version\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"agents_slug_unique\": {\n          \"name\": \"agents_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_channel\": {\n      \"name\": \"notification_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"notification_channel_organization_id_organization_id_fk\": {\n          \"name\": \"notification_channel_organization_id_organization_id_fk\",\n          \"tableFrom\": \"notification_channel\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_notification_channels\": {\n      \"name\": \"organization_notification_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_notification_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_notification_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_notification_channels_organization_id_notification_channel_id_unique\": {\n          \"name\": \"organization_notification_channels_organization_id_notification_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"notification_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.alert_policy\": {\n      \"name\": \"alert_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"event_kind\": {\n          \"name\": \"event_kind\",\n          \"type\": \"event_kind[]\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"alert_policy_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"alert_policy_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"alert_policy_database_id_databases_id_fk\": {\n          \"name\": \"alert_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_log\": {\n      \"name\": \"notification_log\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"channel_id\": {\n          \"name\": \"channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"policy_id\": {\n          \"name\": \"policy_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"event\": {\n          \"name\": \"event\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_name\": {\n          \"name\": \"provider_name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"title\": {\n          \"name\": \"title\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"message\": {\n          \"name\": \"message\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"level\": {\n          \"name\": \"level\",\n          \"type\": \"level\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"payload\": {\n          \"name\": \"payload\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"success\": {\n          \"name\": \"success\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"error\": {\n          \"name\": \"error\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider_response\": {\n          \"name\": \"provider_response\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"sent_at\": {\n          \"name\": \"sent_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_storage_channels\": {\n      \"name\": \"organization_storage_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_storage_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_storage_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_storage_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_storage_channels_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"organization_storage_channels_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"organization_storage_channels\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_storage_channels_organization_id_storage_channel_id_unique\": {\n          \"name\": \"organization_storage_channels_organization_id_storage_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"storage_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.storage_channel\": {\n      \"name\": \"storage_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_storage_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"storage_channel_organization_id_organization_id_fk\": {\n          \"name\": \"storage_channel_organization_id_organization_id_fk\",\n          \"tableFrom\": \"storage_channel\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.storage_policy\": {\n      \"name\": \"storage_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"storage_policy_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"storage_policy_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"storage_policy\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"storage_policy_database_id_databases_id_fk\": {\n          \"name\": \"storage_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"storage_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backup_storage\": {\n      \"name\": \"backup_storage\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"backup_storage_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'pending'\"\n        },\n        \"path\": {\n          \"name\": \"path\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"size\": {\n          \"name\": \"size\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"checksum\": {\n          \"name\": \"checksum\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backup_storage_backup_id_backups_id_fk\": {\n          \"name\": \"backup_storage_backup_id_backups_id_fk\",\n          \"tableFrom\": \"backup_storage\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"backup_storage_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"backup_storage_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"backup_storage\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    }\n  },\n  \"enums\": {\n    \"public.user_themes\": {\n      \"name\": \"user_themes\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"light\",\n        \"dark\",\n        \"system\"\n      ]\n    },\n    \"public.retention_policy_type\": {\n      \"name\": \"retention_policy_type\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"count\",\n        \"days\",\n        \"gfs\"\n      ]\n    },\n    \"public.provider_kind\": {\n      \"name\": \"provider_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"slack\",\n        \"smtp\",\n        \"discord\",\n        \"telegram\",\n        \"gotify\",\n        \"ntfy\",\n        \"webhook\"\n      ]\n    },\n    \"public.event_kind\": {\n      \"name\": \"event_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"error_backup\",\n        \"error_restore\",\n        \"success_restore\",\n        \"success_backup\",\n        \"weekly_report\"\n      ]\n    },\n    \"public.level\": {\n      \"name\": \"level\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"critical\",\n        \"warning\",\n        \"info\"\n      ]\n    },\n    \"public.provider_storage_kind\": {\n      \"name\": \"provider_storage_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\"\n      ]\n    },\n    \"public.backup_storage_status\": {\n      \"name\": \"backup_storage_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"pending\",\n        \"success\",\n        \"failed\"\n      ]\n    },\n    \"public.dbms_status\": {\n      \"name\": \"dbms_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"postgresql\",\n        \"mysql\"\n      ]\n    },\n    \"public.status\": {\n      \"name\": \"status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"waiting\",\n        \"ongoing\",\n        \"failed\",\n        \"success\"\n      ]\n    },\n    \"public.type_storage\": {\n      \"name\": \"type_storage\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\"\n      ]\n    }\n  },\n  \"schemas\": {},\n  \"sequences\": {},\n  \"roles\": {},\n  \"policies\": {},\n  \"views\": {},\n  \"_meta\": {\n    \"columns\": {},\n    \"schemas\": {},\n    \"tables\": {}\n  }\n}"
  },
  {
    "path": "src/db/migrations/meta/0026_snapshot.json",
    "content": "{\n  \"id\": \"5d244170-557d-433b-8acd-742ead8246c8\",\n  \"prevId\": \"2767f202-1e4b-42b1-8be0-1fa9dcd48cbb\",\n  \"version\": \"7\",\n  \"dialect\": \"postgresql\",\n  \"tables\": {\n    \"public.settings\": {\n      \"name\": \"settings\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"storage\": {\n          \"name\": \"storage\",\n          \"type\": \"type_storage\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'local'\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"s3_endpoint_url\": {\n          \"name\": \"s3_endpoint_url\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_access_key_id\": {\n          \"name\": \"s3_access_key_id\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_secret_access_key\": {\n          \"name\": \"s3_secret_access_key\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_bucket_name\": {\n          \"name\": \"s3_bucket_name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_password\": {\n          \"name\": \"smtp_password\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_from\": {\n          \"name\": \"smtp_from\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_host\": {\n          \"name\": \"smtp_host\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_port\": {\n          \"name\": \"smtp_port\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_user\": {\n          \"name\": \"smtp_user\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"default_storage_channel_id\": {\n          \"name\": \"default_storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"settings_default_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"settings_default_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"settings\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"default_storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"set null\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"settings_name_unique\": {\n          \"name\": \"settings_name_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"name\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.account\": {\n      \"name\": \"account\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"account_id\": {\n          \"name\": \"account_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"access_token\": {\n          \"name\": \"access_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token\": {\n          \"name\": \"refresh_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"id_token\": {\n          \"name\": \"id_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"access_token_expires_at\": {\n          \"name\": \"access_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token_expires_at\": {\n          \"name\": \"refresh_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"scope\": {\n          \"name\": \"scope\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"password\": {\n          \"name\": \"password\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"account_user_id_user_id_fk\": {\n          \"name\": \"account_user_id_user_id_fk\",\n          \"tableFrom\": \"account\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.passkey\": {\n      \"name\": \"passkey\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"publicKey\": {\n          \"name\": \"publicKey\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"userId\": {\n          \"name\": \"userId\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"credentialId\": {\n          \"name\": \"credentialId\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"counter\": {\n          \"name\": \"counter\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"deviceType\": {\n          \"name\": \"deviceType\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backedUp\": {\n          \"name\": \"backedUp\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"transports\": {\n          \"name\": \"transports\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"passkey_userId_user_id_fk\": {\n          \"name\": \"passkey_userId_user_id_fk\",\n          \"tableFrom\": \"passkey\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"userId\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.session\": {\n      \"name\": \"session\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"token\": {\n          \"name\": \"token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"ip_address\": {\n          \"name\": \"ip_address\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_agent\": {\n          \"name\": \"user_agent\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"impersonated_by\": {\n          \"name\": \"impersonated_by\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"active_organization_id\": {\n          \"name\": \"active_organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"session_user_id_user_id_fk\": {\n          \"name\": \"session_user_id_user_id_fk\",\n          \"tableFrom\": \"session\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"session_token_unique\": {\n          \"name\": \"session_token_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"token\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.two_factor\": {\n      \"name\": \"two_factor\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"secret\": {\n          \"name\": \"secret\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backup_codes\": {\n          \"name\": \"backup_codes\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"two_factor_user_id_user_id_fk\": {\n          \"name\": \"two_factor_user_id_user_id_fk\",\n          \"tableFrom\": \"two_factor\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.user\": {\n      \"name\": \"user\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email_verified\": {\n          \"name\": \"email_verified\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"image\": {\n          \"name\": \"image\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"theme\": {\n          \"name\": \"theme\",\n          \"type\": \"user_themes\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'light'\"\n        },\n        \"banned\": {\n          \"name\": \"banned\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_reason\": {\n          \"name\": \"ban_reason\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_expires\": {\n          \"name\": \"ban_expires\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"lastChangedPasswordAt\": {\n          \"name\": \"lastChangedPasswordAt\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"two_factor_enabled\": {\n          \"name\": \"two_factor_enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"user_email_unique\": {\n          \"name\": \"user_email_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"email\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.verification\": {\n      \"name\": \"verification\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"identifier\": {\n          \"name\": \"identifier\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"value\": {\n          \"name\": \"value\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization\": {\n      \"name\": \"organization\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"logo\": {\n          \"name\": \"logo\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"metadata\": {\n          \"name\": \"metadata\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_slug_unique\": {\n          \"name\": \"organization_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.member\": {\n      \"name\": \"member\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"member_organization_id_organization_id_fk\": {\n          \"name\": \"member_organization_id_organization_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"member_user_id_user_id_fk\": {\n          \"name\": \"member_user_id_user_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.invitation\": {\n      \"name\": \"invitation\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"inviter_id\": {\n          \"name\": \"inviter_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"invitation_organization_id_organization_id_fk\": {\n          \"name\": \"invitation_organization_id_organization_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"invitation_inviter_id_user_id_fk\": {\n          \"name\": \"invitation_inviter_id_user_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"inviter_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.projects\": {\n      \"name\": \"projects\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"projects_organization_id_organization_id_fk\": {\n          \"name\": \"projects_organization_id_organization_id_fk\",\n          \"tableFrom\": \"projects\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"projects_slug_unique\": {\n          \"name\": \"projects_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backups\": {\n      \"name\": \"backups\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"file\": {\n          \"name\": \"file\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"file_size\": {\n          \"name\": \"file_size\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backups_database_id_databases_id_fk\": {\n          \"name\": \"backups_database_id_databases_id_fk\",\n          \"tableFrom\": \"backups\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.databases\": {\n      \"name\": \"databases\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"agent_database_id\": {\n          \"name\": \"agent_database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"dbms\": {\n          \"name\": \"dbms\",\n          \"type\": \"dbms_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_policy\": {\n          \"name\": \"backup_policy\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"is_waiting_for_backup\": {\n          \"name\": \"is_waiting_for_backup\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"backup_to_restore\": {\n          \"name\": \"backup_to_restore\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"agent_id\": {\n          \"name\": \"agent_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"project_id\": {\n          \"name\": \"project_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"databases_agent_id_agents_id_fk\": {\n          \"name\": \"databases_agent_id_agents_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"agents\",\n          \"columnsFrom\": [\n            \"agent_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"databases_project_id_projects_id_fk\": {\n          \"name\": \"databases_project_id_projects_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"projects\",\n          \"columnsFrom\": [\n            \"project_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"no action\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.restorations\": {\n      \"name\": \"restorations\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"backup_storage_id\": {\n          \"name\": \"backup_storage_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"restorations_backup_storage_id_backup_storage_id_fk\": {\n          \"name\": \"restorations_backup_storage_id_backup_storage_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backup_storage\",\n          \"columnsFrom\": [\n            \"backup_storage_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_backup_id_backups_id_fk\": {\n          \"name\": \"restorations_backup_id_backups_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_database_id_databases_id_fk\": {\n          \"name\": \"restorations_database_id_databases_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.retention_policies\": {\n      \"name\": \"retention_policies\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"type\": {\n          \"name\": \"type\",\n          \"type\": \"retention_policy_type\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"count\": {\n          \"name\": \"count\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"days\": {\n          \"name\": \"days\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 30\n        },\n        \"gfs_daily\": {\n          \"name\": \"gfs_daily\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"gfs_weekly\": {\n          \"name\": \"gfs_weekly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 4\n        },\n        \"gfs_monthly\": {\n          \"name\": \"gfs_monthly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 12\n        },\n        \"gfs_yearly\": {\n          \"name\": \"gfs_yearly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 3\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"retention_policies_database_id_databases_id_fk\": {\n          \"name\": \"retention_policies_database_id_databases_id_fk\",\n          \"tableFrom\": \"retention_policies\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.agents\": {\n      \"name\": \"agents\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"version\": {\n          \"name\": \"version\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"agents_slug_unique\": {\n          \"name\": \"agents_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_channel\": {\n      \"name\": \"notification_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"notification_channel_organization_id_organization_id_fk\": {\n          \"name\": \"notification_channel_organization_id_organization_id_fk\",\n          \"tableFrom\": \"notification_channel\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_notification_channels\": {\n      \"name\": \"organization_notification_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_notification_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_notification_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_notification_channels_organization_id_notification_channel_id_unique\": {\n          \"name\": \"organization_notification_channels_organization_id_notification_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"notification_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.alert_policy\": {\n      \"name\": \"alert_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"event_kind\": {\n          \"name\": \"event_kind\",\n          \"type\": \"event_kind[]\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"alert_policy_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"alert_policy_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"alert_policy_database_id_databases_id_fk\": {\n          \"name\": \"alert_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_log\": {\n      \"name\": \"notification_log\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"channel_id\": {\n          \"name\": \"channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"policy_id\": {\n          \"name\": \"policy_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"event\": {\n          \"name\": \"event\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_name\": {\n          \"name\": \"provider_name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"title\": {\n          \"name\": \"title\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"message\": {\n          \"name\": \"message\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"level\": {\n          \"name\": \"level\",\n          \"type\": \"level\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"payload\": {\n          \"name\": \"payload\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"success\": {\n          \"name\": \"success\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"error\": {\n          \"name\": \"error\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider_response\": {\n          \"name\": \"provider_response\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"sent_at\": {\n          \"name\": \"sent_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_storage_channels\": {\n      \"name\": \"organization_storage_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_storage_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_storage_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_storage_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_storage_channels_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"organization_storage_channels_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"organization_storage_channels\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_storage_channels_organization_id_storage_channel_id_unique\": {\n          \"name\": \"organization_storage_channels_organization_id_storage_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"storage_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.storage_channel\": {\n      \"name\": \"storage_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_storage_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"storage_channel_organization_id_organization_id_fk\": {\n          \"name\": \"storage_channel_organization_id_organization_id_fk\",\n          \"tableFrom\": \"storage_channel\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.storage_policy\": {\n      \"name\": \"storage_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"storage_policy_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"storage_policy_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"storage_policy\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"storage_policy_database_id_databases_id_fk\": {\n          \"name\": \"storage_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"storage_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backup_storage\": {\n      \"name\": \"backup_storage\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"backup_storage_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'pending'\"\n        },\n        \"path\": {\n          \"name\": \"path\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"size\": {\n          \"name\": \"size\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"checksum\": {\n          \"name\": \"checksum\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backup_storage_backup_id_backups_id_fk\": {\n          \"name\": \"backup_storage_backup_id_backups_id_fk\",\n          \"tableFrom\": \"backup_storage\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"backup_storage_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"backup_storage_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"backup_storage\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    }\n  },\n  \"enums\": {\n    \"public.user_themes\": {\n      \"name\": \"user_themes\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"light\",\n        \"dark\",\n        \"system\"\n      ]\n    },\n    \"public.retention_policy_type\": {\n      \"name\": \"retention_policy_type\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"count\",\n        \"days\",\n        \"gfs\"\n      ]\n    },\n    \"public.provider_kind\": {\n      \"name\": \"provider_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"slack\",\n        \"smtp\",\n        \"discord\",\n        \"telegram\",\n        \"gotify\",\n        \"ntfy\",\n        \"webhook\"\n      ]\n    },\n    \"public.event_kind\": {\n      \"name\": \"event_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"error_backup\",\n        \"error_restore\",\n        \"success_restore\",\n        \"success_backup\",\n        \"weekly_report\"\n      ]\n    },\n    \"public.level\": {\n      \"name\": \"level\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"critical\",\n        \"warning\",\n        \"info\"\n      ]\n    },\n    \"public.provider_storage_kind\": {\n      \"name\": \"provider_storage_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\"\n      ]\n    },\n    \"public.backup_storage_status\": {\n      \"name\": \"backup_storage_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"pending\",\n        \"success\",\n        \"failed\"\n      ]\n    },\n    \"public.dbms_status\": {\n      \"name\": \"dbms_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"postgresql\",\n        \"mysql\"\n      ]\n    },\n    \"public.status\": {\n      \"name\": \"status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"waiting\",\n        \"ongoing\",\n        \"failed\",\n        \"success\"\n      ]\n    },\n    \"public.type_storage\": {\n      \"name\": \"type_storage\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\"\n      ]\n    }\n  },\n  \"schemas\": {},\n  \"sequences\": {},\n  \"roles\": {},\n  \"policies\": {},\n  \"views\": {},\n  \"_meta\": {\n    \"columns\": {},\n    \"schemas\": {},\n    \"tables\": {}\n  }\n}"
  },
  {
    "path": "src/db/migrations/meta/0027_snapshot.json",
    "content": "{\n  \"id\": \"5db47099-e931-4eaa-8678-d3314a8336ca\",\n  \"prevId\": \"5d244170-557d-433b-8acd-742ead8246c8\",\n  \"version\": \"7\",\n  \"dialect\": \"postgresql\",\n  \"tables\": {\n    \"public.settings\": {\n      \"name\": \"settings\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"storage\": {\n          \"name\": \"storage\",\n          \"type\": \"type_storage\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'local'\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"s3_endpoint_url\": {\n          \"name\": \"s3_endpoint_url\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_access_key_id\": {\n          \"name\": \"s3_access_key_id\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_secret_access_key\": {\n          \"name\": \"s3_secret_access_key\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"s3_bucket_name\": {\n          \"name\": \"s3_bucket_name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_password\": {\n          \"name\": \"smtp_password\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_from\": {\n          \"name\": \"smtp_from\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_host\": {\n          \"name\": \"smtp_host\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_port\": {\n          \"name\": \"smtp_port\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_user\": {\n          \"name\": \"smtp_user\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"default_storage_channel_id\": {\n          \"name\": \"default_storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"settings_default_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"settings_default_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"settings\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"default_storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"set null\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"settings_name_unique\": {\n          \"name\": \"settings_name_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"name\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.account\": {\n      \"name\": \"account\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"account_id\": {\n          \"name\": \"account_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"access_token\": {\n          \"name\": \"access_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token\": {\n          \"name\": \"refresh_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"id_token\": {\n          \"name\": \"id_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"access_token_expires_at\": {\n          \"name\": \"access_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token_expires_at\": {\n          \"name\": \"refresh_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"scope\": {\n          \"name\": \"scope\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"password\": {\n          \"name\": \"password\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"account_user_id_user_id_fk\": {\n          \"name\": \"account_user_id_user_id_fk\",\n          \"tableFrom\": \"account\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.passkey\": {\n      \"name\": \"passkey\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"publicKey\": {\n          \"name\": \"publicKey\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"userId\": {\n          \"name\": \"userId\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"credentialId\": {\n          \"name\": \"credentialId\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"counter\": {\n          \"name\": \"counter\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"deviceType\": {\n          \"name\": \"deviceType\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backedUp\": {\n          \"name\": \"backedUp\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"transports\": {\n          \"name\": \"transports\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"passkey_userId_user_id_fk\": {\n          \"name\": \"passkey_userId_user_id_fk\",\n          \"tableFrom\": \"passkey\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"userId\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.session\": {\n      \"name\": \"session\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"token\": {\n          \"name\": \"token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"ip_address\": {\n          \"name\": \"ip_address\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_agent\": {\n          \"name\": \"user_agent\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"impersonated_by\": {\n          \"name\": \"impersonated_by\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"active_organization_id\": {\n          \"name\": \"active_organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"session_user_id_user_id_fk\": {\n          \"name\": \"session_user_id_user_id_fk\",\n          \"tableFrom\": \"session\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"session_token_unique\": {\n          \"name\": \"session_token_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"token\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.two_factor\": {\n      \"name\": \"two_factor\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"secret\": {\n          \"name\": \"secret\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backup_codes\": {\n          \"name\": \"backup_codes\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"two_factor_user_id_user_id_fk\": {\n          \"name\": \"two_factor_user_id_user_id_fk\",\n          \"tableFrom\": \"two_factor\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.user\": {\n      \"name\": \"user\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email_verified\": {\n          \"name\": \"email_verified\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"image\": {\n          \"name\": \"image\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"theme\": {\n          \"name\": \"theme\",\n          \"type\": \"user_themes\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'light'\"\n        },\n        \"banned\": {\n          \"name\": \"banned\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_reason\": {\n          \"name\": \"ban_reason\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_expires\": {\n          \"name\": \"ban_expires\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"lastChangedPasswordAt\": {\n          \"name\": \"lastChangedPasswordAt\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"two_factor_enabled\": {\n          \"name\": \"two_factor_enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"user_email_unique\": {\n          \"name\": \"user_email_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"email\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.verification\": {\n      \"name\": \"verification\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"identifier\": {\n          \"name\": \"identifier\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"value\": {\n          \"name\": \"value\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization\": {\n      \"name\": \"organization\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"logo\": {\n          \"name\": \"logo\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"metadata\": {\n          \"name\": \"metadata\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_slug_unique\": {\n          \"name\": \"organization_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.member\": {\n      \"name\": \"member\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"member_organization_id_organization_id_fk\": {\n          \"name\": \"member_organization_id_organization_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"member_user_id_user_id_fk\": {\n          \"name\": \"member_user_id_user_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.invitation\": {\n      \"name\": \"invitation\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"inviter_id\": {\n          \"name\": \"inviter_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"invitation_organization_id_organization_id_fk\": {\n          \"name\": \"invitation_organization_id_organization_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"invitation_inviter_id_user_id_fk\": {\n          \"name\": \"invitation_inviter_id_user_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"inviter_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.projects\": {\n      \"name\": \"projects\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"projects_organization_id_organization_id_fk\": {\n          \"name\": \"projects_organization_id_organization_id_fk\",\n          \"tableFrom\": \"projects\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"projects_slug_unique\": {\n          \"name\": \"projects_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backups\": {\n      \"name\": \"backups\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"file\": {\n          \"name\": \"file\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"file_size\": {\n          \"name\": \"file_size\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"imported\": {\n          \"name\": \"imported\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backups_database_id_databases_id_fk\": {\n          \"name\": \"backups_database_id_databases_id_fk\",\n          \"tableFrom\": \"backups\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.databases\": {\n      \"name\": \"databases\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"agent_database_id\": {\n          \"name\": \"agent_database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"dbms\": {\n          \"name\": \"dbms\",\n          \"type\": \"dbms_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_policy\": {\n          \"name\": \"backup_policy\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"is_waiting_for_backup\": {\n          \"name\": \"is_waiting_for_backup\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"backup_to_restore\": {\n          \"name\": \"backup_to_restore\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"agent_id\": {\n          \"name\": \"agent_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"project_id\": {\n          \"name\": \"project_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"databases_agent_id_agents_id_fk\": {\n          \"name\": \"databases_agent_id_agents_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"agents\",\n          \"columnsFrom\": [\n            \"agent_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"databases_project_id_projects_id_fk\": {\n          \"name\": \"databases_project_id_projects_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"projects\",\n          \"columnsFrom\": [\n            \"project_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"no action\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.restorations\": {\n      \"name\": \"restorations\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"backup_storage_id\": {\n          \"name\": \"backup_storage_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"restorations_backup_storage_id_backup_storage_id_fk\": {\n          \"name\": \"restorations_backup_storage_id_backup_storage_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backup_storage\",\n          \"columnsFrom\": [\n            \"backup_storage_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_backup_id_backups_id_fk\": {\n          \"name\": \"restorations_backup_id_backups_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_database_id_databases_id_fk\": {\n          \"name\": \"restorations_database_id_databases_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.retention_policies\": {\n      \"name\": \"retention_policies\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"type\": {\n          \"name\": \"type\",\n          \"type\": \"retention_policy_type\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"count\": {\n          \"name\": \"count\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"days\": {\n          \"name\": \"days\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 30\n        },\n        \"gfs_daily\": {\n          \"name\": \"gfs_daily\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"gfs_weekly\": {\n          \"name\": \"gfs_weekly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 4\n        },\n        \"gfs_monthly\": {\n          \"name\": \"gfs_monthly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 12\n        },\n        \"gfs_yearly\": {\n          \"name\": \"gfs_yearly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 3\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"retention_policies_database_id_databases_id_fk\": {\n          \"name\": \"retention_policies_database_id_databases_id_fk\",\n          \"tableFrom\": \"retention_policies\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.agents\": {\n      \"name\": \"agents\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"version\": {\n          \"name\": \"version\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"agents_slug_unique\": {\n          \"name\": \"agents_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_channel\": {\n      \"name\": \"notification_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"notification_channel_organization_id_organization_id_fk\": {\n          \"name\": \"notification_channel_organization_id_organization_id_fk\",\n          \"tableFrom\": \"notification_channel\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_notification_channels\": {\n      \"name\": \"organization_notification_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_notification_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_notification_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_notification_channels_organization_id_notification_channel_id_unique\": {\n          \"name\": \"organization_notification_channels_organization_id_notification_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"notification_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.alert_policy\": {\n      \"name\": \"alert_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"event_kind\": {\n          \"name\": \"event_kind\",\n          \"type\": \"event_kind[]\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"alert_policy_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"alert_policy_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"alert_policy_database_id_databases_id_fk\": {\n          \"name\": \"alert_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_log\": {\n      \"name\": \"notification_log\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"channel_id\": {\n          \"name\": \"channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"policy_id\": {\n          \"name\": \"policy_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"event\": {\n          \"name\": \"event\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_name\": {\n          \"name\": \"provider_name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"title\": {\n          \"name\": \"title\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"message\": {\n          \"name\": \"message\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"level\": {\n          \"name\": \"level\",\n          \"type\": \"level\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"payload\": {\n          \"name\": \"payload\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"success\": {\n          \"name\": \"success\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"error\": {\n          \"name\": \"error\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider_response\": {\n          \"name\": \"provider_response\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"sent_at\": {\n          \"name\": \"sent_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_storage_channels\": {\n      \"name\": \"organization_storage_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_storage_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_storage_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_storage_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_storage_channels_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"organization_storage_channels_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"organization_storage_channels\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_storage_channels_organization_id_storage_channel_id_unique\": {\n          \"name\": \"organization_storage_channels_organization_id_storage_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"storage_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.storage_channel\": {\n      \"name\": \"storage_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_storage_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"storage_channel_organization_id_organization_id_fk\": {\n          \"name\": \"storage_channel_organization_id_organization_id_fk\",\n          \"tableFrom\": \"storage_channel\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.storage_policy\": {\n      \"name\": \"storage_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"storage_policy_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"storage_policy_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"storage_policy\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"storage_policy_database_id_databases_id_fk\": {\n          \"name\": \"storage_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"storage_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backup_storage\": {\n      \"name\": \"backup_storage\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"backup_storage_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'pending'\"\n        },\n        \"path\": {\n          \"name\": \"path\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"size\": {\n          \"name\": \"size\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"checksum\": {\n          \"name\": \"checksum\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backup_storage_backup_id_backups_id_fk\": {\n          \"name\": \"backup_storage_backup_id_backups_id_fk\",\n          \"tableFrom\": \"backup_storage\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"backup_storage_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"backup_storage_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"backup_storage\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    }\n  },\n  \"enums\": {\n    \"public.user_themes\": {\n      \"name\": \"user_themes\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"light\",\n        \"dark\",\n        \"system\"\n      ]\n    },\n    \"public.retention_policy_type\": {\n      \"name\": \"retention_policy_type\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"count\",\n        \"days\",\n        \"gfs\"\n      ]\n    },\n    \"public.provider_kind\": {\n      \"name\": \"provider_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"slack\",\n        \"smtp\",\n        \"discord\",\n        \"telegram\",\n        \"gotify\",\n        \"ntfy\",\n        \"webhook\"\n      ]\n    },\n    \"public.event_kind\": {\n      \"name\": \"event_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"error_backup\",\n        \"error_restore\",\n        \"success_restore\",\n        \"success_backup\",\n        \"weekly_report\"\n      ]\n    },\n    \"public.level\": {\n      \"name\": \"level\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"critical\",\n        \"warning\",\n        \"info\"\n      ]\n    },\n    \"public.provider_storage_kind\": {\n      \"name\": \"provider_storage_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\"\n      ]\n    },\n    \"public.backup_storage_status\": {\n      \"name\": \"backup_storage_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"pending\",\n        \"success\",\n        \"failed\"\n      ]\n    },\n    \"public.dbms_status\": {\n      \"name\": \"dbms_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"postgresql\",\n        \"mysql\"\n      ]\n    },\n    \"public.status\": {\n      \"name\": \"status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"waiting\",\n        \"ongoing\",\n        \"failed\",\n        \"success\"\n      ]\n    },\n    \"public.type_storage\": {\n      \"name\": \"type_storage\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\"\n      ]\n    }\n  },\n  \"schemas\": {},\n  \"sequences\": {},\n  \"roles\": {},\n  \"policies\": {},\n  \"views\": {},\n  \"_meta\": {\n    \"columns\": {},\n    \"schemas\": {},\n    \"tables\": {}\n  }\n}"
  },
  {
    "path": "src/db/migrations/meta/0028_snapshot.json",
    "content": "{\n  \"id\": \"358236a9-653f-4c5c-abc2-cd5d15eb1f89\",\n  \"prevId\": \"5db47099-e931-4eaa-8678-d3314a8336ca\",\n  \"version\": \"7\",\n  \"dialect\": \"postgresql\",\n  \"tables\": {\n    \"public.settings\": {\n      \"name\": \"settings\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"smtp_password\": {\n          \"name\": \"smtp_password\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_from\": {\n          \"name\": \"smtp_from\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_host\": {\n          \"name\": \"smtp_host\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_port\": {\n          \"name\": \"smtp_port\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_user\": {\n          \"name\": \"smtp_user\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"default_storage_channel_id\": {\n          \"name\": \"default_storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"settings_default_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"settings_default_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"settings\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"default_storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"set null\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"settings_name_unique\": {\n          \"name\": \"settings_name_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"name\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.account\": {\n      \"name\": \"account\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"account_id\": {\n          \"name\": \"account_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"access_token\": {\n          \"name\": \"access_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token\": {\n          \"name\": \"refresh_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"id_token\": {\n          \"name\": \"id_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"access_token_expires_at\": {\n          \"name\": \"access_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token_expires_at\": {\n          \"name\": \"refresh_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"scope\": {\n          \"name\": \"scope\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"password\": {\n          \"name\": \"password\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"account_user_id_user_id_fk\": {\n          \"name\": \"account_user_id_user_id_fk\",\n          \"tableFrom\": \"account\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.passkey\": {\n      \"name\": \"passkey\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"publicKey\": {\n          \"name\": \"publicKey\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"userId\": {\n          \"name\": \"userId\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"credentialId\": {\n          \"name\": \"credentialId\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"counter\": {\n          \"name\": \"counter\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"deviceType\": {\n          \"name\": \"deviceType\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backedUp\": {\n          \"name\": \"backedUp\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"transports\": {\n          \"name\": \"transports\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"passkey_userId_user_id_fk\": {\n          \"name\": \"passkey_userId_user_id_fk\",\n          \"tableFrom\": \"passkey\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"userId\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.session\": {\n      \"name\": \"session\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"token\": {\n          \"name\": \"token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"ip_address\": {\n          \"name\": \"ip_address\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_agent\": {\n          \"name\": \"user_agent\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"impersonated_by\": {\n          \"name\": \"impersonated_by\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"active_organization_id\": {\n          \"name\": \"active_organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"session_user_id_user_id_fk\": {\n          \"name\": \"session_user_id_user_id_fk\",\n          \"tableFrom\": \"session\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"session_token_unique\": {\n          \"name\": \"session_token_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"token\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.two_factor\": {\n      \"name\": \"two_factor\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"secret\": {\n          \"name\": \"secret\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backup_codes\": {\n          \"name\": \"backup_codes\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"two_factor_user_id_user_id_fk\": {\n          \"name\": \"two_factor_user_id_user_id_fk\",\n          \"tableFrom\": \"two_factor\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.user\": {\n      \"name\": \"user\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email_verified\": {\n          \"name\": \"email_verified\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"image\": {\n          \"name\": \"image\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"theme\": {\n          \"name\": \"theme\",\n          \"type\": \"user_themes\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'light'\"\n        },\n        \"banned\": {\n          \"name\": \"banned\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_reason\": {\n          \"name\": \"ban_reason\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_expires\": {\n          \"name\": \"ban_expires\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"lastChangedPasswordAt\": {\n          \"name\": \"lastChangedPasswordAt\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"two_factor_enabled\": {\n          \"name\": \"two_factor_enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"user_email_unique\": {\n          \"name\": \"user_email_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"email\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.verification\": {\n      \"name\": \"verification\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"identifier\": {\n          \"name\": \"identifier\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"value\": {\n          \"name\": \"value\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization\": {\n      \"name\": \"organization\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"logo\": {\n          \"name\": \"logo\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"metadata\": {\n          \"name\": \"metadata\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_slug_unique\": {\n          \"name\": \"organization_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.member\": {\n      \"name\": \"member\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"member_organization_id_organization_id_fk\": {\n          \"name\": \"member_organization_id_organization_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"member_user_id_user_id_fk\": {\n          \"name\": \"member_user_id_user_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.invitation\": {\n      \"name\": \"invitation\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"inviter_id\": {\n          \"name\": \"inviter_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"invitation_organization_id_organization_id_fk\": {\n          \"name\": \"invitation_organization_id_organization_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"invitation_inviter_id_user_id_fk\": {\n          \"name\": \"invitation_inviter_id_user_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"inviter_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.projects\": {\n      \"name\": \"projects\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"projects_organization_id_organization_id_fk\": {\n          \"name\": \"projects_organization_id_organization_id_fk\",\n          \"tableFrom\": \"projects\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"projects_slug_unique\": {\n          \"name\": \"projects_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backups\": {\n      \"name\": \"backups\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"file\": {\n          \"name\": \"file\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"file_size\": {\n          \"name\": \"file_size\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"imported\": {\n          \"name\": \"imported\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backups_database_id_databases_id_fk\": {\n          \"name\": \"backups_database_id_databases_id_fk\",\n          \"tableFrom\": \"backups\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.databases\": {\n      \"name\": \"databases\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"agent_database_id\": {\n          \"name\": \"agent_database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"dbms\": {\n          \"name\": \"dbms\",\n          \"type\": \"dbms_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_policy\": {\n          \"name\": \"backup_policy\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"is_waiting_for_backup\": {\n          \"name\": \"is_waiting_for_backup\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"backup_to_restore\": {\n          \"name\": \"backup_to_restore\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"agent_id\": {\n          \"name\": \"agent_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"project_id\": {\n          \"name\": \"project_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"databases_agent_id_agents_id_fk\": {\n          \"name\": \"databases_agent_id_agents_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"agents\",\n          \"columnsFrom\": [\n            \"agent_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"databases_project_id_projects_id_fk\": {\n          \"name\": \"databases_project_id_projects_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"projects\",\n          \"columnsFrom\": [\n            \"project_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"no action\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.restorations\": {\n      \"name\": \"restorations\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"backup_storage_id\": {\n          \"name\": \"backup_storage_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"restorations_backup_storage_id_backup_storage_id_fk\": {\n          \"name\": \"restorations_backup_storage_id_backup_storage_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backup_storage\",\n          \"columnsFrom\": [\n            \"backup_storage_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_backup_id_backups_id_fk\": {\n          \"name\": \"restorations_backup_id_backups_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_database_id_databases_id_fk\": {\n          \"name\": \"restorations_database_id_databases_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.retention_policies\": {\n      \"name\": \"retention_policies\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"type\": {\n          \"name\": \"type\",\n          \"type\": \"retention_policy_type\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"count\": {\n          \"name\": \"count\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"days\": {\n          \"name\": \"days\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 30\n        },\n        \"gfs_daily\": {\n          \"name\": \"gfs_daily\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"gfs_weekly\": {\n          \"name\": \"gfs_weekly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 4\n        },\n        \"gfs_monthly\": {\n          \"name\": \"gfs_monthly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 12\n        },\n        \"gfs_yearly\": {\n          \"name\": \"gfs_yearly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 3\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"retention_policies_database_id_databases_id_fk\": {\n          \"name\": \"retention_policies_database_id_databases_id_fk\",\n          \"tableFrom\": \"retention_policies\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.agents\": {\n      \"name\": \"agents\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"version\": {\n          \"name\": \"version\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"agents_slug_unique\": {\n          \"name\": \"agents_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_channel\": {\n      \"name\": \"notification_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"notification_channel_organization_id_organization_id_fk\": {\n          \"name\": \"notification_channel_organization_id_organization_id_fk\",\n          \"tableFrom\": \"notification_channel\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_notification_channels\": {\n      \"name\": \"organization_notification_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_notification_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_notification_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_notification_channels_organization_id_notification_channel_id_unique\": {\n          \"name\": \"organization_notification_channels_organization_id_notification_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"notification_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.alert_policy\": {\n      \"name\": \"alert_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"event_kind\": {\n          \"name\": \"event_kind\",\n          \"type\": \"event_kind[]\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"alert_policy_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"alert_policy_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"alert_policy_database_id_databases_id_fk\": {\n          \"name\": \"alert_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_log\": {\n      \"name\": \"notification_log\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"channel_id\": {\n          \"name\": \"channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"policy_id\": {\n          \"name\": \"policy_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"event\": {\n          \"name\": \"event\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_name\": {\n          \"name\": \"provider_name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"title\": {\n          \"name\": \"title\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"message\": {\n          \"name\": \"message\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"level\": {\n          \"name\": \"level\",\n          \"type\": \"level\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"payload\": {\n          \"name\": \"payload\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"success\": {\n          \"name\": \"success\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"error\": {\n          \"name\": \"error\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider_response\": {\n          \"name\": \"provider_response\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"sent_at\": {\n          \"name\": \"sent_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_storage_channels\": {\n      \"name\": \"organization_storage_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_storage_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_storage_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_storage_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_storage_channels_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"organization_storage_channels_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"organization_storage_channels\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_storage_channels_organization_id_storage_channel_id_unique\": {\n          \"name\": \"organization_storage_channels_organization_id_storage_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"storage_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.storage_channel\": {\n      \"name\": \"storage_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_storage_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"storage_channel_organization_id_organization_id_fk\": {\n          \"name\": \"storage_channel_organization_id_organization_id_fk\",\n          \"tableFrom\": \"storage_channel\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.storage_policy\": {\n      \"name\": \"storage_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"storage_policy_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"storage_policy_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"storage_policy\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"storage_policy_database_id_databases_id_fk\": {\n          \"name\": \"storage_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"storage_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backup_storage\": {\n      \"name\": \"backup_storage\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"backup_storage_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'pending'\"\n        },\n        \"path\": {\n          \"name\": \"path\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"size\": {\n          \"name\": \"size\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"checksum\": {\n          \"name\": \"checksum\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backup_storage_backup_id_backups_id_fk\": {\n          \"name\": \"backup_storage_backup_id_backups_id_fk\",\n          \"tableFrom\": \"backup_storage\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"backup_storage_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"backup_storage_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"backup_storage\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    }\n  },\n  \"enums\": {\n    \"public.user_themes\": {\n      \"name\": \"user_themes\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"light\",\n        \"dark\",\n        \"system\"\n      ]\n    },\n    \"public.retention_policy_type\": {\n      \"name\": \"retention_policy_type\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"count\",\n        \"days\",\n        \"gfs\"\n      ]\n    },\n    \"public.provider_kind\": {\n      \"name\": \"provider_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"slack\",\n        \"smtp\",\n        \"discord\",\n        \"telegram\",\n        \"gotify\",\n        \"ntfy\",\n        \"webhook\"\n      ]\n    },\n    \"public.event_kind\": {\n      \"name\": \"event_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"error_backup\",\n        \"error_restore\",\n        \"success_restore\",\n        \"success_backup\",\n        \"weekly_report\"\n      ]\n    },\n    \"public.level\": {\n      \"name\": \"level\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"critical\",\n        \"warning\",\n        \"info\"\n      ]\n    },\n    \"public.provider_storage_kind\": {\n      \"name\": \"provider_storage_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\"\n      ]\n    },\n    \"public.backup_storage_status\": {\n      \"name\": \"backup_storage_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"pending\",\n        \"success\",\n        \"failed\"\n      ]\n    },\n    \"public.dbms_status\": {\n      \"name\": \"dbms_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"postgresql\",\n        \"mysql\"\n      ]\n    },\n    \"public.status\": {\n      \"name\": \"status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"waiting\",\n        \"ongoing\",\n        \"failed\",\n        \"success\"\n      ]\n    },\n    \"public.type_storage\": {\n      \"name\": \"type_storage\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\"\n      ]\n    }\n  },\n  \"schemas\": {},\n  \"sequences\": {},\n  \"roles\": {},\n  \"policies\": {},\n  \"views\": {},\n  \"_meta\": {\n    \"columns\": {},\n    \"schemas\": {},\n    \"tables\": {}\n  }\n}"
  },
  {
    "path": "src/db/migrations/meta/0029_snapshot.json",
    "content": "{\n  \"id\": \"709e5437-9dac-41a6-8cb0-54a569e15c6e\",\n  \"prevId\": \"358236a9-653f-4c5c-abc2-cd5d15eb1f89\",\n  \"version\": \"7\",\n  \"dialect\": \"postgresql\",\n  \"tables\": {\n    \"public.settings\": {\n      \"name\": \"settings\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"smtp_password\": {\n          \"name\": \"smtp_password\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_from\": {\n          \"name\": \"smtp_from\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_host\": {\n          \"name\": \"smtp_host\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_port\": {\n          \"name\": \"smtp_port\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_user\": {\n          \"name\": \"smtp_user\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"default_storage_channel_id\": {\n          \"name\": \"default_storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"settings_default_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"settings_default_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"settings\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"default_storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"set null\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"settings_name_unique\": {\n          \"name\": \"settings_name_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"name\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.account\": {\n      \"name\": \"account\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"account_id\": {\n          \"name\": \"account_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"access_token\": {\n          \"name\": \"access_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token\": {\n          \"name\": \"refresh_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"id_token\": {\n          \"name\": \"id_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"access_token_expires_at\": {\n          \"name\": \"access_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token_expires_at\": {\n          \"name\": \"refresh_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"scope\": {\n          \"name\": \"scope\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"password\": {\n          \"name\": \"password\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"account_user_id_user_id_fk\": {\n          \"name\": \"account_user_id_user_id_fk\",\n          \"tableFrom\": \"account\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.passkey\": {\n      \"name\": \"passkey\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"publicKey\": {\n          \"name\": \"publicKey\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"userId\": {\n          \"name\": \"userId\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"credentialId\": {\n          \"name\": \"credentialId\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"counter\": {\n          \"name\": \"counter\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"deviceType\": {\n          \"name\": \"deviceType\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backedUp\": {\n          \"name\": \"backedUp\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"transports\": {\n          \"name\": \"transports\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"passkey_userId_user_id_fk\": {\n          \"name\": \"passkey_userId_user_id_fk\",\n          \"tableFrom\": \"passkey\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"userId\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.session\": {\n      \"name\": \"session\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"token\": {\n          \"name\": \"token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"ip_address\": {\n          \"name\": \"ip_address\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_agent\": {\n          \"name\": \"user_agent\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"impersonated_by\": {\n          \"name\": \"impersonated_by\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"active_organization_id\": {\n          \"name\": \"active_organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"session_user_id_user_id_fk\": {\n          \"name\": \"session_user_id_user_id_fk\",\n          \"tableFrom\": \"session\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"session_token_unique\": {\n          \"name\": \"session_token_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"token\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.two_factor\": {\n      \"name\": \"two_factor\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"secret\": {\n          \"name\": \"secret\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backup_codes\": {\n          \"name\": \"backup_codes\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"two_factor_user_id_user_id_fk\": {\n          \"name\": \"two_factor_user_id_user_id_fk\",\n          \"tableFrom\": \"two_factor\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.user\": {\n      \"name\": \"user\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email_verified\": {\n          \"name\": \"email_verified\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"image\": {\n          \"name\": \"image\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"theme\": {\n          \"name\": \"theme\",\n          \"type\": \"user_themes\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'light'\"\n        },\n        \"banned\": {\n          \"name\": \"banned\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_reason\": {\n          \"name\": \"ban_reason\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_expires\": {\n          \"name\": \"ban_expires\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"lastConnectedAt\": {\n          \"name\": \"lastConnectedAt\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"lastChangedPasswordAt\": {\n          \"name\": \"lastChangedPasswordAt\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"two_factor_enabled\": {\n          \"name\": \"two_factor_enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"user_email_unique\": {\n          \"name\": \"user_email_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"email\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.verification\": {\n      \"name\": \"verification\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"identifier\": {\n          \"name\": \"identifier\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"value\": {\n          \"name\": \"value\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization\": {\n      \"name\": \"organization\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"logo\": {\n          \"name\": \"logo\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"metadata\": {\n          \"name\": \"metadata\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_slug_unique\": {\n          \"name\": \"organization_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.member\": {\n      \"name\": \"member\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"member_organization_id_organization_id_fk\": {\n          \"name\": \"member_organization_id_organization_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"member_user_id_user_id_fk\": {\n          \"name\": \"member_user_id_user_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.invitation\": {\n      \"name\": \"invitation\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"inviter_id\": {\n          \"name\": \"inviter_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"invitation_organization_id_organization_id_fk\": {\n          \"name\": \"invitation_organization_id_organization_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"invitation_inviter_id_user_id_fk\": {\n          \"name\": \"invitation_inviter_id_user_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"inviter_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.projects\": {\n      \"name\": \"projects\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"projects_organization_id_organization_id_fk\": {\n          \"name\": \"projects_organization_id_organization_id_fk\",\n          \"tableFrom\": \"projects\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"projects_slug_unique\": {\n          \"name\": \"projects_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backups\": {\n      \"name\": \"backups\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"file\": {\n          \"name\": \"file\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"file_size\": {\n          \"name\": \"file_size\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"imported\": {\n          \"name\": \"imported\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backups_database_id_databases_id_fk\": {\n          \"name\": \"backups_database_id_databases_id_fk\",\n          \"tableFrom\": \"backups\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.databases\": {\n      \"name\": \"databases\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"agent_database_id\": {\n          \"name\": \"agent_database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"dbms\": {\n          \"name\": \"dbms\",\n          \"type\": \"dbms_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_policy\": {\n          \"name\": \"backup_policy\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"is_waiting_for_backup\": {\n          \"name\": \"is_waiting_for_backup\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"backup_to_restore\": {\n          \"name\": \"backup_to_restore\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"agent_id\": {\n          \"name\": \"agent_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"project_id\": {\n          \"name\": \"project_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"databases_agent_id_agents_id_fk\": {\n          \"name\": \"databases_agent_id_agents_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"agents\",\n          \"columnsFrom\": [\n            \"agent_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"databases_project_id_projects_id_fk\": {\n          \"name\": \"databases_project_id_projects_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"projects\",\n          \"columnsFrom\": [\n            \"project_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"no action\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.restorations\": {\n      \"name\": \"restorations\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"backup_storage_id\": {\n          \"name\": \"backup_storage_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"restorations_backup_storage_id_backup_storage_id_fk\": {\n          \"name\": \"restorations_backup_storage_id_backup_storage_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backup_storage\",\n          \"columnsFrom\": [\n            \"backup_storage_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_backup_id_backups_id_fk\": {\n          \"name\": \"restorations_backup_id_backups_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_database_id_databases_id_fk\": {\n          \"name\": \"restorations_database_id_databases_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.retention_policies\": {\n      \"name\": \"retention_policies\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"type\": {\n          \"name\": \"type\",\n          \"type\": \"retention_policy_type\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"count\": {\n          \"name\": \"count\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"days\": {\n          \"name\": \"days\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 30\n        },\n        \"gfs_daily\": {\n          \"name\": \"gfs_daily\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"gfs_weekly\": {\n          \"name\": \"gfs_weekly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 4\n        },\n        \"gfs_monthly\": {\n          \"name\": \"gfs_monthly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 12\n        },\n        \"gfs_yearly\": {\n          \"name\": \"gfs_yearly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 3\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"retention_policies_database_id_databases_id_fk\": {\n          \"name\": \"retention_policies_database_id_databases_id_fk\",\n          \"tableFrom\": \"retention_policies\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.agents\": {\n      \"name\": \"agents\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"version\": {\n          \"name\": \"version\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"agents_slug_unique\": {\n          \"name\": \"agents_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_channel\": {\n      \"name\": \"notification_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"notification_channel_organization_id_organization_id_fk\": {\n          \"name\": \"notification_channel_organization_id_organization_id_fk\",\n          \"tableFrom\": \"notification_channel\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_notification_channels\": {\n      \"name\": \"organization_notification_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_notification_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_notification_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_notification_channels_organization_id_notification_channel_id_unique\": {\n          \"name\": \"organization_notification_channels_organization_id_notification_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"notification_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.alert_policy\": {\n      \"name\": \"alert_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"event_kind\": {\n          \"name\": \"event_kind\",\n          \"type\": \"event_kind[]\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"alert_policy_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"alert_policy_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"alert_policy_database_id_databases_id_fk\": {\n          \"name\": \"alert_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_log\": {\n      \"name\": \"notification_log\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"channel_id\": {\n          \"name\": \"channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"policy_id\": {\n          \"name\": \"policy_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"event\": {\n          \"name\": \"event\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_name\": {\n          \"name\": \"provider_name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"title\": {\n          \"name\": \"title\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"message\": {\n          \"name\": \"message\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"level\": {\n          \"name\": \"level\",\n          \"type\": \"level\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"payload\": {\n          \"name\": \"payload\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"success\": {\n          \"name\": \"success\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"error\": {\n          \"name\": \"error\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider_response\": {\n          \"name\": \"provider_response\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"sent_at\": {\n          \"name\": \"sent_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_storage_channels\": {\n      \"name\": \"organization_storage_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_storage_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_storage_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_storage_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_storage_channels_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"organization_storage_channels_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"organization_storage_channels\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_storage_channels_organization_id_storage_channel_id_unique\": {\n          \"name\": \"organization_storage_channels_organization_id_storage_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"storage_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.storage_channel\": {\n      \"name\": \"storage_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_storage_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"storage_channel_organization_id_organization_id_fk\": {\n          \"name\": \"storage_channel_organization_id_organization_id_fk\",\n          \"tableFrom\": \"storage_channel\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.storage_policy\": {\n      \"name\": \"storage_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"storage_policy_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"storage_policy_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"storage_policy\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"storage_policy_database_id_databases_id_fk\": {\n          \"name\": \"storage_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"storage_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backup_storage\": {\n      \"name\": \"backup_storage\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"backup_storage_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'pending'\"\n        },\n        \"path\": {\n          \"name\": \"path\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"size\": {\n          \"name\": \"size\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"checksum\": {\n          \"name\": \"checksum\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backup_storage_backup_id_backups_id_fk\": {\n          \"name\": \"backup_storage_backup_id_backups_id_fk\",\n          \"tableFrom\": \"backup_storage\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"backup_storage_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"backup_storage_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"backup_storage\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    }\n  },\n  \"enums\": {\n    \"public.user_themes\": {\n      \"name\": \"user_themes\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"light\",\n        \"dark\",\n        \"system\"\n      ]\n    },\n    \"public.retention_policy_type\": {\n      \"name\": \"retention_policy_type\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"count\",\n        \"days\",\n        \"gfs\"\n      ]\n    },\n    \"public.provider_kind\": {\n      \"name\": \"provider_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"slack\",\n        \"smtp\",\n        \"discord\",\n        \"telegram\",\n        \"gotify\",\n        \"ntfy\",\n        \"webhook\"\n      ]\n    },\n    \"public.event_kind\": {\n      \"name\": \"event_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"error_backup\",\n        \"error_restore\",\n        \"success_restore\",\n        \"success_backup\",\n        \"weekly_report\"\n      ]\n    },\n    \"public.level\": {\n      \"name\": \"level\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"critical\",\n        \"warning\",\n        \"info\"\n      ]\n    },\n    \"public.provider_storage_kind\": {\n      \"name\": \"provider_storage_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\"\n      ]\n    },\n    \"public.backup_storage_status\": {\n      \"name\": \"backup_storage_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"pending\",\n        \"success\",\n        \"failed\"\n      ]\n    },\n    \"public.dbms_status\": {\n      \"name\": \"dbms_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"postgresql\",\n        \"mysql\"\n      ]\n    },\n    \"public.status\": {\n      \"name\": \"status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"waiting\",\n        \"ongoing\",\n        \"failed\",\n        \"success\"\n      ]\n    },\n    \"public.type_storage\": {\n      \"name\": \"type_storage\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\"\n      ]\n    }\n  },\n  \"schemas\": {},\n  \"sequences\": {},\n  \"roles\": {},\n  \"policies\": {},\n  \"views\": {},\n  \"_meta\": {\n    \"columns\": {},\n    \"schemas\": {},\n    \"tables\": {}\n  }\n}"
  },
  {
    "path": "src/db/migrations/meta/0030_snapshot.json",
    "content": "{\n  \"id\": \"a77eff5a-37f1-4328-ba9c-8ca24b94b84a\",\n  \"prevId\": \"709e5437-9dac-41a6-8cb0-54a569e15c6e\",\n  \"version\": \"7\",\n  \"dialect\": \"postgresql\",\n  \"tables\": {\n    \"public.settings\": {\n      \"name\": \"settings\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"smtp_password\": {\n          \"name\": \"smtp_password\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_from\": {\n          \"name\": \"smtp_from\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_host\": {\n          \"name\": \"smtp_host\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_port\": {\n          \"name\": \"smtp_port\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_user\": {\n          \"name\": \"smtp_user\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"default_storage_channel_id\": {\n          \"name\": \"default_storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"settings_default_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"settings_default_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"settings\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"default_storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"set null\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"settings_name_unique\": {\n          \"name\": \"settings_name_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"name\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.account\": {\n      \"name\": \"account\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"account_id\": {\n          \"name\": \"account_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"access_token\": {\n          \"name\": \"access_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token\": {\n          \"name\": \"refresh_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"id_token\": {\n          \"name\": \"id_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"access_token_expires_at\": {\n          \"name\": \"access_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token_expires_at\": {\n          \"name\": \"refresh_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"scope\": {\n          \"name\": \"scope\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"password\": {\n          \"name\": \"password\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"account_user_id_user_id_fk\": {\n          \"name\": \"account_user_id_user_id_fk\",\n          \"tableFrom\": \"account\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.passkey\": {\n      \"name\": \"passkey\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"publicKey\": {\n          \"name\": \"publicKey\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"userId\": {\n          \"name\": \"userId\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"credentialId\": {\n          \"name\": \"credentialId\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"counter\": {\n          \"name\": \"counter\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"deviceType\": {\n          \"name\": \"deviceType\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backedUp\": {\n          \"name\": \"backedUp\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"transports\": {\n          \"name\": \"transports\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"passkey_userId_user_id_fk\": {\n          \"name\": \"passkey_userId_user_id_fk\",\n          \"tableFrom\": \"passkey\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"userId\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.session\": {\n      \"name\": \"session\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"token\": {\n          \"name\": \"token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"ip_address\": {\n          \"name\": \"ip_address\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_agent\": {\n          \"name\": \"user_agent\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"impersonated_by\": {\n          \"name\": \"impersonated_by\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"active_organization_id\": {\n          \"name\": \"active_organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"session_user_id_user_id_fk\": {\n          \"name\": \"session_user_id_user_id_fk\",\n          \"tableFrom\": \"session\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"session_token_unique\": {\n          \"name\": \"session_token_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"token\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.two_factor\": {\n      \"name\": \"two_factor\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"secret\": {\n          \"name\": \"secret\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backup_codes\": {\n          \"name\": \"backup_codes\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"two_factor_user_id_user_id_fk\": {\n          \"name\": \"two_factor_user_id_user_id_fk\",\n          \"tableFrom\": \"two_factor\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.user\": {\n      \"name\": \"user\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email_verified\": {\n          \"name\": \"email_verified\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"image\": {\n          \"name\": \"image\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"theme\": {\n          \"name\": \"theme\",\n          \"type\": \"user_themes\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'light'\"\n        },\n        \"banned\": {\n          \"name\": \"banned\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_reason\": {\n          \"name\": \"ban_reason\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_expires\": {\n          \"name\": \"ban_expires\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"lastConnectedAt\": {\n          \"name\": \"lastConnectedAt\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"lastChangedPasswordAt\": {\n          \"name\": \"lastChangedPasswordAt\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"two_factor_enabled\": {\n          \"name\": \"two_factor_enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"user_email_unique\": {\n          \"name\": \"user_email_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"email\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.verification\": {\n      \"name\": \"verification\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"identifier\": {\n          \"name\": \"identifier\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"value\": {\n          \"name\": \"value\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization\": {\n      \"name\": \"organization\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"logo\": {\n          \"name\": \"logo\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"metadata\": {\n          \"name\": \"metadata\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_slug_unique\": {\n          \"name\": \"organization_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.member\": {\n      \"name\": \"member\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"member_organization_id_organization_id_fk\": {\n          \"name\": \"member_organization_id_organization_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"member_user_id_user_id_fk\": {\n          \"name\": \"member_user_id_user_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.invitation\": {\n      \"name\": \"invitation\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"inviter_id\": {\n          \"name\": \"inviter_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"invitation_organization_id_organization_id_fk\": {\n          \"name\": \"invitation_organization_id_organization_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"invitation_inviter_id_user_id_fk\": {\n          \"name\": \"invitation_inviter_id_user_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"inviter_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.projects\": {\n      \"name\": \"projects\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"projects_organization_id_organization_id_fk\": {\n          \"name\": \"projects_organization_id_organization_id_fk\",\n          \"tableFrom\": \"projects\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"projects_slug_unique\": {\n          \"name\": \"projects_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backups\": {\n      \"name\": \"backups\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"file\": {\n          \"name\": \"file\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"file_size\": {\n          \"name\": \"file_size\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"imported\": {\n          \"name\": \"imported\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backups_database_id_databases_id_fk\": {\n          \"name\": \"backups_database_id_databases_id_fk\",\n          \"tableFrom\": \"backups\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.databases\": {\n      \"name\": \"databases\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"agent_database_id\": {\n          \"name\": \"agent_database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"dbms\": {\n          \"name\": \"dbms\",\n          \"type\": \"dbms_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_policy\": {\n          \"name\": \"backup_policy\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"is_waiting_for_backup\": {\n          \"name\": \"is_waiting_for_backup\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"backup_to_restore\": {\n          \"name\": \"backup_to_restore\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"agent_id\": {\n          \"name\": \"agent_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"project_id\": {\n          \"name\": \"project_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"databases_agent_id_agents_id_fk\": {\n          \"name\": \"databases_agent_id_agents_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"agents\",\n          \"columnsFrom\": [\n            \"agent_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"databases_project_id_projects_id_fk\": {\n          \"name\": \"databases_project_id_projects_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"projects\",\n          \"columnsFrom\": [\n            \"project_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"no action\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.restorations\": {\n      \"name\": \"restorations\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"backup_storage_id\": {\n          \"name\": \"backup_storage_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"restorations_backup_storage_id_backup_storage_id_fk\": {\n          \"name\": \"restorations_backup_storage_id_backup_storage_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backup_storage\",\n          \"columnsFrom\": [\n            \"backup_storage_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_backup_id_backups_id_fk\": {\n          \"name\": \"restorations_backup_id_backups_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_database_id_databases_id_fk\": {\n          \"name\": \"restorations_database_id_databases_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.retention_policies\": {\n      \"name\": \"retention_policies\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"type\": {\n          \"name\": \"type\",\n          \"type\": \"retention_policy_type\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"count\": {\n          \"name\": \"count\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"days\": {\n          \"name\": \"days\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 30\n        },\n        \"gfs_daily\": {\n          \"name\": \"gfs_daily\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"gfs_weekly\": {\n          \"name\": \"gfs_weekly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 4\n        },\n        \"gfs_monthly\": {\n          \"name\": \"gfs_monthly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 12\n        },\n        \"gfs_yearly\": {\n          \"name\": \"gfs_yearly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 3\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"retention_policies_database_id_databases_id_fk\": {\n          \"name\": \"retention_policies_database_id_databases_id_fk\",\n          \"tableFrom\": \"retention_policies\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.agents\": {\n      \"name\": \"agents\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"version\": {\n          \"name\": \"version\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"agents_slug_unique\": {\n          \"name\": \"agents_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_channel\": {\n      \"name\": \"notification_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"notification_channel_organization_id_organization_id_fk\": {\n          \"name\": \"notification_channel_organization_id_organization_id_fk\",\n          \"tableFrom\": \"notification_channel\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_notification_channels\": {\n      \"name\": \"organization_notification_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_notification_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_notification_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_notification_channels_organization_id_notification_channel_id_unique\": {\n          \"name\": \"organization_notification_channels_organization_id_notification_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"notification_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.alert_policy\": {\n      \"name\": \"alert_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"event_kind\": {\n          \"name\": \"event_kind\",\n          \"type\": \"event_kind[]\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"alert_policy_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"alert_policy_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"alert_policy_database_id_databases_id_fk\": {\n          \"name\": \"alert_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_log\": {\n      \"name\": \"notification_log\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"channel_id\": {\n          \"name\": \"channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"policy_id\": {\n          \"name\": \"policy_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"event\": {\n          \"name\": \"event\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_name\": {\n          \"name\": \"provider_name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"title\": {\n          \"name\": \"title\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"message\": {\n          \"name\": \"message\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"level\": {\n          \"name\": \"level\",\n          \"type\": \"level\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"payload\": {\n          \"name\": \"payload\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"success\": {\n          \"name\": \"success\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"error\": {\n          \"name\": \"error\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider_response\": {\n          \"name\": \"provider_response\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"sent_at\": {\n          \"name\": \"sent_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_storage_channels\": {\n      \"name\": \"organization_storage_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_storage_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_storage_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_storage_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_storage_channels_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"organization_storage_channels_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"organization_storage_channels\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_storage_channels_organization_id_storage_channel_id_unique\": {\n          \"name\": \"organization_storage_channels_organization_id_storage_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"storage_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.storage_channel\": {\n      \"name\": \"storage_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_storage_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"storage_channel_organization_id_organization_id_fk\": {\n          \"name\": \"storage_channel_organization_id_organization_id_fk\",\n          \"tableFrom\": \"storage_channel\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.storage_policy\": {\n      \"name\": \"storage_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"storage_policy_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"storage_policy_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"storage_policy\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"storage_policy_database_id_databases_id_fk\": {\n          \"name\": \"storage_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"storage_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backup_storage\": {\n      \"name\": \"backup_storage\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"backup_storage_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'pending'\"\n        },\n        \"path\": {\n          \"name\": \"path\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"size\": {\n          \"name\": \"size\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"checksum\": {\n          \"name\": \"checksum\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backup_storage_backup_id_backups_id_fk\": {\n          \"name\": \"backup_storage_backup_id_backups_id_fk\",\n          \"tableFrom\": \"backup_storage\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"backup_storage_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"backup_storage_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"backup_storage\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    }\n  },\n  \"enums\": {\n    \"public.user_themes\": {\n      \"name\": \"user_themes\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"light\",\n        \"dark\",\n        \"system\"\n      ]\n    },\n    \"public.retention_policy_type\": {\n      \"name\": \"retention_policy_type\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"count\",\n        \"days\",\n        \"gfs\"\n      ]\n    },\n    \"public.provider_kind\": {\n      \"name\": \"provider_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"slack\",\n        \"smtp\",\n        \"discord\",\n        \"telegram\",\n        \"gotify\",\n        \"ntfy\",\n        \"webhook\"\n      ]\n    },\n    \"public.event_kind\": {\n      \"name\": \"event_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"error_backup\",\n        \"error_restore\",\n        \"success_restore\",\n        \"success_backup\",\n        \"weekly_report\"\n      ]\n    },\n    \"public.level\": {\n      \"name\": \"level\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"critical\",\n        \"warning\",\n        \"info\"\n      ]\n    },\n    \"public.provider_storage_kind\": {\n      \"name\": \"provider_storage_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\"\n      ]\n    },\n    \"public.backup_storage_status\": {\n      \"name\": \"backup_storage_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"pending\",\n        \"success\",\n        \"failed\"\n      ]\n    },\n    \"public.dbms_status\": {\n      \"name\": \"dbms_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"postgresql\",\n        \"mysql\",\n        \"mongodb\"\n      ]\n    },\n    \"public.status\": {\n      \"name\": \"status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"waiting\",\n        \"ongoing\",\n        \"failed\",\n        \"success\"\n      ]\n    },\n    \"public.type_storage\": {\n      \"name\": \"type_storage\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\"\n      ]\n    }\n  },\n  \"schemas\": {},\n  \"sequences\": {},\n  \"roles\": {},\n  \"policies\": {},\n  \"views\": {},\n  \"_meta\": {\n    \"columns\": {},\n    \"schemas\": {},\n    \"tables\": {}\n  }\n}"
  },
  {
    "path": "src/db/migrations/meta/0031_snapshot.json",
    "content": "{\n  \"id\": \"e8eea249-8a89-4ef2-a752-d85a13977bcb\",\n  \"prevId\": \"a77eff5a-37f1-4328-ba9c-8ca24b94b84a\",\n  \"version\": \"7\",\n  \"dialect\": \"postgresql\",\n  \"tables\": {\n    \"public.settings\": {\n      \"name\": \"settings\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"smtp_password\": {\n          \"name\": \"smtp_password\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_from\": {\n          \"name\": \"smtp_from\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_host\": {\n          \"name\": \"smtp_host\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_port\": {\n          \"name\": \"smtp_port\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_user\": {\n          \"name\": \"smtp_user\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_secure\": {\n          \"name\": \"smtp_secure\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"default_storage_channel_id\": {\n          \"name\": \"default_storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"settings_default_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"settings_default_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"settings\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"default_storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"set null\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"settings_name_unique\": {\n          \"name\": \"settings_name_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"name\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.account\": {\n      \"name\": \"account\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"account_id\": {\n          \"name\": \"account_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"access_token\": {\n          \"name\": \"access_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token\": {\n          \"name\": \"refresh_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"id_token\": {\n          \"name\": \"id_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"access_token_expires_at\": {\n          \"name\": \"access_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token_expires_at\": {\n          \"name\": \"refresh_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"scope\": {\n          \"name\": \"scope\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"password\": {\n          \"name\": \"password\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"account_user_id_user_id_fk\": {\n          \"name\": \"account_user_id_user_id_fk\",\n          \"tableFrom\": \"account\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.passkey\": {\n      \"name\": \"passkey\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"publicKey\": {\n          \"name\": \"publicKey\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"userId\": {\n          \"name\": \"userId\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"credentialId\": {\n          \"name\": \"credentialId\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"counter\": {\n          \"name\": \"counter\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"deviceType\": {\n          \"name\": \"deviceType\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backedUp\": {\n          \"name\": \"backedUp\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"transports\": {\n          \"name\": \"transports\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"passkey_userId_user_id_fk\": {\n          \"name\": \"passkey_userId_user_id_fk\",\n          \"tableFrom\": \"passkey\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"userId\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.session\": {\n      \"name\": \"session\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"token\": {\n          \"name\": \"token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"ip_address\": {\n          \"name\": \"ip_address\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_agent\": {\n          \"name\": \"user_agent\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"impersonated_by\": {\n          \"name\": \"impersonated_by\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"active_organization_id\": {\n          \"name\": \"active_organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"session_user_id_user_id_fk\": {\n          \"name\": \"session_user_id_user_id_fk\",\n          \"tableFrom\": \"session\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"session_token_unique\": {\n          \"name\": \"session_token_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"token\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.two_factor\": {\n      \"name\": \"two_factor\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"secret\": {\n          \"name\": \"secret\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backup_codes\": {\n          \"name\": \"backup_codes\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"two_factor_user_id_user_id_fk\": {\n          \"name\": \"two_factor_user_id_user_id_fk\",\n          \"tableFrom\": \"two_factor\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.user\": {\n      \"name\": \"user\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email_verified\": {\n          \"name\": \"email_verified\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"image\": {\n          \"name\": \"image\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"theme\": {\n          \"name\": \"theme\",\n          \"type\": \"user_themes\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'light'\"\n        },\n        \"banned\": {\n          \"name\": \"banned\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_reason\": {\n          \"name\": \"ban_reason\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_expires\": {\n          \"name\": \"ban_expires\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"lastConnectedAt\": {\n          \"name\": \"lastConnectedAt\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"lastChangedPasswordAt\": {\n          \"name\": \"lastChangedPasswordAt\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"two_factor_enabled\": {\n          \"name\": \"two_factor_enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"user_email_unique\": {\n          \"name\": \"user_email_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"email\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.verification\": {\n      \"name\": \"verification\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"identifier\": {\n          \"name\": \"identifier\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"value\": {\n          \"name\": \"value\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization\": {\n      \"name\": \"organization\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"logo\": {\n          \"name\": \"logo\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"metadata\": {\n          \"name\": \"metadata\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_slug_unique\": {\n          \"name\": \"organization_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.member\": {\n      \"name\": \"member\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"member_organization_id_organization_id_fk\": {\n          \"name\": \"member_organization_id_organization_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"member_user_id_user_id_fk\": {\n          \"name\": \"member_user_id_user_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.invitation\": {\n      \"name\": \"invitation\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"inviter_id\": {\n          \"name\": \"inviter_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"invitation_organization_id_organization_id_fk\": {\n          \"name\": \"invitation_organization_id_organization_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"invitation_inviter_id_user_id_fk\": {\n          \"name\": \"invitation_inviter_id_user_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"inviter_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.projects\": {\n      \"name\": \"projects\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"projects_organization_id_organization_id_fk\": {\n          \"name\": \"projects_organization_id_organization_id_fk\",\n          \"tableFrom\": \"projects\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"projects_slug_unique\": {\n          \"name\": \"projects_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backups\": {\n      \"name\": \"backups\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"file\": {\n          \"name\": \"file\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"file_size\": {\n          \"name\": \"file_size\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"imported\": {\n          \"name\": \"imported\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backups_database_id_databases_id_fk\": {\n          \"name\": \"backups_database_id_databases_id_fk\",\n          \"tableFrom\": \"backups\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.databases\": {\n      \"name\": \"databases\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"agent_database_id\": {\n          \"name\": \"agent_database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"dbms\": {\n          \"name\": \"dbms\",\n          \"type\": \"dbms_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_policy\": {\n          \"name\": \"backup_policy\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"is_waiting_for_backup\": {\n          \"name\": \"is_waiting_for_backup\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"backup_to_restore\": {\n          \"name\": \"backup_to_restore\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"agent_id\": {\n          \"name\": \"agent_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"project_id\": {\n          \"name\": \"project_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"databases_agent_id_agents_id_fk\": {\n          \"name\": \"databases_agent_id_agents_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"agents\",\n          \"columnsFrom\": [\n            \"agent_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"databases_project_id_projects_id_fk\": {\n          \"name\": \"databases_project_id_projects_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"projects\",\n          \"columnsFrom\": [\n            \"project_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"no action\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.restorations\": {\n      \"name\": \"restorations\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"backup_storage_id\": {\n          \"name\": \"backup_storage_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"restorations_backup_storage_id_backup_storage_id_fk\": {\n          \"name\": \"restorations_backup_storage_id_backup_storage_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backup_storage\",\n          \"columnsFrom\": [\n            \"backup_storage_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_backup_id_backups_id_fk\": {\n          \"name\": \"restorations_backup_id_backups_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_database_id_databases_id_fk\": {\n          \"name\": \"restorations_database_id_databases_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.retention_policies\": {\n      \"name\": \"retention_policies\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"type\": {\n          \"name\": \"type\",\n          \"type\": \"retention_policy_type\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"count\": {\n          \"name\": \"count\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"days\": {\n          \"name\": \"days\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 30\n        },\n        \"gfs_daily\": {\n          \"name\": \"gfs_daily\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"gfs_weekly\": {\n          \"name\": \"gfs_weekly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 4\n        },\n        \"gfs_monthly\": {\n          \"name\": \"gfs_monthly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 12\n        },\n        \"gfs_yearly\": {\n          \"name\": \"gfs_yearly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 3\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"retention_policies_database_id_databases_id_fk\": {\n          \"name\": \"retention_policies_database_id_databases_id_fk\",\n          \"tableFrom\": \"retention_policies\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.agents\": {\n      \"name\": \"agents\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"version\": {\n          \"name\": \"version\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"agents_slug_unique\": {\n          \"name\": \"agents_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_channel\": {\n      \"name\": \"notification_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"notification_channel_organization_id_organization_id_fk\": {\n          \"name\": \"notification_channel_organization_id_organization_id_fk\",\n          \"tableFrom\": \"notification_channel\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_notification_channels\": {\n      \"name\": \"organization_notification_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_notification_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_notification_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_notification_channels_organization_id_notification_channel_id_unique\": {\n          \"name\": \"organization_notification_channels_organization_id_notification_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"notification_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.alert_policy\": {\n      \"name\": \"alert_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"event_kind\": {\n          \"name\": \"event_kind\",\n          \"type\": \"event_kind[]\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"alert_policy_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"alert_policy_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"alert_policy_database_id_databases_id_fk\": {\n          \"name\": \"alert_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_log\": {\n      \"name\": \"notification_log\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"channel_id\": {\n          \"name\": \"channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"policy_id\": {\n          \"name\": \"policy_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"event\": {\n          \"name\": \"event\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_name\": {\n          \"name\": \"provider_name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"title\": {\n          \"name\": \"title\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"message\": {\n          \"name\": \"message\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"level\": {\n          \"name\": \"level\",\n          \"type\": \"level\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"payload\": {\n          \"name\": \"payload\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"success\": {\n          \"name\": \"success\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"error\": {\n          \"name\": \"error\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider_response\": {\n          \"name\": \"provider_response\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"sent_at\": {\n          \"name\": \"sent_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_storage_channels\": {\n      \"name\": \"organization_storage_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_storage_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_storage_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_storage_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_storage_channels_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"organization_storage_channels_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"organization_storage_channels\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_storage_channels_organization_id_storage_channel_id_unique\": {\n          \"name\": \"organization_storage_channels_organization_id_storage_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"storage_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.storage_channel\": {\n      \"name\": \"storage_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_storage_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"storage_channel_organization_id_organization_id_fk\": {\n          \"name\": \"storage_channel_organization_id_organization_id_fk\",\n          \"tableFrom\": \"storage_channel\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.storage_policy\": {\n      \"name\": \"storage_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"storage_policy_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"storage_policy_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"storage_policy\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"storage_policy_database_id_databases_id_fk\": {\n          \"name\": \"storage_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"storage_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backup_storage\": {\n      \"name\": \"backup_storage\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"backup_storage_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'pending'\"\n        },\n        \"path\": {\n          \"name\": \"path\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"size\": {\n          \"name\": \"size\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"checksum\": {\n          \"name\": \"checksum\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backup_storage_backup_id_backups_id_fk\": {\n          \"name\": \"backup_storage_backup_id_backups_id_fk\",\n          \"tableFrom\": \"backup_storage\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"backup_storage_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"backup_storage_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"backup_storage\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    }\n  },\n  \"enums\": {\n    \"public.user_themes\": {\n      \"name\": \"user_themes\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"light\",\n        \"dark\",\n        \"system\"\n      ]\n    },\n    \"public.retention_policy_type\": {\n      \"name\": \"retention_policy_type\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"count\",\n        \"days\",\n        \"gfs\"\n      ]\n    },\n    \"public.provider_kind\": {\n      \"name\": \"provider_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"slack\",\n        \"smtp\",\n        \"discord\",\n        \"telegram\",\n        \"gotify\",\n        \"ntfy\",\n        \"webhook\"\n      ]\n    },\n    \"public.event_kind\": {\n      \"name\": \"event_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"error_backup\",\n        \"error_restore\",\n        \"success_restore\",\n        \"success_backup\",\n        \"weekly_report\"\n      ]\n    },\n    \"public.level\": {\n      \"name\": \"level\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"critical\",\n        \"warning\",\n        \"info\"\n      ]\n    },\n    \"public.provider_storage_kind\": {\n      \"name\": \"provider_storage_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\"\n      ]\n    },\n    \"public.backup_storage_status\": {\n      \"name\": \"backup_storage_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"pending\",\n        \"success\",\n        \"failed\"\n      ]\n    },\n    \"public.dbms_status\": {\n      \"name\": \"dbms_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"postgresql\",\n        \"mysql\",\n        \"mongodb\"\n      ]\n    },\n    \"public.status\": {\n      \"name\": \"status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"waiting\",\n        \"ongoing\",\n        \"failed\",\n        \"success\"\n      ]\n    },\n    \"public.type_storage\": {\n      \"name\": \"type_storage\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\"\n      ]\n    }\n  },\n  \"schemas\": {},\n  \"sequences\": {},\n  \"roles\": {},\n  \"policies\": {},\n  \"views\": {},\n  \"_meta\": {\n    \"columns\": {},\n    \"schemas\": {},\n    \"tables\": {}\n  }\n}"
  },
  {
    "path": "src/db/migrations/meta/0032_snapshot.json",
    "content": "{\n  \"id\": \"905981d5-793f-4584-b93b-cbae807321f1\",\n  \"prevId\": \"e8eea249-8a89-4ef2-a752-d85a13977bcb\",\n  \"version\": \"7\",\n  \"dialect\": \"postgresql\",\n  \"tables\": {\n    \"public.settings\": {\n      \"name\": \"settings\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"smtp_password\": {\n          \"name\": \"smtp_password\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_from\": {\n          \"name\": \"smtp_from\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_host\": {\n          \"name\": \"smtp_host\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_port\": {\n          \"name\": \"smtp_port\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_user\": {\n          \"name\": \"smtp_user\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_secure\": {\n          \"name\": \"smtp_secure\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"default_storage_channel_id\": {\n          \"name\": \"default_storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"settings_default_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"settings_default_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"settings\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"default_storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"set null\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"settings_name_unique\": {\n          \"name\": \"settings_name_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"name\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.account\": {\n      \"name\": \"account\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"account_id\": {\n          \"name\": \"account_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"access_token\": {\n          \"name\": \"access_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token\": {\n          \"name\": \"refresh_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"id_token\": {\n          \"name\": \"id_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"access_token_expires_at\": {\n          \"name\": \"access_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token_expires_at\": {\n          \"name\": \"refresh_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"scope\": {\n          \"name\": \"scope\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"password\": {\n          \"name\": \"password\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"account_user_id_user_id_fk\": {\n          \"name\": \"account_user_id_user_id_fk\",\n          \"tableFrom\": \"account\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.passkey\": {\n      \"name\": \"passkey\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"publicKey\": {\n          \"name\": \"publicKey\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"userId\": {\n          \"name\": \"userId\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"credentialId\": {\n          \"name\": \"credentialId\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"counter\": {\n          \"name\": \"counter\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"deviceType\": {\n          \"name\": \"deviceType\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backedUp\": {\n          \"name\": \"backedUp\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"transports\": {\n          \"name\": \"transports\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"passkey_userId_user_id_fk\": {\n          \"name\": \"passkey_userId_user_id_fk\",\n          \"tableFrom\": \"passkey\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"userId\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.session\": {\n      \"name\": \"session\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"token\": {\n          \"name\": \"token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"ip_address\": {\n          \"name\": \"ip_address\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_agent\": {\n          \"name\": \"user_agent\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"impersonated_by\": {\n          \"name\": \"impersonated_by\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"active_organization_id\": {\n          \"name\": \"active_organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"session_user_id_user_id_fk\": {\n          \"name\": \"session_user_id_user_id_fk\",\n          \"tableFrom\": \"session\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"session_token_unique\": {\n          \"name\": \"session_token_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"token\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.two_factor\": {\n      \"name\": \"two_factor\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"secret\": {\n          \"name\": \"secret\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backup_codes\": {\n          \"name\": \"backup_codes\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"two_factor_user_id_user_id_fk\": {\n          \"name\": \"two_factor_user_id_user_id_fk\",\n          \"tableFrom\": \"two_factor\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.user\": {\n      \"name\": \"user\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email_verified\": {\n          \"name\": \"email_verified\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"image\": {\n          \"name\": \"image\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"theme\": {\n          \"name\": \"theme\",\n          \"type\": \"user_themes\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'light'\"\n        },\n        \"banned\": {\n          \"name\": \"banned\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_reason\": {\n          \"name\": \"ban_reason\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_expires\": {\n          \"name\": \"ban_expires\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"lastConnectedAt\": {\n          \"name\": \"lastConnectedAt\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"lastChangedPasswordAt\": {\n          \"name\": \"lastChangedPasswordAt\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"two_factor_enabled\": {\n          \"name\": \"two_factor_enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"user_email_unique\": {\n          \"name\": \"user_email_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"email\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.verification\": {\n      \"name\": \"verification\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"identifier\": {\n          \"name\": \"identifier\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"value\": {\n          \"name\": \"value\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization\": {\n      \"name\": \"organization\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"logo\": {\n          \"name\": \"logo\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"metadata\": {\n          \"name\": \"metadata\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_slug_unique\": {\n          \"name\": \"organization_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.member\": {\n      \"name\": \"member\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"member_organization_id_organization_id_fk\": {\n          \"name\": \"member_organization_id_organization_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"member_user_id_user_id_fk\": {\n          \"name\": \"member_user_id_user_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.invitation\": {\n      \"name\": \"invitation\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"inviter_id\": {\n          \"name\": \"inviter_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"invitation_organization_id_organization_id_fk\": {\n          \"name\": \"invitation_organization_id_organization_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"invitation_inviter_id_user_id_fk\": {\n          \"name\": \"invitation_inviter_id_user_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"inviter_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.projects\": {\n      \"name\": \"projects\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"projects_organization_id_organization_id_fk\": {\n          \"name\": \"projects_organization_id_organization_id_fk\",\n          \"tableFrom\": \"projects\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"projects_slug_unique\": {\n          \"name\": \"projects_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backups\": {\n      \"name\": \"backups\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"file\": {\n          \"name\": \"file\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"file_size\": {\n          \"name\": \"file_size\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"imported\": {\n          \"name\": \"imported\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backups_database_id_databases_id_fk\": {\n          \"name\": \"backups_database_id_databases_id_fk\",\n          \"tableFrom\": \"backups\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.databases\": {\n      \"name\": \"databases\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"agent_database_id\": {\n          \"name\": \"agent_database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"dbms\": {\n          \"name\": \"dbms\",\n          \"type\": \"dbms_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_policy\": {\n          \"name\": \"backup_policy\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"is_waiting_for_backup\": {\n          \"name\": \"is_waiting_for_backup\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"backup_to_restore\": {\n          \"name\": \"backup_to_restore\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"agent_id\": {\n          \"name\": \"agent_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"project_id\": {\n          \"name\": \"project_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"databases_agent_id_agents_id_fk\": {\n          \"name\": \"databases_agent_id_agents_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"agents\",\n          \"columnsFrom\": [\n            \"agent_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"databases_project_id_projects_id_fk\": {\n          \"name\": \"databases_project_id_projects_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"projects\",\n          \"columnsFrom\": [\n            \"project_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"no action\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.restorations\": {\n      \"name\": \"restorations\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"backup_storage_id\": {\n          \"name\": \"backup_storage_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"restorations_backup_storage_id_backup_storage_id_fk\": {\n          \"name\": \"restorations_backup_storage_id_backup_storage_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backup_storage\",\n          \"columnsFrom\": [\n            \"backup_storage_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_backup_id_backups_id_fk\": {\n          \"name\": \"restorations_backup_id_backups_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_database_id_databases_id_fk\": {\n          \"name\": \"restorations_database_id_databases_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.retention_policies\": {\n      \"name\": \"retention_policies\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"type\": {\n          \"name\": \"type\",\n          \"type\": \"retention_policy_type\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"count\": {\n          \"name\": \"count\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"days\": {\n          \"name\": \"days\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 30\n        },\n        \"gfs_daily\": {\n          \"name\": \"gfs_daily\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"gfs_weekly\": {\n          \"name\": \"gfs_weekly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 4\n        },\n        \"gfs_monthly\": {\n          \"name\": \"gfs_monthly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 12\n        },\n        \"gfs_yearly\": {\n          \"name\": \"gfs_yearly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 3\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"retention_policies_database_id_databases_id_fk\": {\n          \"name\": \"retention_policies_database_id_databases_id_fk\",\n          \"tableFrom\": \"retention_policies\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.agents\": {\n      \"name\": \"agents\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"version\": {\n          \"name\": \"version\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"agents_slug_unique\": {\n          \"name\": \"agents_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_channel\": {\n      \"name\": \"notification_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"notification_channel_organization_id_organization_id_fk\": {\n          \"name\": \"notification_channel_organization_id_organization_id_fk\",\n          \"tableFrom\": \"notification_channel\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_notification_channels\": {\n      \"name\": \"organization_notification_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_notification_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_notification_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_notification_channels_organization_id_notification_channel_id_unique\": {\n          \"name\": \"organization_notification_channels_organization_id_notification_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"notification_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.alert_policy\": {\n      \"name\": \"alert_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"event_kind\": {\n          \"name\": \"event_kind\",\n          \"type\": \"event_kind[]\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"alert_policy_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"alert_policy_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"alert_policy_database_id_databases_id_fk\": {\n          \"name\": \"alert_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_log\": {\n      \"name\": \"notification_log\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"channel_id\": {\n          \"name\": \"channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"policy_id\": {\n          \"name\": \"policy_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"event\": {\n          \"name\": \"event\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_name\": {\n          \"name\": \"provider_name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"title\": {\n          \"name\": \"title\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"message\": {\n          \"name\": \"message\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"level\": {\n          \"name\": \"level\",\n          \"type\": \"level\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"payload\": {\n          \"name\": \"payload\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"success\": {\n          \"name\": \"success\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"error\": {\n          \"name\": \"error\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider_response\": {\n          \"name\": \"provider_response\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"sent_at\": {\n          \"name\": \"sent_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_storage_channels\": {\n      \"name\": \"organization_storage_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_storage_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_storage_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_storage_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_storage_channels_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"organization_storage_channels_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"organization_storage_channels\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_storage_channels_organization_id_storage_channel_id_unique\": {\n          \"name\": \"organization_storage_channels_organization_id_storage_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"storage_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.storage_channel\": {\n      \"name\": \"storage_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_storage_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"storage_channel_organization_id_organization_id_fk\": {\n          \"name\": \"storage_channel_organization_id_organization_id_fk\",\n          \"tableFrom\": \"storage_channel\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.storage_policy\": {\n      \"name\": \"storage_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"storage_policy_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"storage_policy_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"storage_policy\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"storage_policy_database_id_databases_id_fk\": {\n          \"name\": \"storage_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"storage_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backup_storage\": {\n      \"name\": \"backup_storage\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"backup_storage_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'pending'\"\n        },\n        \"path\": {\n          \"name\": \"path\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"size\": {\n          \"name\": \"size\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"checksum\": {\n          \"name\": \"checksum\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backup_storage_backup_id_backups_id_fk\": {\n          \"name\": \"backup_storage_backup_id_backups_id_fk\",\n          \"tableFrom\": \"backup_storage\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"backup_storage_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"backup_storage_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"backup_storage\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    }\n  },\n  \"enums\": {\n    \"public.user_themes\": {\n      \"name\": \"user_themes\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"light\",\n        \"dark\",\n        \"system\"\n      ]\n    },\n    \"public.retention_policy_type\": {\n      \"name\": \"retention_policy_type\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"count\",\n        \"days\",\n        \"gfs\"\n      ]\n    },\n    \"public.provider_kind\": {\n      \"name\": \"provider_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"slack\",\n        \"smtp\",\n        \"discord\",\n        \"telegram\",\n        \"gotify\",\n        \"ntfy\",\n        \"webhook\"\n      ]\n    },\n    \"public.event_kind\": {\n      \"name\": \"event_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"error_backup\",\n        \"error_restore\",\n        \"success_restore\",\n        \"success_backup\",\n        \"weekly_report\"\n      ]\n    },\n    \"public.level\": {\n      \"name\": \"level\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"critical\",\n        \"warning\",\n        \"info\"\n      ]\n    },\n    \"public.provider_storage_kind\": {\n      \"name\": \"provider_storage_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\",\n        \"google-drive\"\n      ]\n    },\n    \"public.backup_storage_status\": {\n      \"name\": \"backup_storage_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"pending\",\n        \"success\",\n        \"failed\"\n      ]\n    },\n    \"public.dbms_status\": {\n      \"name\": \"dbms_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"postgresql\",\n        \"mysql\",\n        \"mongodb\"\n      ]\n    },\n    \"public.status\": {\n      \"name\": \"status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"waiting\",\n        \"ongoing\",\n        \"failed\",\n        \"success\"\n      ]\n    },\n    \"public.type_storage\": {\n      \"name\": \"type_storage\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\"\n      ]\n    }\n  },\n  \"schemas\": {},\n  \"sequences\": {},\n  \"roles\": {},\n  \"policies\": {},\n  \"views\": {},\n  \"_meta\": {\n    \"columns\": {},\n    \"schemas\": {},\n    \"tables\": {}\n  }\n}"
  },
  {
    "path": "src/db/migrations/meta/0033_snapshot.json",
    "content": "{\n  \"id\": \"29b53ca7-d603-4433-96f0-44d2df48ebdc\",\n  \"prevId\": \"905981d5-793f-4584-b93b-cbae807321f1\",\n  \"version\": \"7\",\n  \"dialect\": \"postgresql\",\n  \"tables\": {\n    \"public.settings\": {\n      \"name\": \"settings\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"smtp_password\": {\n          \"name\": \"smtp_password\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_from\": {\n          \"name\": \"smtp_from\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_host\": {\n          \"name\": \"smtp_host\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_port\": {\n          \"name\": \"smtp_port\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_user\": {\n          \"name\": \"smtp_user\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_secure\": {\n          \"name\": \"smtp_secure\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"default_storage_channel_id\": {\n          \"name\": \"default_storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"encryption\": {\n          \"name\": \"encryption\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"settings_default_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"settings_default_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"settings\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"default_storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"set null\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"settings_name_unique\": {\n          \"name\": \"settings_name_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"name\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.account\": {\n      \"name\": \"account\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"account_id\": {\n          \"name\": \"account_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"access_token\": {\n          \"name\": \"access_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token\": {\n          \"name\": \"refresh_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"id_token\": {\n          \"name\": \"id_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"access_token_expires_at\": {\n          \"name\": \"access_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token_expires_at\": {\n          \"name\": \"refresh_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"scope\": {\n          \"name\": \"scope\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"password\": {\n          \"name\": \"password\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"account_user_id_user_id_fk\": {\n          \"name\": \"account_user_id_user_id_fk\",\n          \"tableFrom\": \"account\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.passkey\": {\n      \"name\": \"passkey\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"publicKey\": {\n          \"name\": \"publicKey\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"userId\": {\n          \"name\": \"userId\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"credentialId\": {\n          \"name\": \"credentialId\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"counter\": {\n          \"name\": \"counter\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"deviceType\": {\n          \"name\": \"deviceType\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backedUp\": {\n          \"name\": \"backedUp\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"transports\": {\n          \"name\": \"transports\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"passkey_userId_user_id_fk\": {\n          \"name\": \"passkey_userId_user_id_fk\",\n          \"tableFrom\": \"passkey\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"userId\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.session\": {\n      \"name\": \"session\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"token\": {\n          \"name\": \"token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"ip_address\": {\n          \"name\": \"ip_address\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_agent\": {\n          \"name\": \"user_agent\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"impersonated_by\": {\n          \"name\": \"impersonated_by\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"active_organization_id\": {\n          \"name\": \"active_organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"session_user_id_user_id_fk\": {\n          \"name\": \"session_user_id_user_id_fk\",\n          \"tableFrom\": \"session\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"session_token_unique\": {\n          \"name\": \"session_token_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"token\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.two_factor\": {\n      \"name\": \"two_factor\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"secret\": {\n          \"name\": \"secret\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backup_codes\": {\n          \"name\": \"backup_codes\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"two_factor_user_id_user_id_fk\": {\n          \"name\": \"two_factor_user_id_user_id_fk\",\n          \"tableFrom\": \"two_factor\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.user\": {\n      \"name\": \"user\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email_verified\": {\n          \"name\": \"email_verified\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"image\": {\n          \"name\": \"image\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"theme\": {\n          \"name\": \"theme\",\n          \"type\": \"user_themes\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'light'\"\n        },\n        \"banned\": {\n          \"name\": \"banned\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_reason\": {\n          \"name\": \"ban_reason\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_expires\": {\n          \"name\": \"ban_expires\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"lastConnectedAt\": {\n          \"name\": \"lastConnectedAt\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"lastChangedPasswordAt\": {\n          \"name\": \"lastChangedPasswordAt\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"two_factor_enabled\": {\n          \"name\": \"two_factor_enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"user_email_unique\": {\n          \"name\": \"user_email_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"email\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.verification\": {\n      \"name\": \"verification\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"identifier\": {\n          \"name\": \"identifier\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"value\": {\n          \"name\": \"value\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization\": {\n      \"name\": \"organization\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"logo\": {\n          \"name\": \"logo\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"metadata\": {\n          \"name\": \"metadata\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_slug_unique\": {\n          \"name\": \"organization_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.member\": {\n      \"name\": \"member\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"member_organization_id_organization_id_fk\": {\n          \"name\": \"member_organization_id_organization_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"member_user_id_user_id_fk\": {\n          \"name\": \"member_user_id_user_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.invitation\": {\n      \"name\": \"invitation\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"inviter_id\": {\n          \"name\": \"inviter_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"invitation_organization_id_organization_id_fk\": {\n          \"name\": \"invitation_organization_id_organization_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"invitation_inviter_id_user_id_fk\": {\n          \"name\": \"invitation_inviter_id_user_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"inviter_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.projects\": {\n      \"name\": \"projects\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"projects_organization_id_organization_id_fk\": {\n          \"name\": \"projects_organization_id_organization_id_fk\",\n          \"tableFrom\": \"projects\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"projects_slug_unique\": {\n          \"name\": \"projects_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backups\": {\n      \"name\": \"backups\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"file\": {\n          \"name\": \"file\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"file_size\": {\n          \"name\": \"file_size\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"imported\": {\n          \"name\": \"imported\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backups_database_id_databases_id_fk\": {\n          \"name\": \"backups_database_id_databases_id_fk\",\n          \"tableFrom\": \"backups\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.databases\": {\n      \"name\": \"databases\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"agent_database_id\": {\n          \"name\": \"agent_database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"dbms\": {\n          \"name\": \"dbms\",\n          \"type\": \"dbms_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_policy\": {\n          \"name\": \"backup_policy\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"is_waiting_for_backup\": {\n          \"name\": \"is_waiting_for_backup\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"backup_to_restore\": {\n          \"name\": \"backup_to_restore\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"agent_id\": {\n          \"name\": \"agent_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"project_id\": {\n          \"name\": \"project_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"databases_agent_id_agents_id_fk\": {\n          \"name\": \"databases_agent_id_agents_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"agents\",\n          \"columnsFrom\": [\n            \"agent_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"databases_project_id_projects_id_fk\": {\n          \"name\": \"databases_project_id_projects_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"projects\",\n          \"columnsFrom\": [\n            \"project_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"no action\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.restorations\": {\n      \"name\": \"restorations\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"backup_storage_id\": {\n          \"name\": \"backup_storage_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"restorations_backup_storage_id_backup_storage_id_fk\": {\n          \"name\": \"restorations_backup_storage_id_backup_storage_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backup_storage\",\n          \"columnsFrom\": [\n            \"backup_storage_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_backup_id_backups_id_fk\": {\n          \"name\": \"restorations_backup_id_backups_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_database_id_databases_id_fk\": {\n          \"name\": \"restorations_database_id_databases_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.retention_policies\": {\n      \"name\": \"retention_policies\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"type\": {\n          \"name\": \"type\",\n          \"type\": \"retention_policy_type\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"count\": {\n          \"name\": \"count\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"days\": {\n          \"name\": \"days\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 30\n        },\n        \"gfs_daily\": {\n          \"name\": \"gfs_daily\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"gfs_weekly\": {\n          \"name\": \"gfs_weekly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 4\n        },\n        \"gfs_monthly\": {\n          \"name\": \"gfs_monthly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 12\n        },\n        \"gfs_yearly\": {\n          \"name\": \"gfs_yearly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 3\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"retention_policies_database_id_databases_id_fk\": {\n          \"name\": \"retention_policies_database_id_databases_id_fk\",\n          \"tableFrom\": \"retention_policies\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.agents\": {\n      \"name\": \"agents\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"version\": {\n          \"name\": \"version\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"agents_slug_unique\": {\n          \"name\": \"agents_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_channel\": {\n      \"name\": \"notification_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"notification_channel_organization_id_organization_id_fk\": {\n          \"name\": \"notification_channel_organization_id_organization_id_fk\",\n          \"tableFrom\": \"notification_channel\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_notification_channels\": {\n      \"name\": \"organization_notification_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_notification_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_notification_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_notification_channels_organization_id_notification_channel_id_unique\": {\n          \"name\": \"organization_notification_channels_organization_id_notification_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"notification_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.alert_policy\": {\n      \"name\": \"alert_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"event_kind\": {\n          \"name\": \"event_kind\",\n          \"type\": \"event_kind[]\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"alert_policy_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"alert_policy_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"alert_policy_database_id_databases_id_fk\": {\n          \"name\": \"alert_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_log\": {\n      \"name\": \"notification_log\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"channel_id\": {\n          \"name\": \"channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"policy_id\": {\n          \"name\": \"policy_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"event\": {\n          \"name\": \"event\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_name\": {\n          \"name\": \"provider_name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"title\": {\n          \"name\": \"title\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"message\": {\n          \"name\": \"message\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"level\": {\n          \"name\": \"level\",\n          \"type\": \"level\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"payload\": {\n          \"name\": \"payload\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"success\": {\n          \"name\": \"success\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"error\": {\n          \"name\": \"error\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider_response\": {\n          \"name\": \"provider_response\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"sent_at\": {\n          \"name\": \"sent_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_storage_channels\": {\n      \"name\": \"organization_storage_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_storage_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_storage_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_storage_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_storage_channels_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"organization_storage_channels_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"organization_storage_channels\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_storage_channels_organization_id_storage_channel_id_unique\": {\n          \"name\": \"organization_storage_channels_organization_id_storage_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"storage_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.storage_channel\": {\n      \"name\": \"storage_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_storage_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"storage_channel_organization_id_organization_id_fk\": {\n          \"name\": \"storage_channel_organization_id_organization_id_fk\",\n          \"tableFrom\": \"storage_channel\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.storage_policy\": {\n      \"name\": \"storage_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"storage_policy_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"storage_policy_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"storage_policy\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"storage_policy_database_id_databases_id_fk\": {\n          \"name\": \"storage_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"storage_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backup_storage\": {\n      \"name\": \"backup_storage\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"backup_storage_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'pending'\"\n        },\n        \"path\": {\n          \"name\": \"path\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"size\": {\n          \"name\": \"size\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"checksum\": {\n          \"name\": \"checksum\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backup_storage_backup_id_backups_id_fk\": {\n          \"name\": \"backup_storage_backup_id_backups_id_fk\",\n          \"tableFrom\": \"backup_storage\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"backup_storage_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"backup_storage_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"backup_storage\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    }\n  },\n  \"enums\": {\n    \"public.user_themes\": {\n      \"name\": \"user_themes\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"light\",\n        \"dark\",\n        \"system\"\n      ]\n    },\n    \"public.retention_policy_type\": {\n      \"name\": \"retention_policy_type\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"count\",\n        \"days\",\n        \"gfs\"\n      ]\n    },\n    \"public.provider_kind\": {\n      \"name\": \"provider_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"slack\",\n        \"smtp\",\n        \"discord\",\n        \"telegram\",\n        \"gotify\",\n        \"ntfy\",\n        \"webhook\"\n      ]\n    },\n    \"public.event_kind\": {\n      \"name\": \"event_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"error_backup\",\n        \"error_restore\",\n        \"success_restore\",\n        \"success_backup\",\n        \"weekly_report\"\n      ]\n    },\n    \"public.level\": {\n      \"name\": \"level\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"critical\",\n        \"warning\",\n        \"info\"\n      ]\n    },\n    \"public.provider_storage_kind\": {\n      \"name\": \"provider_storage_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\",\n        \"google-drive\"\n      ]\n    },\n    \"public.backup_storage_status\": {\n      \"name\": \"backup_storage_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"pending\",\n        \"success\",\n        \"failed\"\n      ]\n    },\n    \"public.dbms_status\": {\n      \"name\": \"dbms_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"postgresql\",\n        \"mysql\",\n        \"mongodb\"\n      ]\n    },\n    \"public.status\": {\n      \"name\": \"status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"waiting\",\n        \"ongoing\",\n        \"failed\",\n        \"success\"\n      ]\n    },\n    \"public.type_storage\": {\n      \"name\": \"type_storage\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\"\n      ]\n    }\n  },\n  \"schemas\": {},\n  \"sequences\": {},\n  \"roles\": {},\n  \"policies\": {},\n  \"views\": {},\n  \"_meta\": {\n    \"columns\": {},\n    \"schemas\": {},\n    \"tables\": {}\n  }\n}"
  },
  {
    "path": "src/db/migrations/meta/0034_snapshot.json",
    "content": "{\n  \"id\": \"90c26bd4-552c-445a-8491-487bcf705fa6\",\n  \"prevId\": \"29b53ca7-d603-4433-96f0-44d2df48ebdc\",\n  \"version\": \"7\",\n  \"dialect\": \"postgresql\",\n  \"tables\": {\n    \"public.settings\": {\n      \"name\": \"settings\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"smtp_password\": {\n          \"name\": \"smtp_password\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_from\": {\n          \"name\": \"smtp_from\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_host\": {\n          \"name\": \"smtp_host\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_port\": {\n          \"name\": \"smtp_port\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_user\": {\n          \"name\": \"smtp_user\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_secure\": {\n          \"name\": \"smtp_secure\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"default_storage_channel_id\": {\n          \"name\": \"default_storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"encryption\": {\n          \"name\": \"encryption\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"settings_default_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"settings_default_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"settings\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\"default_storage_channel_id\"],\n          \"columnsTo\": [\"id\"],\n          \"onDelete\": \"set null\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"settings_name_unique\": {\n          \"name\": \"settings_name_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\"name\"]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.account\": {\n      \"name\": \"account\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"account_id\": {\n          \"name\": \"account_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"access_token\": {\n          \"name\": \"access_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token\": {\n          \"name\": \"refresh_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"id_token\": {\n          \"name\": \"id_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"access_token_expires_at\": {\n          \"name\": \"access_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token_expires_at\": {\n          \"name\": \"refresh_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"scope\": {\n          \"name\": \"scope\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"password\": {\n          \"name\": \"password\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"account_user_id_user_id_fk\": {\n          \"name\": \"account_user_id_user_id_fk\",\n          \"tableFrom\": \"account\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\"user_id\"],\n          \"columnsTo\": [\"id\"],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.passkey\": {\n      \"name\": \"passkey\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"publicKey\": {\n          \"name\": \"publicKey\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"userId\": {\n          \"name\": \"userId\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"credentialId\": {\n          \"name\": \"credentialId\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"counter\": {\n          \"name\": \"counter\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"deviceType\": {\n          \"name\": \"deviceType\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backedUp\": {\n          \"name\": \"backedUp\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"transports\": {\n          \"name\": \"transports\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"passkey_userId_user_id_fk\": {\n          \"name\": \"passkey_userId_user_id_fk\",\n          \"tableFrom\": \"passkey\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\"userId\"],\n          \"columnsTo\": [\"id\"],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.session\": {\n      \"name\": \"session\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"token\": {\n          \"name\": \"token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"ip_address\": {\n          \"name\": \"ip_address\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_agent\": {\n          \"name\": \"user_agent\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"impersonated_by\": {\n          \"name\": \"impersonated_by\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"active_organization_id\": {\n          \"name\": \"active_organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"session_user_id_user_id_fk\": {\n          \"name\": \"session_user_id_user_id_fk\",\n          \"tableFrom\": \"session\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\"user_id\"],\n          \"columnsTo\": [\"id\"],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"session_token_unique\": {\n          \"name\": \"session_token_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\"token\"]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.two_factor\": {\n      \"name\": \"two_factor\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"secret\": {\n          \"name\": \"secret\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backup_codes\": {\n          \"name\": \"backup_codes\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"two_factor_user_id_user_id_fk\": {\n          \"name\": \"two_factor_user_id_user_id_fk\",\n          \"tableFrom\": \"two_factor\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\"user_id\"],\n          \"columnsTo\": [\"id\"],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.user\": {\n      \"name\": \"user\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email_verified\": {\n          \"name\": \"email_verified\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"image\": {\n          \"name\": \"image\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"theme\": {\n          \"name\": \"theme\",\n          \"type\": \"user_themes\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'light'\"\n        },\n        \"banned\": {\n          \"name\": \"banned\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_reason\": {\n          \"name\": \"ban_reason\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_expires\": {\n          \"name\": \"ban_expires\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"lastConnectedAt\": {\n          \"name\": \"lastConnectedAt\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"lastChangedPasswordAt\": {\n          \"name\": \"lastChangedPasswordAt\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"two_factor_enabled\": {\n          \"name\": \"two_factor_enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"user_email_unique\": {\n          \"name\": \"user_email_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\"email\"]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.verification\": {\n      \"name\": \"verification\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"identifier\": {\n          \"name\": \"identifier\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"value\": {\n          \"name\": \"value\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization\": {\n      \"name\": \"organization\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"logo\": {\n          \"name\": \"logo\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"metadata\": {\n          \"name\": \"metadata\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_slug_unique\": {\n          \"name\": \"organization_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\"slug\"]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.member\": {\n      \"name\": \"member\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"member_organization_id_organization_id_fk\": {\n          \"name\": \"member_organization_id_organization_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\"organization_id\"],\n          \"columnsTo\": [\"id\"],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"member_user_id_user_id_fk\": {\n          \"name\": \"member_user_id_user_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\"user_id\"],\n          \"columnsTo\": [\"id\"],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.invitation\": {\n      \"name\": \"invitation\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"inviter_id\": {\n          \"name\": \"inviter_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"invitation_organization_id_organization_id_fk\": {\n          \"name\": \"invitation_organization_id_organization_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\"organization_id\"],\n          \"columnsTo\": [\"id\"],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"invitation_inviter_id_user_id_fk\": {\n          \"name\": \"invitation_inviter_id_user_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\"inviter_id\"],\n          \"columnsTo\": [\"id\"],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.projects\": {\n      \"name\": \"projects\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"projects_organization_id_organization_id_fk\": {\n          \"name\": \"projects_organization_id_organization_id_fk\",\n          \"tableFrom\": \"projects\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\"organization_id\"],\n          \"columnsTo\": [\"id\"],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"projects_slug_unique\": {\n          \"name\": \"projects_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\"slug\"]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backups\": {\n      \"name\": \"backups\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"file\": {\n          \"name\": \"file\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"file_size\": {\n          \"name\": \"file_size\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"imported\": {\n          \"name\": \"imported\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backups_database_id_databases_id_fk\": {\n          \"name\": \"backups_database_id_databases_id_fk\",\n          \"tableFrom\": \"backups\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\"database_id\"],\n          \"columnsTo\": [\"id\"],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.databases\": {\n      \"name\": \"databases\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"agent_database_id\": {\n          \"name\": \"agent_database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"dbms\": {\n          \"name\": \"dbms\",\n          \"type\": \"dbms_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_policy\": {\n          \"name\": \"backup_policy\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"is_waiting_for_backup\": {\n          \"name\": \"is_waiting_for_backup\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"backup_to_restore\": {\n          \"name\": \"backup_to_restore\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"agent_id\": {\n          \"name\": \"agent_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"project_id\": {\n          \"name\": \"project_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"databases_agent_id_agents_id_fk\": {\n          \"name\": \"databases_agent_id_agents_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"agents\",\n          \"columnsFrom\": [\"agent_id\"],\n          \"columnsTo\": [\"id\"],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"databases_project_id_projects_id_fk\": {\n          \"name\": \"databases_project_id_projects_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"projects\",\n          \"columnsFrom\": [\"project_id\"],\n          \"columnsTo\": [\"id\"],\n          \"onDelete\": \"no action\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.restorations\": {\n      \"name\": \"restorations\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"backup_storage_id\": {\n          \"name\": \"backup_storage_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"restorations_backup_storage_id_backup_storage_id_fk\": {\n          \"name\": \"restorations_backup_storage_id_backup_storage_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backup_storage\",\n          \"columnsFrom\": [\"backup_storage_id\"],\n          \"columnsTo\": [\"id\"],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_backup_id_backups_id_fk\": {\n          \"name\": \"restorations_backup_id_backups_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\"backup_id\"],\n          \"columnsTo\": [\"id\"],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_database_id_databases_id_fk\": {\n          \"name\": \"restorations_database_id_databases_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\"database_id\"],\n          \"columnsTo\": [\"id\"],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.retention_policies\": {\n      \"name\": \"retention_policies\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"type\": {\n          \"name\": \"type\",\n          \"type\": \"retention_policy_type\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"count\": {\n          \"name\": \"count\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"days\": {\n          \"name\": \"days\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 30\n        },\n        \"gfs_daily\": {\n          \"name\": \"gfs_daily\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"gfs_weekly\": {\n          \"name\": \"gfs_weekly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 4\n        },\n        \"gfs_monthly\": {\n          \"name\": \"gfs_monthly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 12\n        },\n        \"gfs_yearly\": {\n          \"name\": \"gfs_yearly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 3\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"retention_policies_database_id_databases_id_fk\": {\n          \"name\": \"retention_policies_database_id_databases_id_fk\",\n          \"tableFrom\": \"retention_policies\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\"database_id\"],\n          \"columnsTo\": [\"id\"],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.agents\": {\n      \"name\": \"agents\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"version\": {\n          \"name\": \"version\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"agents_slug_unique\": {\n          \"name\": \"agents_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\"slug\"]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_channel\": {\n      \"name\": \"notification_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"notification_channel_organization_id_organization_id_fk\": {\n          \"name\": \"notification_channel_organization_id_organization_id_fk\",\n          \"tableFrom\": \"notification_channel\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\"organization_id\"],\n          \"columnsTo\": [\"id\"],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_notification_channels\": {\n      \"name\": \"organization_notification_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_notification_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_notification_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\"organization_id\"],\n          \"columnsTo\": [\"id\"],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\"notification_channel_id\"],\n          \"columnsTo\": [\"id\"],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_notification_channels_organization_id_notification_channel_id_unique\": {\n          \"name\": \"organization_notification_channels_organization_id_notification_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\"organization_id\", \"notification_channel_id\"]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.alert_policy\": {\n      \"name\": \"alert_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"event_kind\": {\n          \"name\": \"event_kind\",\n          \"type\": \"event_kind[]\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"alert_policy_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"alert_policy_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\"notification_channel_id\"],\n          \"columnsTo\": [\"id\"],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"alert_policy_database_id_databases_id_fk\": {\n          \"name\": \"alert_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\"database_id\"],\n          \"columnsTo\": [\"id\"],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_log\": {\n      \"name\": \"notification_log\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"channel_id\": {\n          \"name\": \"channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"policy_id\": {\n          \"name\": \"policy_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"event\": {\n          \"name\": \"event\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_name\": {\n          \"name\": \"provider_name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"title\": {\n          \"name\": \"title\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"message\": {\n          \"name\": \"message\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"level\": {\n          \"name\": \"level\",\n          \"type\": \"level\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"payload\": {\n          \"name\": \"payload\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"success\": {\n          \"name\": \"success\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"error\": {\n          \"name\": \"error\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider_response\": {\n          \"name\": \"provider_response\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"sent_at\": {\n          \"name\": \"sent_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_storage_channels\": {\n      \"name\": \"organization_storage_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_storage_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_storage_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_storage_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\"organization_id\"],\n          \"columnsTo\": [\"id\"],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_storage_channels_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"organization_storage_channels_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"organization_storage_channels\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\"storage_channel_id\"],\n          \"columnsTo\": [\"id\"],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_storage_channels_organization_id_storage_channel_id_unique\": {\n          \"name\": \"organization_storage_channels_organization_id_storage_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\"organization_id\", \"storage_channel_id\"]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.storage_channel\": {\n      \"name\": \"storage_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_storage_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"storage_channel_organization_id_organization_id_fk\": {\n          \"name\": \"storage_channel_organization_id_organization_id_fk\",\n          \"tableFrom\": \"storage_channel\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\"organization_id\"],\n          \"columnsTo\": [\"id\"],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.storage_policy\": {\n      \"name\": \"storage_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"storage_policy_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"storage_policy_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"storage_policy\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\"storage_channel_id\"],\n          \"columnsTo\": [\"id\"],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"storage_policy_database_id_databases_id_fk\": {\n          \"name\": \"storage_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"storage_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\"database_id\"],\n          \"columnsTo\": [\"id\"],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backup_storage\": {\n      \"name\": \"backup_storage\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"backup_storage_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'pending'\"\n        },\n        \"path\": {\n          \"name\": \"path\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"size\": {\n          \"name\": \"size\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"checksum\": {\n          \"name\": \"checksum\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backup_storage_backup_id_backups_id_fk\": {\n          \"name\": \"backup_storage_backup_id_backups_id_fk\",\n          \"tableFrom\": \"backup_storage\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\"backup_id\"],\n          \"columnsTo\": [\"id\"],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"backup_storage_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"backup_storage_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"backup_storage\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\"storage_channel_id\"],\n          \"columnsTo\": [\"id\"],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    }\n  },\n  \"enums\": {\n    \"public.user_themes\": {\n      \"name\": \"user_themes\",\n      \"schema\": \"public\",\n      \"values\": [\"light\", \"dark\", \"system\"]\n    },\n    \"public.retention_policy_type\": {\n      \"name\": \"retention_policy_type\",\n      \"schema\": \"public\",\n      \"values\": [\"count\", \"days\", \"gfs\"]\n    },\n    \"public.provider_kind\": {\n      \"name\": \"provider_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"slack\",\n        \"smtp\",\n        \"discord\",\n        \"telegram\",\n        \"gotify\",\n        \"ntfy\",\n        \"webhook\"\n      ]\n    },\n    \"public.event_kind\": {\n      \"name\": \"event_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"error_backup\",\n        \"error_restore\",\n        \"success_restore\",\n        \"success_backup\",\n        \"weekly_report\"\n      ]\n    },\n    \"public.level\": {\n      \"name\": \"level\",\n      \"schema\": \"public\",\n      \"values\": [\"critical\", \"warning\", \"info\"]\n    },\n    \"public.provider_storage_kind\": {\n      \"name\": \"provider_storage_kind\",\n      \"schema\": \"public\",\n      \"values\": [\"local\", \"s3\", \"google-drive\"]\n    },\n    \"public.backup_storage_status\": {\n      \"name\": \"backup_storage_status\",\n      \"schema\": \"public\",\n      \"values\": [\"pending\", \"success\", \"failed\"]\n    },\n    \"public.dbms_status\": {\n      \"name\": \"dbms_status\",\n      \"schema\": \"public\",\n      \"values\": [\"postgresql\", \"mysql\", \"mongodb\", \"sqlite\"]\n    },\n    \"public.status\": {\n      \"name\": \"status\",\n      \"schema\": \"public\",\n      \"values\": [\"waiting\", \"ongoing\", \"failed\", \"success\"]\n    },\n    \"public.type_storage\": {\n      \"name\": \"type_storage\",\n      \"schema\": \"public\",\n      \"values\": [\"local\", \"s3\"]\n    }\n  },\n  \"schemas\": {},\n  \"sequences\": {},\n  \"roles\": {},\n  \"policies\": {},\n  \"views\": {},\n  \"_meta\": {\n    \"columns\": {},\n    \"schemas\": {},\n    \"tables\": {}\n  }\n}\n"
  },
  {
    "path": "src/db/migrations/meta/0035_snapshot.json",
    "content": "{\n  \"id\": \"d26e1e78-ce2d-4084-bceb-c9e058a2b610\",\n  \"prevId\": \"90c26bd4-552c-445a-8491-487bcf705fa6\",\n  \"version\": \"7\",\n  \"dialect\": \"postgresql\",\n  \"tables\": {\n    \"public.settings\": {\n      \"name\": \"settings\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"smtp_password\": {\n          \"name\": \"smtp_password\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_from\": {\n          \"name\": \"smtp_from\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_host\": {\n          \"name\": \"smtp_host\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_port\": {\n          \"name\": \"smtp_port\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_user\": {\n          \"name\": \"smtp_user\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_secure\": {\n          \"name\": \"smtp_secure\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"default_storage_channel_id\": {\n          \"name\": \"default_storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"encryption\": {\n          \"name\": \"encryption\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"settings_default_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"settings_default_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"settings\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"default_storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"set null\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"settings_name_unique\": {\n          \"name\": \"settings_name_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"name\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.account\": {\n      \"name\": \"account\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"account_id\": {\n          \"name\": \"account_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"access_token\": {\n          \"name\": \"access_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token\": {\n          \"name\": \"refresh_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"id_token\": {\n          \"name\": \"id_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"access_token_expires_at\": {\n          \"name\": \"access_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token_expires_at\": {\n          \"name\": \"refresh_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"scope\": {\n          \"name\": \"scope\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"password\": {\n          \"name\": \"password\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"account_user_id_user_id_fk\": {\n          \"name\": \"account_user_id_user_id_fk\",\n          \"tableFrom\": \"account\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.passkey\": {\n      \"name\": \"passkey\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"public_key\": {\n          \"name\": \"public_key\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"credential_id\": {\n          \"name\": \"credential_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"counter\": {\n          \"name\": \"counter\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"device_type\": {\n          \"name\": \"device_type\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backed_up\": {\n          \"name\": \"backed_up\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"transports\": {\n          \"name\": \"transports\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"aaguid\": {\n          \"name\": \"aaguid\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"passkey_user_id_user_id_fk\": {\n          \"name\": \"passkey_user_id_user_id_fk\",\n          \"tableFrom\": \"passkey\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.session\": {\n      \"name\": \"session\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"token\": {\n          \"name\": \"token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"ip_address\": {\n          \"name\": \"ip_address\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_agent\": {\n          \"name\": \"user_agent\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"impersonated_by\": {\n          \"name\": \"impersonated_by\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"active_organization_id\": {\n          \"name\": \"active_organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"session_user_id_user_id_fk\": {\n          \"name\": \"session_user_id_user_id_fk\",\n          \"tableFrom\": \"session\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"session_token_unique\": {\n          \"name\": \"session_token_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"token\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.sso_provider\": {\n      \"name\": \"sso_provider\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"issuer\": {\n          \"name\": \"issuer\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"oidc_config\": {\n          \"name\": \"oidc_config\",\n          \"type\": \"json\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"saml_config\": {\n          \"name\": \"saml_config\",\n          \"type\": \"json\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"domain\": {\n          \"name\": \"domain\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"sso_provider_user_id_user_id_fk\": {\n          \"name\": \"sso_provider_user_id_user_id_fk\",\n          \"tableFrom\": \"sso_provider\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"sso_provider_provider_id_unique\": {\n          \"name\": \"sso_provider_provider_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"provider_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.two_factor\": {\n      \"name\": \"two_factor\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"secret\": {\n          \"name\": \"secret\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backup_codes\": {\n          \"name\": \"backup_codes\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"two_factor_user_id_user_id_fk\": {\n          \"name\": \"two_factor_user_id_user_id_fk\",\n          \"tableFrom\": \"two_factor\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.user\": {\n      \"name\": \"user\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email_verified\": {\n          \"name\": \"email_verified\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"image\": {\n          \"name\": \"image\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"theme\": {\n          \"name\": \"theme\",\n          \"type\": \"user_themes\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'light'\"\n        },\n        \"banned\": {\n          \"name\": \"banned\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_reason\": {\n          \"name\": \"ban_reason\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_expires\": {\n          \"name\": \"ban_expires\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"lastConnectedAt\": {\n          \"name\": \"lastConnectedAt\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"lastChangedPasswordAt\": {\n          \"name\": \"lastChangedPasswordAt\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"two_factor_enabled\": {\n          \"name\": \"two_factor_enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"user_email_unique\": {\n          \"name\": \"user_email_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"email\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.verification\": {\n      \"name\": \"verification\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"identifier\": {\n          \"name\": \"identifier\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"value\": {\n          \"name\": \"value\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization\": {\n      \"name\": \"organization\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"logo\": {\n          \"name\": \"logo\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"metadata\": {\n          \"name\": \"metadata\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_slug_unique\": {\n          \"name\": \"organization_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.member\": {\n      \"name\": \"member\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"member_organization_id_organization_id_fk\": {\n          \"name\": \"member_organization_id_organization_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"member_user_id_user_id_fk\": {\n          \"name\": \"member_user_id_user_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.invitation\": {\n      \"name\": \"invitation\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"inviter_id\": {\n          \"name\": \"inviter_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"invitation_organization_id_organization_id_fk\": {\n          \"name\": \"invitation_organization_id_organization_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"invitation_inviter_id_user_id_fk\": {\n          \"name\": \"invitation_inviter_id_user_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"inviter_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.projects\": {\n      \"name\": \"projects\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"projects_organization_id_organization_id_fk\": {\n          \"name\": \"projects_organization_id_organization_id_fk\",\n          \"tableFrom\": \"projects\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"projects_slug_unique\": {\n          \"name\": \"projects_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backups\": {\n      \"name\": \"backups\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"file\": {\n          \"name\": \"file\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"file_size\": {\n          \"name\": \"file_size\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"imported\": {\n          \"name\": \"imported\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backups_database_id_databases_id_fk\": {\n          \"name\": \"backups_database_id_databases_id_fk\",\n          \"tableFrom\": \"backups\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.databases\": {\n      \"name\": \"databases\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"agent_database_id\": {\n          \"name\": \"agent_database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"dbms\": {\n          \"name\": \"dbms\",\n          \"type\": \"dbms_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_policy\": {\n          \"name\": \"backup_policy\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"is_waiting_for_backup\": {\n          \"name\": \"is_waiting_for_backup\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"backup_to_restore\": {\n          \"name\": \"backup_to_restore\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"agent_id\": {\n          \"name\": \"agent_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"project_id\": {\n          \"name\": \"project_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"databases_agent_id_agents_id_fk\": {\n          \"name\": \"databases_agent_id_agents_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"agents\",\n          \"columnsFrom\": [\n            \"agent_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"databases_project_id_projects_id_fk\": {\n          \"name\": \"databases_project_id_projects_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"projects\",\n          \"columnsFrom\": [\n            \"project_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"no action\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.restorations\": {\n      \"name\": \"restorations\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"backup_storage_id\": {\n          \"name\": \"backup_storage_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"restorations_backup_storage_id_backup_storage_id_fk\": {\n          \"name\": \"restorations_backup_storage_id_backup_storage_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backup_storage\",\n          \"columnsFrom\": [\n            \"backup_storage_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_backup_id_backups_id_fk\": {\n          \"name\": \"restorations_backup_id_backups_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_database_id_databases_id_fk\": {\n          \"name\": \"restorations_database_id_databases_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.retention_policies\": {\n      \"name\": \"retention_policies\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"type\": {\n          \"name\": \"type\",\n          \"type\": \"retention_policy_type\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"count\": {\n          \"name\": \"count\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"days\": {\n          \"name\": \"days\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 30\n        },\n        \"gfs_daily\": {\n          \"name\": \"gfs_daily\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"gfs_weekly\": {\n          \"name\": \"gfs_weekly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 4\n        },\n        \"gfs_monthly\": {\n          \"name\": \"gfs_monthly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 12\n        },\n        \"gfs_yearly\": {\n          \"name\": \"gfs_yearly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 3\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"retention_policies_database_id_databases_id_fk\": {\n          \"name\": \"retention_policies_database_id_databases_id_fk\",\n          \"tableFrom\": \"retention_policies\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.agents\": {\n      \"name\": \"agents\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"version\": {\n          \"name\": \"version\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"agents_slug_unique\": {\n          \"name\": \"agents_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_channel\": {\n      \"name\": \"notification_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"notification_channel_organization_id_organization_id_fk\": {\n          \"name\": \"notification_channel_organization_id_organization_id_fk\",\n          \"tableFrom\": \"notification_channel\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_notification_channels\": {\n      \"name\": \"organization_notification_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_notification_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_notification_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_notification_channels_organization_id_notification_channel_id_unique\": {\n          \"name\": \"organization_notification_channels_organization_id_notification_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"notification_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.alert_policy\": {\n      \"name\": \"alert_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"event_kind\": {\n          \"name\": \"event_kind\",\n          \"type\": \"event_kind[]\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"alert_policy_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"alert_policy_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"alert_policy_database_id_databases_id_fk\": {\n          \"name\": \"alert_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_log\": {\n      \"name\": \"notification_log\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"channel_id\": {\n          \"name\": \"channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"policy_id\": {\n          \"name\": \"policy_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"event\": {\n          \"name\": \"event\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_name\": {\n          \"name\": \"provider_name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"title\": {\n          \"name\": \"title\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"message\": {\n          \"name\": \"message\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"level\": {\n          \"name\": \"level\",\n          \"type\": \"level\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"payload\": {\n          \"name\": \"payload\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"success\": {\n          \"name\": \"success\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"error\": {\n          \"name\": \"error\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider_response\": {\n          \"name\": \"provider_response\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"sent_at\": {\n          \"name\": \"sent_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_storage_channels\": {\n      \"name\": \"organization_storage_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_storage_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_storage_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_storage_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_storage_channels_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"organization_storage_channels_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"organization_storage_channels\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_storage_channels_organization_id_storage_channel_id_unique\": {\n          \"name\": \"organization_storage_channels_organization_id_storage_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"storage_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.storage_channel\": {\n      \"name\": \"storage_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_storage_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"storage_channel_organization_id_organization_id_fk\": {\n          \"name\": \"storage_channel_organization_id_organization_id_fk\",\n          \"tableFrom\": \"storage_channel\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.storage_policy\": {\n      \"name\": \"storage_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"storage_policy_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"storage_policy_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"storage_policy\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"storage_policy_database_id_databases_id_fk\": {\n          \"name\": \"storage_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"storage_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backup_storage\": {\n      \"name\": \"backup_storage\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"backup_storage_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'pending'\"\n        },\n        \"path\": {\n          \"name\": \"path\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"size\": {\n          \"name\": \"size\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"checksum\": {\n          \"name\": \"checksum\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backup_storage_backup_id_backups_id_fk\": {\n          \"name\": \"backup_storage_backup_id_backups_id_fk\",\n          \"tableFrom\": \"backup_storage\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"backup_storage_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"backup_storage_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"backup_storage\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    }\n  },\n  \"enums\": {\n    \"public.user_themes\": {\n      \"name\": \"user_themes\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"light\",\n        \"dark\",\n        \"system\"\n      ]\n    },\n    \"public.retention_policy_type\": {\n      \"name\": \"retention_policy_type\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"count\",\n        \"days\",\n        \"gfs\"\n      ]\n    },\n    \"public.provider_kind\": {\n      \"name\": \"provider_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"slack\",\n        \"smtp\",\n        \"discord\",\n        \"telegram\",\n        \"gotify\",\n        \"ntfy\",\n        \"webhook\"\n      ]\n    },\n    \"public.event_kind\": {\n      \"name\": \"event_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"error_backup\",\n        \"error_restore\",\n        \"success_restore\",\n        \"success_backup\",\n        \"weekly_report\"\n      ]\n    },\n    \"public.level\": {\n      \"name\": \"level\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"critical\",\n        \"warning\",\n        \"info\"\n      ]\n    },\n    \"public.provider_storage_kind\": {\n      \"name\": \"provider_storage_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\",\n        \"google-drive\"\n      ]\n    },\n    \"public.backup_storage_status\": {\n      \"name\": \"backup_storage_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"pending\",\n        \"success\",\n        \"failed\"\n      ]\n    },\n    \"public.dbms_status\": {\n      \"name\": \"dbms_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"postgresql\",\n        \"mysql\",\n        \"mongodb\",\n        \"sqlite\"\n      ]\n    },\n    \"public.status\": {\n      \"name\": \"status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"waiting\",\n        \"ongoing\",\n        \"failed\",\n        \"success\"\n      ]\n    },\n    \"public.type_storage\": {\n      \"name\": \"type_storage\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\"\n      ]\n    }\n  },\n  \"schemas\": {},\n  \"sequences\": {},\n  \"roles\": {},\n  \"policies\": {},\n  \"views\": {},\n  \"_meta\": {\n    \"columns\": {},\n    \"schemas\": {},\n    \"tables\": {}\n  }\n}"
  },
  {
    "path": "src/db/migrations/meta/0036_snapshot.json",
    "content": "{\n  \"id\": \"1cfe23fa-914c-4bd0-b131-af115fdac03d\",\n  \"prevId\": \"d26e1e78-ce2d-4084-bceb-c9e058a2b610\",\n  \"version\": \"7\",\n  \"dialect\": \"postgresql\",\n  \"tables\": {\n    \"public.settings\": {\n      \"name\": \"settings\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"smtp_password\": {\n          \"name\": \"smtp_password\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_from\": {\n          \"name\": \"smtp_from\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_host\": {\n          \"name\": \"smtp_host\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_port\": {\n          \"name\": \"smtp_port\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_user\": {\n          \"name\": \"smtp_user\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_secure\": {\n          \"name\": \"smtp_secure\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"default_storage_channel_id\": {\n          \"name\": \"default_storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"encryption\": {\n          \"name\": \"encryption\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"settings_default_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"settings_default_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"settings\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"default_storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"set null\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"settings_name_unique\": {\n          \"name\": \"settings_name_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"name\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.account\": {\n      \"name\": \"account\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"account_id\": {\n          \"name\": \"account_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"access_token\": {\n          \"name\": \"access_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token\": {\n          \"name\": \"refresh_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"id_token\": {\n          \"name\": \"id_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"access_token_expires_at\": {\n          \"name\": \"access_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token_expires_at\": {\n          \"name\": \"refresh_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"scope\": {\n          \"name\": \"scope\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"password\": {\n          \"name\": \"password\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"account_user_id_user_id_fk\": {\n          \"name\": \"account_user_id_user_id_fk\",\n          \"tableFrom\": \"account\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.passkey\": {\n      \"name\": \"passkey\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"publicKey\": {\n          \"name\": \"publicKey\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"credentialId\": {\n          \"name\": \"credentialId\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"counter\": {\n          \"name\": \"counter\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"deviceType\": {\n          \"name\": \"deviceType\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backedUp\": {\n          \"name\": \"backedUp\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"transports\": {\n          \"name\": \"transports\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"aaguid\": {\n          \"name\": \"aaguid\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"passkey_user_id_user_id_fk\": {\n          \"name\": \"passkey_user_id_user_id_fk\",\n          \"tableFrom\": \"passkey\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.session\": {\n      \"name\": \"session\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"token\": {\n          \"name\": \"token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"ip_address\": {\n          \"name\": \"ip_address\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_agent\": {\n          \"name\": \"user_agent\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"impersonated_by\": {\n          \"name\": \"impersonated_by\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"active_organization_id\": {\n          \"name\": \"active_organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"session_user_id_user_id_fk\": {\n          \"name\": \"session_user_id_user_id_fk\",\n          \"tableFrom\": \"session\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"session_token_unique\": {\n          \"name\": \"session_token_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"token\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.sso_provider\": {\n      \"name\": \"sso_provider\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"issuer\": {\n          \"name\": \"issuer\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"oidc_config\": {\n          \"name\": \"oidc_config\",\n          \"type\": \"json\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"saml_config\": {\n          \"name\": \"saml_config\",\n          \"type\": \"json\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"domain\": {\n          \"name\": \"domain\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"sso_provider_user_id_user_id_fk\": {\n          \"name\": \"sso_provider_user_id_user_id_fk\",\n          \"tableFrom\": \"sso_provider\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"sso_provider_provider_id_unique\": {\n          \"name\": \"sso_provider_provider_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"provider_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.two_factor\": {\n      \"name\": \"two_factor\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"secret\": {\n          \"name\": \"secret\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backup_codes\": {\n          \"name\": \"backup_codes\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"two_factor_user_id_user_id_fk\": {\n          \"name\": \"two_factor_user_id_user_id_fk\",\n          \"tableFrom\": \"two_factor\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.user\": {\n      \"name\": \"user\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email_verified\": {\n          \"name\": \"email_verified\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"image\": {\n          \"name\": \"image\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"theme\": {\n          \"name\": \"theme\",\n          \"type\": \"user_themes\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'light'\"\n        },\n        \"banned\": {\n          \"name\": \"banned\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_reason\": {\n          \"name\": \"ban_reason\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_expires\": {\n          \"name\": \"ban_expires\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"lastConnectedAt\": {\n          \"name\": \"lastConnectedAt\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"lastChangedPasswordAt\": {\n          \"name\": \"lastChangedPasswordAt\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"two_factor_enabled\": {\n          \"name\": \"two_factor_enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"user_email_unique\": {\n          \"name\": \"user_email_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"email\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.verification\": {\n      \"name\": \"verification\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"identifier\": {\n          \"name\": \"identifier\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"value\": {\n          \"name\": \"value\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization\": {\n      \"name\": \"organization\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"logo\": {\n          \"name\": \"logo\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"metadata\": {\n          \"name\": \"metadata\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_slug_unique\": {\n          \"name\": \"organization_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.member\": {\n      \"name\": \"member\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"member_organization_id_organization_id_fk\": {\n          \"name\": \"member_organization_id_organization_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"member_user_id_user_id_fk\": {\n          \"name\": \"member_user_id_user_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.invitation\": {\n      \"name\": \"invitation\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"inviter_id\": {\n          \"name\": \"inviter_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"invitation_organization_id_organization_id_fk\": {\n          \"name\": \"invitation_organization_id_organization_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"invitation_inviter_id_user_id_fk\": {\n          \"name\": \"invitation_inviter_id_user_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"inviter_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.projects\": {\n      \"name\": \"projects\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"projects_organization_id_organization_id_fk\": {\n          \"name\": \"projects_organization_id_organization_id_fk\",\n          \"tableFrom\": \"projects\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"projects_slug_unique\": {\n          \"name\": \"projects_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backups\": {\n      \"name\": \"backups\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"file\": {\n          \"name\": \"file\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"file_size\": {\n          \"name\": \"file_size\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"imported\": {\n          \"name\": \"imported\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backups_database_id_databases_id_fk\": {\n          \"name\": \"backups_database_id_databases_id_fk\",\n          \"tableFrom\": \"backups\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.databases\": {\n      \"name\": \"databases\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"agent_database_id\": {\n          \"name\": \"agent_database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"dbms\": {\n          \"name\": \"dbms\",\n          \"type\": \"dbms_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_policy\": {\n          \"name\": \"backup_policy\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"is_waiting_for_backup\": {\n          \"name\": \"is_waiting_for_backup\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"backup_to_restore\": {\n          \"name\": \"backup_to_restore\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"agent_id\": {\n          \"name\": \"agent_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"project_id\": {\n          \"name\": \"project_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"databases_agent_id_agents_id_fk\": {\n          \"name\": \"databases_agent_id_agents_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"agents\",\n          \"columnsFrom\": [\n            \"agent_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"databases_project_id_projects_id_fk\": {\n          \"name\": \"databases_project_id_projects_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"projects\",\n          \"columnsFrom\": [\n            \"project_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"no action\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.restorations\": {\n      \"name\": \"restorations\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"backup_storage_id\": {\n          \"name\": \"backup_storage_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"restorations_backup_storage_id_backup_storage_id_fk\": {\n          \"name\": \"restorations_backup_storage_id_backup_storage_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backup_storage\",\n          \"columnsFrom\": [\n            \"backup_storage_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_backup_id_backups_id_fk\": {\n          \"name\": \"restorations_backup_id_backups_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_database_id_databases_id_fk\": {\n          \"name\": \"restorations_database_id_databases_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.retention_policies\": {\n      \"name\": \"retention_policies\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"type\": {\n          \"name\": \"type\",\n          \"type\": \"retention_policy_type\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"count\": {\n          \"name\": \"count\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"days\": {\n          \"name\": \"days\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 30\n        },\n        \"gfs_daily\": {\n          \"name\": \"gfs_daily\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"gfs_weekly\": {\n          \"name\": \"gfs_weekly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 4\n        },\n        \"gfs_monthly\": {\n          \"name\": \"gfs_monthly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 12\n        },\n        \"gfs_yearly\": {\n          \"name\": \"gfs_yearly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 3\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"retention_policies_database_id_databases_id_fk\": {\n          \"name\": \"retention_policies_database_id_databases_id_fk\",\n          \"tableFrom\": \"retention_policies\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.agents\": {\n      \"name\": \"agents\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"version\": {\n          \"name\": \"version\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"agents_slug_unique\": {\n          \"name\": \"agents_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_channel\": {\n      \"name\": \"notification_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"notification_channel_organization_id_organization_id_fk\": {\n          \"name\": \"notification_channel_organization_id_organization_id_fk\",\n          \"tableFrom\": \"notification_channel\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_notification_channels\": {\n      \"name\": \"organization_notification_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_notification_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_notification_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_notification_channels_organization_id_notification_channel_id_unique\": {\n          \"name\": \"organization_notification_channels_organization_id_notification_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"notification_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.alert_policy\": {\n      \"name\": \"alert_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"event_kind\": {\n          \"name\": \"event_kind\",\n          \"type\": \"event_kind[]\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"alert_policy_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"alert_policy_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"alert_policy_database_id_databases_id_fk\": {\n          \"name\": \"alert_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_log\": {\n      \"name\": \"notification_log\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"channel_id\": {\n          \"name\": \"channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"policy_id\": {\n          \"name\": \"policy_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"event\": {\n          \"name\": \"event\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_name\": {\n          \"name\": \"provider_name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"title\": {\n          \"name\": \"title\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"message\": {\n          \"name\": \"message\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"level\": {\n          \"name\": \"level\",\n          \"type\": \"level\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"payload\": {\n          \"name\": \"payload\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"success\": {\n          \"name\": \"success\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"error\": {\n          \"name\": \"error\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider_response\": {\n          \"name\": \"provider_response\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"sent_at\": {\n          \"name\": \"sent_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_storage_channels\": {\n      \"name\": \"organization_storage_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_storage_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_storage_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_storage_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_storage_channels_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"organization_storage_channels_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"organization_storage_channels\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_storage_channels_organization_id_storage_channel_id_unique\": {\n          \"name\": \"organization_storage_channels_organization_id_storage_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"storage_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.storage_channel\": {\n      \"name\": \"storage_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_storage_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"storage_channel_organization_id_organization_id_fk\": {\n          \"name\": \"storage_channel_organization_id_organization_id_fk\",\n          \"tableFrom\": \"storage_channel\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.storage_policy\": {\n      \"name\": \"storage_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"storage_policy_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"storage_policy_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"storage_policy\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"storage_policy_database_id_databases_id_fk\": {\n          \"name\": \"storage_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"storage_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backup_storage\": {\n      \"name\": \"backup_storage\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"backup_storage_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'pending'\"\n        },\n        \"path\": {\n          \"name\": \"path\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"size\": {\n          \"name\": \"size\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"checksum\": {\n          \"name\": \"checksum\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backup_storage_backup_id_backups_id_fk\": {\n          \"name\": \"backup_storage_backup_id_backups_id_fk\",\n          \"tableFrom\": \"backup_storage\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"backup_storage_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"backup_storage_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"backup_storage\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    }\n  },\n  \"enums\": {\n    \"public.user_themes\": {\n      \"name\": \"user_themes\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"light\",\n        \"dark\",\n        \"system\"\n      ]\n    },\n    \"public.retention_policy_type\": {\n      \"name\": \"retention_policy_type\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"count\",\n        \"days\",\n        \"gfs\"\n      ]\n    },\n    \"public.provider_kind\": {\n      \"name\": \"provider_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"slack\",\n        \"smtp\",\n        \"discord\",\n        \"telegram\",\n        \"gotify\",\n        \"ntfy\",\n        \"webhook\"\n      ]\n    },\n    \"public.event_kind\": {\n      \"name\": \"event_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"error_backup\",\n        \"error_restore\",\n        \"success_restore\",\n        \"success_backup\",\n        \"weekly_report\"\n      ]\n    },\n    \"public.level\": {\n      \"name\": \"level\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"critical\",\n        \"warning\",\n        \"info\"\n      ]\n    },\n    \"public.provider_storage_kind\": {\n      \"name\": \"provider_storage_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\",\n        \"google-drive\"\n      ]\n    },\n    \"public.backup_storage_status\": {\n      \"name\": \"backup_storage_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"pending\",\n        \"success\",\n        \"failed\"\n      ]\n    },\n    \"public.dbms_status\": {\n      \"name\": \"dbms_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"postgresql\",\n        \"mysql\",\n        \"mongodb\",\n        \"sqlite\"\n      ]\n    },\n    \"public.status\": {\n      \"name\": \"status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"waiting\",\n        \"ongoing\",\n        \"failed\",\n        \"success\"\n      ]\n    },\n    \"public.type_storage\": {\n      \"name\": \"type_storage\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\"\n      ]\n    }\n  },\n  \"schemas\": {},\n  \"sequences\": {},\n  \"roles\": {},\n  \"policies\": {},\n  \"views\": {},\n  \"_meta\": {\n    \"columns\": {},\n    \"schemas\": {},\n    \"tables\": {}\n  }\n}"
  },
  {
    "path": "src/db/migrations/meta/0037_snapshot.json",
    "content": "{\n  \"id\": \"e6e7c2db-ee6c-4887-ad2f-051e630b6198\",\n  \"prevId\": \"1cfe23fa-914c-4bd0-b131-af115fdac03d\",\n  \"version\": \"7\",\n  \"dialect\": \"postgresql\",\n  \"tables\": {\n    \"public.settings\": {\n      \"name\": \"settings\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"smtp_password\": {\n          \"name\": \"smtp_password\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_from\": {\n          \"name\": \"smtp_from\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_host\": {\n          \"name\": \"smtp_host\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_port\": {\n          \"name\": \"smtp_port\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_user\": {\n          \"name\": \"smtp_user\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_secure\": {\n          \"name\": \"smtp_secure\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"default_storage_channel_id\": {\n          \"name\": \"default_storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"encryption\": {\n          \"name\": \"encryption\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"settings_default_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"settings_default_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"settings\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"default_storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"set null\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"settings_name_unique\": {\n          \"name\": \"settings_name_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"name\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.account\": {\n      \"name\": \"account\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"account_id\": {\n          \"name\": \"account_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"access_token\": {\n          \"name\": \"access_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token\": {\n          \"name\": \"refresh_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"id_token\": {\n          \"name\": \"id_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"access_token_expires_at\": {\n          \"name\": \"access_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token_expires_at\": {\n          \"name\": \"refresh_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"scope\": {\n          \"name\": \"scope\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"password\": {\n          \"name\": \"password\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"account_user_id_user_id_fk\": {\n          \"name\": \"account_user_id_user_id_fk\",\n          \"tableFrom\": \"account\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.passkey\": {\n      \"name\": \"passkey\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"publicKey\": {\n          \"name\": \"publicKey\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"credentialID\": {\n          \"name\": \"credentialID\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"counter\": {\n          \"name\": \"counter\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"deviceType\": {\n          \"name\": \"deviceType\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backedUp\": {\n          \"name\": \"backedUp\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"transports\": {\n          \"name\": \"transports\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"aaguid\": {\n          \"name\": \"aaguid\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"passkey_user_id_user_id_fk\": {\n          \"name\": \"passkey_user_id_user_id_fk\",\n          \"tableFrom\": \"passkey\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.session\": {\n      \"name\": \"session\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"token\": {\n          \"name\": \"token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"ip_address\": {\n          \"name\": \"ip_address\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_agent\": {\n          \"name\": \"user_agent\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"impersonated_by\": {\n          \"name\": \"impersonated_by\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"active_organization_id\": {\n          \"name\": \"active_organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"session_user_id_user_id_fk\": {\n          \"name\": \"session_user_id_user_id_fk\",\n          \"tableFrom\": \"session\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"session_token_unique\": {\n          \"name\": \"session_token_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"token\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.sso_provider\": {\n      \"name\": \"sso_provider\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"issuer\": {\n          \"name\": \"issuer\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"oidc_config\": {\n          \"name\": \"oidc_config\",\n          \"type\": \"json\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"saml_config\": {\n          \"name\": \"saml_config\",\n          \"type\": \"json\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"domain\": {\n          \"name\": \"domain\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"sso_provider_user_id_user_id_fk\": {\n          \"name\": \"sso_provider_user_id_user_id_fk\",\n          \"tableFrom\": \"sso_provider\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"sso_provider_provider_id_unique\": {\n          \"name\": \"sso_provider_provider_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"provider_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.two_factor\": {\n      \"name\": \"two_factor\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"secret\": {\n          \"name\": \"secret\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backup_codes\": {\n          \"name\": \"backup_codes\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"two_factor_user_id_user_id_fk\": {\n          \"name\": \"two_factor_user_id_user_id_fk\",\n          \"tableFrom\": \"two_factor\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.user\": {\n      \"name\": \"user\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email_verified\": {\n          \"name\": \"email_verified\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"image\": {\n          \"name\": \"image\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"theme\": {\n          \"name\": \"theme\",\n          \"type\": \"user_themes\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'light'\"\n        },\n        \"banned\": {\n          \"name\": \"banned\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_reason\": {\n          \"name\": \"ban_reason\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_expires\": {\n          \"name\": \"ban_expires\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"lastConnectedAt\": {\n          \"name\": \"lastConnectedAt\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"lastChangedPasswordAt\": {\n          \"name\": \"lastChangedPasswordAt\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"two_factor_enabled\": {\n          \"name\": \"two_factor_enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"user_email_unique\": {\n          \"name\": \"user_email_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"email\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.verification\": {\n      \"name\": \"verification\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"identifier\": {\n          \"name\": \"identifier\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"value\": {\n          \"name\": \"value\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization\": {\n      \"name\": \"organization\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"logo\": {\n          \"name\": \"logo\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"metadata\": {\n          \"name\": \"metadata\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_slug_unique\": {\n          \"name\": \"organization_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.member\": {\n      \"name\": \"member\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"member_organization_id_organization_id_fk\": {\n          \"name\": \"member_organization_id_organization_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"member_user_id_user_id_fk\": {\n          \"name\": \"member_user_id_user_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.invitation\": {\n      \"name\": \"invitation\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"inviter_id\": {\n          \"name\": \"inviter_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"invitation_organization_id_organization_id_fk\": {\n          \"name\": \"invitation_organization_id_organization_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"invitation_inviter_id_user_id_fk\": {\n          \"name\": \"invitation_inviter_id_user_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"inviter_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.projects\": {\n      \"name\": \"projects\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"projects_organization_id_organization_id_fk\": {\n          \"name\": \"projects_organization_id_organization_id_fk\",\n          \"tableFrom\": \"projects\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"projects_slug_unique\": {\n          \"name\": \"projects_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backups\": {\n      \"name\": \"backups\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"file\": {\n          \"name\": \"file\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"file_size\": {\n          \"name\": \"file_size\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"imported\": {\n          \"name\": \"imported\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backups_database_id_databases_id_fk\": {\n          \"name\": \"backups_database_id_databases_id_fk\",\n          \"tableFrom\": \"backups\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.databases\": {\n      \"name\": \"databases\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"agent_database_id\": {\n          \"name\": \"agent_database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"dbms\": {\n          \"name\": \"dbms\",\n          \"type\": \"dbms_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_policy\": {\n          \"name\": \"backup_policy\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"is_waiting_for_backup\": {\n          \"name\": \"is_waiting_for_backup\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"backup_to_restore\": {\n          \"name\": \"backup_to_restore\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"agent_id\": {\n          \"name\": \"agent_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"project_id\": {\n          \"name\": \"project_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"databases_agent_id_agents_id_fk\": {\n          \"name\": \"databases_agent_id_agents_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"agents\",\n          \"columnsFrom\": [\n            \"agent_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"databases_project_id_projects_id_fk\": {\n          \"name\": \"databases_project_id_projects_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"projects\",\n          \"columnsFrom\": [\n            \"project_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"no action\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.restorations\": {\n      \"name\": \"restorations\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"backup_storage_id\": {\n          \"name\": \"backup_storage_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"restorations_backup_storage_id_backup_storage_id_fk\": {\n          \"name\": \"restorations_backup_storage_id_backup_storage_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backup_storage\",\n          \"columnsFrom\": [\n            \"backup_storage_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_backup_id_backups_id_fk\": {\n          \"name\": \"restorations_backup_id_backups_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_database_id_databases_id_fk\": {\n          \"name\": \"restorations_database_id_databases_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.retention_policies\": {\n      \"name\": \"retention_policies\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"type\": {\n          \"name\": \"type\",\n          \"type\": \"retention_policy_type\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"count\": {\n          \"name\": \"count\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"days\": {\n          \"name\": \"days\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 30\n        },\n        \"gfs_daily\": {\n          \"name\": \"gfs_daily\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"gfs_weekly\": {\n          \"name\": \"gfs_weekly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 4\n        },\n        \"gfs_monthly\": {\n          \"name\": \"gfs_monthly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 12\n        },\n        \"gfs_yearly\": {\n          \"name\": \"gfs_yearly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 3\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"retention_policies_database_id_databases_id_fk\": {\n          \"name\": \"retention_policies_database_id_databases_id_fk\",\n          \"tableFrom\": \"retention_policies\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.agents\": {\n      \"name\": \"agents\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"version\": {\n          \"name\": \"version\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"agents_slug_unique\": {\n          \"name\": \"agents_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_channel\": {\n      \"name\": \"notification_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"notification_channel_organization_id_organization_id_fk\": {\n          \"name\": \"notification_channel_organization_id_organization_id_fk\",\n          \"tableFrom\": \"notification_channel\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_notification_channels\": {\n      \"name\": \"organization_notification_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_notification_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_notification_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_notification_channels_organization_id_notification_channel_id_unique\": {\n          \"name\": \"organization_notification_channels_organization_id_notification_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"notification_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.alert_policy\": {\n      \"name\": \"alert_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"event_kind\": {\n          \"name\": \"event_kind\",\n          \"type\": \"event_kind[]\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"alert_policy_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"alert_policy_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"alert_policy_database_id_databases_id_fk\": {\n          \"name\": \"alert_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_log\": {\n      \"name\": \"notification_log\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"channel_id\": {\n          \"name\": \"channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"policy_id\": {\n          \"name\": \"policy_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"event\": {\n          \"name\": \"event\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_name\": {\n          \"name\": \"provider_name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"title\": {\n          \"name\": \"title\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"message\": {\n          \"name\": \"message\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"level\": {\n          \"name\": \"level\",\n          \"type\": \"level\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"payload\": {\n          \"name\": \"payload\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"success\": {\n          \"name\": \"success\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"error\": {\n          \"name\": \"error\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider_response\": {\n          \"name\": \"provider_response\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"sent_at\": {\n          \"name\": \"sent_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_storage_channels\": {\n      \"name\": \"organization_storage_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_storage_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_storage_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_storage_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_storage_channels_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"organization_storage_channels_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"organization_storage_channels\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_storage_channels_organization_id_storage_channel_id_unique\": {\n          \"name\": \"organization_storage_channels_organization_id_storage_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"storage_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.storage_channel\": {\n      \"name\": \"storage_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_storage_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"storage_channel_organization_id_organization_id_fk\": {\n          \"name\": \"storage_channel_organization_id_organization_id_fk\",\n          \"tableFrom\": \"storage_channel\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.storage_policy\": {\n      \"name\": \"storage_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"storage_policy_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"storage_policy_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"storage_policy\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"storage_policy_database_id_databases_id_fk\": {\n          \"name\": \"storage_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"storage_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backup_storage\": {\n      \"name\": \"backup_storage\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"backup_storage_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'pending'\"\n        },\n        \"path\": {\n          \"name\": \"path\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"size\": {\n          \"name\": \"size\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"checksum\": {\n          \"name\": \"checksum\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backup_storage_backup_id_backups_id_fk\": {\n          \"name\": \"backup_storage_backup_id_backups_id_fk\",\n          \"tableFrom\": \"backup_storage\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"backup_storage_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"backup_storage_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"backup_storage\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    }\n  },\n  \"enums\": {\n    \"public.user_themes\": {\n      \"name\": \"user_themes\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"light\",\n        \"dark\",\n        \"system\"\n      ]\n    },\n    \"public.retention_policy_type\": {\n      \"name\": \"retention_policy_type\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"count\",\n        \"days\",\n        \"gfs\"\n      ]\n    },\n    \"public.provider_kind\": {\n      \"name\": \"provider_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"slack\",\n        \"smtp\",\n        \"discord\",\n        \"telegram\",\n        \"gotify\",\n        \"ntfy\",\n        \"webhook\"\n      ]\n    },\n    \"public.event_kind\": {\n      \"name\": \"event_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"error_backup\",\n        \"error_restore\",\n        \"success_restore\",\n        \"success_backup\",\n        \"weekly_report\"\n      ]\n    },\n    \"public.level\": {\n      \"name\": \"level\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"critical\",\n        \"warning\",\n        \"info\"\n      ]\n    },\n    \"public.provider_storage_kind\": {\n      \"name\": \"provider_storage_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\",\n        \"google-drive\"\n      ]\n    },\n    \"public.backup_storage_status\": {\n      \"name\": \"backup_storage_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"pending\",\n        \"success\",\n        \"failed\"\n      ]\n    },\n    \"public.dbms_status\": {\n      \"name\": \"dbms_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"postgresql\",\n        \"mysql\",\n        \"mongodb\",\n        \"sqlite\"\n      ]\n    },\n    \"public.status\": {\n      \"name\": \"status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"waiting\",\n        \"ongoing\",\n        \"failed\",\n        \"success\"\n      ]\n    },\n    \"public.type_storage\": {\n      \"name\": \"type_storage\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\"\n      ]\n    }\n  },\n  \"schemas\": {},\n  \"sequences\": {},\n  \"roles\": {},\n  \"policies\": {},\n  \"views\": {},\n  \"_meta\": {\n    \"columns\": {},\n    \"schemas\": {},\n    \"tables\": {}\n  }\n}"
  },
  {
    "path": "src/db/migrations/meta/0038_snapshot.json",
    "content": "{\n  \"id\": \"32b91ca6-d52f-4120-8bfd-dd0a25beb913\",\n  \"prevId\": \"e6e7c2db-ee6c-4887-ad2f-051e630b6198\",\n  \"version\": \"7\",\n  \"dialect\": \"postgresql\",\n  \"tables\": {\n    \"public.settings\": {\n      \"name\": \"settings\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"smtp_password\": {\n          \"name\": \"smtp_password\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_from\": {\n          \"name\": \"smtp_from\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_host\": {\n          \"name\": \"smtp_host\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_port\": {\n          \"name\": \"smtp_port\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_user\": {\n          \"name\": \"smtp_user\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_secure\": {\n          \"name\": \"smtp_secure\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"default_storage_channel_id\": {\n          \"name\": \"default_storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"encryption\": {\n          \"name\": \"encryption\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"settings_default_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"settings_default_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"settings\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"default_storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"set null\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"settings_name_unique\": {\n          \"name\": \"settings_name_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"name\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.account\": {\n      \"name\": \"account\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"account_id\": {\n          \"name\": \"account_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"access_token\": {\n          \"name\": \"access_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token\": {\n          \"name\": \"refresh_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"id_token\": {\n          \"name\": \"id_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"access_token_expires_at\": {\n          \"name\": \"access_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token_expires_at\": {\n          \"name\": \"refresh_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"scope\": {\n          \"name\": \"scope\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"password\": {\n          \"name\": \"password\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"account_user_id_user_id_fk\": {\n          \"name\": \"account_user_id_user_id_fk\",\n          \"tableFrom\": \"account\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.passkey\": {\n      \"name\": \"passkey\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"publicKey\": {\n          \"name\": \"publicKey\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"credentialID\": {\n          \"name\": \"credentialID\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"counter\": {\n          \"name\": \"counter\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"deviceType\": {\n          \"name\": \"deviceType\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backedUp\": {\n          \"name\": \"backedUp\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"transports\": {\n          \"name\": \"transports\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"aaguid\": {\n          \"name\": \"aaguid\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"passkey_user_id_user_id_fk\": {\n          \"name\": \"passkey_user_id_user_id_fk\",\n          \"tableFrom\": \"passkey\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.session\": {\n      \"name\": \"session\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"token\": {\n          \"name\": \"token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"ip_address\": {\n          \"name\": \"ip_address\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_agent\": {\n          \"name\": \"user_agent\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"impersonated_by\": {\n          \"name\": \"impersonated_by\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"active_organization_id\": {\n          \"name\": \"active_organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"session_user_id_user_id_fk\": {\n          \"name\": \"session_user_id_user_id_fk\",\n          \"tableFrom\": \"session\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"session_token_unique\": {\n          \"name\": \"session_token_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"token\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.sso_provider\": {\n      \"name\": \"sso_provider\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"issuer\": {\n          \"name\": \"issuer\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"oidc_config\": {\n          \"name\": \"oidc_config\",\n          \"type\": \"json\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"saml_config\": {\n          \"name\": \"saml_config\",\n          \"type\": \"json\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"domain\": {\n          \"name\": \"domain\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"sso_provider_user_id_user_id_fk\": {\n          \"name\": \"sso_provider_user_id_user_id_fk\",\n          \"tableFrom\": \"sso_provider\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"sso_provider_provider_id_unique\": {\n          \"name\": \"sso_provider_provider_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"provider_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.two_factor\": {\n      \"name\": \"two_factor\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"secret\": {\n          \"name\": \"secret\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backup_codes\": {\n          \"name\": \"backup_codes\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"two_factor_user_id_user_id_fk\": {\n          \"name\": \"two_factor_user_id_user_id_fk\",\n          \"tableFrom\": \"two_factor\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.user\": {\n      \"name\": \"user\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email_verified\": {\n          \"name\": \"email_verified\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"image\": {\n          \"name\": \"image\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"theme\": {\n          \"name\": \"theme\",\n          \"type\": \"user_themes\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'light'\"\n        },\n        \"banned\": {\n          \"name\": \"banned\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_reason\": {\n          \"name\": \"ban_reason\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_expires\": {\n          \"name\": \"ban_expires\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"lastConnectedAt\": {\n          \"name\": \"lastConnectedAt\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"lastChangedPasswordAt\": {\n          \"name\": \"lastChangedPasswordAt\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"two_factor_enabled\": {\n          \"name\": \"two_factor_enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"user_email_unique\": {\n          \"name\": \"user_email_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"email\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.verification\": {\n      \"name\": \"verification\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"identifier\": {\n          \"name\": \"identifier\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"value\": {\n          \"name\": \"value\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization\": {\n      \"name\": \"organization\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"logo\": {\n          \"name\": \"logo\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"metadata\": {\n          \"name\": \"metadata\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_slug_unique\": {\n          \"name\": \"organization_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.member\": {\n      \"name\": \"member\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"member_organization_id_organization_id_fk\": {\n          \"name\": \"member_organization_id_organization_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"member_user_id_user_id_fk\": {\n          \"name\": \"member_user_id_user_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.invitation\": {\n      \"name\": \"invitation\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"inviter_id\": {\n          \"name\": \"inviter_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"invitation_organization_id_organization_id_fk\": {\n          \"name\": \"invitation_organization_id_organization_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"invitation_inviter_id_user_id_fk\": {\n          \"name\": \"invitation_inviter_id_user_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"inviter_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.projects\": {\n      \"name\": \"projects\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"projects_organization_id_organization_id_fk\": {\n          \"name\": \"projects_organization_id_organization_id_fk\",\n          \"tableFrom\": \"projects\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"projects_slug_unique\": {\n          \"name\": \"projects_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backups\": {\n      \"name\": \"backups\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"file\": {\n          \"name\": \"file\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"file_size\": {\n          \"name\": \"file_size\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"imported\": {\n          \"name\": \"imported\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backups_database_id_databases_id_fk\": {\n          \"name\": \"backups_database_id_databases_id_fk\",\n          \"tableFrom\": \"backups\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.databases\": {\n      \"name\": \"databases\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"agent_database_id\": {\n          \"name\": \"agent_database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"dbms\": {\n          \"name\": \"dbms\",\n          \"type\": \"dbms_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_policy\": {\n          \"name\": \"backup_policy\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"is_waiting_for_backup\": {\n          \"name\": \"is_waiting_for_backup\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"backup_to_restore\": {\n          \"name\": \"backup_to_restore\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"agent_id\": {\n          \"name\": \"agent_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"project_id\": {\n          \"name\": \"project_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"databases_agent_id_agents_id_fk\": {\n          \"name\": \"databases_agent_id_agents_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"agents\",\n          \"columnsFrom\": [\n            \"agent_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"databases_project_id_projects_id_fk\": {\n          \"name\": \"databases_project_id_projects_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"projects\",\n          \"columnsFrom\": [\n            \"project_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"no action\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.restorations\": {\n      \"name\": \"restorations\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"backup_storage_id\": {\n          \"name\": \"backup_storage_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"restorations_backup_storage_id_backup_storage_id_fk\": {\n          \"name\": \"restorations_backup_storage_id_backup_storage_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backup_storage\",\n          \"columnsFrom\": [\n            \"backup_storage_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_backup_id_backups_id_fk\": {\n          \"name\": \"restorations_backup_id_backups_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_database_id_databases_id_fk\": {\n          \"name\": \"restorations_database_id_databases_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.retention_policies\": {\n      \"name\": \"retention_policies\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"type\": {\n          \"name\": \"type\",\n          \"type\": \"retention_policy_type\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"count\": {\n          \"name\": \"count\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"days\": {\n          \"name\": \"days\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 30\n        },\n        \"gfs_daily\": {\n          \"name\": \"gfs_daily\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"gfs_weekly\": {\n          \"name\": \"gfs_weekly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 4\n        },\n        \"gfs_monthly\": {\n          \"name\": \"gfs_monthly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 12\n        },\n        \"gfs_yearly\": {\n          \"name\": \"gfs_yearly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 3\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"retention_policies_database_id_databases_id_fk\": {\n          \"name\": \"retention_policies_database_id_databases_id_fk\",\n          \"tableFrom\": \"retention_policies\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.agents\": {\n      \"name\": \"agents\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"version\": {\n          \"name\": \"version\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"agents_slug_unique\": {\n          \"name\": \"agents_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_channel\": {\n      \"name\": \"notification_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"notification_channel_organization_id_organization_id_fk\": {\n          \"name\": \"notification_channel_organization_id_organization_id_fk\",\n          \"tableFrom\": \"notification_channel\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_notification_channels\": {\n      \"name\": \"organization_notification_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_notification_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_notification_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_notification_channels_organization_id_notification_channel_id_unique\": {\n          \"name\": \"organization_notification_channels_organization_id_notification_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"notification_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.alert_policy\": {\n      \"name\": \"alert_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"event_kind\": {\n          \"name\": \"event_kind\",\n          \"type\": \"event_kind[]\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"alert_policy_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"alert_policy_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"alert_policy_database_id_databases_id_fk\": {\n          \"name\": \"alert_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_log\": {\n      \"name\": \"notification_log\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"channel_id\": {\n          \"name\": \"channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"policy_id\": {\n          \"name\": \"policy_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"event\": {\n          \"name\": \"event\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_name\": {\n          \"name\": \"provider_name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"title\": {\n          \"name\": \"title\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"message\": {\n          \"name\": \"message\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"level\": {\n          \"name\": \"level\",\n          \"type\": \"level\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"payload\": {\n          \"name\": \"payload\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"success\": {\n          \"name\": \"success\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"error\": {\n          \"name\": \"error\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider_response\": {\n          \"name\": \"provider_response\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"sent_at\": {\n          \"name\": \"sent_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_storage_channels\": {\n      \"name\": \"organization_storage_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_storage_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_storage_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_storage_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_storage_channels_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"organization_storage_channels_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"organization_storage_channels\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_storage_channels_organization_id_storage_channel_id_unique\": {\n          \"name\": \"organization_storage_channels_organization_id_storage_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"storage_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.storage_channel\": {\n      \"name\": \"storage_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_storage_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"storage_channel_organization_id_organization_id_fk\": {\n          \"name\": \"storage_channel_organization_id_organization_id_fk\",\n          \"tableFrom\": \"storage_channel\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.storage_policy\": {\n      \"name\": \"storage_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"storage_policy_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"storage_policy_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"storage_policy\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"storage_policy_database_id_databases_id_fk\": {\n          \"name\": \"storage_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"storage_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backup_storage\": {\n      \"name\": \"backup_storage\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"backup_storage_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'pending'\"\n        },\n        \"path\": {\n          \"name\": \"path\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"size\": {\n          \"name\": \"size\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"checksum\": {\n          \"name\": \"checksum\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backup_storage_backup_id_backups_id_fk\": {\n          \"name\": \"backup_storage_backup_id_backups_id_fk\",\n          \"tableFrom\": \"backup_storage\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"backup_storage_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"backup_storage_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"backup_storage\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    }\n  },\n  \"enums\": {\n    \"public.user_themes\": {\n      \"name\": \"user_themes\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"light\",\n        \"dark\",\n        \"system\"\n      ]\n    },\n    \"public.retention_policy_type\": {\n      \"name\": \"retention_policy_type\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"count\",\n        \"days\",\n        \"gfs\"\n      ]\n    },\n    \"public.provider_kind\": {\n      \"name\": \"provider_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"slack\",\n        \"smtp\",\n        \"discord\",\n        \"telegram\",\n        \"gotify\",\n        \"ntfy\",\n        \"webhook\"\n      ]\n    },\n    \"public.event_kind\": {\n      \"name\": \"event_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"error_backup\",\n        \"error_restore\",\n        \"success_restore\",\n        \"success_backup\",\n        \"weekly_report\"\n      ]\n    },\n    \"public.level\": {\n      \"name\": \"level\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"critical\",\n        \"warning\",\n        \"info\"\n      ]\n    },\n    \"public.provider_storage_kind\": {\n      \"name\": \"provider_storage_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\",\n        \"google-drive\"\n      ]\n    },\n    \"public.backup_storage_status\": {\n      \"name\": \"backup_storage_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"pending\",\n        \"success\",\n        \"failed\"\n      ]\n    },\n    \"public.dbms_status\": {\n      \"name\": \"dbms_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"postgresql\",\n        \"mysql\",\n        \"mongodb\",\n        \"sqlite\",\n        \"redis\"\n      ]\n    },\n    \"public.status\": {\n      \"name\": \"status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"waiting\",\n        \"ongoing\",\n        \"failed\",\n        \"success\"\n      ]\n    },\n    \"public.type_storage\": {\n      \"name\": \"type_storage\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\"\n      ]\n    }\n  },\n  \"schemas\": {},\n  \"sequences\": {},\n  \"roles\": {},\n  \"policies\": {},\n  \"views\": {},\n  \"_meta\": {\n    \"columns\": {},\n    \"schemas\": {},\n    \"tables\": {}\n  }\n}"
  },
  {
    "path": "src/db/migrations/meta/0039_snapshot.json",
    "content": "{\n  \"id\": \"c1175913-c1dd-43a4-b396-282406986d5e\",\n  \"prevId\": \"32b91ca6-d52f-4120-8bfd-dd0a25beb913\",\n  \"version\": \"7\",\n  \"dialect\": \"postgresql\",\n  \"tables\": {\n    \"public.settings\": {\n      \"name\": \"settings\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"smtp_password\": {\n          \"name\": \"smtp_password\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_from\": {\n          \"name\": \"smtp_from\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_host\": {\n          \"name\": \"smtp_host\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_port\": {\n          \"name\": \"smtp_port\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_user\": {\n          \"name\": \"smtp_user\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_secure\": {\n          \"name\": \"smtp_secure\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"default_storage_channel_id\": {\n          \"name\": \"default_storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"encryption\": {\n          \"name\": \"encryption\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"settings_default_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"settings_default_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"settings\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"default_storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"set null\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"settings_name_unique\": {\n          \"name\": \"settings_name_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"name\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.account\": {\n      \"name\": \"account\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"account_id\": {\n          \"name\": \"account_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"access_token\": {\n          \"name\": \"access_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token\": {\n          \"name\": \"refresh_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"id_token\": {\n          \"name\": \"id_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"access_token_expires_at\": {\n          \"name\": \"access_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token_expires_at\": {\n          \"name\": \"refresh_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"scope\": {\n          \"name\": \"scope\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"password\": {\n          \"name\": \"password\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"account_user_id_user_id_fk\": {\n          \"name\": \"account_user_id_user_id_fk\",\n          \"tableFrom\": \"account\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.passkey\": {\n      \"name\": \"passkey\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"publicKey\": {\n          \"name\": \"publicKey\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"credentialID\": {\n          \"name\": \"credentialID\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"counter\": {\n          \"name\": \"counter\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"deviceType\": {\n          \"name\": \"deviceType\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backedUp\": {\n          \"name\": \"backedUp\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"transports\": {\n          \"name\": \"transports\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"aaguid\": {\n          \"name\": \"aaguid\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"passkey_user_id_user_id_fk\": {\n          \"name\": \"passkey_user_id_user_id_fk\",\n          \"tableFrom\": \"passkey\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.session\": {\n      \"name\": \"session\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"token\": {\n          \"name\": \"token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"ip_address\": {\n          \"name\": \"ip_address\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_agent\": {\n          \"name\": \"user_agent\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"impersonated_by\": {\n          \"name\": \"impersonated_by\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"active_organization_id\": {\n          \"name\": \"active_organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"session_user_id_user_id_fk\": {\n          \"name\": \"session_user_id_user_id_fk\",\n          \"tableFrom\": \"session\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"session_token_unique\": {\n          \"name\": \"session_token_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"token\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.sso_provider\": {\n      \"name\": \"sso_provider\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"issuer\": {\n          \"name\": \"issuer\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"oidc_config\": {\n          \"name\": \"oidc_config\",\n          \"type\": \"json\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"saml_config\": {\n          \"name\": \"saml_config\",\n          \"type\": \"json\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"domain\": {\n          \"name\": \"domain\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"sso_provider_user_id_user_id_fk\": {\n          \"name\": \"sso_provider_user_id_user_id_fk\",\n          \"tableFrom\": \"sso_provider\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"sso_provider_provider_id_unique\": {\n          \"name\": \"sso_provider_provider_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"provider_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.two_factor\": {\n      \"name\": \"two_factor\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"secret\": {\n          \"name\": \"secret\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backup_codes\": {\n          \"name\": \"backup_codes\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"two_factor_user_id_user_id_fk\": {\n          \"name\": \"two_factor_user_id_user_id_fk\",\n          \"tableFrom\": \"two_factor\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.user\": {\n      \"name\": \"user\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email_verified\": {\n          \"name\": \"email_verified\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"image\": {\n          \"name\": \"image\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"theme\": {\n          \"name\": \"theme\",\n          \"type\": \"user_themes\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'light'\"\n        },\n        \"banned\": {\n          \"name\": \"banned\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_reason\": {\n          \"name\": \"ban_reason\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_expires\": {\n          \"name\": \"ban_expires\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"lastConnectedAt\": {\n          \"name\": \"lastConnectedAt\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"lastChangedPasswordAt\": {\n          \"name\": \"lastChangedPasswordAt\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"two_factor_enabled\": {\n          \"name\": \"two_factor_enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"user_email_unique\": {\n          \"name\": \"user_email_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"email\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.verification\": {\n      \"name\": \"verification\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"identifier\": {\n          \"name\": \"identifier\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"value\": {\n          \"name\": \"value\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization\": {\n      \"name\": \"organization\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"logo\": {\n          \"name\": \"logo\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"metadata\": {\n          \"name\": \"metadata\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_slug_unique\": {\n          \"name\": \"organization_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.member\": {\n      \"name\": \"member\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"member_organization_id_organization_id_fk\": {\n          \"name\": \"member_organization_id_organization_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"member_user_id_user_id_fk\": {\n          \"name\": \"member_user_id_user_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.invitation\": {\n      \"name\": \"invitation\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"inviter_id\": {\n          \"name\": \"inviter_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"invitation_organization_id_organization_id_fk\": {\n          \"name\": \"invitation_organization_id_organization_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"invitation_inviter_id_user_id_fk\": {\n          \"name\": \"invitation_inviter_id_user_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"inviter_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.projects\": {\n      \"name\": \"projects\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"projects_organization_id_organization_id_fk\": {\n          \"name\": \"projects_organization_id_organization_id_fk\",\n          \"tableFrom\": \"projects\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"projects_slug_unique\": {\n          \"name\": \"projects_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backups\": {\n      \"name\": \"backups\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"file\": {\n          \"name\": \"file\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"file_size\": {\n          \"name\": \"file_size\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"imported\": {\n          \"name\": \"imported\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backups_database_id_databases_id_fk\": {\n          \"name\": \"backups_database_id_databases_id_fk\",\n          \"tableFrom\": \"backups\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.databases\": {\n      \"name\": \"databases\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"agent_database_id\": {\n          \"name\": \"agent_database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"dbms\": {\n          \"name\": \"dbms\",\n          \"type\": \"dbms_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_policy\": {\n          \"name\": \"backup_policy\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"is_waiting_for_backup\": {\n          \"name\": \"is_waiting_for_backup\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"backup_to_restore\": {\n          \"name\": \"backup_to_restore\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"agent_id\": {\n          \"name\": \"agent_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"project_id\": {\n          \"name\": \"project_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"databases_agent_id_agents_id_fk\": {\n          \"name\": \"databases_agent_id_agents_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"agents\",\n          \"columnsFrom\": [\n            \"agent_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"databases_project_id_projects_id_fk\": {\n          \"name\": \"databases_project_id_projects_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"projects\",\n          \"columnsFrom\": [\n            \"project_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"no action\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.restorations\": {\n      \"name\": \"restorations\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"backup_storage_id\": {\n          \"name\": \"backup_storage_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"restorations_backup_storage_id_backup_storage_id_fk\": {\n          \"name\": \"restorations_backup_storage_id_backup_storage_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backup_storage\",\n          \"columnsFrom\": [\n            \"backup_storage_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_backup_id_backups_id_fk\": {\n          \"name\": \"restorations_backup_id_backups_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_database_id_databases_id_fk\": {\n          \"name\": \"restorations_database_id_databases_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.retention_policies\": {\n      \"name\": \"retention_policies\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"type\": {\n          \"name\": \"type\",\n          \"type\": \"retention_policy_type\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"count\": {\n          \"name\": \"count\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"days\": {\n          \"name\": \"days\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 30\n        },\n        \"gfs_daily\": {\n          \"name\": \"gfs_daily\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"gfs_weekly\": {\n          \"name\": \"gfs_weekly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 4\n        },\n        \"gfs_monthly\": {\n          \"name\": \"gfs_monthly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 12\n        },\n        \"gfs_yearly\": {\n          \"name\": \"gfs_yearly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 3\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"retention_policies_database_id_databases_id_fk\": {\n          \"name\": \"retention_policies_database_id_databases_id_fk\",\n          \"tableFrom\": \"retention_policies\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.agents\": {\n      \"name\": \"agents\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"version\": {\n          \"name\": \"version\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"agents_slug_unique\": {\n          \"name\": \"agents_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_channel\": {\n      \"name\": \"notification_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"notification_channel_organization_id_organization_id_fk\": {\n          \"name\": \"notification_channel_organization_id_organization_id_fk\",\n          \"tableFrom\": \"notification_channel\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_notification_channels\": {\n      \"name\": \"organization_notification_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_notification_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_notification_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_notification_channels_organization_id_notification_channel_id_unique\": {\n          \"name\": \"organization_notification_channels_organization_id_notification_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"notification_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.alert_policy\": {\n      \"name\": \"alert_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"event_kind\": {\n          \"name\": \"event_kind\",\n          \"type\": \"event_kind[]\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"alert_policy_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"alert_policy_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"alert_policy_database_id_databases_id_fk\": {\n          \"name\": \"alert_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_log\": {\n      \"name\": \"notification_log\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"channel_id\": {\n          \"name\": \"channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"policy_id\": {\n          \"name\": \"policy_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"event\": {\n          \"name\": \"event\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_name\": {\n          \"name\": \"provider_name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"title\": {\n          \"name\": \"title\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"message\": {\n          \"name\": \"message\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"level\": {\n          \"name\": \"level\",\n          \"type\": \"level\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"payload\": {\n          \"name\": \"payload\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"success\": {\n          \"name\": \"success\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"error\": {\n          \"name\": \"error\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider_response\": {\n          \"name\": \"provider_response\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"sent_at\": {\n          \"name\": \"sent_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_storage_channels\": {\n      \"name\": \"organization_storage_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_storage_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_storage_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_storage_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_storage_channels_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"organization_storage_channels_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"organization_storage_channels\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_storage_channels_organization_id_storage_channel_id_unique\": {\n          \"name\": \"organization_storage_channels_organization_id_storage_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"storage_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.storage_channel\": {\n      \"name\": \"storage_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_storage_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"storage_channel_organization_id_organization_id_fk\": {\n          \"name\": \"storage_channel_organization_id_organization_id_fk\",\n          \"tableFrom\": \"storage_channel\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.storage_policy\": {\n      \"name\": \"storage_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"storage_policy_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"storage_policy_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"storage_policy\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"storage_policy_database_id_databases_id_fk\": {\n          \"name\": \"storage_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"storage_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backup_storage\": {\n      \"name\": \"backup_storage\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"backup_storage_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'pending'\"\n        },\n        \"path\": {\n          \"name\": \"path\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"size\": {\n          \"name\": \"size\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"checksum\": {\n          \"name\": \"checksum\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backup_storage_backup_id_backups_id_fk\": {\n          \"name\": \"backup_storage_backup_id_backups_id_fk\",\n          \"tableFrom\": \"backup_storage\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"backup_storage_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"backup_storage_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"backup_storage\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    }\n  },\n  \"enums\": {\n    \"public.user_themes\": {\n      \"name\": \"user_themes\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"light\",\n        \"dark\",\n        \"system\"\n      ]\n    },\n    \"public.retention_policy_type\": {\n      \"name\": \"retention_policy_type\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"count\",\n        \"days\",\n        \"gfs\"\n      ]\n    },\n    \"public.provider_kind\": {\n      \"name\": \"provider_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"slack\",\n        \"smtp\",\n        \"discord\",\n        \"telegram\",\n        \"gotify\",\n        \"ntfy\",\n        \"webhook\"\n      ]\n    },\n    \"public.event_kind\": {\n      \"name\": \"event_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"error_backup\",\n        \"error_restore\",\n        \"success_restore\",\n        \"success_backup\",\n        \"weekly_report\"\n      ]\n    },\n    \"public.level\": {\n      \"name\": \"level\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"critical\",\n        \"warning\",\n        \"info\"\n      ]\n    },\n    \"public.provider_storage_kind\": {\n      \"name\": \"provider_storage_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\",\n        \"google-drive\"\n      ]\n    },\n    \"public.backup_storage_status\": {\n      \"name\": \"backup_storage_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"pending\",\n        \"success\",\n        \"failed\"\n      ]\n    },\n    \"public.dbms_status\": {\n      \"name\": \"dbms_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"postgresql\",\n        \"mysql\",\n        \"mongodb\",\n        \"sqlite\",\n        \"redis\",\n        \"valkey\"\n      ]\n    },\n    \"public.status\": {\n      \"name\": \"status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"waiting\",\n        \"ongoing\",\n        \"failed\",\n        \"success\"\n      ]\n    },\n    \"public.type_storage\": {\n      \"name\": \"type_storage\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\"\n      ]\n    }\n  },\n  \"schemas\": {},\n  \"sequences\": {},\n  \"roles\": {},\n  \"policies\": {},\n  \"views\": {},\n  \"_meta\": {\n    \"columns\": {},\n    \"schemas\": {},\n    \"tables\": {}\n  }\n}"
  },
  {
    "path": "src/db/migrations/meta/0040_snapshot.json",
    "content": "{\n  \"id\": \"3af90bf6-9867-4b59-94a4-ae5abb40dd31\",\n  \"prevId\": \"c1175913-c1dd-43a4-b396-282406986d5e\",\n  \"version\": \"7\",\n  \"dialect\": \"postgresql\",\n  \"tables\": {\n    \"public.settings\": {\n      \"name\": \"settings\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"smtp_password\": {\n          \"name\": \"smtp_password\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_from\": {\n          \"name\": \"smtp_from\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_host\": {\n          \"name\": \"smtp_host\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_port\": {\n          \"name\": \"smtp_port\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_user\": {\n          \"name\": \"smtp_user\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_secure\": {\n          \"name\": \"smtp_secure\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"default_storage_channel_id\": {\n          \"name\": \"default_storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"encryption\": {\n          \"name\": \"encryption\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"settings_default_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"settings_default_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"settings\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"default_storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"set null\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"settings_name_unique\": {\n          \"name\": \"settings_name_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"name\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.account\": {\n      \"name\": \"account\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"account_id\": {\n          \"name\": \"account_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"access_token\": {\n          \"name\": \"access_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token\": {\n          \"name\": \"refresh_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"id_token\": {\n          \"name\": \"id_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"access_token_expires_at\": {\n          \"name\": \"access_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token_expires_at\": {\n          \"name\": \"refresh_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"scope\": {\n          \"name\": \"scope\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"password\": {\n          \"name\": \"password\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"account_user_id_user_id_fk\": {\n          \"name\": \"account_user_id_user_id_fk\",\n          \"tableFrom\": \"account\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.passkey\": {\n      \"name\": \"passkey\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"publicKey\": {\n          \"name\": \"publicKey\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"credentialID\": {\n          \"name\": \"credentialID\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"counter\": {\n          \"name\": \"counter\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"deviceType\": {\n          \"name\": \"deviceType\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backedUp\": {\n          \"name\": \"backedUp\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"transports\": {\n          \"name\": \"transports\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"aaguid\": {\n          \"name\": \"aaguid\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"passkey_user_id_user_id_fk\": {\n          \"name\": \"passkey_user_id_user_id_fk\",\n          \"tableFrom\": \"passkey\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.session\": {\n      \"name\": \"session\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"token\": {\n          \"name\": \"token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"ip_address\": {\n          \"name\": \"ip_address\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_agent\": {\n          \"name\": \"user_agent\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"impersonated_by\": {\n          \"name\": \"impersonated_by\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"active_organization_id\": {\n          \"name\": \"active_organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"session_user_id_user_id_fk\": {\n          \"name\": \"session_user_id_user_id_fk\",\n          \"tableFrom\": \"session\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"session_token_unique\": {\n          \"name\": \"session_token_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"token\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.sso_provider\": {\n      \"name\": \"sso_provider\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"issuer\": {\n          \"name\": \"issuer\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"oidc_config\": {\n          \"name\": \"oidc_config\",\n          \"type\": \"json\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"saml_config\": {\n          \"name\": \"saml_config\",\n          \"type\": \"json\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"domain\": {\n          \"name\": \"domain\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"sso_provider_user_id_user_id_fk\": {\n          \"name\": \"sso_provider_user_id_user_id_fk\",\n          \"tableFrom\": \"sso_provider\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"sso_provider_provider_id_unique\": {\n          \"name\": \"sso_provider_provider_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"provider_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.two_factor\": {\n      \"name\": \"two_factor\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"secret\": {\n          \"name\": \"secret\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backup_codes\": {\n          \"name\": \"backup_codes\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"two_factor_user_id_user_id_fk\": {\n          \"name\": \"two_factor_user_id_user_id_fk\",\n          \"tableFrom\": \"two_factor\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.user\": {\n      \"name\": \"user\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email_verified\": {\n          \"name\": \"email_verified\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"image\": {\n          \"name\": \"image\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"theme\": {\n          \"name\": \"theme\",\n          \"type\": \"user_themes\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'light'\"\n        },\n        \"banned\": {\n          \"name\": \"banned\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_reason\": {\n          \"name\": \"ban_reason\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_expires\": {\n          \"name\": \"ban_expires\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"lastConnectedAt\": {\n          \"name\": \"lastConnectedAt\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"lastChangedPasswordAt\": {\n          \"name\": \"lastChangedPasswordAt\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"two_factor_enabled\": {\n          \"name\": \"two_factor_enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"user_email_unique\": {\n          \"name\": \"user_email_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"email\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.verification\": {\n      \"name\": \"verification\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"identifier\": {\n          \"name\": \"identifier\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"value\": {\n          \"name\": \"value\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization\": {\n      \"name\": \"organization\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"logo\": {\n          \"name\": \"logo\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"metadata\": {\n          \"name\": \"metadata\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_slug_unique\": {\n          \"name\": \"organization_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.member\": {\n      \"name\": \"member\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"member_organization_id_organization_id_fk\": {\n          \"name\": \"member_organization_id_organization_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"member_user_id_user_id_fk\": {\n          \"name\": \"member_user_id_user_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.invitation\": {\n      \"name\": \"invitation\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"inviter_id\": {\n          \"name\": \"inviter_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"invitation_organization_id_organization_id_fk\": {\n          \"name\": \"invitation_organization_id_organization_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"invitation_inviter_id_user_id_fk\": {\n          \"name\": \"invitation_inviter_id_user_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"inviter_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.projects\": {\n      \"name\": \"projects\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"projects_organization_id_organization_id_fk\": {\n          \"name\": \"projects_organization_id_organization_id_fk\",\n          \"tableFrom\": \"projects\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"projects_slug_unique\": {\n          \"name\": \"projects_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backups\": {\n      \"name\": \"backups\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"file\": {\n          \"name\": \"file\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"file_size\": {\n          \"name\": \"file_size\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"imported\": {\n          \"name\": \"imported\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backups_database_id_databases_id_fk\": {\n          \"name\": \"backups_database_id_databases_id_fk\",\n          \"tableFrom\": \"backups\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.databases\": {\n      \"name\": \"databases\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"agent_database_id\": {\n          \"name\": \"agent_database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"dbms\": {\n          \"name\": \"dbms\",\n          \"type\": \"dbms_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_policy\": {\n          \"name\": \"backup_policy\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"is_waiting_for_backup\": {\n          \"name\": \"is_waiting_for_backup\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"backup_to_restore\": {\n          \"name\": \"backup_to_restore\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"agent_id\": {\n          \"name\": \"agent_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"project_id\": {\n          \"name\": \"project_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"databases_agent_id_agents_id_fk\": {\n          \"name\": \"databases_agent_id_agents_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"agents\",\n          \"columnsFrom\": [\n            \"agent_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"databases_project_id_projects_id_fk\": {\n          \"name\": \"databases_project_id_projects_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"projects\",\n          \"columnsFrom\": [\n            \"project_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"no action\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.restorations\": {\n      \"name\": \"restorations\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"backup_storage_id\": {\n          \"name\": \"backup_storage_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"restorations_backup_storage_id_backup_storage_id_fk\": {\n          \"name\": \"restorations_backup_storage_id_backup_storage_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backup_storage\",\n          \"columnsFrom\": [\n            \"backup_storage_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_backup_id_backups_id_fk\": {\n          \"name\": \"restorations_backup_id_backups_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_database_id_databases_id_fk\": {\n          \"name\": \"restorations_database_id_databases_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.retention_policies\": {\n      \"name\": \"retention_policies\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"type\": {\n          \"name\": \"type\",\n          \"type\": \"retention_policy_type\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"count\": {\n          \"name\": \"count\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"days\": {\n          \"name\": \"days\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 30\n        },\n        \"gfs_daily\": {\n          \"name\": \"gfs_daily\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"gfs_weekly\": {\n          \"name\": \"gfs_weekly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 4\n        },\n        \"gfs_monthly\": {\n          \"name\": \"gfs_monthly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 12\n        },\n        \"gfs_yearly\": {\n          \"name\": \"gfs_yearly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 3\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"retention_policies_database_id_databases_id_fk\": {\n          \"name\": \"retention_policies_database_id_databases_id_fk\",\n          \"tableFrom\": \"retention_policies\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.agents\": {\n      \"name\": \"agents\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"version\": {\n          \"name\": \"version\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"agents_slug_unique\": {\n          \"name\": \"agents_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_channel\": {\n      \"name\": \"notification_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"notification_channel_organization_id_organization_id_fk\": {\n          \"name\": \"notification_channel_organization_id_organization_id_fk\",\n          \"tableFrom\": \"notification_channel\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_notification_channels\": {\n      \"name\": \"organization_notification_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_notification_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_notification_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_notification_channels_organization_id_notification_channel_id_unique\": {\n          \"name\": \"organization_notification_channels_organization_id_notification_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"notification_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.alert_policy\": {\n      \"name\": \"alert_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"event_kind\": {\n          \"name\": \"event_kind\",\n          \"type\": \"event_kind[]\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"alert_policy_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"alert_policy_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"alert_policy_database_id_databases_id_fk\": {\n          \"name\": \"alert_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_log\": {\n      \"name\": \"notification_log\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"channel_id\": {\n          \"name\": \"channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"policy_id\": {\n          \"name\": \"policy_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"event\": {\n          \"name\": \"event\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_name\": {\n          \"name\": \"provider_name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"title\": {\n          \"name\": \"title\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"message\": {\n          \"name\": \"message\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"level\": {\n          \"name\": \"level\",\n          \"type\": \"level\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"payload\": {\n          \"name\": \"payload\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"success\": {\n          \"name\": \"success\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"error\": {\n          \"name\": \"error\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider_response\": {\n          \"name\": \"provider_response\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"sent_at\": {\n          \"name\": \"sent_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_storage_channels\": {\n      \"name\": \"organization_storage_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_storage_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_storage_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_storage_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_storage_channels_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"organization_storage_channels_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"organization_storage_channels\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_storage_channels_organization_id_storage_channel_id_unique\": {\n          \"name\": \"organization_storage_channels_organization_id_storage_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"storage_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.storage_channel\": {\n      \"name\": \"storage_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_storage_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"storage_channel_organization_id_organization_id_fk\": {\n          \"name\": \"storage_channel_organization_id_organization_id_fk\",\n          \"tableFrom\": \"storage_channel\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.storage_policy\": {\n      \"name\": \"storage_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"storage_policy_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"storage_policy_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"storage_policy\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"storage_policy_database_id_databases_id_fk\": {\n          \"name\": \"storage_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"storage_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backup_storage\": {\n      \"name\": \"backup_storage\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"backup_storage_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'pending'\"\n        },\n        \"path\": {\n          \"name\": \"path\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"size\": {\n          \"name\": \"size\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"checksum\": {\n          \"name\": \"checksum\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backup_storage_backup_id_backups_id_fk\": {\n          \"name\": \"backup_storage_backup_id_backups_id_fk\",\n          \"tableFrom\": \"backup_storage\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"backup_storage_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"backup_storage_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"backup_storage\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.healthcheck_log\": {\n      \"name\": \"healthcheck_log\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"kind\": {\n          \"name\": \"kind\",\n          \"type\": \"healthcheck_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"date\": {\n          \"name\": \"date\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"healthcheck_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"object_id\": {\n          \"name\": \"object_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    }\n  },\n  \"enums\": {\n    \"public.user_themes\": {\n      \"name\": \"user_themes\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"light\",\n        \"dark\",\n        \"system\"\n      ]\n    },\n    \"public.retention_policy_type\": {\n      \"name\": \"retention_policy_type\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"count\",\n        \"days\",\n        \"gfs\"\n      ]\n    },\n    \"public.provider_kind\": {\n      \"name\": \"provider_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"slack\",\n        \"smtp\",\n        \"discord\",\n        \"telegram\",\n        \"gotify\",\n        \"ntfy\",\n        \"webhook\"\n      ]\n    },\n    \"public.event_kind\": {\n      \"name\": \"event_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"error_backup\",\n        \"error_restore\",\n        \"success_restore\",\n        \"success_backup\",\n        \"weekly_report\"\n      ]\n    },\n    \"public.level\": {\n      \"name\": \"level\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"critical\",\n        \"warning\",\n        \"info\"\n      ]\n    },\n    \"public.provider_storage_kind\": {\n      \"name\": \"provider_storage_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\",\n        \"google-drive\"\n      ]\n    },\n    \"public.backup_storage_status\": {\n      \"name\": \"backup_storage_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"pending\",\n        \"success\",\n        \"failed\"\n      ]\n    },\n    \"public.healthcheck_status\": {\n      \"name\": \"healthcheck_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"success\",\n        \"failed\"\n      ]\n    },\n    \"public.healthcheck_kind\": {\n      \"name\": \"healthcheck_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"database\",\n        \"agent\"\n      ]\n    },\n    \"public.dbms_status\": {\n      \"name\": \"dbms_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"postgresql\",\n        \"mysql\",\n        \"mongodb\",\n        \"sqlite\",\n        \"redis\",\n        \"valkey\"\n      ]\n    },\n    \"public.status\": {\n      \"name\": \"status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"waiting\",\n        \"ongoing\",\n        \"failed\",\n        \"success\"\n      ]\n    },\n    \"public.type_storage\": {\n      \"name\": \"type_storage\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\"\n      ]\n    }\n  },\n  \"schemas\": {},\n  \"sequences\": {},\n  \"roles\": {},\n  \"policies\": {},\n  \"views\": {},\n  \"_meta\": {\n    \"columns\": {},\n    \"schemas\": {},\n    \"tables\": {}\n  }\n}"
  },
  {
    "path": "src/db/migrations/meta/0041_snapshot.json",
    "content": "{\n  \"id\": \"de2537b3-16a9-488e-b776-448175eac116\",\n  \"prevId\": \"3af90bf6-9867-4b59-94a4-ae5abb40dd31\",\n  \"version\": \"7\",\n  \"dialect\": \"postgresql\",\n  \"tables\": {\n    \"public.settings\": {\n      \"name\": \"settings\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"smtp_password\": {\n          \"name\": \"smtp_password\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_from\": {\n          \"name\": \"smtp_from\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_host\": {\n          \"name\": \"smtp_host\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_port\": {\n          \"name\": \"smtp_port\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_user\": {\n          \"name\": \"smtp_user\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_secure\": {\n          \"name\": \"smtp_secure\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"default_storage_channel_id\": {\n          \"name\": \"default_storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"encryption\": {\n          \"name\": \"encryption\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"settings_default_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"settings_default_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"settings\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"default_storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"set null\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"settings_name_unique\": {\n          \"name\": \"settings_name_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"name\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.account\": {\n      \"name\": \"account\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"account_id\": {\n          \"name\": \"account_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"access_token\": {\n          \"name\": \"access_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token\": {\n          \"name\": \"refresh_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"id_token\": {\n          \"name\": \"id_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"access_token_expires_at\": {\n          \"name\": \"access_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token_expires_at\": {\n          \"name\": \"refresh_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"scope\": {\n          \"name\": \"scope\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"password\": {\n          \"name\": \"password\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"account_user_id_user_id_fk\": {\n          \"name\": \"account_user_id_user_id_fk\",\n          \"tableFrom\": \"account\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.passkey\": {\n      \"name\": \"passkey\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"publicKey\": {\n          \"name\": \"publicKey\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"credentialID\": {\n          \"name\": \"credentialID\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"counter\": {\n          \"name\": \"counter\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"deviceType\": {\n          \"name\": \"deviceType\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backedUp\": {\n          \"name\": \"backedUp\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"transports\": {\n          \"name\": \"transports\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"aaguid\": {\n          \"name\": \"aaguid\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"passkey_user_id_user_id_fk\": {\n          \"name\": \"passkey_user_id_user_id_fk\",\n          \"tableFrom\": \"passkey\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.session\": {\n      \"name\": \"session\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"token\": {\n          \"name\": \"token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"ip_address\": {\n          \"name\": \"ip_address\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_agent\": {\n          \"name\": \"user_agent\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"impersonated_by\": {\n          \"name\": \"impersonated_by\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"active_organization_id\": {\n          \"name\": \"active_organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"session_user_id_user_id_fk\": {\n          \"name\": \"session_user_id_user_id_fk\",\n          \"tableFrom\": \"session\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"session_token_unique\": {\n          \"name\": \"session_token_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"token\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.sso_provider\": {\n      \"name\": \"sso_provider\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"issuer\": {\n          \"name\": \"issuer\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"oidc_config\": {\n          \"name\": \"oidc_config\",\n          \"type\": \"json\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"saml_config\": {\n          \"name\": \"saml_config\",\n          \"type\": \"json\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"domain\": {\n          \"name\": \"domain\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"sso_provider_user_id_user_id_fk\": {\n          \"name\": \"sso_provider_user_id_user_id_fk\",\n          \"tableFrom\": \"sso_provider\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"sso_provider_provider_id_unique\": {\n          \"name\": \"sso_provider_provider_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"provider_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.two_factor\": {\n      \"name\": \"two_factor\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"secret\": {\n          \"name\": \"secret\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backup_codes\": {\n          \"name\": \"backup_codes\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"two_factor_user_id_user_id_fk\": {\n          \"name\": \"two_factor_user_id_user_id_fk\",\n          \"tableFrom\": \"two_factor\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.user\": {\n      \"name\": \"user\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email_verified\": {\n          \"name\": \"email_verified\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"image\": {\n          \"name\": \"image\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"theme\": {\n          \"name\": \"theme\",\n          \"type\": \"user_themes\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'light'\"\n        },\n        \"banned\": {\n          \"name\": \"banned\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_reason\": {\n          \"name\": \"ban_reason\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_expires\": {\n          \"name\": \"ban_expires\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"lastConnectedAt\": {\n          \"name\": \"lastConnectedAt\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"lastChangedPasswordAt\": {\n          \"name\": \"lastChangedPasswordAt\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"two_factor_enabled\": {\n          \"name\": \"two_factor_enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"user_email_unique\": {\n          \"name\": \"user_email_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"email\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.verification\": {\n      \"name\": \"verification\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"identifier\": {\n          \"name\": \"identifier\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"value\": {\n          \"name\": \"value\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization\": {\n      \"name\": \"organization\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"logo\": {\n          \"name\": \"logo\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"metadata\": {\n          \"name\": \"metadata\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_slug_unique\": {\n          \"name\": \"organization_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.member\": {\n      \"name\": \"member\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"member_organization_id_organization_id_fk\": {\n          \"name\": \"member_organization_id_organization_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"member_user_id_user_id_fk\": {\n          \"name\": \"member_user_id_user_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.invitation\": {\n      \"name\": \"invitation\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"inviter_id\": {\n          \"name\": \"inviter_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"invitation_organization_id_organization_id_fk\": {\n          \"name\": \"invitation_organization_id_organization_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"invitation_inviter_id_user_id_fk\": {\n          \"name\": \"invitation_inviter_id_user_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"inviter_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.projects\": {\n      \"name\": \"projects\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"projects_organization_id_organization_id_fk\": {\n          \"name\": \"projects_organization_id_organization_id_fk\",\n          \"tableFrom\": \"projects\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"projects_slug_unique\": {\n          \"name\": \"projects_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backups\": {\n      \"name\": \"backups\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"file\": {\n          \"name\": \"file\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"file_size\": {\n          \"name\": \"file_size\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"imported\": {\n          \"name\": \"imported\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backups_database_id_databases_id_fk\": {\n          \"name\": \"backups_database_id_databases_id_fk\",\n          \"tableFrom\": \"backups\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.databases\": {\n      \"name\": \"databases\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"agent_database_id\": {\n          \"name\": \"agent_database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"dbms\": {\n          \"name\": \"dbms\",\n          \"type\": \"dbms_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_policy\": {\n          \"name\": \"backup_policy\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"is_waiting_for_backup\": {\n          \"name\": \"is_waiting_for_backup\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"backup_to_restore\": {\n          \"name\": \"backup_to_restore\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"agent_id\": {\n          \"name\": \"agent_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"project_id\": {\n          \"name\": \"project_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"databases_agent_id_agents_id_fk\": {\n          \"name\": \"databases_agent_id_agents_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"agents\",\n          \"columnsFrom\": [\n            \"agent_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"databases_project_id_projects_id_fk\": {\n          \"name\": \"databases_project_id_projects_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"projects\",\n          \"columnsFrom\": [\n            \"project_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"no action\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.restorations\": {\n      \"name\": \"restorations\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"backup_storage_id\": {\n          \"name\": \"backup_storage_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"restorations_backup_storage_id_backup_storage_id_fk\": {\n          \"name\": \"restorations_backup_storage_id_backup_storage_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backup_storage\",\n          \"columnsFrom\": [\n            \"backup_storage_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_backup_id_backups_id_fk\": {\n          \"name\": \"restorations_backup_id_backups_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_database_id_databases_id_fk\": {\n          \"name\": \"restorations_database_id_databases_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.retention_policies\": {\n      \"name\": \"retention_policies\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"type\": {\n          \"name\": \"type\",\n          \"type\": \"retention_policy_type\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"count\": {\n          \"name\": \"count\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"days\": {\n          \"name\": \"days\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 30\n        },\n        \"gfs_daily\": {\n          \"name\": \"gfs_daily\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"gfs_weekly\": {\n          \"name\": \"gfs_weekly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 4\n        },\n        \"gfs_monthly\": {\n          \"name\": \"gfs_monthly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 12\n        },\n        \"gfs_yearly\": {\n          \"name\": \"gfs_yearly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 3\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"retention_policies_database_id_databases_id_fk\": {\n          \"name\": \"retention_policies_database_id_databases_id_fk\",\n          \"tableFrom\": \"retention_policies\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.agents\": {\n      \"name\": \"agents\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"version\": {\n          \"name\": \"version\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"agents_slug_unique\": {\n          \"name\": \"agents_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_channel\": {\n      \"name\": \"notification_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"notification_channel_organization_id_organization_id_fk\": {\n          \"name\": \"notification_channel_organization_id_organization_id_fk\",\n          \"tableFrom\": \"notification_channel\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_notification_channels\": {\n      \"name\": \"organization_notification_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_notification_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_notification_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_notification_channels_organization_id_notification_channel_id_unique\": {\n          \"name\": \"organization_notification_channels_organization_id_notification_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"notification_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.alert_policy\": {\n      \"name\": \"alert_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"event_kind\": {\n          \"name\": \"event_kind\",\n          \"type\": \"event_kind[]\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"alert_policy_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"alert_policy_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"alert_policy_database_id_databases_id_fk\": {\n          \"name\": \"alert_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_log\": {\n      \"name\": \"notification_log\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"channel_id\": {\n          \"name\": \"channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"policy_id\": {\n          \"name\": \"policy_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"event\": {\n          \"name\": \"event\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_name\": {\n          \"name\": \"provider_name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"title\": {\n          \"name\": \"title\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"message\": {\n          \"name\": \"message\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"level\": {\n          \"name\": \"level\",\n          \"type\": \"level\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"payload\": {\n          \"name\": \"payload\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"success\": {\n          \"name\": \"success\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"error\": {\n          \"name\": \"error\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider_response\": {\n          \"name\": \"provider_response\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"sent_at\": {\n          \"name\": \"sent_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_storage_channels\": {\n      \"name\": \"organization_storage_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_storage_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_storage_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_storage_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_storage_channels_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"organization_storage_channels_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"organization_storage_channels\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_storage_channels_organization_id_storage_channel_id_unique\": {\n          \"name\": \"organization_storage_channels_organization_id_storage_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"storage_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.storage_channel\": {\n      \"name\": \"storage_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_storage_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"storage_channel_organization_id_organization_id_fk\": {\n          \"name\": \"storage_channel_organization_id_organization_id_fk\",\n          \"tableFrom\": \"storage_channel\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.storage_policy\": {\n      \"name\": \"storage_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"storage_policy_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"storage_policy_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"storage_policy\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"storage_policy_database_id_databases_id_fk\": {\n          \"name\": \"storage_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"storage_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backup_storage\": {\n      \"name\": \"backup_storage\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"backup_storage_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'pending'\"\n        },\n        \"path\": {\n          \"name\": \"path\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"size\": {\n          \"name\": \"size\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"checksum\": {\n          \"name\": \"checksum\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backup_storage_backup_id_backups_id_fk\": {\n          \"name\": \"backup_storage_backup_id_backups_id_fk\",\n          \"tableFrom\": \"backup_storage\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"backup_storage_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"backup_storage_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"backup_storage\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.healthcheck_log\": {\n      \"name\": \"healthcheck_log\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"kind\": {\n          \"name\": \"kind\",\n          \"type\": \"healthcheck_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"date\": {\n          \"name\": \"date\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"healthcheck_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"object_id\": {\n          \"name\": \"object_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    }\n  },\n  \"enums\": {\n    \"public.user_themes\": {\n      \"name\": \"user_themes\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"light\",\n        \"dark\",\n        \"system\"\n      ]\n    },\n    \"public.retention_policy_type\": {\n      \"name\": \"retention_policy_type\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"count\",\n        \"days\",\n        \"gfs\"\n      ]\n    },\n    \"public.provider_kind\": {\n      \"name\": \"provider_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"slack\",\n        \"smtp\",\n        \"discord\",\n        \"telegram\",\n        \"gotify\",\n        \"ntfy\",\n        \"webhook\"\n      ]\n    },\n    \"public.event_kind\": {\n      \"name\": \"event_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"error_backup\",\n        \"error_restore\",\n        \"success_restore\",\n        \"success_backup\",\n        \"weekly_report\"\n      ]\n    },\n    \"public.level\": {\n      \"name\": \"level\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"critical\",\n        \"warning\",\n        \"info\"\n      ]\n    },\n    \"public.provider_storage_kind\": {\n      \"name\": \"provider_storage_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\",\n        \"google-drive\"\n      ]\n    },\n    \"public.backup_storage_status\": {\n      \"name\": \"backup_storage_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"pending\",\n        \"success\",\n        \"failed\"\n      ]\n    },\n    \"public.healthcheck_status\": {\n      \"name\": \"healthcheck_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"success\",\n        \"failed\"\n      ]\n    },\n    \"public.healthcheck_kind\": {\n      \"name\": \"healthcheck_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"database\",\n        \"agent\"\n      ]\n    },\n    \"public.dbms_status\": {\n      \"name\": \"dbms_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"postgresql\",\n        \"mysql\",\n        \"mongodb\",\n        \"sqlite\",\n        \"redis\",\n        \"valkey\"\n      ]\n    },\n    \"public.status\": {\n      \"name\": \"status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"waiting\",\n        \"ongoing\",\n        \"failed\",\n        \"success\"\n      ]\n    },\n    \"public.type_storage\": {\n      \"name\": \"type_storage\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\"\n      ]\n    }\n  },\n  \"schemas\": {},\n  \"sequences\": {},\n  \"roles\": {},\n  \"policies\": {},\n  \"views\": {},\n  \"_meta\": {\n    \"columns\": {},\n    \"schemas\": {},\n    \"tables\": {}\n  }\n}"
  },
  {
    "path": "src/db/migrations/meta/0042_snapshot.json",
    "content": "{\n  \"id\": \"c08dd4c5-3af3-438c-bddd-48ae79a4c787\",\n  \"prevId\": \"de2537b3-16a9-488e-b776-448175eac116\",\n  \"version\": \"7\",\n  \"dialect\": \"postgresql\",\n  \"tables\": {\n    \"public.settings\": {\n      \"name\": \"settings\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"smtp_password\": {\n          \"name\": \"smtp_password\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_from\": {\n          \"name\": \"smtp_from\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_host\": {\n          \"name\": \"smtp_host\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_port\": {\n          \"name\": \"smtp_port\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_user\": {\n          \"name\": \"smtp_user\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_secure\": {\n          \"name\": \"smtp_secure\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"default_notification_channel_id\": {\n          \"name\": \"default_notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"default_storage_channel_id\": {\n          \"name\": \"default_storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"encryption\": {\n          \"name\": \"encryption\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"settings_default_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"settings_default_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"settings\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"default_notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"set null\",\n          \"onUpdate\": \"no action\"\n        },\n        \"settings_default_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"settings_default_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"settings\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"default_storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"set null\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"settings_name_unique\": {\n          \"name\": \"settings_name_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"name\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.account\": {\n      \"name\": \"account\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"account_id\": {\n          \"name\": \"account_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"access_token\": {\n          \"name\": \"access_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token\": {\n          \"name\": \"refresh_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"id_token\": {\n          \"name\": \"id_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"access_token_expires_at\": {\n          \"name\": \"access_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token_expires_at\": {\n          \"name\": \"refresh_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"scope\": {\n          \"name\": \"scope\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"password\": {\n          \"name\": \"password\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"account_user_id_user_id_fk\": {\n          \"name\": \"account_user_id_user_id_fk\",\n          \"tableFrom\": \"account\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.passkey\": {\n      \"name\": \"passkey\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"publicKey\": {\n          \"name\": \"publicKey\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"credentialID\": {\n          \"name\": \"credentialID\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"counter\": {\n          \"name\": \"counter\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"deviceType\": {\n          \"name\": \"deviceType\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backedUp\": {\n          \"name\": \"backedUp\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"transports\": {\n          \"name\": \"transports\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"aaguid\": {\n          \"name\": \"aaguid\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"passkey_user_id_user_id_fk\": {\n          \"name\": \"passkey_user_id_user_id_fk\",\n          \"tableFrom\": \"passkey\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.session\": {\n      \"name\": \"session\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"token\": {\n          \"name\": \"token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"ip_address\": {\n          \"name\": \"ip_address\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_agent\": {\n          \"name\": \"user_agent\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"impersonated_by\": {\n          \"name\": \"impersonated_by\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"active_organization_id\": {\n          \"name\": \"active_organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"session_user_id_user_id_fk\": {\n          \"name\": \"session_user_id_user_id_fk\",\n          \"tableFrom\": \"session\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"session_token_unique\": {\n          \"name\": \"session_token_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"token\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.sso_provider\": {\n      \"name\": \"sso_provider\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"issuer\": {\n          \"name\": \"issuer\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"oidc_config\": {\n          \"name\": \"oidc_config\",\n          \"type\": \"json\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"saml_config\": {\n          \"name\": \"saml_config\",\n          \"type\": \"json\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"domain\": {\n          \"name\": \"domain\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"sso_provider_user_id_user_id_fk\": {\n          \"name\": \"sso_provider_user_id_user_id_fk\",\n          \"tableFrom\": \"sso_provider\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"sso_provider_provider_id_unique\": {\n          \"name\": \"sso_provider_provider_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"provider_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.two_factor\": {\n      \"name\": \"two_factor\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"secret\": {\n          \"name\": \"secret\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backup_codes\": {\n          \"name\": \"backup_codes\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"two_factor_user_id_user_id_fk\": {\n          \"name\": \"two_factor_user_id_user_id_fk\",\n          \"tableFrom\": \"two_factor\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.user\": {\n      \"name\": \"user\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email_verified\": {\n          \"name\": \"email_verified\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"image\": {\n          \"name\": \"image\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"theme\": {\n          \"name\": \"theme\",\n          \"type\": \"user_themes\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'light'\"\n        },\n        \"banned\": {\n          \"name\": \"banned\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_reason\": {\n          \"name\": \"ban_reason\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_expires\": {\n          \"name\": \"ban_expires\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"lastConnectedAt\": {\n          \"name\": \"lastConnectedAt\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"lastChangedPasswordAt\": {\n          \"name\": \"lastChangedPasswordAt\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"two_factor_enabled\": {\n          \"name\": \"two_factor_enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"user_email_unique\": {\n          \"name\": \"user_email_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"email\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.verification\": {\n      \"name\": \"verification\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"identifier\": {\n          \"name\": \"identifier\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"value\": {\n          \"name\": \"value\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization\": {\n      \"name\": \"organization\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"logo\": {\n          \"name\": \"logo\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"metadata\": {\n          \"name\": \"metadata\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_slug_unique\": {\n          \"name\": \"organization_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.member\": {\n      \"name\": \"member\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"member_organization_id_organization_id_fk\": {\n          \"name\": \"member_organization_id_organization_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"member_user_id_user_id_fk\": {\n          \"name\": \"member_user_id_user_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.invitation\": {\n      \"name\": \"invitation\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"inviter_id\": {\n          \"name\": \"inviter_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"invitation_organization_id_organization_id_fk\": {\n          \"name\": \"invitation_organization_id_organization_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"invitation_inviter_id_user_id_fk\": {\n          \"name\": \"invitation_inviter_id_user_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"inviter_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.projects\": {\n      \"name\": \"projects\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"projects_organization_id_organization_id_fk\": {\n          \"name\": \"projects_organization_id_organization_id_fk\",\n          \"tableFrom\": \"projects\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"projects_slug_unique\": {\n          \"name\": \"projects_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backups\": {\n      \"name\": \"backups\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"file\": {\n          \"name\": \"file\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"file_size\": {\n          \"name\": \"file_size\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"imported\": {\n          \"name\": \"imported\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backups_database_id_databases_id_fk\": {\n          \"name\": \"backups_database_id_databases_id_fk\",\n          \"tableFrom\": \"backups\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.databases\": {\n      \"name\": \"databases\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"agent_database_id\": {\n          \"name\": \"agent_database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"dbms\": {\n          \"name\": \"dbms\",\n          \"type\": \"dbms_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_policy\": {\n          \"name\": \"backup_policy\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"is_waiting_for_backup\": {\n          \"name\": \"is_waiting_for_backup\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"backup_to_restore\": {\n          \"name\": \"backup_to_restore\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"agent_id\": {\n          \"name\": \"agent_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"project_id\": {\n          \"name\": \"project_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"databases_agent_id_agents_id_fk\": {\n          \"name\": \"databases_agent_id_agents_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"agents\",\n          \"columnsFrom\": [\n            \"agent_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"databases_project_id_projects_id_fk\": {\n          \"name\": \"databases_project_id_projects_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"projects\",\n          \"columnsFrom\": [\n            \"project_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"no action\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.restorations\": {\n      \"name\": \"restorations\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"backup_storage_id\": {\n          \"name\": \"backup_storage_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"restorations_backup_storage_id_backup_storage_id_fk\": {\n          \"name\": \"restorations_backup_storage_id_backup_storage_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backup_storage\",\n          \"columnsFrom\": [\n            \"backup_storage_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_backup_id_backups_id_fk\": {\n          \"name\": \"restorations_backup_id_backups_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_database_id_databases_id_fk\": {\n          \"name\": \"restorations_database_id_databases_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.retention_policies\": {\n      \"name\": \"retention_policies\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"type\": {\n          \"name\": \"type\",\n          \"type\": \"retention_policy_type\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"count\": {\n          \"name\": \"count\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"days\": {\n          \"name\": \"days\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 30\n        },\n        \"gfs_daily\": {\n          \"name\": \"gfs_daily\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"gfs_weekly\": {\n          \"name\": \"gfs_weekly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 4\n        },\n        \"gfs_monthly\": {\n          \"name\": \"gfs_monthly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 12\n        },\n        \"gfs_yearly\": {\n          \"name\": \"gfs_yearly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 3\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"retention_policies_database_id_databases_id_fk\": {\n          \"name\": \"retention_policies_database_id_databases_id_fk\",\n          \"tableFrom\": \"retention_policies\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.agents\": {\n      \"name\": \"agents\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"version\": {\n          \"name\": \"version\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"agents_slug_unique\": {\n          \"name\": \"agents_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_channel\": {\n      \"name\": \"notification_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"notification_channel_organization_id_organization_id_fk\": {\n          \"name\": \"notification_channel_organization_id_organization_id_fk\",\n          \"tableFrom\": \"notification_channel\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_notification_channels\": {\n      \"name\": \"organization_notification_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_notification_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_notification_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_notification_channels_organization_id_notification_channel_id_unique\": {\n          \"name\": \"organization_notification_channels_organization_id_notification_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"notification_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.alert_policy\": {\n      \"name\": \"alert_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"event_kind\": {\n          \"name\": \"event_kind\",\n          \"type\": \"event_kind[]\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"alert_policy_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"alert_policy_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"alert_policy_database_id_databases_id_fk\": {\n          \"name\": \"alert_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_log\": {\n      \"name\": \"notification_log\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"channel_id\": {\n          \"name\": \"channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"policy_id\": {\n          \"name\": \"policy_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"event\": {\n          \"name\": \"event\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_name\": {\n          \"name\": \"provider_name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"title\": {\n          \"name\": \"title\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"message\": {\n          \"name\": \"message\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"level\": {\n          \"name\": \"level\",\n          \"type\": \"level\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"payload\": {\n          \"name\": \"payload\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"success\": {\n          \"name\": \"success\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"error\": {\n          \"name\": \"error\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider_response\": {\n          \"name\": \"provider_response\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"sent_at\": {\n          \"name\": \"sent_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_storage_channels\": {\n      \"name\": \"organization_storage_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_storage_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_storage_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_storage_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_storage_channels_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"organization_storage_channels_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"organization_storage_channels\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_storage_channels_organization_id_storage_channel_id_unique\": {\n          \"name\": \"organization_storage_channels_organization_id_storage_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"storage_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.storage_channel\": {\n      \"name\": \"storage_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_storage_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"storage_channel_organization_id_organization_id_fk\": {\n          \"name\": \"storage_channel_organization_id_organization_id_fk\",\n          \"tableFrom\": \"storage_channel\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.storage_policy\": {\n      \"name\": \"storage_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"storage_policy_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"storage_policy_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"storage_policy\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"storage_policy_database_id_databases_id_fk\": {\n          \"name\": \"storage_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"storage_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backup_storage\": {\n      \"name\": \"backup_storage\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"backup_storage_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'pending'\"\n        },\n        \"path\": {\n          \"name\": \"path\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"size\": {\n          \"name\": \"size\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"checksum\": {\n          \"name\": \"checksum\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backup_storage_backup_id_backups_id_fk\": {\n          \"name\": \"backup_storage_backup_id_backups_id_fk\",\n          \"tableFrom\": \"backup_storage\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"backup_storage_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"backup_storage_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"backup_storage\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.healthcheck_log\": {\n      \"name\": \"healthcheck_log\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"kind\": {\n          \"name\": \"kind\",\n          \"type\": \"healthcheck_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"date\": {\n          \"name\": \"date\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"healthcheck_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"object_id\": {\n          \"name\": \"object_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    }\n  },\n  \"enums\": {\n    \"public.user_themes\": {\n      \"name\": \"user_themes\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"light\",\n        \"dark\",\n        \"system\"\n      ]\n    },\n    \"public.retention_policy_type\": {\n      \"name\": \"retention_policy_type\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"count\",\n        \"days\",\n        \"gfs\"\n      ]\n    },\n    \"public.provider_kind\": {\n      \"name\": \"provider_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"slack\",\n        \"smtp\",\n        \"discord\",\n        \"telegram\",\n        \"gotify\",\n        \"ntfy\",\n        \"webhook\"\n      ]\n    },\n    \"public.event_kind\": {\n      \"name\": \"event_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"error_backup\",\n        \"error_restore\",\n        \"success_restore\",\n        \"success_backup\",\n        \"weekly_report\"\n      ]\n    },\n    \"public.level\": {\n      \"name\": \"level\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"critical\",\n        \"warning\",\n        \"info\"\n      ]\n    },\n    \"public.provider_storage_kind\": {\n      \"name\": \"provider_storage_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\",\n        \"google-drive\"\n      ]\n    },\n    \"public.backup_storage_status\": {\n      \"name\": \"backup_storage_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"pending\",\n        \"success\",\n        \"failed\"\n      ]\n    },\n    \"public.healthcheck_status\": {\n      \"name\": \"healthcheck_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"success\",\n        \"failed\"\n      ]\n    },\n    \"public.healthcheck_kind\": {\n      \"name\": \"healthcheck_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"database\",\n        \"agent\"\n      ]\n    },\n    \"public.dbms_status\": {\n      \"name\": \"dbms_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"postgresql\",\n        \"mysql\",\n        \"mongodb\",\n        \"sqlite\",\n        \"redis\",\n        \"valkey\"\n      ]\n    },\n    \"public.status\": {\n      \"name\": \"status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"waiting\",\n        \"ongoing\",\n        \"failed\",\n        \"success\"\n      ]\n    },\n    \"public.type_storage\": {\n      \"name\": \"type_storage\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\"\n      ]\n    }\n  },\n  \"schemas\": {},\n  \"sequences\": {},\n  \"roles\": {},\n  \"policies\": {},\n  \"views\": {},\n  \"_meta\": {\n    \"columns\": {},\n    \"schemas\": {},\n    \"tables\": {}\n  }\n}"
  },
  {
    "path": "src/db/migrations/meta/0043_snapshot.json",
    "content": "{\n  \"id\": \"2c0841a6-65ba-4b23-81c2-38b19fa558c7\",\n  \"prevId\": \"c08dd4c5-3af3-438c-bddd-48ae79a4c787\",\n  \"version\": \"7\",\n  \"dialect\": \"postgresql\",\n  \"tables\": {\n    \"public.settings\": {\n      \"name\": \"settings\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"smtp_password\": {\n          \"name\": \"smtp_password\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_from\": {\n          \"name\": \"smtp_from\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_host\": {\n          \"name\": \"smtp_host\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_port\": {\n          \"name\": \"smtp_port\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_user\": {\n          \"name\": \"smtp_user\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_secure\": {\n          \"name\": \"smtp_secure\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"default_notification_channel_id\": {\n          \"name\": \"default_notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"default_storage_channel_id\": {\n          \"name\": \"default_storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"encryption\": {\n          \"name\": \"encryption\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"settings_default_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"settings_default_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"settings\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"default_notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"set null\",\n          \"onUpdate\": \"no action\"\n        },\n        \"settings_default_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"settings_default_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"settings\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"default_storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"set null\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"settings_name_unique\": {\n          \"name\": \"settings_name_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"name\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.account\": {\n      \"name\": \"account\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"account_id\": {\n          \"name\": \"account_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"access_token\": {\n          \"name\": \"access_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token\": {\n          \"name\": \"refresh_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"id_token\": {\n          \"name\": \"id_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"access_token_expires_at\": {\n          \"name\": \"access_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token_expires_at\": {\n          \"name\": \"refresh_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"scope\": {\n          \"name\": \"scope\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"password\": {\n          \"name\": \"password\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"account_user_id_user_id_fk\": {\n          \"name\": \"account_user_id_user_id_fk\",\n          \"tableFrom\": \"account\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.passkey\": {\n      \"name\": \"passkey\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"publicKey\": {\n          \"name\": \"publicKey\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"credentialID\": {\n          \"name\": \"credentialID\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"counter\": {\n          \"name\": \"counter\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"deviceType\": {\n          \"name\": \"deviceType\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backedUp\": {\n          \"name\": \"backedUp\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"transports\": {\n          \"name\": \"transports\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"aaguid\": {\n          \"name\": \"aaguid\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"passkey_user_id_user_id_fk\": {\n          \"name\": \"passkey_user_id_user_id_fk\",\n          \"tableFrom\": \"passkey\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.session\": {\n      \"name\": \"session\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"token\": {\n          \"name\": \"token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"ip_address\": {\n          \"name\": \"ip_address\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_agent\": {\n          \"name\": \"user_agent\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"impersonated_by\": {\n          \"name\": \"impersonated_by\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"active_organization_id\": {\n          \"name\": \"active_organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"session_user_id_user_id_fk\": {\n          \"name\": \"session_user_id_user_id_fk\",\n          \"tableFrom\": \"session\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"session_token_unique\": {\n          \"name\": \"session_token_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"token\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.sso_provider\": {\n      \"name\": \"sso_provider\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"issuer\": {\n          \"name\": \"issuer\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"oidc_config\": {\n          \"name\": \"oidc_config\",\n          \"type\": \"json\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"saml_config\": {\n          \"name\": \"saml_config\",\n          \"type\": \"json\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"domain\": {\n          \"name\": \"domain\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"sso_provider_user_id_user_id_fk\": {\n          \"name\": \"sso_provider_user_id_user_id_fk\",\n          \"tableFrom\": \"sso_provider\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"sso_provider_provider_id_unique\": {\n          \"name\": \"sso_provider_provider_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"provider_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.two_factor\": {\n      \"name\": \"two_factor\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"secret\": {\n          \"name\": \"secret\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backup_codes\": {\n          \"name\": \"backup_codes\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"two_factor_user_id_user_id_fk\": {\n          \"name\": \"two_factor_user_id_user_id_fk\",\n          \"tableFrom\": \"two_factor\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.user\": {\n      \"name\": \"user\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email_verified\": {\n          \"name\": \"email_verified\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"image\": {\n          \"name\": \"image\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"theme\": {\n          \"name\": \"theme\",\n          \"type\": \"user_themes\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'light'\"\n        },\n        \"banned\": {\n          \"name\": \"banned\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_reason\": {\n          \"name\": \"ban_reason\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_expires\": {\n          \"name\": \"ban_expires\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"lastConnectedAt\": {\n          \"name\": \"lastConnectedAt\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"lastChangedPasswordAt\": {\n          \"name\": \"lastChangedPasswordAt\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"two_factor_enabled\": {\n          \"name\": \"two_factor_enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"user_email_unique\": {\n          \"name\": \"user_email_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"email\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.verification\": {\n      \"name\": \"verification\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"identifier\": {\n          \"name\": \"identifier\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"value\": {\n          \"name\": \"value\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization\": {\n      \"name\": \"organization\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"logo\": {\n          \"name\": \"logo\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"metadata\": {\n          \"name\": \"metadata\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_slug_unique\": {\n          \"name\": \"organization_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.member\": {\n      \"name\": \"member\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"member_organization_id_organization_id_fk\": {\n          \"name\": \"member_organization_id_organization_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"member_user_id_user_id_fk\": {\n          \"name\": \"member_user_id_user_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.invitation\": {\n      \"name\": \"invitation\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"inviter_id\": {\n          \"name\": \"inviter_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"invitation_organization_id_organization_id_fk\": {\n          \"name\": \"invitation_organization_id_organization_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"invitation_inviter_id_user_id_fk\": {\n          \"name\": \"invitation_inviter_id_user_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"inviter_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.projects\": {\n      \"name\": \"projects\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"projects_organization_id_organization_id_fk\": {\n          \"name\": \"projects_organization_id_organization_id_fk\",\n          \"tableFrom\": \"projects\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"projects_slug_unique\": {\n          \"name\": \"projects_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backups\": {\n      \"name\": \"backups\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"file\": {\n          \"name\": \"file\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"file_size\": {\n          \"name\": \"file_size\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"imported\": {\n          \"name\": \"imported\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backups_database_id_databases_id_fk\": {\n          \"name\": \"backups_database_id_databases_id_fk\",\n          \"tableFrom\": \"backups\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.databases\": {\n      \"name\": \"databases\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"agent_database_id\": {\n          \"name\": \"agent_database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"dbms\": {\n          \"name\": \"dbms\",\n          \"type\": \"dbms_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_policy\": {\n          \"name\": \"backup_policy\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"is_waiting_for_backup\": {\n          \"name\": \"is_waiting_for_backup\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"backup_to_restore\": {\n          \"name\": \"backup_to_restore\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"agent_id\": {\n          \"name\": \"agent_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"project_id\": {\n          \"name\": \"project_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"databases_agent_id_agents_id_fk\": {\n          \"name\": \"databases_agent_id_agents_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"agents\",\n          \"columnsFrom\": [\n            \"agent_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"databases_project_id_projects_id_fk\": {\n          \"name\": \"databases_project_id_projects_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"projects\",\n          \"columnsFrom\": [\n            \"project_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"no action\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.restorations\": {\n      \"name\": \"restorations\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"backup_storage_id\": {\n          \"name\": \"backup_storage_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"restorations_backup_storage_id_backup_storage_id_fk\": {\n          \"name\": \"restorations_backup_storage_id_backup_storage_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backup_storage\",\n          \"columnsFrom\": [\n            \"backup_storage_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_backup_id_backups_id_fk\": {\n          \"name\": \"restorations_backup_id_backups_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_database_id_databases_id_fk\": {\n          \"name\": \"restorations_database_id_databases_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.retention_policies\": {\n      \"name\": \"retention_policies\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"type\": {\n          \"name\": \"type\",\n          \"type\": \"retention_policy_type\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"count\": {\n          \"name\": \"count\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"days\": {\n          \"name\": \"days\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 30\n        },\n        \"gfs_daily\": {\n          \"name\": \"gfs_daily\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"gfs_weekly\": {\n          \"name\": \"gfs_weekly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 4\n        },\n        \"gfs_monthly\": {\n          \"name\": \"gfs_monthly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 12\n        },\n        \"gfs_yearly\": {\n          \"name\": \"gfs_yearly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 3\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"retention_policies_database_id_databases_id_fk\": {\n          \"name\": \"retention_policies_database_id_databases_id_fk\",\n          \"tableFrom\": \"retention_policies\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.agents\": {\n      \"name\": \"agents\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"version\": {\n          \"name\": \"version\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"health_error_count\": {\n          \"name\": \"health_error_count\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"agents_slug_unique\": {\n          \"name\": \"agents_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_channel\": {\n      \"name\": \"notification_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"notification_channel_organization_id_organization_id_fk\": {\n          \"name\": \"notification_channel_organization_id_organization_id_fk\",\n          \"tableFrom\": \"notification_channel\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_notification_channels\": {\n      \"name\": \"organization_notification_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_notification_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_notification_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_notification_channels_organization_id_notification_channel_id_unique\": {\n          \"name\": \"organization_notification_channels_organization_id_notification_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"notification_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.alert_policy\": {\n      \"name\": \"alert_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"event_kind\": {\n          \"name\": \"event_kind\",\n          \"type\": \"event_kind[]\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"alert_policy_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"alert_policy_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"alert_policy_database_id_databases_id_fk\": {\n          \"name\": \"alert_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_log\": {\n      \"name\": \"notification_log\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"channel_id\": {\n          \"name\": \"channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"policy_id\": {\n          \"name\": \"policy_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"event\": {\n          \"name\": \"event\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_name\": {\n          \"name\": \"provider_name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"title\": {\n          \"name\": \"title\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"message\": {\n          \"name\": \"message\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"level\": {\n          \"name\": \"level\",\n          \"type\": \"level\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"payload\": {\n          \"name\": \"payload\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"success\": {\n          \"name\": \"success\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"error\": {\n          \"name\": \"error\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider_response\": {\n          \"name\": \"provider_response\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"sent_at\": {\n          \"name\": \"sent_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_storage_channels\": {\n      \"name\": \"organization_storage_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_storage_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_storage_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_storage_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_storage_channels_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"organization_storage_channels_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"organization_storage_channels\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_storage_channels_organization_id_storage_channel_id_unique\": {\n          \"name\": \"organization_storage_channels_organization_id_storage_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"storage_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.storage_channel\": {\n      \"name\": \"storage_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_storage_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"storage_channel_organization_id_organization_id_fk\": {\n          \"name\": \"storage_channel_organization_id_organization_id_fk\",\n          \"tableFrom\": \"storage_channel\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.storage_policy\": {\n      \"name\": \"storage_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"storage_policy_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"storage_policy_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"storage_policy\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"storage_policy_database_id_databases_id_fk\": {\n          \"name\": \"storage_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"storage_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backup_storage\": {\n      \"name\": \"backup_storage\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"backup_storage_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'pending'\"\n        },\n        \"path\": {\n          \"name\": \"path\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"size\": {\n          \"name\": \"size\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"checksum\": {\n          \"name\": \"checksum\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backup_storage_backup_id_backups_id_fk\": {\n          \"name\": \"backup_storage_backup_id_backups_id_fk\",\n          \"tableFrom\": \"backup_storage\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"backup_storage_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"backup_storage_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"backup_storage\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.healthcheck_log\": {\n      \"name\": \"healthcheck_log\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"kind\": {\n          \"name\": \"kind\",\n          \"type\": \"healthcheck_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"date\": {\n          \"name\": \"date\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"healthcheck_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"object_id\": {\n          \"name\": \"object_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    }\n  },\n  \"enums\": {\n    \"public.user_themes\": {\n      \"name\": \"user_themes\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"light\",\n        \"dark\",\n        \"system\"\n      ]\n    },\n    \"public.retention_policy_type\": {\n      \"name\": \"retention_policy_type\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"count\",\n        \"days\",\n        \"gfs\"\n      ]\n    },\n    \"public.provider_kind\": {\n      \"name\": \"provider_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"slack\",\n        \"smtp\",\n        \"discord\",\n        \"telegram\",\n        \"gotify\",\n        \"ntfy\",\n        \"webhook\"\n      ]\n    },\n    \"public.event_kind\": {\n      \"name\": \"event_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"error_backup\",\n        \"error_restore\",\n        \"success_restore\",\n        \"success_backup\",\n        \"weekly_report\"\n      ]\n    },\n    \"public.level\": {\n      \"name\": \"level\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"critical\",\n        \"warning\",\n        \"info\"\n      ]\n    },\n    \"public.provider_storage_kind\": {\n      \"name\": \"provider_storage_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\",\n        \"google-drive\"\n      ]\n    },\n    \"public.backup_storage_status\": {\n      \"name\": \"backup_storage_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"pending\",\n        \"success\",\n        \"failed\"\n      ]\n    },\n    \"public.healthcheck_status\": {\n      \"name\": \"healthcheck_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"success\",\n        \"failed\"\n      ]\n    },\n    \"public.healthcheck_kind\": {\n      \"name\": \"healthcheck_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"database\",\n        \"agent\"\n      ]\n    },\n    \"public.dbms_status\": {\n      \"name\": \"dbms_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"postgresql\",\n        \"mysql\",\n        \"mongodb\",\n        \"sqlite\",\n        \"redis\",\n        \"valkey\"\n      ]\n    },\n    \"public.status\": {\n      \"name\": \"status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"waiting\",\n        \"ongoing\",\n        \"failed\",\n        \"success\"\n      ]\n    },\n    \"public.type_storage\": {\n      \"name\": \"type_storage\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\"\n      ]\n    }\n  },\n  \"schemas\": {},\n  \"sequences\": {},\n  \"roles\": {},\n  \"policies\": {},\n  \"views\": {},\n  \"_meta\": {\n    \"columns\": {},\n    \"schemas\": {},\n    \"tables\": {}\n  }\n}"
  },
  {
    "path": "src/db/migrations/meta/0044_snapshot.json",
    "content": "{\n  \"id\": \"bf21a054-dee1-4890-a81e-d922b9f48f15\",\n  \"prevId\": \"2c0841a6-65ba-4b23-81c2-38b19fa558c7\",\n  \"version\": \"7\",\n  \"dialect\": \"postgresql\",\n  \"tables\": {\n    \"public.settings\": {\n      \"name\": \"settings\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"smtp_password\": {\n          \"name\": \"smtp_password\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_from\": {\n          \"name\": \"smtp_from\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_host\": {\n          \"name\": \"smtp_host\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_port\": {\n          \"name\": \"smtp_port\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_user\": {\n          \"name\": \"smtp_user\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_secure\": {\n          \"name\": \"smtp_secure\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"default_notification_channel_id\": {\n          \"name\": \"default_notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"default_storage_channel_id\": {\n          \"name\": \"default_storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"encryption\": {\n          \"name\": \"encryption\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"settings_default_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"settings_default_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"settings\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"default_notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"set null\",\n          \"onUpdate\": \"no action\"\n        },\n        \"settings_default_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"settings_default_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"settings\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"default_storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"set null\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"settings_name_unique\": {\n          \"name\": \"settings_name_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"name\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.account\": {\n      \"name\": \"account\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"account_id\": {\n          \"name\": \"account_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"access_token\": {\n          \"name\": \"access_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token\": {\n          \"name\": \"refresh_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"id_token\": {\n          \"name\": \"id_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"access_token_expires_at\": {\n          \"name\": \"access_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token_expires_at\": {\n          \"name\": \"refresh_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"scope\": {\n          \"name\": \"scope\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"password\": {\n          \"name\": \"password\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"account_user_id_user_id_fk\": {\n          \"name\": \"account_user_id_user_id_fk\",\n          \"tableFrom\": \"account\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.passkey\": {\n      \"name\": \"passkey\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"publicKey\": {\n          \"name\": \"publicKey\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"credentialID\": {\n          \"name\": \"credentialID\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"counter\": {\n          \"name\": \"counter\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"deviceType\": {\n          \"name\": \"deviceType\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backedUp\": {\n          \"name\": \"backedUp\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"transports\": {\n          \"name\": \"transports\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"aaguid\": {\n          \"name\": \"aaguid\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"passkey_user_id_user_id_fk\": {\n          \"name\": \"passkey_user_id_user_id_fk\",\n          \"tableFrom\": \"passkey\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.session\": {\n      \"name\": \"session\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"token\": {\n          \"name\": \"token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"ip_address\": {\n          \"name\": \"ip_address\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_agent\": {\n          \"name\": \"user_agent\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"impersonated_by\": {\n          \"name\": \"impersonated_by\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"active_organization_id\": {\n          \"name\": \"active_organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"session_user_id_user_id_fk\": {\n          \"name\": \"session_user_id_user_id_fk\",\n          \"tableFrom\": \"session\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"session_token_unique\": {\n          \"name\": \"session_token_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"token\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.sso_provider\": {\n      \"name\": \"sso_provider\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"issuer\": {\n          \"name\": \"issuer\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"oidc_config\": {\n          \"name\": \"oidc_config\",\n          \"type\": \"json\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"saml_config\": {\n          \"name\": \"saml_config\",\n          \"type\": \"json\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"domain\": {\n          \"name\": \"domain\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"sso_provider_user_id_user_id_fk\": {\n          \"name\": \"sso_provider_user_id_user_id_fk\",\n          \"tableFrom\": \"sso_provider\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"sso_provider_provider_id_unique\": {\n          \"name\": \"sso_provider_provider_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"provider_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.two_factor\": {\n      \"name\": \"two_factor\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"secret\": {\n          \"name\": \"secret\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backup_codes\": {\n          \"name\": \"backup_codes\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"two_factor_user_id_user_id_fk\": {\n          \"name\": \"two_factor_user_id_user_id_fk\",\n          \"tableFrom\": \"two_factor\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.user\": {\n      \"name\": \"user\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email_verified\": {\n          \"name\": \"email_verified\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"image\": {\n          \"name\": \"image\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"theme\": {\n          \"name\": \"theme\",\n          \"type\": \"user_themes\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'light'\"\n        },\n        \"banned\": {\n          \"name\": \"banned\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_reason\": {\n          \"name\": \"ban_reason\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_expires\": {\n          \"name\": \"ban_expires\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"lastConnectedAt\": {\n          \"name\": \"lastConnectedAt\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"lastChangedPasswordAt\": {\n          \"name\": \"lastChangedPasswordAt\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"two_factor_enabled\": {\n          \"name\": \"two_factor_enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"user_email_unique\": {\n          \"name\": \"user_email_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"email\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.verification\": {\n      \"name\": \"verification\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"identifier\": {\n          \"name\": \"identifier\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"value\": {\n          \"name\": \"value\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization\": {\n      \"name\": \"organization\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"logo\": {\n          \"name\": \"logo\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"metadata\": {\n          \"name\": \"metadata\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_slug_unique\": {\n          \"name\": \"organization_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.member\": {\n      \"name\": \"member\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"member_organization_id_organization_id_fk\": {\n          \"name\": \"member_organization_id_organization_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"member_user_id_user_id_fk\": {\n          \"name\": \"member_user_id_user_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.invitation\": {\n      \"name\": \"invitation\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"inviter_id\": {\n          \"name\": \"inviter_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"invitation_organization_id_organization_id_fk\": {\n          \"name\": \"invitation_organization_id_organization_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"invitation_inviter_id_user_id_fk\": {\n          \"name\": \"invitation_inviter_id_user_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"inviter_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.projects\": {\n      \"name\": \"projects\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"projects_organization_id_organization_id_fk\": {\n          \"name\": \"projects_organization_id_organization_id_fk\",\n          \"tableFrom\": \"projects\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"projects_slug_unique\": {\n          \"name\": \"projects_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backups\": {\n      \"name\": \"backups\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"file\": {\n          \"name\": \"file\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"file_size\": {\n          \"name\": \"file_size\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"imported\": {\n          \"name\": \"imported\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backups_database_id_databases_id_fk\": {\n          \"name\": \"backups_database_id_databases_id_fk\",\n          \"tableFrom\": \"backups\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.databases\": {\n      \"name\": \"databases\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"agent_database_id\": {\n          \"name\": \"agent_database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"dbms\": {\n          \"name\": \"dbms\",\n          \"type\": \"dbms_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_policy\": {\n          \"name\": \"backup_policy\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"is_waiting_for_backup\": {\n          \"name\": \"is_waiting_for_backup\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"backup_to_restore\": {\n          \"name\": \"backup_to_restore\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"agent_id\": {\n          \"name\": \"agent_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"project_id\": {\n          \"name\": \"project_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"databases_agent_id_agents_id_fk\": {\n          \"name\": \"databases_agent_id_agents_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"agents\",\n          \"columnsFrom\": [\n            \"agent_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"databases_project_id_projects_id_fk\": {\n          \"name\": \"databases_project_id_projects_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"projects\",\n          \"columnsFrom\": [\n            \"project_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"no action\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.restorations\": {\n      \"name\": \"restorations\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"backup_storage_id\": {\n          \"name\": \"backup_storage_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"restorations_backup_storage_id_backup_storage_id_fk\": {\n          \"name\": \"restorations_backup_storage_id_backup_storage_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backup_storage\",\n          \"columnsFrom\": [\n            \"backup_storage_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_backup_id_backups_id_fk\": {\n          \"name\": \"restorations_backup_id_backups_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_database_id_databases_id_fk\": {\n          \"name\": \"restorations_database_id_databases_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.retention_policies\": {\n      \"name\": \"retention_policies\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"type\": {\n          \"name\": \"type\",\n          \"type\": \"retention_policy_type\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"count\": {\n          \"name\": \"count\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"days\": {\n          \"name\": \"days\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 30\n        },\n        \"gfs_daily\": {\n          \"name\": \"gfs_daily\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"gfs_weekly\": {\n          \"name\": \"gfs_weekly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 4\n        },\n        \"gfs_monthly\": {\n          \"name\": \"gfs_monthly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 12\n        },\n        \"gfs_yearly\": {\n          \"name\": \"gfs_yearly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 3\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"retention_policies_database_id_databases_id_fk\": {\n          \"name\": \"retention_policies_database_id_databases_id_fk\",\n          \"tableFrom\": \"retention_policies\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.agents\": {\n      \"name\": \"agents\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"version\": {\n          \"name\": \"version\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"health_error_count\": {\n          \"name\": \"health_error_count\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"agents_slug_unique\": {\n          \"name\": \"agents_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_channel\": {\n      \"name\": \"notification_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"notification_channel_organization_id_organization_id_fk\": {\n          \"name\": \"notification_channel_organization_id_organization_id_fk\",\n          \"tableFrom\": \"notification_channel\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_notification_channels\": {\n      \"name\": \"organization_notification_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_notification_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_notification_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_notification_channels_organization_id_notification_channel_id_unique\": {\n          \"name\": \"organization_notification_channels_organization_id_notification_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"notification_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.alert_policy\": {\n      \"name\": \"alert_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"event_kind\": {\n          \"name\": \"event_kind\",\n          \"type\": \"event_kind[]\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"alert_policy_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"alert_policy_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"alert_policy_database_id_databases_id_fk\": {\n          \"name\": \"alert_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_log\": {\n      \"name\": \"notification_log\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"channel_id\": {\n          \"name\": \"channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"policy_id\": {\n          \"name\": \"policy_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"event\": {\n          \"name\": \"event\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_name\": {\n          \"name\": \"provider_name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"title\": {\n          \"name\": \"title\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"message\": {\n          \"name\": \"message\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"level\": {\n          \"name\": \"level\",\n          \"type\": \"level\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"payload\": {\n          \"name\": \"payload\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"success\": {\n          \"name\": \"success\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"error\": {\n          \"name\": \"error\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider_response\": {\n          \"name\": \"provider_response\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"sent_at\": {\n          \"name\": \"sent_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_storage_channels\": {\n      \"name\": \"organization_storage_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_storage_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_storage_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_storage_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_storage_channels_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"organization_storage_channels_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"organization_storage_channels\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_storage_channels_organization_id_storage_channel_id_unique\": {\n          \"name\": \"organization_storage_channels_organization_id_storage_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"storage_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.storage_channel\": {\n      \"name\": \"storage_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_storage_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"storage_channel_organization_id_organization_id_fk\": {\n          \"name\": \"storage_channel_organization_id_organization_id_fk\",\n          \"tableFrom\": \"storage_channel\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.storage_policy\": {\n      \"name\": \"storage_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"storage_policy_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"storage_policy_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"storage_policy\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"storage_policy_database_id_databases_id_fk\": {\n          \"name\": \"storage_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"storage_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backup_storage\": {\n      \"name\": \"backup_storage\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"backup_storage_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'pending'\"\n        },\n        \"path\": {\n          \"name\": \"path\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"size\": {\n          \"name\": \"size\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"checksum\": {\n          \"name\": \"checksum\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backup_storage_backup_id_backups_id_fk\": {\n          \"name\": \"backup_storage_backup_id_backups_id_fk\",\n          \"tableFrom\": \"backup_storage\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"backup_storage_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"backup_storage_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"backup_storage\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.healthcheck_log\": {\n      \"name\": \"healthcheck_log\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"kind\": {\n          \"name\": \"kind\",\n          \"type\": \"healthcheck_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"date\": {\n          \"name\": \"date\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"healthcheck_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"object_id\": {\n          \"name\": \"object_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    }\n  },\n  \"enums\": {\n    \"public.user_themes\": {\n      \"name\": \"user_themes\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"light\",\n        \"dark\",\n        \"system\"\n      ]\n    },\n    \"public.retention_policy_type\": {\n      \"name\": \"retention_policy_type\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"count\",\n        \"days\",\n        \"gfs\"\n      ]\n    },\n    \"public.provider_kind\": {\n      \"name\": \"provider_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"slack\",\n        \"smtp\",\n        \"discord\",\n        \"telegram\",\n        \"gotify\",\n        \"ntfy\",\n        \"webhook\"\n      ]\n    },\n    \"public.event_kind\": {\n      \"name\": \"event_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"error_backup\",\n        \"error_restore\",\n        \"success_restore\",\n        \"success_backup\",\n        \"weekly_report\",\n        \"error_health_agent\"\n      ]\n    },\n    \"public.level\": {\n      \"name\": \"level\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"critical\",\n        \"warning\",\n        \"info\"\n      ]\n    },\n    \"public.provider_storage_kind\": {\n      \"name\": \"provider_storage_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\",\n        \"google-drive\"\n      ]\n    },\n    \"public.backup_storage_status\": {\n      \"name\": \"backup_storage_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"pending\",\n        \"success\",\n        \"failed\"\n      ]\n    },\n    \"public.healthcheck_status\": {\n      \"name\": \"healthcheck_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"success\",\n        \"failed\"\n      ]\n    },\n    \"public.healthcheck_kind\": {\n      \"name\": \"healthcheck_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"database\",\n        \"agent\"\n      ]\n    },\n    \"public.dbms_status\": {\n      \"name\": \"dbms_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"postgresql\",\n        \"mysql\",\n        \"mongodb\",\n        \"sqlite\",\n        \"redis\",\n        \"valkey\"\n      ]\n    },\n    \"public.status\": {\n      \"name\": \"status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"waiting\",\n        \"ongoing\",\n        \"failed\",\n        \"success\"\n      ]\n    },\n    \"public.type_storage\": {\n      \"name\": \"type_storage\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\"\n      ]\n    }\n  },\n  \"schemas\": {},\n  \"sequences\": {},\n  \"roles\": {},\n  \"policies\": {},\n  \"views\": {},\n  \"_meta\": {\n    \"columns\": {},\n    \"schemas\": {},\n    \"tables\": {}\n  }\n}"
  },
  {
    "path": "src/db/migrations/meta/0045_snapshot.json",
    "content": "{\n  \"id\": \"af696e5b-ae80-4231-aa26-9e9f4c4c43d6\",\n  \"prevId\": \"bf21a054-dee1-4890-a81e-d922b9f48f15\",\n  \"version\": \"7\",\n  \"dialect\": \"postgresql\",\n  \"tables\": {\n    \"public.settings\": {\n      \"name\": \"settings\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"smtp_password\": {\n          \"name\": \"smtp_password\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_from\": {\n          \"name\": \"smtp_from\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_host\": {\n          \"name\": \"smtp_host\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_port\": {\n          \"name\": \"smtp_port\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_user\": {\n          \"name\": \"smtp_user\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_secure\": {\n          \"name\": \"smtp_secure\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"default_notification_channel_id\": {\n          \"name\": \"default_notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"default_storage_channel_id\": {\n          \"name\": \"default_storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"encryption\": {\n          \"name\": \"encryption\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"settings_default_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"settings_default_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"settings\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"default_notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"set null\",\n          \"onUpdate\": \"no action\"\n        },\n        \"settings_default_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"settings_default_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"settings\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"default_storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"set null\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"settings_name_unique\": {\n          \"name\": \"settings_name_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"name\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.account\": {\n      \"name\": \"account\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"account_id\": {\n          \"name\": \"account_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"access_token\": {\n          \"name\": \"access_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token\": {\n          \"name\": \"refresh_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"id_token\": {\n          \"name\": \"id_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"access_token_expires_at\": {\n          \"name\": \"access_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token_expires_at\": {\n          \"name\": \"refresh_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"scope\": {\n          \"name\": \"scope\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"password\": {\n          \"name\": \"password\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"account_user_id_user_id_fk\": {\n          \"name\": \"account_user_id_user_id_fk\",\n          \"tableFrom\": \"account\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.passkey\": {\n      \"name\": \"passkey\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"publicKey\": {\n          \"name\": \"publicKey\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"credentialID\": {\n          \"name\": \"credentialID\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"counter\": {\n          \"name\": \"counter\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"deviceType\": {\n          \"name\": \"deviceType\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backedUp\": {\n          \"name\": \"backedUp\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"transports\": {\n          \"name\": \"transports\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"aaguid\": {\n          \"name\": \"aaguid\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"passkey_user_id_user_id_fk\": {\n          \"name\": \"passkey_user_id_user_id_fk\",\n          \"tableFrom\": \"passkey\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.session\": {\n      \"name\": \"session\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"token\": {\n          \"name\": \"token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"ip_address\": {\n          \"name\": \"ip_address\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_agent\": {\n          \"name\": \"user_agent\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"impersonated_by\": {\n          \"name\": \"impersonated_by\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"active_organization_id\": {\n          \"name\": \"active_organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"session_user_id_user_id_fk\": {\n          \"name\": \"session_user_id_user_id_fk\",\n          \"tableFrom\": \"session\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"session_token_unique\": {\n          \"name\": \"session_token_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"token\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.sso_provider\": {\n      \"name\": \"sso_provider\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"issuer\": {\n          \"name\": \"issuer\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"oidc_config\": {\n          \"name\": \"oidc_config\",\n          \"type\": \"json\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"saml_config\": {\n          \"name\": \"saml_config\",\n          \"type\": \"json\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"domain\": {\n          \"name\": \"domain\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"sso_provider_user_id_user_id_fk\": {\n          \"name\": \"sso_provider_user_id_user_id_fk\",\n          \"tableFrom\": \"sso_provider\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"sso_provider_provider_id_unique\": {\n          \"name\": \"sso_provider_provider_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"provider_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.two_factor\": {\n      \"name\": \"two_factor\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"secret\": {\n          \"name\": \"secret\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backup_codes\": {\n          \"name\": \"backup_codes\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"two_factor_user_id_user_id_fk\": {\n          \"name\": \"two_factor_user_id_user_id_fk\",\n          \"tableFrom\": \"two_factor\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.user\": {\n      \"name\": \"user\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email_verified\": {\n          \"name\": \"email_verified\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"image\": {\n          \"name\": \"image\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"theme\": {\n          \"name\": \"theme\",\n          \"type\": \"user_themes\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'light'\"\n        },\n        \"banned\": {\n          \"name\": \"banned\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_reason\": {\n          \"name\": \"ban_reason\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_expires\": {\n          \"name\": \"ban_expires\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"lastConnectedAt\": {\n          \"name\": \"lastConnectedAt\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"lastChangedPasswordAt\": {\n          \"name\": \"lastChangedPasswordAt\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"two_factor_enabled\": {\n          \"name\": \"two_factor_enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"user_email_unique\": {\n          \"name\": \"user_email_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"email\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.verification\": {\n      \"name\": \"verification\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"identifier\": {\n          \"name\": \"identifier\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"value\": {\n          \"name\": \"value\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization\": {\n      \"name\": \"organization\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"logo\": {\n          \"name\": \"logo\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"metadata\": {\n          \"name\": \"metadata\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_slug_unique\": {\n          \"name\": \"organization_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.member\": {\n      \"name\": \"member\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"member_organization_id_organization_id_fk\": {\n          \"name\": \"member_organization_id_organization_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"member_user_id_user_id_fk\": {\n          \"name\": \"member_user_id_user_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.invitation\": {\n      \"name\": \"invitation\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"inviter_id\": {\n          \"name\": \"inviter_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"invitation_organization_id_organization_id_fk\": {\n          \"name\": \"invitation_organization_id_organization_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"invitation_inviter_id_user_id_fk\": {\n          \"name\": \"invitation_inviter_id_user_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"inviter_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.projects\": {\n      \"name\": \"projects\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"projects_organization_id_organization_id_fk\": {\n          \"name\": \"projects_organization_id_organization_id_fk\",\n          \"tableFrom\": \"projects\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"projects_slug_unique\": {\n          \"name\": \"projects_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backups\": {\n      \"name\": \"backups\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"file\": {\n          \"name\": \"file\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"file_size\": {\n          \"name\": \"file_size\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"imported\": {\n          \"name\": \"imported\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backups_database_id_databases_id_fk\": {\n          \"name\": \"backups_database_id_databases_id_fk\",\n          \"tableFrom\": \"backups\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.databases\": {\n      \"name\": \"databases\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"agent_database_id\": {\n          \"name\": \"agent_database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"dbms\": {\n          \"name\": \"dbms\",\n          \"type\": \"dbms_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_policy\": {\n          \"name\": \"backup_policy\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"is_waiting_for_backup\": {\n          \"name\": \"is_waiting_for_backup\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"backup_to_restore\": {\n          \"name\": \"backup_to_restore\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"agent_id\": {\n          \"name\": \"agent_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"project_id\": {\n          \"name\": \"project_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"databases_agent_id_agents_id_fk\": {\n          \"name\": \"databases_agent_id_agents_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"agents\",\n          \"columnsFrom\": [\n            \"agent_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"databases_project_id_projects_id_fk\": {\n          \"name\": \"databases_project_id_projects_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"projects\",\n          \"columnsFrom\": [\n            \"project_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"no action\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.restorations\": {\n      \"name\": \"restorations\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"backup_storage_id\": {\n          \"name\": \"backup_storage_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"restorations_backup_storage_id_backup_storage_id_fk\": {\n          \"name\": \"restorations_backup_storage_id_backup_storage_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backup_storage\",\n          \"columnsFrom\": [\n            \"backup_storage_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_backup_id_backups_id_fk\": {\n          \"name\": \"restorations_backup_id_backups_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_database_id_databases_id_fk\": {\n          \"name\": \"restorations_database_id_databases_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.retention_policies\": {\n      \"name\": \"retention_policies\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"type\": {\n          \"name\": \"type\",\n          \"type\": \"retention_policy_type\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"count\": {\n          \"name\": \"count\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"days\": {\n          \"name\": \"days\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 30\n        },\n        \"gfs_daily\": {\n          \"name\": \"gfs_daily\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"gfs_weekly\": {\n          \"name\": \"gfs_weekly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 4\n        },\n        \"gfs_monthly\": {\n          \"name\": \"gfs_monthly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 12\n        },\n        \"gfs_yearly\": {\n          \"name\": \"gfs_yearly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 3\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"retention_policies_database_id_databases_id_fk\": {\n          \"name\": \"retention_policies_database_id_databases_id_fk\",\n          \"tableFrom\": \"retention_policies\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.agents\": {\n      \"name\": \"agents\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"version\": {\n          \"name\": \"version\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"health_error_count\": {\n          \"name\": \"health_error_count\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"agents_slug_unique\": {\n          \"name\": \"agents_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_channel\": {\n      \"name\": \"notification_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"notification_channel_organization_id_organization_id_fk\": {\n          \"name\": \"notification_channel_organization_id_organization_id_fk\",\n          \"tableFrom\": \"notification_channel\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_notification_channels\": {\n      \"name\": \"organization_notification_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_notification_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_notification_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_notification_channels_organization_id_notification_channel_id_unique\": {\n          \"name\": \"organization_notification_channels_organization_id_notification_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"notification_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.alert_policy\": {\n      \"name\": \"alert_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"event_kind\": {\n          \"name\": \"event_kind\",\n          \"type\": \"event_kind[]\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"alert_policy_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"alert_policy_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"alert_policy_database_id_databases_id_fk\": {\n          \"name\": \"alert_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_log\": {\n      \"name\": \"notification_log\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"channel_id\": {\n          \"name\": \"channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"policy_id\": {\n          \"name\": \"policy_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"event\": {\n          \"name\": \"event\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_name\": {\n          \"name\": \"provider_name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"title\": {\n          \"name\": \"title\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"message\": {\n          \"name\": \"message\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"level\": {\n          \"name\": \"level\",\n          \"type\": \"level\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"payload\": {\n          \"name\": \"payload\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"success\": {\n          \"name\": \"success\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"error\": {\n          \"name\": \"error\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider_response\": {\n          \"name\": \"provider_response\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"sent_at\": {\n          \"name\": \"sent_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_storage_channels\": {\n      \"name\": \"organization_storage_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_storage_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_storage_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_storage_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_storage_channels_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"organization_storage_channels_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"organization_storage_channels\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_storage_channels_organization_id_storage_channel_id_unique\": {\n          \"name\": \"organization_storage_channels_organization_id_storage_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"storage_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.storage_channel\": {\n      \"name\": \"storage_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_storage_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"storage_channel_organization_id_organization_id_fk\": {\n          \"name\": \"storage_channel_organization_id_organization_id_fk\",\n          \"tableFrom\": \"storage_channel\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.storage_policy\": {\n      \"name\": \"storage_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"storage_policy_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"storage_policy_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"storage_policy\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"storage_policy_database_id_databases_id_fk\": {\n          \"name\": \"storage_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"storage_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backup_storage\": {\n      \"name\": \"backup_storage\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"backup_storage_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'pending'\"\n        },\n        \"path\": {\n          \"name\": \"path\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"size\": {\n          \"name\": \"size\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"checksum\": {\n          \"name\": \"checksum\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backup_storage_backup_id_backups_id_fk\": {\n          \"name\": \"backup_storage_backup_id_backups_id_fk\",\n          \"tableFrom\": \"backup_storage\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"backup_storage_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"backup_storage_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"backup_storage\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.healthcheck_log\": {\n      \"name\": \"healthcheck_log\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"kind\": {\n          \"name\": \"kind\",\n          \"type\": \"healthcheck_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"date\": {\n          \"name\": \"date\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"healthcheck_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"object_id\": {\n          \"name\": \"object_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    }\n  },\n  \"enums\": {\n    \"public.user_themes\": {\n      \"name\": \"user_themes\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"light\",\n        \"dark\",\n        \"system\"\n      ]\n    },\n    \"public.retention_policy_type\": {\n      \"name\": \"retention_policy_type\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"count\",\n        \"days\",\n        \"gfs\"\n      ]\n    },\n    \"public.provider_kind\": {\n      \"name\": \"provider_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"slack\",\n        \"smtp\",\n        \"discord\",\n        \"telegram\",\n        \"gotify\",\n        \"ntfy\",\n        \"webhook\"\n      ]\n    },\n    \"public.event_kind\": {\n      \"name\": \"event_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"error_backup\",\n        \"error_restore\",\n        \"success_restore\",\n        \"success_backup\",\n        \"weekly_report\",\n        \"error_health_agent\",\n        \"error_health_database\"\n      ]\n    },\n    \"public.level\": {\n      \"name\": \"level\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"critical\",\n        \"warning\",\n        \"info\"\n      ]\n    },\n    \"public.provider_storage_kind\": {\n      \"name\": \"provider_storage_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\",\n        \"google-drive\"\n      ]\n    },\n    \"public.backup_storage_status\": {\n      \"name\": \"backup_storage_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"pending\",\n        \"success\",\n        \"failed\"\n      ]\n    },\n    \"public.healthcheck_status\": {\n      \"name\": \"healthcheck_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"success\",\n        \"failed\"\n      ]\n    },\n    \"public.healthcheck_kind\": {\n      \"name\": \"healthcheck_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"database\",\n        \"agent\"\n      ]\n    },\n    \"public.dbms_status\": {\n      \"name\": \"dbms_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"postgresql\",\n        \"mysql\",\n        \"mongodb\",\n        \"sqlite\",\n        \"redis\",\n        \"valkey\"\n      ]\n    },\n    \"public.status\": {\n      \"name\": \"status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"waiting\",\n        \"ongoing\",\n        \"failed\",\n        \"success\"\n      ]\n    },\n    \"public.type_storage\": {\n      \"name\": \"type_storage\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\"\n      ]\n    }\n  },\n  \"schemas\": {},\n  \"sequences\": {},\n  \"roles\": {},\n  \"policies\": {},\n  \"views\": {},\n  \"_meta\": {\n    \"columns\": {},\n    \"schemas\": {},\n    \"tables\": {}\n  }\n}"
  },
  {
    "path": "src/db/migrations/meta/0046_snapshot.json",
    "content": "{\n  \"id\": \"55f92cdf-a328-485d-a299-447119a7bca4\",\n  \"prevId\": \"af696e5b-ae80-4231-aa26-9e9f4c4c43d6\",\n  \"version\": \"7\",\n  \"dialect\": \"postgresql\",\n  \"tables\": {\n    \"public.settings\": {\n      \"name\": \"settings\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"smtp_password\": {\n          \"name\": \"smtp_password\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_from\": {\n          \"name\": \"smtp_from\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_host\": {\n          \"name\": \"smtp_host\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_port\": {\n          \"name\": \"smtp_port\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_user\": {\n          \"name\": \"smtp_user\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_secure\": {\n          \"name\": \"smtp_secure\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"default_notification_channel_id\": {\n          \"name\": \"default_notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"default_storage_channel_id\": {\n          \"name\": \"default_storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"encryption\": {\n          \"name\": \"encryption\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"settings_default_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"settings_default_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"settings\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"default_notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"set null\",\n          \"onUpdate\": \"no action\"\n        },\n        \"settings_default_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"settings_default_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"settings\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"default_storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"set null\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"settings_name_unique\": {\n          \"name\": \"settings_name_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"name\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.account\": {\n      \"name\": \"account\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"account_id\": {\n          \"name\": \"account_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"access_token\": {\n          \"name\": \"access_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token\": {\n          \"name\": \"refresh_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"id_token\": {\n          \"name\": \"id_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"access_token_expires_at\": {\n          \"name\": \"access_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token_expires_at\": {\n          \"name\": \"refresh_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"scope\": {\n          \"name\": \"scope\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"password\": {\n          \"name\": \"password\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"account_user_id_user_id_fk\": {\n          \"name\": \"account_user_id_user_id_fk\",\n          \"tableFrom\": \"account\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.passkey\": {\n      \"name\": \"passkey\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"publicKey\": {\n          \"name\": \"publicKey\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"credentialID\": {\n          \"name\": \"credentialID\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"counter\": {\n          \"name\": \"counter\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"deviceType\": {\n          \"name\": \"deviceType\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backedUp\": {\n          \"name\": \"backedUp\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"transports\": {\n          \"name\": \"transports\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"aaguid\": {\n          \"name\": \"aaguid\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"passkey_user_id_user_id_fk\": {\n          \"name\": \"passkey_user_id_user_id_fk\",\n          \"tableFrom\": \"passkey\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.session\": {\n      \"name\": \"session\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"token\": {\n          \"name\": \"token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"ip_address\": {\n          \"name\": \"ip_address\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_agent\": {\n          \"name\": \"user_agent\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"impersonated_by\": {\n          \"name\": \"impersonated_by\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"active_organization_id\": {\n          \"name\": \"active_organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"session_user_id_user_id_fk\": {\n          \"name\": \"session_user_id_user_id_fk\",\n          \"tableFrom\": \"session\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"session_token_unique\": {\n          \"name\": \"session_token_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"token\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.sso_provider\": {\n      \"name\": \"sso_provider\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"issuer\": {\n          \"name\": \"issuer\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"oidc_config\": {\n          \"name\": \"oidc_config\",\n          \"type\": \"json\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"saml_config\": {\n          \"name\": \"saml_config\",\n          \"type\": \"json\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"domain\": {\n          \"name\": \"domain\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"sso_provider_user_id_user_id_fk\": {\n          \"name\": \"sso_provider_user_id_user_id_fk\",\n          \"tableFrom\": \"sso_provider\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"sso_provider_provider_id_unique\": {\n          \"name\": \"sso_provider_provider_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"provider_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.two_factor\": {\n      \"name\": \"two_factor\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"secret\": {\n          \"name\": \"secret\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backup_codes\": {\n          \"name\": \"backup_codes\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"two_factor_user_id_user_id_fk\": {\n          \"name\": \"two_factor_user_id_user_id_fk\",\n          \"tableFrom\": \"two_factor\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.user\": {\n      \"name\": \"user\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email_verified\": {\n          \"name\": \"email_verified\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"image\": {\n          \"name\": \"image\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"theme\": {\n          \"name\": \"theme\",\n          \"type\": \"user_themes\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'light'\"\n        },\n        \"banned\": {\n          \"name\": \"banned\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_reason\": {\n          \"name\": \"ban_reason\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_expires\": {\n          \"name\": \"ban_expires\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"lastConnectedAt\": {\n          \"name\": \"lastConnectedAt\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"lastChangedPasswordAt\": {\n          \"name\": \"lastChangedPasswordAt\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"two_factor_enabled\": {\n          \"name\": \"two_factor_enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"user_email_unique\": {\n          \"name\": \"user_email_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"email\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.verification\": {\n      \"name\": \"verification\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"identifier\": {\n          \"name\": \"identifier\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"value\": {\n          \"name\": \"value\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization\": {\n      \"name\": \"organization\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"logo\": {\n          \"name\": \"logo\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"metadata\": {\n          \"name\": \"metadata\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_slug_unique\": {\n          \"name\": \"organization_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.member\": {\n      \"name\": \"member\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"member_organization_id_organization_id_fk\": {\n          \"name\": \"member_organization_id_organization_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"member_user_id_user_id_fk\": {\n          \"name\": \"member_user_id_user_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.invitation\": {\n      \"name\": \"invitation\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"inviter_id\": {\n          \"name\": \"inviter_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"invitation_organization_id_organization_id_fk\": {\n          \"name\": \"invitation_organization_id_organization_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"invitation_inviter_id_user_id_fk\": {\n          \"name\": \"invitation_inviter_id_user_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"inviter_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.projects\": {\n      \"name\": \"projects\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"projects_organization_id_organization_id_fk\": {\n          \"name\": \"projects_organization_id_organization_id_fk\",\n          \"tableFrom\": \"projects\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"projects_slug_unique\": {\n          \"name\": \"projects_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backups\": {\n      \"name\": \"backups\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"file\": {\n          \"name\": \"file\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"file_size\": {\n          \"name\": \"file_size\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"imported\": {\n          \"name\": \"imported\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backups_database_id_databases_id_fk\": {\n          \"name\": \"backups_database_id_databases_id_fk\",\n          \"tableFrom\": \"backups\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.databases\": {\n      \"name\": \"databases\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"agent_database_id\": {\n          \"name\": \"agent_database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"dbms\": {\n          \"name\": \"dbms\",\n          \"type\": \"dbms_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_policy\": {\n          \"name\": \"backup_policy\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"is_waiting_for_backup\": {\n          \"name\": \"is_waiting_for_backup\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"backup_to_restore\": {\n          \"name\": \"backup_to_restore\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"health_error_count\": {\n          \"name\": \"health_error_count\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"agent_id\": {\n          \"name\": \"agent_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"project_id\": {\n          \"name\": \"project_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"databases_agent_id_agents_id_fk\": {\n          \"name\": \"databases_agent_id_agents_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"agents\",\n          \"columnsFrom\": [\n            \"agent_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"databases_project_id_projects_id_fk\": {\n          \"name\": \"databases_project_id_projects_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"projects\",\n          \"columnsFrom\": [\n            \"project_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"no action\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.restorations\": {\n      \"name\": \"restorations\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"backup_storage_id\": {\n          \"name\": \"backup_storage_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"restorations_backup_storage_id_backup_storage_id_fk\": {\n          \"name\": \"restorations_backup_storage_id_backup_storage_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backup_storage\",\n          \"columnsFrom\": [\n            \"backup_storage_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_backup_id_backups_id_fk\": {\n          \"name\": \"restorations_backup_id_backups_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_database_id_databases_id_fk\": {\n          \"name\": \"restorations_database_id_databases_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.retention_policies\": {\n      \"name\": \"retention_policies\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"type\": {\n          \"name\": \"type\",\n          \"type\": \"retention_policy_type\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"count\": {\n          \"name\": \"count\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"days\": {\n          \"name\": \"days\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 30\n        },\n        \"gfs_daily\": {\n          \"name\": \"gfs_daily\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"gfs_weekly\": {\n          \"name\": \"gfs_weekly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 4\n        },\n        \"gfs_monthly\": {\n          \"name\": \"gfs_monthly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 12\n        },\n        \"gfs_yearly\": {\n          \"name\": \"gfs_yearly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 3\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"retention_policies_database_id_databases_id_fk\": {\n          \"name\": \"retention_policies_database_id_databases_id_fk\",\n          \"tableFrom\": \"retention_policies\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.agents\": {\n      \"name\": \"agents\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"version\": {\n          \"name\": \"version\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"health_error_count\": {\n          \"name\": \"health_error_count\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"agents_slug_unique\": {\n          \"name\": \"agents_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_channel\": {\n      \"name\": \"notification_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"notification_channel_organization_id_organization_id_fk\": {\n          \"name\": \"notification_channel_organization_id_organization_id_fk\",\n          \"tableFrom\": \"notification_channel\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_notification_channels\": {\n      \"name\": \"organization_notification_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_notification_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_notification_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_notification_channels_organization_id_notification_channel_id_unique\": {\n          \"name\": \"organization_notification_channels_organization_id_notification_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"notification_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.alert_policy\": {\n      \"name\": \"alert_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"event_kind\": {\n          \"name\": \"event_kind\",\n          \"type\": \"event_kind[]\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"alert_policy_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"alert_policy_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"alert_policy_database_id_databases_id_fk\": {\n          \"name\": \"alert_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_log\": {\n      \"name\": \"notification_log\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"channel_id\": {\n          \"name\": \"channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"policy_id\": {\n          \"name\": \"policy_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"event\": {\n          \"name\": \"event\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_name\": {\n          \"name\": \"provider_name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"title\": {\n          \"name\": \"title\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"message\": {\n          \"name\": \"message\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"level\": {\n          \"name\": \"level\",\n          \"type\": \"level\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"payload\": {\n          \"name\": \"payload\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"success\": {\n          \"name\": \"success\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"error\": {\n          \"name\": \"error\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider_response\": {\n          \"name\": \"provider_response\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"sent_at\": {\n          \"name\": \"sent_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_storage_channels\": {\n      \"name\": \"organization_storage_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_storage_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_storage_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_storage_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_storage_channels_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"organization_storage_channels_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"organization_storage_channels\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_storage_channels_organization_id_storage_channel_id_unique\": {\n          \"name\": \"organization_storage_channels_organization_id_storage_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"storage_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.storage_channel\": {\n      \"name\": \"storage_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_storage_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"storage_channel_organization_id_organization_id_fk\": {\n          \"name\": \"storage_channel_organization_id_organization_id_fk\",\n          \"tableFrom\": \"storage_channel\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.storage_policy\": {\n      \"name\": \"storage_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"storage_policy_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"storage_policy_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"storage_policy\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"storage_policy_database_id_databases_id_fk\": {\n          \"name\": \"storage_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"storage_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backup_storage\": {\n      \"name\": \"backup_storage\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"backup_storage_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'pending'\"\n        },\n        \"path\": {\n          \"name\": \"path\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"size\": {\n          \"name\": \"size\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"checksum\": {\n          \"name\": \"checksum\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backup_storage_backup_id_backups_id_fk\": {\n          \"name\": \"backup_storage_backup_id_backups_id_fk\",\n          \"tableFrom\": \"backup_storage\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"backup_storage_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"backup_storage_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"backup_storage\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.healthcheck_log\": {\n      \"name\": \"healthcheck_log\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"kind\": {\n          \"name\": \"kind\",\n          \"type\": \"healthcheck_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"date\": {\n          \"name\": \"date\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"healthcheck_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"object_id\": {\n          \"name\": \"object_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    }\n  },\n  \"enums\": {\n    \"public.user_themes\": {\n      \"name\": \"user_themes\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"light\",\n        \"dark\",\n        \"system\"\n      ]\n    },\n    \"public.retention_policy_type\": {\n      \"name\": \"retention_policy_type\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"count\",\n        \"days\",\n        \"gfs\"\n      ]\n    },\n    \"public.provider_kind\": {\n      \"name\": \"provider_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"slack\",\n        \"smtp\",\n        \"discord\",\n        \"telegram\",\n        \"gotify\",\n        \"ntfy\",\n        \"webhook\"\n      ]\n    },\n    \"public.event_kind\": {\n      \"name\": \"event_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"error_backup\",\n        \"error_restore\",\n        \"success_restore\",\n        \"success_backup\",\n        \"weekly_report\",\n        \"error_health_agent\",\n        \"error_health_database\"\n      ]\n    },\n    \"public.level\": {\n      \"name\": \"level\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"critical\",\n        \"warning\",\n        \"info\"\n      ]\n    },\n    \"public.provider_storage_kind\": {\n      \"name\": \"provider_storage_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\",\n        \"google-drive\"\n      ]\n    },\n    \"public.backup_storage_status\": {\n      \"name\": \"backup_storage_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"pending\",\n        \"success\",\n        \"failed\"\n      ]\n    },\n    \"public.healthcheck_status\": {\n      \"name\": \"healthcheck_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"success\",\n        \"failed\"\n      ]\n    },\n    \"public.healthcheck_kind\": {\n      \"name\": \"healthcheck_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"database\",\n        \"agent\"\n      ]\n    },\n    \"public.dbms_status\": {\n      \"name\": \"dbms_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"postgresql\",\n        \"mysql\",\n        \"mongodb\",\n        \"sqlite\",\n        \"redis\",\n        \"valkey\"\n      ]\n    },\n    \"public.status\": {\n      \"name\": \"status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"waiting\",\n        \"ongoing\",\n        \"failed\",\n        \"success\"\n      ]\n    },\n    \"public.type_storage\": {\n      \"name\": \"type_storage\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\"\n      ]\n    }\n  },\n  \"schemas\": {},\n  \"sequences\": {},\n  \"roles\": {},\n  \"policies\": {},\n  \"views\": {},\n  \"_meta\": {\n    \"columns\": {},\n    \"schemas\": {},\n    \"tables\": {}\n  }\n}"
  },
  {
    "path": "src/db/migrations/meta/0047_snapshot.json",
    "content": "{\n  \"id\": \"57c11afe-bc47-46be-9e76-84f150a07aa3\",\n  \"prevId\": \"55f92cdf-a328-485d-a299-447119a7bca4\",\n  \"version\": \"7\",\n  \"dialect\": \"postgresql\",\n  \"tables\": {\n    \"public.settings\": {\n      \"name\": \"settings\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"smtp_password\": {\n          \"name\": \"smtp_password\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_from\": {\n          \"name\": \"smtp_from\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_host\": {\n          \"name\": \"smtp_host\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_port\": {\n          \"name\": \"smtp_port\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_user\": {\n          \"name\": \"smtp_user\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_secure\": {\n          \"name\": \"smtp_secure\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"default_notification_channel_id\": {\n          \"name\": \"default_notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"default_storage_channel_id\": {\n          \"name\": \"default_storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"encryption\": {\n          \"name\": \"encryption\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"settings_default_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"settings_default_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"settings\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"default_notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"set null\",\n          \"onUpdate\": \"no action\"\n        },\n        \"settings_default_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"settings_default_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"settings\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"default_storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"set null\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"settings_name_unique\": {\n          \"name\": \"settings_name_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"name\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.account\": {\n      \"name\": \"account\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"account_id\": {\n          \"name\": \"account_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"access_token\": {\n          \"name\": \"access_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token\": {\n          \"name\": \"refresh_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"id_token\": {\n          \"name\": \"id_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"access_token_expires_at\": {\n          \"name\": \"access_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token_expires_at\": {\n          \"name\": \"refresh_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"scope\": {\n          \"name\": \"scope\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"password\": {\n          \"name\": \"password\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"account_user_id_user_id_fk\": {\n          \"name\": \"account_user_id_user_id_fk\",\n          \"tableFrom\": \"account\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.passkey\": {\n      \"name\": \"passkey\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"publicKey\": {\n          \"name\": \"publicKey\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"credentialID\": {\n          \"name\": \"credentialID\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"counter\": {\n          \"name\": \"counter\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"deviceType\": {\n          \"name\": \"deviceType\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backedUp\": {\n          \"name\": \"backedUp\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"transports\": {\n          \"name\": \"transports\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"aaguid\": {\n          \"name\": \"aaguid\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"passkey_user_id_user_id_fk\": {\n          \"name\": \"passkey_user_id_user_id_fk\",\n          \"tableFrom\": \"passkey\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.session\": {\n      \"name\": \"session\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"token\": {\n          \"name\": \"token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"ip_address\": {\n          \"name\": \"ip_address\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_agent\": {\n          \"name\": \"user_agent\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"impersonated_by\": {\n          \"name\": \"impersonated_by\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"active_organization_id\": {\n          \"name\": \"active_organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"session_user_id_user_id_fk\": {\n          \"name\": \"session_user_id_user_id_fk\",\n          \"tableFrom\": \"session\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"session_token_unique\": {\n          \"name\": \"session_token_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"token\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.sso_provider\": {\n      \"name\": \"sso_provider\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"issuer\": {\n          \"name\": \"issuer\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"oidc_config\": {\n          \"name\": \"oidc_config\",\n          \"type\": \"json\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"saml_config\": {\n          \"name\": \"saml_config\",\n          \"type\": \"json\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"domain\": {\n          \"name\": \"domain\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"sso_provider_user_id_user_id_fk\": {\n          \"name\": \"sso_provider_user_id_user_id_fk\",\n          \"tableFrom\": \"sso_provider\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"sso_provider_provider_id_unique\": {\n          \"name\": \"sso_provider_provider_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"provider_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.two_factor\": {\n      \"name\": \"two_factor\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"secret\": {\n          \"name\": \"secret\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backup_codes\": {\n          \"name\": \"backup_codes\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"two_factor_user_id_user_id_fk\": {\n          \"name\": \"two_factor_user_id_user_id_fk\",\n          \"tableFrom\": \"two_factor\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.user\": {\n      \"name\": \"user\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email_verified\": {\n          \"name\": \"email_verified\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"image\": {\n          \"name\": \"image\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"theme\": {\n          \"name\": \"theme\",\n          \"type\": \"user_themes\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'light'\"\n        },\n        \"banned\": {\n          \"name\": \"banned\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_reason\": {\n          \"name\": \"ban_reason\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_expires\": {\n          \"name\": \"ban_expires\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"lastConnectedAt\": {\n          \"name\": \"lastConnectedAt\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"lastChangedPasswordAt\": {\n          \"name\": \"lastChangedPasswordAt\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"two_factor_enabled\": {\n          \"name\": \"two_factor_enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"user_email_unique\": {\n          \"name\": \"user_email_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"email\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.verification\": {\n      \"name\": \"verification\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"identifier\": {\n          \"name\": \"identifier\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"value\": {\n          \"name\": \"value\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization\": {\n      \"name\": \"organization\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"logo\": {\n          \"name\": \"logo\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"metadata\": {\n          \"name\": \"metadata\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_slug_unique\": {\n          \"name\": \"organization_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.member\": {\n      \"name\": \"member\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"member_organization_id_organization_id_fk\": {\n          \"name\": \"member_organization_id_organization_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"member_user_id_user_id_fk\": {\n          \"name\": \"member_user_id_user_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.invitation\": {\n      \"name\": \"invitation\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"inviter_id\": {\n          \"name\": \"inviter_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"invitation_organization_id_organization_id_fk\": {\n          \"name\": \"invitation_organization_id_organization_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"invitation_inviter_id_user_id_fk\": {\n          \"name\": \"invitation_inviter_id_user_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"inviter_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.projects\": {\n      \"name\": \"projects\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"projects_organization_id_organization_id_fk\": {\n          \"name\": \"projects_organization_id_organization_id_fk\",\n          \"tableFrom\": \"projects\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"projects_slug_unique\": {\n          \"name\": \"projects_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backups\": {\n      \"name\": \"backups\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"file\": {\n          \"name\": \"file\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"file_size\": {\n          \"name\": \"file_size\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"imported\": {\n          \"name\": \"imported\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backups_database_id_databases_id_fk\": {\n          \"name\": \"backups_database_id_databases_id_fk\",\n          \"tableFrom\": \"backups\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.databases\": {\n      \"name\": \"databases\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"agent_database_id\": {\n          \"name\": \"agent_database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"dbms\": {\n          \"name\": \"dbms\",\n          \"type\": \"dbms_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_policy\": {\n          \"name\": \"backup_policy\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"is_waiting_for_backup\": {\n          \"name\": \"is_waiting_for_backup\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"backup_to_restore\": {\n          \"name\": \"backup_to_restore\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"health_error_count\": {\n          \"name\": \"health_error_count\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"agent_id\": {\n          \"name\": \"agent_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"project_id\": {\n          \"name\": \"project_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"databases_agent_id_agents_id_fk\": {\n          \"name\": \"databases_agent_id_agents_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"agents\",\n          \"columnsFrom\": [\n            \"agent_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"databases_project_id_projects_id_fk\": {\n          \"name\": \"databases_project_id_projects_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"projects\",\n          \"columnsFrom\": [\n            \"project_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"no action\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.restorations\": {\n      \"name\": \"restorations\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"backup_storage_id\": {\n          \"name\": \"backup_storage_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"restorations_backup_storage_id_backup_storage_id_fk\": {\n          \"name\": \"restorations_backup_storage_id_backup_storage_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backup_storage\",\n          \"columnsFrom\": [\n            \"backup_storage_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_backup_id_backups_id_fk\": {\n          \"name\": \"restorations_backup_id_backups_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_database_id_databases_id_fk\": {\n          \"name\": \"restorations_database_id_databases_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.retention_policies\": {\n      \"name\": \"retention_policies\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"type\": {\n          \"name\": \"type\",\n          \"type\": \"retention_policy_type\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"count\": {\n          \"name\": \"count\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"days\": {\n          \"name\": \"days\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 30\n        },\n        \"gfs_daily\": {\n          \"name\": \"gfs_daily\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"gfs_weekly\": {\n          \"name\": \"gfs_weekly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 4\n        },\n        \"gfs_monthly\": {\n          \"name\": \"gfs_monthly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 12\n        },\n        \"gfs_yearly\": {\n          \"name\": \"gfs_yearly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 3\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"retention_policies_database_id_databases_id_fk\": {\n          \"name\": \"retention_policies_database_id_databases_id_fk\",\n          \"tableFrom\": \"retention_policies\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.agents\": {\n      \"name\": \"agents\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"version\": {\n          \"name\": \"version\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"health_error_count\": {\n          \"name\": \"health_error_count\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"agents_slug_unique\": {\n          \"name\": \"agents_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_channel\": {\n      \"name\": \"notification_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"notification_channel_organization_id_organization_id_fk\": {\n          \"name\": \"notification_channel_organization_id_organization_id_fk\",\n          \"tableFrom\": \"notification_channel\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_notification_channels\": {\n      \"name\": \"organization_notification_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_notification_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_notification_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_notification_channels_organization_id_notification_channel_id_unique\": {\n          \"name\": \"organization_notification_channels_organization_id_notification_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"notification_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.alert_policy\": {\n      \"name\": \"alert_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"event_kind\": {\n          \"name\": \"event_kind\",\n          \"type\": \"event_kind[]\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"alert_policy_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"alert_policy_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"alert_policy_database_id_databases_id_fk\": {\n          \"name\": \"alert_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_log\": {\n      \"name\": \"notification_log\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"channel_id\": {\n          \"name\": \"channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"policy_id\": {\n          \"name\": \"policy_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"event\": {\n          \"name\": \"event\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_name\": {\n          \"name\": \"provider_name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"title\": {\n          \"name\": \"title\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"message\": {\n          \"name\": \"message\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"level\": {\n          \"name\": \"level\",\n          \"type\": \"level\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"payload\": {\n          \"name\": \"payload\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"success\": {\n          \"name\": \"success\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"error\": {\n          \"name\": \"error\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider_response\": {\n          \"name\": \"provider_response\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"sent_at\": {\n          \"name\": \"sent_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_storage_channels\": {\n      \"name\": \"organization_storage_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_storage_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_storage_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_storage_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_storage_channels_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"organization_storage_channels_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"organization_storage_channels\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_storage_channels_organization_id_storage_channel_id_unique\": {\n          \"name\": \"organization_storage_channels_organization_id_storage_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"storage_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.storage_channel\": {\n      \"name\": \"storage_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_storage_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"storage_channel_organization_id_organization_id_fk\": {\n          \"name\": \"storage_channel_organization_id_organization_id_fk\",\n          \"tableFrom\": \"storage_channel\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.storage_policy\": {\n      \"name\": \"storage_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"storage_policy_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"storage_policy_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"storage_policy\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"storage_policy_database_id_databases_id_fk\": {\n          \"name\": \"storage_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"storage_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backup_storage\": {\n      \"name\": \"backup_storage\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"backup_storage_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'pending'\"\n        },\n        \"path\": {\n          \"name\": \"path\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"size\": {\n          \"name\": \"size\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"checksum\": {\n          \"name\": \"checksum\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backup_storage_backup_id_backups_id_fk\": {\n          \"name\": \"backup_storage_backup_id_backups_id_fk\",\n          \"tableFrom\": \"backup_storage\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"backup_storage_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"backup_storage_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"backup_storage\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.healthcheck_log\": {\n      \"name\": \"healthcheck_log\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"kind\": {\n          \"name\": \"kind\",\n          \"type\": \"healthcheck_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"date\": {\n          \"name\": \"date\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"healthcheck_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"object_id\": {\n          \"name\": \"object_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    }\n  },\n  \"enums\": {\n    \"public.user_themes\": {\n      \"name\": \"user_themes\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"light\",\n        \"dark\",\n        \"system\"\n      ]\n    },\n    \"public.retention_policy_type\": {\n      \"name\": \"retention_policy_type\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"count\",\n        \"days\",\n        \"gfs\"\n      ]\n    },\n    \"public.provider_kind\": {\n      \"name\": \"provider_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"slack\",\n        \"smtp\",\n        \"discord\",\n        \"telegram\",\n        \"gotify\",\n        \"ntfy\",\n        \"webhook\"\n      ]\n    },\n    \"public.event_kind\": {\n      \"name\": \"event_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"error_backup\",\n        \"error_restore\",\n        \"success_restore\",\n        \"success_backup\",\n        \"weekly_report\",\n        \"error_health_agent\",\n        \"error_health_database\"\n      ]\n    },\n    \"public.level\": {\n      \"name\": \"level\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"critical\",\n        \"warning\",\n        \"info\"\n      ]\n    },\n    \"public.provider_storage_kind\": {\n      \"name\": \"provider_storage_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\",\n        \"google-drive\"\n      ]\n    },\n    \"public.backup_storage_status\": {\n      \"name\": \"backup_storage_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"pending\",\n        \"success\",\n        \"failed\"\n      ]\n    },\n    \"public.healthcheck_status\": {\n      \"name\": \"healthcheck_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"success\",\n        \"failed\"\n      ]\n    },\n    \"public.healthcheck_kind\": {\n      \"name\": \"healthcheck_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"database\",\n        \"agent\"\n      ]\n    },\n    \"public.dbms_status\": {\n      \"name\": \"dbms_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"postgresql\",\n        \"mysql\",\n        \"mariadb\",\n        \"mongodb\",\n        \"sqlite\",\n        \"redis\",\n        \"valkey\"\n      ]\n    },\n    \"public.status\": {\n      \"name\": \"status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"waiting\",\n        \"ongoing\",\n        \"failed\",\n        \"success\"\n      ]\n    },\n    \"public.type_storage\": {\n      \"name\": \"type_storage\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\"\n      ]\n    }\n  },\n  \"schemas\": {},\n  \"sequences\": {},\n  \"roles\": {},\n  \"policies\": {},\n  \"views\": {},\n  \"_meta\": {\n    \"columns\": {},\n    \"schemas\": {},\n    \"tables\": {}\n  }\n}"
  },
  {
    "path": "src/db/migrations/meta/0048_snapshot.json",
    "content": "{\n  \"id\": \"065ff89b-19b1-4932-8cdb-1ea0e3faf177\",\n  \"prevId\": \"57c11afe-bc47-46be-9e76-84f150a07aa3\",\n  \"version\": \"7\",\n  \"dialect\": \"postgresql\",\n  \"tables\": {\n    \"public.settings\": {\n      \"name\": \"settings\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"smtp_password\": {\n          \"name\": \"smtp_password\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_from\": {\n          \"name\": \"smtp_from\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_host\": {\n          \"name\": \"smtp_host\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_port\": {\n          \"name\": \"smtp_port\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_user\": {\n          \"name\": \"smtp_user\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_secure\": {\n          \"name\": \"smtp_secure\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"default_notification_channel_id\": {\n          \"name\": \"default_notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"default_storage_channel_id\": {\n          \"name\": \"default_storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"encryption\": {\n          \"name\": \"encryption\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"settings_default_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"settings_default_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"settings\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"default_notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"set null\",\n          \"onUpdate\": \"no action\"\n        },\n        \"settings_default_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"settings_default_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"settings\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"default_storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"set null\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"settings_name_unique\": {\n          \"name\": \"settings_name_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"name\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.account\": {\n      \"name\": \"account\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"account_id\": {\n          \"name\": \"account_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"access_token\": {\n          \"name\": \"access_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token\": {\n          \"name\": \"refresh_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"id_token\": {\n          \"name\": \"id_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"access_token_expires_at\": {\n          \"name\": \"access_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token_expires_at\": {\n          \"name\": \"refresh_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"scope\": {\n          \"name\": \"scope\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"password\": {\n          \"name\": \"password\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"account_user_id_user_id_fk\": {\n          \"name\": \"account_user_id_user_id_fk\",\n          \"tableFrom\": \"account\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.passkey\": {\n      \"name\": \"passkey\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"publicKey\": {\n          \"name\": \"publicKey\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"credentialID\": {\n          \"name\": \"credentialID\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"counter\": {\n          \"name\": \"counter\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"deviceType\": {\n          \"name\": \"deviceType\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backedUp\": {\n          \"name\": \"backedUp\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"transports\": {\n          \"name\": \"transports\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"aaguid\": {\n          \"name\": \"aaguid\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"passkey_user_id_user_id_fk\": {\n          \"name\": \"passkey_user_id_user_id_fk\",\n          \"tableFrom\": \"passkey\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.session\": {\n      \"name\": \"session\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"token\": {\n          \"name\": \"token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"ip_address\": {\n          \"name\": \"ip_address\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_agent\": {\n          \"name\": \"user_agent\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"impersonated_by\": {\n          \"name\": \"impersonated_by\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"active_organization_id\": {\n          \"name\": \"active_organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"session_user_id_user_id_fk\": {\n          \"name\": \"session_user_id_user_id_fk\",\n          \"tableFrom\": \"session\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"session_token_unique\": {\n          \"name\": \"session_token_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"token\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.sso_provider\": {\n      \"name\": \"sso_provider\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"issuer\": {\n          \"name\": \"issuer\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"oidc_config\": {\n          \"name\": \"oidc_config\",\n          \"type\": \"json\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"saml_config\": {\n          \"name\": \"saml_config\",\n          \"type\": \"json\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"domain\": {\n          \"name\": \"domain\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"sso_provider_user_id_user_id_fk\": {\n          \"name\": \"sso_provider_user_id_user_id_fk\",\n          \"tableFrom\": \"sso_provider\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"sso_provider_provider_id_unique\": {\n          \"name\": \"sso_provider_provider_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"provider_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.two_factor\": {\n      \"name\": \"two_factor\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"secret\": {\n          \"name\": \"secret\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backup_codes\": {\n          \"name\": \"backup_codes\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"two_factor_user_id_user_id_fk\": {\n          \"name\": \"two_factor_user_id_user_id_fk\",\n          \"tableFrom\": \"two_factor\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.user\": {\n      \"name\": \"user\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email_verified\": {\n          \"name\": \"email_verified\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"image\": {\n          \"name\": \"image\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"theme\": {\n          \"name\": \"theme\",\n          \"type\": \"user_themes\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'light'\"\n        },\n        \"banned\": {\n          \"name\": \"banned\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_reason\": {\n          \"name\": \"ban_reason\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_expires\": {\n          \"name\": \"ban_expires\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"lastConnectedAt\": {\n          \"name\": \"lastConnectedAt\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"lastChangedPasswordAt\": {\n          \"name\": \"lastChangedPasswordAt\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"two_factor_enabled\": {\n          \"name\": \"two_factor_enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"user_email_unique\": {\n          \"name\": \"user_email_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"email\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.verification\": {\n      \"name\": \"verification\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"identifier\": {\n          \"name\": \"identifier\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"value\": {\n          \"name\": \"value\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization\": {\n      \"name\": \"organization\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"logo\": {\n          \"name\": \"logo\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"metadata\": {\n          \"name\": \"metadata\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_slug_unique\": {\n          \"name\": \"organization_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.member\": {\n      \"name\": \"member\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"member_organization_id_organization_id_fk\": {\n          \"name\": \"member_organization_id_organization_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"member_user_id_user_id_fk\": {\n          \"name\": \"member_user_id_user_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.invitation\": {\n      \"name\": \"invitation\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"inviter_id\": {\n          \"name\": \"inviter_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"invitation_organization_id_organization_id_fk\": {\n          \"name\": \"invitation_organization_id_organization_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"invitation_inviter_id_user_id_fk\": {\n          \"name\": \"invitation_inviter_id_user_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"inviter_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.projects\": {\n      \"name\": \"projects\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"projects_organization_id_organization_id_fk\": {\n          \"name\": \"projects_organization_id_organization_id_fk\",\n          \"tableFrom\": \"projects\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"projects_slug_unique\": {\n          \"name\": \"projects_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backups\": {\n      \"name\": \"backups\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"file\": {\n          \"name\": \"file\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"file_size\": {\n          \"name\": \"file_size\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"imported\": {\n          \"name\": \"imported\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backups_database_id_databases_id_fk\": {\n          \"name\": \"backups_database_id_databases_id_fk\",\n          \"tableFrom\": \"backups\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.databases\": {\n      \"name\": \"databases\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"agent_database_id\": {\n          \"name\": \"agent_database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"dbms\": {\n          \"name\": \"dbms\",\n          \"type\": \"dbms_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_policy\": {\n          \"name\": \"backup_policy\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"is_waiting_for_backup\": {\n          \"name\": \"is_waiting_for_backup\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"backup_to_restore\": {\n          \"name\": \"backup_to_restore\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"health_error_count\": {\n          \"name\": \"health_error_count\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"agent_id\": {\n          \"name\": \"agent_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"project_id\": {\n          \"name\": \"project_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"databases_agent_id_agents_id_fk\": {\n          \"name\": \"databases_agent_id_agents_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"agents\",\n          \"columnsFrom\": [\n            \"agent_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"databases_project_id_projects_id_fk\": {\n          \"name\": \"databases_project_id_projects_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"projects\",\n          \"columnsFrom\": [\n            \"project_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"no action\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.restorations\": {\n      \"name\": \"restorations\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"backup_storage_id\": {\n          \"name\": \"backup_storage_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"restorations_backup_storage_id_backup_storage_id_fk\": {\n          \"name\": \"restorations_backup_storage_id_backup_storage_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backup_storage\",\n          \"columnsFrom\": [\n            \"backup_storage_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_backup_id_backups_id_fk\": {\n          \"name\": \"restorations_backup_id_backups_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_database_id_databases_id_fk\": {\n          \"name\": \"restorations_database_id_databases_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.retention_policies\": {\n      \"name\": \"retention_policies\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"type\": {\n          \"name\": \"type\",\n          \"type\": \"retention_policy_type\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"count\": {\n          \"name\": \"count\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"days\": {\n          \"name\": \"days\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 30\n        },\n        \"gfs_daily\": {\n          \"name\": \"gfs_daily\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"gfs_weekly\": {\n          \"name\": \"gfs_weekly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 4\n        },\n        \"gfs_monthly\": {\n          \"name\": \"gfs_monthly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 12\n        },\n        \"gfs_yearly\": {\n          \"name\": \"gfs_yearly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 3\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"retention_policies_database_id_databases_id_fk\": {\n          \"name\": \"retention_policies_database_id_databases_id_fk\",\n          \"tableFrom\": \"retention_policies\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.agents\": {\n      \"name\": \"agents\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"version\": {\n          \"name\": \"version\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"health_error_count\": {\n          \"name\": \"health_error_count\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"agents_slug_unique\": {\n          \"name\": \"agents_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_channel\": {\n      \"name\": \"notification_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"notification_channel_organization_id_organization_id_fk\": {\n          \"name\": \"notification_channel_organization_id_organization_id_fk\",\n          \"tableFrom\": \"notification_channel\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_notification_channels\": {\n      \"name\": \"organization_notification_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_notification_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_notification_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_notification_channels_organization_id_notification_channel_id_unique\": {\n          \"name\": \"organization_notification_channels_organization_id_notification_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"notification_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.alert_policy\": {\n      \"name\": \"alert_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"event_kind\": {\n          \"name\": \"event_kind\",\n          \"type\": \"event_kind[]\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"alert_policy_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"alert_policy_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"alert_policy_database_id_databases_id_fk\": {\n          \"name\": \"alert_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_log\": {\n      \"name\": \"notification_log\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"channel_id\": {\n          \"name\": \"channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"policy_id\": {\n          \"name\": \"policy_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"event\": {\n          \"name\": \"event\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_name\": {\n          \"name\": \"provider_name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"title\": {\n          \"name\": \"title\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"message\": {\n          \"name\": \"message\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"level\": {\n          \"name\": \"level\",\n          \"type\": \"level\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"payload\": {\n          \"name\": \"payload\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"success\": {\n          \"name\": \"success\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"error\": {\n          \"name\": \"error\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider_response\": {\n          \"name\": \"provider_response\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"sent_at\": {\n          \"name\": \"sent_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_storage_channels\": {\n      \"name\": \"organization_storage_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_storage_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_storage_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_storage_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_storage_channels_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"organization_storage_channels_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"organization_storage_channels\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_storage_channels_organization_id_storage_channel_id_unique\": {\n          \"name\": \"organization_storage_channels_organization_id_storage_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"storage_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.storage_channel\": {\n      \"name\": \"storage_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_storage_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"storage_channel_organization_id_organization_id_fk\": {\n          \"name\": \"storage_channel_organization_id_organization_id_fk\",\n          \"tableFrom\": \"storage_channel\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.storage_policy\": {\n      \"name\": \"storage_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"storage_policy_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"storage_policy_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"storage_policy\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"storage_policy_database_id_databases_id_fk\": {\n          \"name\": \"storage_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"storage_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backup_storage\": {\n      \"name\": \"backup_storage\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"backup_storage_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'pending'\"\n        },\n        \"path\": {\n          \"name\": \"path\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"size\": {\n          \"name\": \"size\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"checksum\": {\n          \"name\": \"checksum\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backup_storage_backup_id_backups_id_fk\": {\n          \"name\": \"backup_storage_backup_id_backups_id_fk\",\n          \"tableFrom\": \"backup_storage\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"backup_storage_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"backup_storage_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"backup_storage\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.healthcheck_log\": {\n      \"name\": \"healthcheck_log\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"kind\": {\n          \"name\": \"kind\",\n          \"type\": \"healthcheck_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"date\": {\n          \"name\": \"date\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"healthcheck_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"object_id\": {\n          \"name\": \"object_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    }\n  },\n  \"enums\": {\n    \"public.user_themes\": {\n      \"name\": \"user_themes\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"light\",\n        \"dark\",\n        \"system\"\n      ]\n    },\n    \"public.retention_policy_type\": {\n      \"name\": \"retention_policy_type\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"count\",\n        \"days\",\n        \"gfs\"\n      ]\n    },\n    \"public.provider_kind\": {\n      \"name\": \"provider_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"slack\",\n        \"smtp\",\n        \"discord\",\n        \"telegram\",\n        \"gotify\",\n        \"ntfy\",\n        \"webhook\"\n      ]\n    },\n    \"public.event_kind\": {\n      \"name\": \"event_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"error_backup\",\n        \"error_restore\",\n        \"success_restore\",\n        \"success_backup\",\n        \"weekly_report\",\n        \"error_health_agent\",\n        \"error_health_database\"\n      ]\n    },\n    \"public.level\": {\n      \"name\": \"level\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"critical\",\n        \"warning\",\n        \"info\"\n      ]\n    },\n    \"public.provider_storage_kind\": {\n      \"name\": \"provider_storage_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\",\n        \"google-drive\"\n      ]\n    },\n    \"public.backup_storage_status\": {\n      \"name\": \"backup_storage_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"pending\",\n        \"success\",\n        \"failed\"\n      ]\n    },\n    \"public.healthcheck_status\": {\n      \"name\": \"healthcheck_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"success\",\n        \"failed\"\n      ]\n    },\n    \"public.healthcheck_kind\": {\n      \"name\": \"healthcheck_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"database\",\n        \"agent\"\n      ]\n    },\n    \"public.dbms_status\": {\n      \"name\": \"dbms_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"postgresql\",\n        \"mysql\",\n        \"mariadb\",\n        \"mongodb\",\n        \"sqlite\",\n        \"redis\",\n        \"valkey\",\n        \"firebird\"\n      ]\n    },\n    \"public.status\": {\n      \"name\": \"status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"waiting\",\n        \"ongoing\",\n        \"failed\",\n        \"success\"\n      ]\n    },\n    \"public.type_storage\": {\n      \"name\": \"type_storage\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\"\n      ]\n    }\n  },\n  \"schemas\": {},\n  \"sequences\": {},\n  \"roles\": {},\n  \"policies\": {},\n  \"views\": {},\n  \"_meta\": {\n    \"columns\": {},\n    \"schemas\": {},\n    \"tables\": {}\n  }\n}"
  },
  {
    "path": "src/db/migrations/meta/0049_snapshot.json",
    "content": "{\n  \"id\": \"514ea1d6-5de7-49ea-9c69-2265b9643012\",\n  \"prevId\": \"065ff89b-19b1-4932-8cdb-1ea0e3faf177\",\n  \"version\": \"7\",\n  \"dialect\": \"postgresql\",\n  \"tables\": {\n    \"public.settings\": {\n      \"name\": \"settings\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"smtp_password\": {\n          \"name\": \"smtp_password\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_from\": {\n          \"name\": \"smtp_from\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_host\": {\n          \"name\": \"smtp_host\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_port\": {\n          \"name\": \"smtp_port\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_user\": {\n          \"name\": \"smtp_user\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_secure\": {\n          \"name\": \"smtp_secure\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"default_notification_channel_id\": {\n          \"name\": \"default_notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"default_storage_channel_id\": {\n          \"name\": \"default_storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"encryption\": {\n          \"name\": \"encryption\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"settings_default_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"settings_default_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"settings\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"default_notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"set null\",\n          \"onUpdate\": \"no action\"\n        },\n        \"settings_default_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"settings_default_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"settings\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"default_storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"set null\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"settings_name_unique\": {\n          \"name\": \"settings_name_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"name\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.account\": {\n      \"name\": \"account\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"account_id\": {\n          \"name\": \"account_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"access_token\": {\n          \"name\": \"access_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token\": {\n          \"name\": \"refresh_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"id_token\": {\n          \"name\": \"id_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"access_token_expires_at\": {\n          \"name\": \"access_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token_expires_at\": {\n          \"name\": \"refresh_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"scope\": {\n          \"name\": \"scope\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"password\": {\n          \"name\": \"password\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"account_user_id_user_id_fk\": {\n          \"name\": \"account_user_id_user_id_fk\",\n          \"tableFrom\": \"account\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.passkey\": {\n      \"name\": \"passkey\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"publicKey\": {\n          \"name\": \"publicKey\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"credentialID\": {\n          \"name\": \"credentialID\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"counter\": {\n          \"name\": \"counter\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"deviceType\": {\n          \"name\": \"deviceType\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backedUp\": {\n          \"name\": \"backedUp\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"transports\": {\n          \"name\": \"transports\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"aaguid\": {\n          \"name\": \"aaguid\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"passkey_user_id_user_id_fk\": {\n          \"name\": \"passkey_user_id_user_id_fk\",\n          \"tableFrom\": \"passkey\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.session\": {\n      \"name\": \"session\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"token\": {\n          \"name\": \"token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"ip_address\": {\n          \"name\": \"ip_address\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_agent\": {\n          \"name\": \"user_agent\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"impersonated_by\": {\n          \"name\": \"impersonated_by\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"active_organization_id\": {\n          \"name\": \"active_organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"session_user_id_user_id_fk\": {\n          \"name\": \"session_user_id_user_id_fk\",\n          \"tableFrom\": \"session\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"session_token_unique\": {\n          \"name\": \"session_token_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"token\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.sso_provider\": {\n      \"name\": \"sso_provider\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"issuer\": {\n          \"name\": \"issuer\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"oidc_config\": {\n          \"name\": \"oidc_config\",\n          \"type\": \"json\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"saml_config\": {\n          \"name\": \"saml_config\",\n          \"type\": \"json\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"domain\": {\n          \"name\": \"domain\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"sso_provider_user_id_user_id_fk\": {\n          \"name\": \"sso_provider_user_id_user_id_fk\",\n          \"tableFrom\": \"sso_provider\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"sso_provider_provider_id_unique\": {\n          \"name\": \"sso_provider_provider_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"provider_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.two_factor\": {\n      \"name\": \"two_factor\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"secret\": {\n          \"name\": \"secret\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backup_codes\": {\n          \"name\": \"backup_codes\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"two_factor_user_id_user_id_fk\": {\n          \"name\": \"two_factor_user_id_user_id_fk\",\n          \"tableFrom\": \"two_factor\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.user\": {\n      \"name\": \"user\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email_verified\": {\n          \"name\": \"email_verified\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"image\": {\n          \"name\": \"image\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"theme\": {\n          \"name\": \"theme\",\n          \"type\": \"user_themes\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'light'\"\n        },\n        \"banned\": {\n          \"name\": \"banned\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_reason\": {\n          \"name\": \"ban_reason\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_expires\": {\n          \"name\": \"ban_expires\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"lastConnectedAt\": {\n          \"name\": \"lastConnectedAt\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"lastChangedPasswordAt\": {\n          \"name\": \"lastChangedPasswordAt\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"two_factor_enabled\": {\n          \"name\": \"two_factor_enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"user_email_unique\": {\n          \"name\": \"user_email_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"email\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.verification\": {\n      \"name\": \"verification\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"identifier\": {\n          \"name\": \"identifier\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"value\": {\n          \"name\": \"value\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization\": {\n      \"name\": \"organization\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"logo\": {\n          \"name\": \"logo\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"metadata\": {\n          \"name\": \"metadata\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_slug_unique\": {\n          \"name\": \"organization_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.member\": {\n      \"name\": \"member\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"member_organization_id_organization_id_fk\": {\n          \"name\": \"member_organization_id_organization_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"member_user_id_user_id_fk\": {\n          \"name\": \"member_user_id_user_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.invitation\": {\n      \"name\": \"invitation\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"inviter_id\": {\n          \"name\": \"inviter_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"invitation_organization_id_organization_id_fk\": {\n          \"name\": \"invitation_organization_id_organization_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"invitation_inviter_id_user_id_fk\": {\n          \"name\": \"invitation_inviter_id_user_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"inviter_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.projects\": {\n      \"name\": \"projects\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"projects_organization_id_organization_id_fk\": {\n          \"name\": \"projects_organization_id_organization_id_fk\",\n          \"tableFrom\": \"projects\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"projects_slug_unique\": {\n          \"name\": \"projects_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backups\": {\n      \"name\": \"backups\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"file\": {\n          \"name\": \"file\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"file_size\": {\n          \"name\": \"file_size\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"imported\": {\n          \"name\": \"imported\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backups_database_id_databases_id_fk\": {\n          \"name\": \"backups_database_id_databases_id_fk\",\n          \"tableFrom\": \"backups\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.databases\": {\n      \"name\": \"databases\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"agent_database_id\": {\n          \"name\": \"agent_database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"dbms\": {\n          \"name\": \"dbms\",\n          \"type\": \"dbms_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_policy\": {\n          \"name\": \"backup_policy\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"is_waiting_for_backup\": {\n          \"name\": \"is_waiting_for_backup\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"backup_to_restore\": {\n          \"name\": \"backup_to_restore\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"health_error_count\": {\n          \"name\": \"health_error_count\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"agent_id\": {\n          \"name\": \"agent_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"project_id\": {\n          \"name\": \"project_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"databases_agent_id_agents_id_fk\": {\n          \"name\": \"databases_agent_id_agents_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"agents\",\n          \"columnsFrom\": [\n            \"agent_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"databases_project_id_projects_id_fk\": {\n          \"name\": \"databases_project_id_projects_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"projects\",\n          \"columnsFrom\": [\n            \"project_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"no action\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.restorations\": {\n      \"name\": \"restorations\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"backup_storage_id\": {\n          \"name\": \"backup_storage_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"restorations_backup_storage_id_backup_storage_id_fk\": {\n          \"name\": \"restorations_backup_storage_id_backup_storage_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backup_storage\",\n          \"columnsFrom\": [\n            \"backup_storage_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_backup_id_backups_id_fk\": {\n          \"name\": \"restorations_backup_id_backups_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_database_id_databases_id_fk\": {\n          \"name\": \"restorations_database_id_databases_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.retention_policies\": {\n      \"name\": \"retention_policies\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"type\": {\n          \"name\": \"type\",\n          \"type\": \"retention_policy_type\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"count\": {\n          \"name\": \"count\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"days\": {\n          \"name\": \"days\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 30\n        },\n        \"gfs_daily\": {\n          \"name\": \"gfs_daily\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"gfs_weekly\": {\n          \"name\": \"gfs_weekly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 4\n        },\n        \"gfs_monthly\": {\n          \"name\": \"gfs_monthly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 12\n        },\n        \"gfs_yearly\": {\n          \"name\": \"gfs_yearly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 3\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"retention_policies_database_id_databases_id_fk\": {\n          \"name\": \"retention_policies_database_id_databases_id_fk\",\n          \"tableFrom\": \"retention_policies\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.agents\": {\n      \"name\": \"agents\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"version\": {\n          \"name\": \"version\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"health_error_count\": {\n          \"name\": \"health_error_count\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"agents_organization_id_organization_id_fk\": {\n          \"name\": \"agents_organization_id_organization_id_fk\",\n          \"tableFrom\": \"agents\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"agents_slug_unique\": {\n          \"name\": \"agents_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_agents\": {\n      \"name\": \"organization_agents\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"agent_id\": {\n          \"name\": \"agent_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_agents_organization_id_organization_id_fk\": {\n          \"name\": \"organization_agents_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_agents\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_agents_agent_id_agents_id_fk\": {\n          \"name\": \"organization_agents_agent_id_agents_id_fk\",\n          \"tableFrom\": \"organization_agents\",\n          \"tableTo\": \"agents\",\n          \"columnsFrom\": [\n            \"agent_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_agents_organization_id_agent_id_unique\": {\n          \"name\": \"organization_agents_organization_id_agent_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"agent_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_channel\": {\n      \"name\": \"notification_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"notification_channel_organization_id_organization_id_fk\": {\n          \"name\": \"notification_channel_organization_id_organization_id_fk\",\n          \"tableFrom\": \"notification_channel\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_notification_channels\": {\n      \"name\": \"organization_notification_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_notification_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_notification_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_notification_channels_organization_id_notification_channel_id_unique\": {\n          \"name\": \"organization_notification_channels_organization_id_notification_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"notification_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.alert_policy\": {\n      \"name\": \"alert_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"event_kind\": {\n          \"name\": \"event_kind\",\n          \"type\": \"event_kind[]\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"alert_policy_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"alert_policy_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"alert_policy_database_id_databases_id_fk\": {\n          \"name\": \"alert_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_log\": {\n      \"name\": \"notification_log\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"channel_id\": {\n          \"name\": \"channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"policy_id\": {\n          \"name\": \"policy_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"event\": {\n          \"name\": \"event\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_name\": {\n          \"name\": \"provider_name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"title\": {\n          \"name\": \"title\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"message\": {\n          \"name\": \"message\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"level\": {\n          \"name\": \"level\",\n          \"type\": \"level\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"payload\": {\n          \"name\": \"payload\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"success\": {\n          \"name\": \"success\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"error\": {\n          \"name\": \"error\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider_response\": {\n          \"name\": \"provider_response\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"sent_at\": {\n          \"name\": \"sent_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_storage_channels\": {\n      \"name\": \"organization_storage_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_storage_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_storage_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_storage_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_storage_channels_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"organization_storage_channels_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"organization_storage_channels\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_storage_channels_organization_id_storage_channel_id_unique\": {\n          \"name\": \"organization_storage_channels_organization_id_storage_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"storage_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.storage_channel\": {\n      \"name\": \"storage_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_storage_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"storage_channel_organization_id_organization_id_fk\": {\n          \"name\": \"storage_channel_organization_id_organization_id_fk\",\n          \"tableFrom\": \"storage_channel\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.storage_policy\": {\n      \"name\": \"storage_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"storage_policy_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"storage_policy_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"storage_policy\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"storage_policy_database_id_databases_id_fk\": {\n          \"name\": \"storage_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"storage_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backup_storage\": {\n      \"name\": \"backup_storage\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"backup_storage_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'pending'\"\n        },\n        \"path\": {\n          \"name\": \"path\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"size\": {\n          \"name\": \"size\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"checksum\": {\n          \"name\": \"checksum\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backup_storage_backup_id_backups_id_fk\": {\n          \"name\": \"backup_storage_backup_id_backups_id_fk\",\n          \"tableFrom\": \"backup_storage\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"backup_storage_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"backup_storage_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"backup_storage\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.healthcheck_log\": {\n      \"name\": \"healthcheck_log\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"kind\": {\n          \"name\": \"kind\",\n          \"type\": \"healthcheck_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"date\": {\n          \"name\": \"date\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"healthcheck_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"object_id\": {\n          \"name\": \"object_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    }\n  },\n  \"enums\": {\n    \"public.user_themes\": {\n      \"name\": \"user_themes\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"light\",\n        \"dark\",\n        \"system\"\n      ]\n    },\n    \"public.retention_policy_type\": {\n      \"name\": \"retention_policy_type\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"count\",\n        \"days\",\n        \"gfs\"\n      ]\n    },\n    \"public.provider_kind\": {\n      \"name\": \"provider_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"slack\",\n        \"smtp\",\n        \"discord\",\n        \"telegram\",\n        \"gotify\",\n        \"ntfy\",\n        \"webhook\"\n      ]\n    },\n    \"public.event_kind\": {\n      \"name\": \"event_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"error_backup\",\n        \"error_restore\",\n        \"success_restore\",\n        \"success_backup\",\n        \"weekly_report\",\n        \"error_health_agent\",\n        \"error_health_database\"\n      ]\n    },\n    \"public.level\": {\n      \"name\": \"level\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"critical\",\n        \"warning\",\n        \"info\"\n      ]\n    },\n    \"public.provider_storage_kind\": {\n      \"name\": \"provider_storage_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\",\n        \"google-drive\"\n      ]\n    },\n    \"public.backup_storage_status\": {\n      \"name\": \"backup_storage_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"pending\",\n        \"success\",\n        \"failed\"\n      ]\n    },\n    \"public.healthcheck_status\": {\n      \"name\": \"healthcheck_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"success\",\n        \"failed\"\n      ]\n    },\n    \"public.healthcheck_kind\": {\n      \"name\": \"healthcheck_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"database\",\n        \"agent\"\n      ]\n    },\n    \"public.dbms_status\": {\n      \"name\": \"dbms_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"postgresql\",\n        \"mysql\",\n        \"mariadb\",\n        \"mongodb\",\n        \"sqlite\",\n        \"redis\",\n        \"valkey\",\n        \"firebird\"\n      ]\n    },\n    \"public.status\": {\n      \"name\": \"status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"waiting\",\n        \"ongoing\",\n        \"failed\",\n        \"success\"\n      ]\n    },\n    \"public.type_storage\": {\n      \"name\": \"type_storage\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\"\n      ]\n    }\n  },\n  \"schemas\": {},\n  \"sequences\": {},\n  \"roles\": {},\n  \"policies\": {},\n  \"views\": {},\n  \"_meta\": {\n    \"columns\": {},\n    \"schemas\": {},\n    \"tables\": {}\n  }\n}"
  },
  {
    "path": "src/db/migrations/meta/0050_snapshot.json",
    "content": "{\n  \"id\": \"642eb1a2-d90f-4434-80b5-ca3b2cae91f2\",\n  \"prevId\": \"514ea1d6-5de7-49ea-9c69-2265b9643012\",\n  \"version\": \"7\",\n  \"dialect\": \"postgresql\",\n  \"tables\": {\n    \"public.settings\": {\n      \"name\": \"settings\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"smtp_password\": {\n          \"name\": \"smtp_password\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_from\": {\n          \"name\": \"smtp_from\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_host\": {\n          \"name\": \"smtp_host\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_port\": {\n          \"name\": \"smtp_port\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_user\": {\n          \"name\": \"smtp_user\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_secure\": {\n          \"name\": \"smtp_secure\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"default_notification_channel_id\": {\n          \"name\": \"default_notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"default_storage_channel_id\": {\n          \"name\": \"default_storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"encryption\": {\n          \"name\": \"encryption\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"settings_default_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"settings_default_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"settings\",\n          \"columnsFrom\": [\n            \"default_notification_channel_id\"\n          ],\n          \"tableTo\": \"notification_channel\",\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onUpdate\": \"no action\",\n          \"onDelete\": \"set null\"\n        },\n        \"settings_default_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"settings_default_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"settings\",\n          \"columnsFrom\": [\n            \"default_storage_channel_id\"\n          ],\n          \"tableTo\": \"storage_channel\",\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onUpdate\": \"no action\",\n          \"onDelete\": \"set null\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"settings_name_unique\": {\n          \"name\": \"settings_name_unique\",\n          \"columns\": [\n            \"name\"\n          ],\n          \"nullsNotDistinct\": false\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.account\": {\n      \"name\": \"account\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"account_id\": {\n          \"name\": \"account_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"access_token\": {\n          \"name\": \"access_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token\": {\n          \"name\": \"refresh_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"id_token\": {\n          \"name\": \"id_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"access_token_expires_at\": {\n          \"name\": \"access_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token_expires_at\": {\n          \"name\": \"refresh_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"scope\": {\n          \"name\": \"scope\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"password\": {\n          \"name\": \"password\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"account_user_id_user_id_fk\": {\n          \"name\": \"account_user_id_user_id_fk\",\n          \"tableFrom\": \"account\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"tableTo\": \"user\",\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onUpdate\": \"no action\",\n          \"onDelete\": \"cascade\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.passkey\": {\n      \"name\": \"passkey\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"publicKey\": {\n          \"name\": \"publicKey\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"credentialID\": {\n          \"name\": \"credentialID\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"counter\": {\n          \"name\": \"counter\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"deviceType\": {\n          \"name\": \"deviceType\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backedUp\": {\n          \"name\": \"backedUp\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"transports\": {\n          \"name\": \"transports\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"aaguid\": {\n          \"name\": \"aaguid\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"passkey_user_id_user_id_fk\": {\n          \"name\": \"passkey_user_id_user_id_fk\",\n          \"tableFrom\": \"passkey\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"tableTo\": \"user\",\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onUpdate\": \"no action\",\n          \"onDelete\": \"cascade\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.session\": {\n      \"name\": \"session\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"token\": {\n          \"name\": \"token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"ip_address\": {\n          \"name\": \"ip_address\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_agent\": {\n          \"name\": \"user_agent\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"impersonated_by\": {\n          \"name\": \"impersonated_by\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"active_organization_id\": {\n          \"name\": \"active_organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"session_user_id_user_id_fk\": {\n          \"name\": \"session_user_id_user_id_fk\",\n          \"tableFrom\": \"session\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"tableTo\": \"user\",\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onUpdate\": \"no action\",\n          \"onDelete\": \"cascade\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"session_token_unique\": {\n          \"name\": \"session_token_unique\",\n          \"columns\": [\n            \"token\"\n          ],\n          \"nullsNotDistinct\": false\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.sso_provider\": {\n      \"name\": \"sso_provider\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"issuer\": {\n          \"name\": \"issuer\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"oidc_config\": {\n          \"name\": \"oidc_config\",\n          \"type\": \"json\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"saml_config\": {\n          \"name\": \"saml_config\",\n          \"type\": \"json\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"domain\": {\n          \"name\": \"domain\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"sso_provider_user_id_user_id_fk\": {\n          \"name\": \"sso_provider_user_id_user_id_fk\",\n          \"tableFrom\": \"sso_provider\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"tableTo\": \"user\",\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onUpdate\": \"no action\",\n          \"onDelete\": \"cascade\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"sso_provider_provider_id_unique\": {\n          \"name\": \"sso_provider_provider_id_unique\",\n          \"columns\": [\n            \"provider_id\"\n          ],\n          \"nullsNotDistinct\": false\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.two_factor\": {\n      \"name\": \"two_factor\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"secret\": {\n          \"name\": \"secret\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backup_codes\": {\n          \"name\": \"backup_codes\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"two_factor_user_id_user_id_fk\": {\n          \"name\": \"two_factor_user_id_user_id_fk\",\n          \"tableFrom\": \"two_factor\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"tableTo\": \"user\",\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onUpdate\": \"no action\",\n          \"onDelete\": \"cascade\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.user\": {\n      \"name\": \"user\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email_verified\": {\n          \"name\": \"email_verified\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"image\": {\n          \"name\": \"image\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"theme\": {\n          \"name\": \"theme\",\n          \"type\": \"user_themes\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'light'\"\n        },\n        \"banned\": {\n          \"name\": \"banned\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_reason\": {\n          \"name\": \"ban_reason\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_expires\": {\n          \"name\": \"ban_expires\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"lastConnectedAt\": {\n          \"name\": \"lastConnectedAt\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"lastChangedPasswordAt\": {\n          \"name\": \"lastChangedPasswordAt\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"two_factor_enabled\": {\n          \"name\": \"two_factor_enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"user_email_unique\": {\n          \"name\": \"user_email_unique\",\n          \"columns\": [\n            \"email\"\n          ],\n          \"nullsNotDistinct\": false\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.verification\": {\n      \"name\": \"verification\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"identifier\": {\n          \"name\": \"identifier\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"value\": {\n          \"name\": \"value\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization\": {\n      \"name\": \"organization\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"logo\": {\n          \"name\": \"logo\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"metadata\": {\n          \"name\": \"metadata\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_slug_unique\": {\n          \"name\": \"organization_slug_unique\",\n          \"columns\": [\n            \"slug\"\n          ],\n          \"nullsNotDistinct\": false\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.member\": {\n      \"name\": \"member\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"member_organization_id_organization_id_fk\": {\n          \"name\": \"member_organization_id_organization_id_fk\",\n          \"tableFrom\": \"member\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"tableTo\": \"organization\",\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onUpdate\": \"no action\",\n          \"onDelete\": \"cascade\"\n        },\n        \"member_user_id_user_id_fk\": {\n          \"name\": \"member_user_id_user_id_fk\",\n          \"tableFrom\": \"member\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"tableTo\": \"user\",\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onUpdate\": \"no action\",\n          \"onDelete\": \"cascade\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.invitation\": {\n      \"name\": \"invitation\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"inviter_id\": {\n          \"name\": \"inviter_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"invitation_organization_id_organization_id_fk\": {\n          \"name\": \"invitation_organization_id_organization_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"tableTo\": \"organization\",\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onUpdate\": \"no action\",\n          \"onDelete\": \"cascade\"\n        },\n        \"invitation_inviter_id_user_id_fk\": {\n          \"name\": \"invitation_inviter_id_user_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"columnsFrom\": [\n            \"inviter_id\"\n          ],\n          \"tableTo\": \"user\",\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onUpdate\": \"no action\",\n          \"onDelete\": \"cascade\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.projects\": {\n      \"name\": \"projects\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"projects_organization_id_organization_id_fk\": {\n          \"name\": \"projects_organization_id_organization_id_fk\",\n          \"tableFrom\": \"projects\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"tableTo\": \"organization\",\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onUpdate\": \"no action\",\n          \"onDelete\": \"cascade\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"projects_slug_unique\": {\n          \"name\": \"projects_slug_unique\",\n          \"columns\": [\n            \"slug\"\n          ],\n          \"nullsNotDistinct\": false\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backups\": {\n      \"name\": \"backups\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"file\": {\n          \"name\": \"file\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"file_size\": {\n          \"name\": \"file_size\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"imported\": {\n          \"name\": \"imported\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backups_database_id_databases_id_fk\": {\n          \"name\": \"backups_database_id_databases_id_fk\",\n          \"tableFrom\": \"backups\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"tableTo\": \"databases\",\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onUpdate\": \"no action\",\n          \"onDelete\": \"cascade\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.databases\": {\n      \"name\": \"databases\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"agent_database_id\": {\n          \"name\": \"agent_database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"dbms\": {\n          \"name\": \"dbms\",\n          \"type\": \"dbms_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_policy\": {\n          \"name\": \"backup_policy\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"is_waiting_for_backup\": {\n          \"name\": \"is_waiting_for_backup\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"backup_to_restore\": {\n          \"name\": \"backup_to_restore\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"health_error_count\": {\n          \"name\": \"health_error_count\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"agent_id\": {\n          \"name\": \"agent_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"project_id\": {\n          \"name\": \"project_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"databases_agent_id_agents_id_fk\": {\n          \"name\": \"databases_agent_id_agents_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"columnsFrom\": [\n            \"agent_id\"\n          ],\n          \"tableTo\": \"agents\",\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onUpdate\": \"no action\",\n          \"onDelete\": \"cascade\"\n        },\n        \"databases_project_id_projects_id_fk\": {\n          \"name\": \"databases_project_id_projects_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"columnsFrom\": [\n            \"project_id\"\n          ],\n          \"tableTo\": \"projects\",\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onUpdate\": \"no action\",\n          \"onDelete\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.restorations\": {\n      \"name\": \"restorations\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"backup_storage_id\": {\n          \"name\": \"backup_storage_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"restorations_backup_storage_id_backup_storage_id_fk\": {\n          \"name\": \"restorations_backup_storage_id_backup_storage_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"columnsFrom\": [\n            \"backup_storage_id\"\n          ],\n          \"tableTo\": \"backup_storage\",\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onUpdate\": \"no action\",\n          \"onDelete\": \"cascade\"\n        },\n        \"restorations_backup_id_backups_id_fk\": {\n          \"name\": \"restorations_backup_id_backups_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"tableTo\": \"backups\",\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onUpdate\": \"no action\",\n          \"onDelete\": \"cascade\"\n        },\n        \"restorations_database_id_databases_id_fk\": {\n          \"name\": \"restorations_database_id_databases_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"tableTo\": \"databases\",\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onUpdate\": \"no action\",\n          \"onDelete\": \"cascade\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.retention_policies\": {\n      \"name\": \"retention_policies\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"type\": {\n          \"name\": \"type\",\n          \"type\": \"retention_policy_type\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"count\": {\n          \"name\": \"count\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"days\": {\n          \"name\": \"days\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 30\n        },\n        \"gfs_daily\": {\n          \"name\": \"gfs_daily\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"gfs_weekly\": {\n          \"name\": \"gfs_weekly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 4\n        },\n        \"gfs_monthly\": {\n          \"name\": \"gfs_monthly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 12\n        },\n        \"gfs_yearly\": {\n          \"name\": \"gfs_yearly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 3\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"retention_policies_database_id_databases_id_fk\": {\n          \"name\": \"retention_policies_database_id_databases_id_fk\",\n          \"tableFrom\": \"retention_policies\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"tableTo\": \"databases\",\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onUpdate\": \"no action\",\n          \"onDelete\": \"cascade\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.agents\": {\n      \"name\": \"agents\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"version\": {\n          \"name\": \"version\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"health_error_count\": {\n          \"name\": \"health_error_count\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"agents_organization_id_organization_id_fk\": {\n          \"name\": \"agents_organization_id_organization_id_fk\",\n          \"tableFrom\": \"agents\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"tableTo\": \"organization\",\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onUpdate\": \"no action\",\n          \"onDelete\": \"cascade\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"agents_slug_unique\": {\n          \"name\": \"agents_slug_unique\",\n          \"columns\": [\n            \"slug\"\n          ],\n          \"nullsNotDistinct\": false\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_agents\": {\n      \"name\": \"organization_agents\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"agent_id\": {\n          \"name\": \"agent_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_agents_organization_id_organization_id_fk\": {\n          \"name\": \"organization_agents_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_agents\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"tableTo\": \"organization\",\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onUpdate\": \"no action\",\n          \"onDelete\": \"cascade\"\n        },\n        \"organization_agents_agent_id_agents_id_fk\": {\n          \"name\": \"organization_agents_agent_id_agents_id_fk\",\n          \"tableFrom\": \"organization_agents\",\n          \"columnsFrom\": [\n            \"agent_id\"\n          ],\n          \"tableTo\": \"agents\",\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onUpdate\": \"no action\",\n          \"onDelete\": \"cascade\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_agents_organization_id_agent_id_unique\": {\n          \"name\": \"organization_agents_organization_id_agent_id_unique\",\n          \"columns\": [\n            \"organization_id\",\n            \"agent_id\"\n          ],\n          \"nullsNotDistinct\": false\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_channel\": {\n      \"name\": \"notification_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"notification_channel_organization_id_organization_id_fk\": {\n          \"name\": \"notification_channel_organization_id_organization_id_fk\",\n          \"tableFrom\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"tableTo\": \"organization\",\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onUpdate\": \"no action\",\n          \"onDelete\": \"cascade\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_notification_channels\": {\n      \"name\": \"organization_notification_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_notification_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_notification_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"tableTo\": \"organization\",\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onUpdate\": \"no action\",\n          \"onDelete\": \"cascade\"\n        },\n        \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"tableTo\": \"notification_channel\",\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onUpdate\": \"no action\",\n          \"onDelete\": \"cascade\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_notification_channels_organization_id_notification_channel_id_unique\": {\n          \"name\": \"organization_notification_channels_organization_id_notification_channel_id_unique\",\n          \"columns\": [\n            \"organization_id\",\n            \"notification_channel_id\"\n          ],\n          \"nullsNotDistinct\": false\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.alert_policy\": {\n      \"name\": \"alert_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"event_kind\": {\n          \"name\": \"event_kind\",\n          \"type\": \"event_kind[]\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"alert_policy_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"alert_policy_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"tableTo\": \"notification_channel\",\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onUpdate\": \"no action\",\n          \"onDelete\": \"cascade\"\n        },\n        \"alert_policy_database_id_databases_id_fk\": {\n          \"name\": \"alert_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"tableTo\": \"databases\",\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onUpdate\": \"no action\",\n          \"onDelete\": \"cascade\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_log\": {\n      \"name\": \"notification_log\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"channel_id\": {\n          \"name\": \"channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"policy_id\": {\n          \"name\": \"policy_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"event\": {\n          \"name\": \"event\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_name\": {\n          \"name\": \"provider_name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"title\": {\n          \"name\": \"title\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"message\": {\n          \"name\": \"message\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"level\": {\n          \"name\": \"level\",\n          \"type\": \"level\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"payload\": {\n          \"name\": \"payload\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"success\": {\n          \"name\": \"success\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"error\": {\n          \"name\": \"error\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider_response\": {\n          \"name\": \"provider_response\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"sent_at\": {\n          \"name\": \"sent_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_storage_channels\": {\n      \"name\": \"organization_storage_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_storage_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_storage_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_storage_channels\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"tableTo\": \"organization\",\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onUpdate\": \"no action\",\n          \"onDelete\": \"cascade\"\n        },\n        \"organization_storage_channels_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"organization_storage_channels_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"organization_storage_channels\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"tableTo\": \"storage_channel\",\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onUpdate\": \"no action\",\n          \"onDelete\": \"cascade\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_storage_channels_organization_id_storage_channel_id_unique\": {\n          \"name\": \"organization_storage_channels_organization_id_storage_channel_id_unique\",\n          \"columns\": [\n            \"organization_id\",\n            \"storage_channel_id\"\n          ],\n          \"nullsNotDistinct\": false\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.storage_channel\": {\n      \"name\": \"storage_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_storage_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"storage_channel_organization_id_organization_id_fk\": {\n          \"name\": \"storage_channel_organization_id_organization_id_fk\",\n          \"tableFrom\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"tableTo\": \"organization\",\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onUpdate\": \"no action\",\n          \"onDelete\": \"cascade\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.storage_policy\": {\n      \"name\": \"storage_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"storage_policy_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"storage_policy_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"storage_policy\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"tableTo\": \"storage_channel\",\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onUpdate\": \"no action\",\n          \"onDelete\": \"cascade\"\n        },\n        \"storage_policy_database_id_databases_id_fk\": {\n          \"name\": \"storage_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"storage_policy\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"tableTo\": \"databases\",\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onUpdate\": \"no action\",\n          \"onDelete\": \"cascade\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backup_storage\": {\n      \"name\": \"backup_storage\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"backup_storage_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'pending'\"\n        },\n        \"path\": {\n          \"name\": \"path\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"size\": {\n          \"name\": \"size\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"checksum\": {\n          \"name\": \"checksum\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backup_storage_backup_id_backups_id_fk\": {\n          \"name\": \"backup_storage_backup_id_backups_id_fk\",\n          \"tableFrom\": \"backup_storage\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"tableTo\": \"backups\",\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onUpdate\": \"no action\",\n          \"onDelete\": \"cascade\"\n        },\n        \"backup_storage_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"backup_storage_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"backup_storage\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"tableTo\": \"storage_channel\",\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onUpdate\": \"no action\",\n          \"onDelete\": \"cascade\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.healthcheck_log\": {\n      \"name\": \"healthcheck_log\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"kind\": {\n          \"name\": \"kind\",\n          \"type\": \"healthcheck_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"date\": {\n          \"name\": \"date\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"healthcheck_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"object_id\": {\n          \"name\": \"object_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    }\n  },\n  \"enums\": {\n    \"public.user_themes\": {\n      \"name\": \"user_themes\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"light\",\n        \"dark\",\n        \"system\"\n      ]\n    },\n    \"public.retention_policy_type\": {\n      \"name\": \"retention_policy_type\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"count\",\n        \"days\",\n        \"gfs\"\n      ]\n    },\n    \"public.provider_kind\": {\n      \"name\": \"provider_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"slack\",\n        \"smtp\",\n        \"discord\",\n        \"telegram\",\n        \"gotify\",\n        \"ntfy\",\n        \"webhook\"\n      ]\n    },\n    \"public.event_kind\": {\n      \"name\": \"event_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"error_backup\",\n        \"error_restore\",\n        \"success_restore\",\n        \"success_backup\",\n        \"weekly_report\",\n        \"error_health_agent\",\n        \"error_health_database\"\n      ]\n    },\n    \"public.level\": {\n      \"name\": \"level\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"critical\",\n        \"warning\",\n        \"info\"\n      ]\n    },\n    \"public.provider_storage_kind\": {\n      \"name\": \"provider_storage_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\",\n        \"google-drive\"\n      ]\n    },\n    \"public.backup_storage_status\": {\n      \"name\": \"backup_storage_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"pending\",\n        \"success\",\n        \"failed\"\n      ]\n    },\n    \"public.healthcheck_status\": {\n      \"name\": \"healthcheck_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"success\",\n        \"failed\"\n      ]\n    },\n    \"public.healthcheck_kind\": {\n      \"name\": \"healthcheck_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"database\",\n        \"agent\"\n      ]\n    },\n    \"public.dbms_status\": {\n      \"name\": \"dbms_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"postgresql\",\n        \"mysql\",\n        \"mariadb\",\n        \"mongodb\",\n        \"sqlite\",\n        \"redis\",\n        \"valkey\",\n        \"firebird\"\n      ]\n    },\n    \"public.status\": {\n      \"name\": \"status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"waiting\",\n        \"ongoing\",\n        \"failed\",\n        \"success\"\n      ]\n    },\n    \"public.type_storage\": {\n      \"name\": \"type_storage\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\"\n      ]\n    }\n  },\n  \"schemas\": {},\n  \"views\": {},\n  \"sequences\": {},\n  \"roles\": {},\n  \"policies\": {},\n  \"_meta\": {\n    \"columns\": {},\n    \"schemas\": {},\n    \"tables\": {}\n  }\n}"
  },
  {
    "path": "src/db/migrations/meta/0051_snapshot.json",
    "content": "{\n  \"id\": \"84867820-36ac-4822-86a5-d1d329e0adff\",\n  \"prevId\": \"642eb1a2-d90f-4434-80b5-ca3b2cae91f2\",\n  \"version\": \"7\",\n  \"dialect\": \"postgresql\",\n  \"tables\": {\n    \"public.settings\": {\n      \"name\": \"settings\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"smtp_password\": {\n          \"name\": \"smtp_password\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_from\": {\n          \"name\": \"smtp_from\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_host\": {\n          \"name\": \"smtp_host\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_port\": {\n          \"name\": \"smtp_port\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_user\": {\n          \"name\": \"smtp_user\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_secure\": {\n          \"name\": \"smtp_secure\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"default_notification_channel_id\": {\n          \"name\": \"default_notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"default_storage_channel_id\": {\n          \"name\": \"default_storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"encryption\": {\n          \"name\": \"encryption\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"settings_default_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"settings_default_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"settings\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"default_notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"set null\",\n          \"onUpdate\": \"no action\"\n        },\n        \"settings_default_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"settings_default_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"settings\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"default_storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"set null\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"settings_name_unique\": {\n          \"name\": \"settings_name_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"name\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.account\": {\n      \"name\": \"account\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"account_id\": {\n          \"name\": \"account_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"access_token\": {\n          \"name\": \"access_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token\": {\n          \"name\": \"refresh_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"id_token\": {\n          \"name\": \"id_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"access_token_expires_at\": {\n          \"name\": \"access_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token_expires_at\": {\n          \"name\": \"refresh_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"scope\": {\n          \"name\": \"scope\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"password\": {\n          \"name\": \"password\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"account_user_id_user_id_fk\": {\n          \"name\": \"account_user_id_user_id_fk\",\n          \"tableFrom\": \"account\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.passkey\": {\n      \"name\": \"passkey\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"publicKey\": {\n          \"name\": \"publicKey\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"credentialID\": {\n          \"name\": \"credentialID\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"counter\": {\n          \"name\": \"counter\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"deviceType\": {\n          \"name\": \"deviceType\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backedUp\": {\n          \"name\": \"backedUp\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"transports\": {\n          \"name\": \"transports\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"aaguid\": {\n          \"name\": \"aaguid\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"passkey_user_id_user_id_fk\": {\n          \"name\": \"passkey_user_id_user_id_fk\",\n          \"tableFrom\": \"passkey\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.session\": {\n      \"name\": \"session\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"token\": {\n          \"name\": \"token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"ip_address\": {\n          \"name\": \"ip_address\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_agent\": {\n          \"name\": \"user_agent\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"impersonated_by\": {\n          \"name\": \"impersonated_by\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"active_organization_id\": {\n          \"name\": \"active_organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"session_user_id_user_id_fk\": {\n          \"name\": \"session_user_id_user_id_fk\",\n          \"tableFrom\": \"session\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"session_token_unique\": {\n          \"name\": \"session_token_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"token\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.sso_provider\": {\n      \"name\": \"sso_provider\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"issuer\": {\n          \"name\": \"issuer\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"oidc_config\": {\n          \"name\": \"oidc_config\",\n          \"type\": \"json\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"saml_config\": {\n          \"name\": \"saml_config\",\n          \"type\": \"json\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"domain\": {\n          \"name\": \"domain\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"sso_provider_user_id_user_id_fk\": {\n          \"name\": \"sso_provider_user_id_user_id_fk\",\n          \"tableFrom\": \"sso_provider\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"sso_provider_provider_id_unique\": {\n          \"name\": \"sso_provider_provider_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"provider_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.two_factor\": {\n      \"name\": \"two_factor\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"secret\": {\n          \"name\": \"secret\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backup_codes\": {\n          \"name\": \"backup_codes\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"two_factor_user_id_user_id_fk\": {\n          \"name\": \"two_factor_user_id_user_id_fk\",\n          \"tableFrom\": \"two_factor\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.user\": {\n      \"name\": \"user\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email_verified\": {\n          \"name\": \"email_verified\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"image\": {\n          \"name\": \"image\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"theme\": {\n          \"name\": \"theme\",\n          \"type\": \"user_themes\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'light'\"\n        },\n        \"banned\": {\n          \"name\": \"banned\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_reason\": {\n          \"name\": \"ban_reason\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_expires\": {\n          \"name\": \"ban_expires\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"lastConnectedAt\": {\n          \"name\": \"lastConnectedAt\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"lastChangedPasswordAt\": {\n          \"name\": \"lastChangedPasswordAt\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"two_factor_enabled\": {\n          \"name\": \"two_factor_enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"user_email_unique\": {\n          \"name\": \"user_email_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"email\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.verification\": {\n      \"name\": \"verification\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"identifier\": {\n          \"name\": \"identifier\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"value\": {\n          \"name\": \"value\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization\": {\n      \"name\": \"organization\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"logo\": {\n          \"name\": \"logo\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"metadata\": {\n          \"name\": \"metadata\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_slug_unique\": {\n          \"name\": \"organization_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.member\": {\n      \"name\": \"member\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"member_organization_id_organization_id_fk\": {\n          \"name\": \"member_organization_id_organization_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"member_user_id_user_id_fk\": {\n          \"name\": \"member_user_id_user_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.invitation\": {\n      \"name\": \"invitation\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"inviter_id\": {\n          \"name\": \"inviter_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"invitation_organization_id_organization_id_fk\": {\n          \"name\": \"invitation_organization_id_organization_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"invitation_inviter_id_user_id_fk\": {\n          \"name\": \"invitation_inviter_id_user_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"inviter_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.projects\": {\n      \"name\": \"projects\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"projects_organization_id_organization_id_fk\": {\n          \"name\": \"projects_organization_id_organization_id_fk\",\n          \"tableFrom\": \"projects\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"projects_slug_unique\": {\n          \"name\": \"projects_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backups\": {\n      \"name\": \"backups\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"file\": {\n          \"name\": \"file\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"file_size\": {\n          \"name\": \"file_size\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"imported\": {\n          \"name\": \"imported\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backups_database_id_databases_id_fk\": {\n          \"name\": \"backups_database_id_databases_id_fk\",\n          \"tableFrom\": \"backups\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.databases\": {\n      \"name\": \"databases\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"agent_database_id\": {\n          \"name\": \"agent_database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"dbms\": {\n          \"name\": \"dbms\",\n          \"type\": \"dbms_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_policy\": {\n          \"name\": \"backup_policy\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"is_waiting_for_backup\": {\n          \"name\": \"is_waiting_for_backup\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"backup_to_restore\": {\n          \"name\": \"backup_to_restore\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"health_error_count\": {\n          \"name\": \"health_error_count\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"agent_id\": {\n          \"name\": \"agent_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"project_id\": {\n          \"name\": \"project_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"databases_agent_id_agents_id_fk\": {\n          \"name\": \"databases_agent_id_agents_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"agents\",\n          \"columnsFrom\": [\n            \"agent_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"databases_project_id_projects_id_fk\": {\n          \"name\": \"databases_project_id_projects_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"projects\",\n          \"columnsFrom\": [\n            \"project_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"no action\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.restorations\": {\n      \"name\": \"restorations\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"backup_storage_id\": {\n          \"name\": \"backup_storage_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"restorations_backup_storage_id_backup_storage_id_fk\": {\n          \"name\": \"restorations_backup_storage_id_backup_storage_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backup_storage\",\n          \"columnsFrom\": [\n            \"backup_storage_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_backup_id_backups_id_fk\": {\n          \"name\": \"restorations_backup_id_backups_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_database_id_databases_id_fk\": {\n          \"name\": \"restorations_database_id_databases_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.retention_policies\": {\n      \"name\": \"retention_policies\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"type\": {\n          \"name\": \"type\",\n          \"type\": \"retention_policy_type\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"count\": {\n          \"name\": \"count\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"days\": {\n          \"name\": \"days\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 30\n        },\n        \"gfs_daily\": {\n          \"name\": \"gfs_daily\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"gfs_weekly\": {\n          \"name\": \"gfs_weekly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 4\n        },\n        \"gfs_monthly\": {\n          \"name\": \"gfs_monthly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 12\n        },\n        \"gfs_yearly\": {\n          \"name\": \"gfs_yearly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 3\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"retention_policies_database_id_databases_id_fk\": {\n          \"name\": \"retention_policies_database_id_databases_id_fk\",\n          \"tableFrom\": \"retention_policies\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.agents\": {\n      \"name\": \"agents\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"version\": {\n          \"name\": \"version\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"health_error_count\": {\n          \"name\": \"health_error_count\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"agents_organization_id_organization_id_fk\": {\n          \"name\": \"agents_organization_id_organization_id_fk\",\n          \"tableFrom\": \"agents\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"agents_slug_unique\": {\n          \"name\": \"agents_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_agents\": {\n      \"name\": \"organization_agents\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"agent_id\": {\n          \"name\": \"agent_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_agents_organization_id_organization_id_fk\": {\n          \"name\": \"organization_agents_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_agents\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_agents_agent_id_agents_id_fk\": {\n          \"name\": \"organization_agents_agent_id_agents_id_fk\",\n          \"tableFrom\": \"organization_agents\",\n          \"tableTo\": \"agents\",\n          \"columnsFrom\": [\n            \"agent_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_agents_organization_id_agent_id_unique\": {\n          \"name\": \"organization_agents_organization_id_agent_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"agent_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_channel\": {\n      \"name\": \"notification_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"notification_channel_organization_id_organization_id_fk\": {\n          \"name\": \"notification_channel_organization_id_organization_id_fk\",\n          \"tableFrom\": \"notification_channel\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_notification_channels\": {\n      \"name\": \"organization_notification_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_notification_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_notification_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_notification_channels_organization_id_notification_channel_id_unique\": {\n          \"name\": \"organization_notification_channels_organization_id_notification_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"notification_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.alert_policy\": {\n      \"name\": \"alert_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"event_kind\": {\n          \"name\": \"event_kind\",\n          \"type\": \"event_kind[]\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"alert_policy_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"alert_policy_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"alert_policy_database_id_databases_id_fk\": {\n          \"name\": \"alert_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_log\": {\n      \"name\": \"notification_log\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"channel_id\": {\n          \"name\": \"channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"policy_id\": {\n          \"name\": \"policy_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"event\": {\n          \"name\": \"event\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_name\": {\n          \"name\": \"provider_name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"title\": {\n          \"name\": \"title\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"message\": {\n          \"name\": \"message\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"level\": {\n          \"name\": \"level\",\n          \"type\": \"level\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"payload\": {\n          \"name\": \"payload\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"success\": {\n          \"name\": \"success\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"error\": {\n          \"name\": \"error\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider_response\": {\n          \"name\": \"provider_response\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"sent_at\": {\n          \"name\": \"sent_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_storage_channels\": {\n      \"name\": \"organization_storage_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_storage_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_storage_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_storage_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_storage_channels_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"organization_storage_channels_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"organization_storage_channels\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_storage_channels_organization_id_storage_channel_id_unique\": {\n          \"name\": \"organization_storage_channels_organization_id_storage_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"storage_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.storage_channel\": {\n      \"name\": \"storage_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_storage_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"storage_channel_organization_id_organization_id_fk\": {\n          \"name\": \"storage_channel_organization_id_organization_id_fk\",\n          \"tableFrom\": \"storage_channel\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.storage_policy\": {\n      \"name\": \"storage_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"storage_policy_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"storage_policy_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"storage_policy\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"storage_policy_database_id_databases_id_fk\": {\n          \"name\": \"storage_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"storage_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backup_storage\": {\n      \"name\": \"backup_storage\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"backup_storage_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'pending'\"\n        },\n        \"path\": {\n          \"name\": \"path\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"size\": {\n          \"name\": \"size\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"checksum\": {\n          \"name\": \"checksum\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backup_storage_backup_id_backups_id_fk\": {\n          \"name\": \"backup_storage_backup_id_backups_id_fk\",\n          \"tableFrom\": \"backup_storage\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"backup_storage_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"backup_storage_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"backup_storage\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.healthcheck_log\": {\n      \"name\": \"healthcheck_log\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"kind\": {\n          \"name\": \"kind\",\n          \"type\": \"healthcheck_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"date\": {\n          \"name\": \"date\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"healthcheck_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"object_id\": {\n          \"name\": \"object_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    }\n  },\n  \"enums\": {\n    \"public.user_themes\": {\n      \"name\": \"user_themes\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"light\",\n        \"dark\",\n        \"system\"\n      ]\n    },\n    \"public.retention_policy_type\": {\n      \"name\": \"retention_policy_type\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"count\",\n        \"days\",\n        \"gfs\"\n      ]\n    },\n    \"public.provider_kind\": {\n      \"name\": \"provider_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"slack\",\n        \"smtp\",\n        \"discord\",\n        \"telegram\",\n        \"gotify\",\n        \"ntfy\",\n        \"webhook\"\n      ]\n    },\n    \"public.event_kind\": {\n      \"name\": \"event_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"error_backup\",\n        \"error_restore\",\n        \"success_restore\",\n        \"success_backup\",\n        \"weekly_report\",\n        \"error_health_agent\",\n        \"error_health_database\"\n      ]\n    },\n    \"public.level\": {\n      \"name\": \"level\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"critical\",\n        \"warning\",\n        \"info\"\n      ]\n    },\n    \"public.provider_storage_kind\": {\n      \"name\": \"provider_storage_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\",\n        \"google-drive\"\n      ]\n    },\n    \"public.backup_storage_status\": {\n      \"name\": \"backup_storage_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"pending\",\n        \"success\",\n        \"failed\"\n      ]\n    },\n    \"public.healthcheck_status\": {\n      \"name\": \"healthcheck_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"success\",\n        \"failed\"\n      ]\n    },\n    \"public.healthcheck_kind\": {\n      \"name\": \"healthcheck_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"database\",\n        \"agent\"\n      ]\n    },\n    \"public.dbms_status\": {\n      \"name\": \"dbms_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"postgresql\",\n        \"mysql\",\n        \"mariadb\",\n        \"mongodb\",\n        \"sqlite\",\n        \"redis\",\n        \"valkey\",\n        \"firebird\"\n      ]\n    },\n    \"public.status\": {\n      \"name\": \"status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"waiting\",\n        \"ongoing\",\n        \"failed\",\n        \"success\"\n      ]\n    },\n    \"public.type_storage\": {\n      \"name\": \"type_storage\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\"\n      ]\n    }\n  },\n  \"schemas\": {},\n  \"sequences\": {},\n  \"roles\": {},\n  \"policies\": {},\n  \"views\": {},\n  \"_meta\": {\n    \"columns\": {},\n    \"schemas\": {},\n    \"tables\": {}\n  }\n}"
  },
  {
    "path": "src/db/migrations/meta/0052_snapshot.json",
    "content": "{\n  \"id\": \"cee595d3-b9bc-4973-ae23-322de576a907\",\n  \"prevId\": \"84867820-36ac-4822-86a5-d1d329e0adff\",\n  \"version\": \"7\",\n  \"dialect\": \"postgresql\",\n  \"tables\": {\n    \"public.settings\": {\n      \"name\": \"settings\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"smtp_password\": {\n          \"name\": \"smtp_password\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_from\": {\n          \"name\": \"smtp_from\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_host\": {\n          \"name\": \"smtp_host\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_port\": {\n          \"name\": \"smtp_port\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_user\": {\n          \"name\": \"smtp_user\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_secure\": {\n          \"name\": \"smtp_secure\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"default_notification_channel_id\": {\n          \"name\": \"default_notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"default_storage_channel_id\": {\n          \"name\": \"default_storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"encryption\": {\n          \"name\": \"encryption\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"settings_default_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"settings_default_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"settings\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"default_notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"set null\",\n          \"onUpdate\": \"no action\"\n        },\n        \"settings_default_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"settings_default_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"settings\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"default_storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"set null\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"settings_name_unique\": {\n          \"name\": \"settings_name_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"name\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.account\": {\n      \"name\": \"account\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"account_id\": {\n          \"name\": \"account_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"access_token\": {\n          \"name\": \"access_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token\": {\n          \"name\": \"refresh_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"id_token\": {\n          \"name\": \"id_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"access_token_expires_at\": {\n          \"name\": \"access_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token_expires_at\": {\n          \"name\": \"refresh_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"scope\": {\n          \"name\": \"scope\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"password\": {\n          \"name\": \"password\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"account_user_id_user_id_fk\": {\n          \"name\": \"account_user_id_user_id_fk\",\n          \"tableFrom\": \"account\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.passkey\": {\n      \"name\": \"passkey\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"publicKey\": {\n          \"name\": \"publicKey\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"credentialID\": {\n          \"name\": \"credentialID\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"counter\": {\n          \"name\": \"counter\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"deviceType\": {\n          \"name\": \"deviceType\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backedUp\": {\n          \"name\": \"backedUp\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"transports\": {\n          \"name\": \"transports\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"aaguid\": {\n          \"name\": \"aaguid\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"passkey_user_id_user_id_fk\": {\n          \"name\": \"passkey_user_id_user_id_fk\",\n          \"tableFrom\": \"passkey\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.session\": {\n      \"name\": \"session\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"token\": {\n          \"name\": \"token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"ip_address\": {\n          \"name\": \"ip_address\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_agent\": {\n          \"name\": \"user_agent\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"impersonated_by\": {\n          \"name\": \"impersonated_by\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"active_organization_id\": {\n          \"name\": \"active_organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"session_user_id_user_id_fk\": {\n          \"name\": \"session_user_id_user_id_fk\",\n          \"tableFrom\": \"session\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"session_token_unique\": {\n          \"name\": \"session_token_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"token\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.sso_provider\": {\n      \"name\": \"sso_provider\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"issuer\": {\n          \"name\": \"issuer\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"oidc_config\": {\n          \"name\": \"oidc_config\",\n          \"type\": \"json\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"saml_config\": {\n          \"name\": \"saml_config\",\n          \"type\": \"json\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"domain\": {\n          \"name\": \"domain\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"sso_provider_user_id_user_id_fk\": {\n          \"name\": \"sso_provider_user_id_user_id_fk\",\n          \"tableFrom\": \"sso_provider\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"sso_provider_provider_id_unique\": {\n          \"name\": \"sso_provider_provider_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"provider_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.two_factor\": {\n      \"name\": \"two_factor\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"secret\": {\n          \"name\": \"secret\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backup_codes\": {\n          \"name\": \"backup_codes\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"verified\": {\n          \"name\": \"verified\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"two_factor_user_id_user_id_fk\": {\n          \"name\": \"two_factor_user_id_user_id_fk\",\n          \"tableFrom\": \"two_factor\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.user\": {\n      \"name\": \"user\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email_verified\": {\n          \"name\": \"email_verified\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"image\": {\n          \"name\": \"image\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"theme\": {\n          \"name\": \"theme\",\n          \"type\": \"user_themes\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'light'\"\n        },\n        \"banned\": {\n          \"name\": \"banned\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_reason\": {\n          \"name\": \"ban_reason\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_expires\": {\n          \"name\": \"ban_expires\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"lastConnectedAt\": {\n          \"name\": \"lastConnectedAt\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"lastChangedPasswordAt\": {\n          \"name\": \"lastChangedPasswordAt\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"two_factor_enabled\": {\n          \"name\": \"two_factor_enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"user_email_unique\": {\n          \"name\": \"user_email_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"email\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.verification\": {\n      \"name\": \"verification\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"identifier\": {\n          \"name\": \"identifier\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"value\": {\n          \"name\": \"value\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization\": {\n      \"name\": \"organization\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"logo\": {\n          \"name\": \"logo\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"metadata\": {\n          \"name\": \"metadata\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_slug_unique\": {\n          \"name\": \"organization_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.member\": {\n      \"name\": \"member\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"member_organization_id_organization_id_fk\": {\n          \"name\": \"member_organization_id_organization_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"member_user_id_user_id_fk\": {\n          \"name\": \"member_user_id_user_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.invitation\": {\n      \"name\": \"invitation\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"inviter_id\": {\n          \"name\": \"inviter_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"invitation_organization_id_organization_id_fk\": {\n          \"name\": \"invitation_organization_id_organization_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"invitation_inviter_id_user_id_fk\": {\n          \"name\": \"invitation_inviter_id_user_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"inviter_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.projects\": {\n      \"name\": \"projects\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"projects_organization_id_organization_id_fk\": {\n          \"name\": \"projects_organization_id_organization_id_fk\",\n          \"tableFrom\": \"projects\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"projects_slug_unique\": {\n          \"name\": \"projects_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backups\": {\n      \"name\": \"backups\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"file\": {\n          \"name\": \"file\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"file_size\": {\n          \"name\": \"file_size\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"imported\": {\n          \"name\": \"imported\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backups_database_id_databases_id_fk\": {\n          \"name\": \"backups_database_id_databases_id_fk\",\n          \"tableFrom\": \"backups\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.databases\": {\n      \"name\": \"databases\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"agent_database_id\": {\n          \"name\": \"agent_database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"dbms\": {\n          \"name\": \"dbms\",\n          \"type\": \"dbms_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_policy\": {\n          \"name\": \"backup_policy\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"is_waiting_for_backup\": {\n          \"name\": \"is_waiting_for_backup\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"backup_to_restore\": {\n          \"name\": \"backup_to_restore\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"health_error_count\": {\n          \"name\": \"health_error_count\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"agent_id\": {\n          \"name\": \"agent_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"project_id\": {\n          \"name\": \"project_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"databases_agent_id_agents_id_fk\": {\n          \"name\": \"databases_agent_id_agents_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"agents\",\n          \"columnsFrom\": [\n            \"agent_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"databases_project_id_projects_id_fk\": {\n          \"name\": \"databases_project_id_projects_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"projects\",\n          \"columnsFrom\": [\n            \"project_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"no action\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.restorations\": {\n      \"name\": \"restorations\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"backup_storage_id\": {\n          \"name\": \"backup_storage_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"restorations_backup_storage_id_backup_storage_id_fk\": {\n          \"name\": \"restorations_backup_storage_id_backup_storage_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backup_storage\",\n          \"columnsFrom\": [\n            \"backup_storage_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_backup_id_backups_id_fk\": {\n          \"name\": \"restorations_backup_id_backups_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_database_id_databases_id_fk\": {\n          \"name\": \"restorations_database_id_databases_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.retention_policies\": {\n      \"name\": \"retention_policies\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"type\": {\n          \"name\": \"type\",\n          \"type\": \"retention_policy_type\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"count\": {\n          \"name\": \"count\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"days\": {\n          \"name\": \"days\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 30\n        },\n        \"gfs_daily\": {\n          \"name\": \"gfs_daily\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"gfs_weekly\": {\n          \"name\": \"gfs_weekly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 4\n        },\n        \"gfs_monthly\": {\n          \"name\": \"gfs_monthly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 12\n        },\n        \"gfs_yearly\": {\n          \"name\": \"gfs_yearly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 3\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"retention_policies_database_id_databases_id_fk\": {\n          \"name\": \"retention_policies_database_id_databases_id_fk\",\n          \"tableFrom\": \"retention_policies\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.agents\": {\n      \"name\": \"agents\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"version\": {\n          \"name\": \"version\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"health_error_count\": {\n          \"name\": \"health_error_count\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"agents_organization_id_organization_id_fk\": {\n          \"name\": \"agents_organization_id_organization_id_fk\",\n          \"tableFrom\": \"agents\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"agents_slug_unique\": {\n          \"name\": \"agents_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_agents\": {\n      \"name\": \"organization_agents\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"agent_id\": {\n          \"name\": \"agent_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_agents_organization_id_organization_id_fk\": {\n          \"name\": \"organization_agents_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_agents\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_agents_agent_id_agents_id_fk\": {\n          \"name\": \"organization_agents_agent_id_agents_id_fk\",\n          \"tableFrom\": \"organization_agents\",\n          \"tableTo\": \"agents\",\n          \"columnsFrom\": [\n            \"agent_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_agents_organization_id_agent_id_unique\": {\n          \"name\": \"organization_agents_organization_id_agent_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"agent_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_channel\": {\n      \"name\": \"notification_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"notification_channel_organization_id_organization_id_fk\": {\n          \"name\": \"notification_channel_organization_id_organization_id_fk\",\n          \"tableFrom\": \"notification_channel\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_notification_channels\": {\n      \"name\": \"organization_notification_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_notification_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_notification_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_notification_channels_organization_id_notification_channel_id_unique\": {\n          \"name\": \"organization_notification_channels_organization_id_notification_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"notification_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.alert_policy\": {\n      \"name\": \"alert_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"event_kind\": {\n          \"name\": \"event_kind\",\n          \"type\": \"event_kind[]\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"alert_policy_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"alert_policy_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"alert_policy_database_id_databases_id_fk\": {\n          \"name\": \"alert_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_log\": {\n      \"name\": \"notification_log\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"channel_id\": {\n          \"name\": \"channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"policy_id\": {\n          \"name\": \"policy_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"event\": {\n          \"name\": \"event\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_name\": {\n          \"name\": \"provider_name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"title\": {\n          \"name\": \"title\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"message\": {\n          \"name\": \"message\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"level\": {\n          \"name\": \"level\",\n          \"type\": \"level\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"payload\": {\n          \"name\": \"payload\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"success\": {\n          \"name\": \"success\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"error\": {\n          \"name\": \"error\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider_response\": {\n          \"name\": \"provider_response\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"sent_at\": {\n          \"name\": \"sent_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_storage_channels\": {\n      \"name\": \"organization_storage_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_storage_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_storage_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_storage_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_storage_channels_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"organization_storage_channels_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"organization_storage_channels\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_storage_channels_organization_id_storage_channel_id_unique\": {\n          \"name\": \"organization_storage_channels_organization_id_storage_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"storage_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.storage_channel\": {\n      \"name\": \"storage_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_storage_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"storage_channel_organization_id_organization_id_fk\": {\n          \"name\": \"storage_channel_organization_id_organization_id_fk\",\n          \"tableFrom\": \"storage_channel\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.storage_policy\": {\n      \"name\": \"storage_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"storage_policy_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"storage_policy_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"storage_policy\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"storage_policy_database_id_databases_id_fk\": {\n          \"name\": \"storage_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"storage_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backup_storage\": {\n      \"name\": \"backup_storage\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"backup_storage_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'pending'\"\n        },\n        \"path\": {\n          \"name\": \"path\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"size\": {\n          \"name\": \"size\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"checksum\": {\n          \"name\": \"checksum\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backup_storage_backup_id_backups_id_fk\": {\n          \"name\": \"backup_storage_backup_id_backups_id_fk\",\n          \"tableFrom\": \"backup_storage\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"backup_storage_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"backup_storage_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"backup_storage\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.healthcheck_log\": {\n      \"name\": \"healthcheck_log\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"kind\": {\n          \"name\": \"kind\",\n          \"type\": \"healthcheck_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"date\": {\n          \"name\": \"date\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"healthcheck_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"object_id\": {\n          \"name\": \"object_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    }\n  },\n  \"enums\": {\n    \"public.user_themes\": {\n      \"name\": \"user_themes\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"light\",\n        \"dark\",\n        \"system\"\n      ]\n    },\n    \"public.retention_policy_type\": {\n      \"name\": \"retention_policy_type\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"count\",\n        \"days\",\n        \"gfs\"\n      ]\n    },\n    \"public.provider_kind\": {\n      \"name\": \"provider_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"slack\",\n        \"smtp\",\n        \"discord\",\n        \"telegram\",\n        \"gotify\",\n        \"ntfy\",\n        \"webhook\"\n      ]\n    },\n    \"public.event_kind\": {\n      \"name\": \"event_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"error_backup\",\n        \"error_restore\",\n        \"success_restore\",\n        \"success_backup\",\n        \"weekly_report\",\n        \"error_health_agent\",\n        \"error_health_database\"\n      ]\n    },\n    \"public.level\": {\n      \"name\": \"level\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"critical\",\n        \"warning\",\n        \"info\"\n      ]\n    },\n    \"public.provider_storage_kind\": {\n      \"name\": \"provider_storage_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\",\n        \"google-drive\"\n      ]\n    },\n    \"public.backup_storage_status\": {\n      \"name\": \"backup_storage_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"pending\",\n        \"success\",\n        \"failed\"\n      ]\n    },\n    \"public.healthcheck_status\": {\n      \"name\": \"healthcheck_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"success\",\n        \"failed\"\n      ]\n    },\n    \"public.healthcheck_kind\": {\n      \"name\": \"healthcheck_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"database\",\n        \"agent\"\n      ]\n    },\n    \"public.dbms_status\": {\n      \"name\": \"dbms_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"postgresql\",\n        \"mysql\",\n        \"mariadb\",\n        \"mongodb\",\n        \"sqlite\",\n        \"redis\",\n        \"valkey\",\n        \"firebird\"\n      ]\n    },\n    \"public.status\": {\n      \"name\": \"status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"waiting\",\n        \"ongoing\",\n        \"failed\",\n        \"success\"\n      ]\n    },\n    \"public.type_storage\": {\n      \"name\": \"type_storage\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\"\n      ]\n    }\n  },\n  \"schemas\": {},\n  \"sequences\": {},\n  \"roles\": {},\n  \"policies\": {},\n  \"views\": {},\n  \"_meta\": {\n    \"columns\": {},\n    \"schemas\": {},\n    \"tables\": {}\n  }\n}"
  },
  {
    "path": "src/db/migrations/meta/0053_snapshot.json",
    "content": "{\n  \"id\": \"5b172f27-7fb7-4168-b410-2ae8100a8a03\",\n  \"prevId\": \"cee595d3-b9bc-4973-ae23-322de576a907\",\n  \"version\": \"7\",\n  \"dialect\": \"postgresql\",\n  \"tables\": {\n    \"public.settings\": {\n      \"name\": \"settings\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"smtp_password\": {\n          \"name\": \"smtp_password\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_from\": {\n          \"name\": \"smtp_from\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_host\": {\n          \"name\": \"smtp_host\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_port\": {\n          \"name\": \"smtp_port\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_user\": {\n          \"name\": \"smtp_user\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"smtp_secure\": {\n          \"name\": \"smtp_secure\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"default_notification_channel_id\": {\n          \"name\": \"default_notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"default_storage_channel_id\": {\n          \"name\": \"default_storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"encryption\": {\n          \"name\": \"encryption\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"settings_default_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"settings_default_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"settings\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"default_notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"set null\",\n          \"onUpdate\": \"no action\"\n        },\n        \"settings_default_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"settings_default_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"settings\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"default_storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"set null\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"settings_name_unique\": {\n          \"name\": \"settings_name_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"name\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.account\": {\n      \"name\": \"account\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"account_id\": {\n          \"name\": \"account_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"access_token\": {\n          \"name\": \"access_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token\": {\n          \"name\": \"refresh_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"id_token\": {\n          \"name\": \"id_token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"access_token_expires_at\": {\n          \"name\": \"access_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"refresh_token_expires_at\": {\n          \"name\": \"refresh_token_expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"scope\": {\n          \"name\": \"scope\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"password\": {\n          \"name\": \"password\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"account_user_id_user_id_fk\": {\n          \"name\": \"account_user_id_user_id_fk\",\n          \"tableFrom\": \"account\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.passkey\": {\n      \"name\": \"passkey\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"publicKey\": {\n          \"name\": \"publicKey\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"credentialID\": {\n          \"name\": \"credentialID\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"counter\": {\n          \"name\": \"counter\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"deviceType\": {\n          \"name\": \"deviceType\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backedUp\": {\n          \"name\": \"backedUp\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"transports\": {\n          \"name\": \"transports\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"aaguid\": {\n          \"name\": \"aaguid\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"passkey_user_id_user_id_fk\": {\n          \"name\": \"passkey_user_id_user_id_fk\",\n          \"tableFrom\": \"passkey\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.session\": {\n      \"name\": \"session\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"token\": {\n          \"name\": \"token\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"ip_address\": {\n          \"name\": \"ip_address\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_agent\": {\n          \"name\": \"user_agent\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"impersonated_by\": {\n          \"name\": \"impersonated_by\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"active_organization_id\": {\n          \"name\": \"active_organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"session_user_id_user_id_fk\": {\n          \"name\": \"session_user_id_user_id_fk\",\n          \"tableFrom\": \"session\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"session_token_unique\": {\n          \"name\": \"session_token_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"token\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.sso_provider\": {\n      \"name\": \"sso_provider\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"issuer\": {\n          \"name\": \"issuer\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"oidc_config\": {\n          \"name\": \"oidc_config\",\n          \"type\": \"json\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"saml_config\": {\n          \"name\": \"saml_config\",\n          \"type\": \"json\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider_id\": {\n          \"name\": \"provider_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"domain\": {\n          \"name\": \"domain\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"sso_provider_user_id_user_id_fk\": {\n          \"name\": \"sso_provider_user_id_user_id_fk\",\n          \"tableFrom\": \"sso_provider\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"sso_provider_provider_id_unique\": {\n          \"name\": \"sso_provider_provider_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"provider_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.two_factor\": {\n      \"name\": \"two_factor\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"secret\": {\n          \"name\": \"secret\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"backup_codes\": {\n          \"name\": \"backup_codes\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"verified\": {\n          \"name\": \"verified\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"two_factor_user_id_user_id_fk\": {\n          \"name\": \"two_factor_user_id_user_id_fk\",\n          \"tableFrom\": \"two_factor\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.user\": {\n      \"name\": \"user\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email_verified\": {\n          \"name\": \"email_verified\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"image\": {\n          \"name\": \"image\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"theme\": {\n          \"name\": \"theme\",\n          \"type\": \"user_themes\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'light'\"\n        },\n        \"banned\": {\n          \"name\": \"banned\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_reason\": {\n          \"name\": \"ban_reason\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"ban_expires\": {\n          \"name\": \"ban_expires\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"lastConnectedAt\": {\n          \"name\": \"lastConnectedAt\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"lastChangedPasswordAt\": {\n          \"name\": \"lastChangedPasswordAt\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"two_factor_enabled\": {\n          \"name\": \"two_factor_enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"user_email_unique\": {\n          \"name\": \"user_email_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"email\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.verification\": {\n      \"name\": \"verification\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"identifier\": {\n          \"name\": \"identifier\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"value\": {\n          \"name\": \"value\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization\": {\n      \"name\": \"organization\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"logo\": {\n          \"name\": \"logo\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"metadata\": {\n          \"name\": \"metadata\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_slug_unique\": {\n          \"name\": \"organization_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.member\": {\n      \"name\": \"member\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"member_organization_id_organization_id_fk\": {\n          \"name\": \"member_organization_id_organization_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"member_user_id_user_id_fk\": {\n          \"name\": \"member_user_id_user_id_fk\",\n          \"tableFrom\": \"member\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"user_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.invitation\": {\n      \"name\": \"invitation\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"role\": {\n          \"name\": \"role\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"expires_at\": {\n          \"name\": \"expires_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"inviter_id\": {\n          \"name\": \"inviter_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"invitation_organization_id_organization_id_fk\": {\n          \"name\": \"invitation_organization_id_organization_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"invitation_inviter_id_user_id_fk\": {\n          \"name\": \"invitation_inviter_id_user_id_fk\",\n          \"tableFrom\": \"invitation\",\n          \"tableTo\": \"user\",\n          \"columnsFrom\": [\n            \"inviter_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.projects\": {\n      \"name\": \"projects\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"projects_organization_id_organization_id_fk\": {\n          \"name\": \"projects_organization_id_organization_id_fk\",\n          \"tableFrom\": \"projects\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"projects_slug_unique\": {\n          \"name\": \"projects_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backups\": {\n      \"name\": \"backups\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"file\": {\n          \"name\": \"file\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"file_size\": {\n          \"name\": \"file_size\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"imported\": {\n          \"name\": \"imported\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"migrated\": {\n          \"name\": \"migrated\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backups_database_id_databases_id_fk\": {\n          \"name\": \"backups_database_id_databases_id_fk\",\n          \"tableFrom\": \"backups\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.databases\": {\n      \"name\": \"databases\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"agent_database_id\": {\n          \"name\": \"agent_database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"dbms\": {\n          \"name\": \"dbms\",\n          \"type\": \"dbms_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_policy\": {\n          \"name\": \"backup_policy\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"is_waiting_for_backup\": {\n          \"name\": \"is_waiting_for_backup\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"backup_to_restore\": {\n          \"name\": \"backup_to_restore\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"health_error_count\": {\n          \"name\": \"health_error_count\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"agent_id\": {\n          \"name\": \"agent_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"project_id\": {\n          \"name\": \"project_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"databases_agent_id_agents_id_fk\": {\n          \"name\": \"databases_agent_id_agents_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"agents\",\n          \"columnsFrom\": [\n            \"agent_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"databases_project_id_projects_id_fk\": {\n          \"name\": \"databases_project_id_projects_id_fk\",\n          \"tableFrom\": \"databases\",\n          \"tableTo\": \"projects\",\n          \"columnsFrom\": [\n            \"project_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"no action\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.restorations\": {\n      \"name\": \"restorations\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'waiting'\"\n        },\n        \"backup_storage_id\": {\n          \"name\": \"backup_storage_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"restorations_backup_storage_id_backup_storage_id_fk\": {\n          \"name\": \"restorations_backup_storage_id_backup_storage_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backup_storage\",\n          \"columnsFrom\": [\n            \"backup_storage_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_backup_id_backups_id_fk\": {\n          \"name\": \"restorations_backup_id_backups_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"restorations_database_id_databases_id_fk\": {\n          \"name\": \"restorations_database_id_databases_id_fk\",\n          \"tableFrom\": \"restorations\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.retention_policies\": {\n      \"name\": \"retention_policies\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"type\": {\n          \"name\": \"type\",\n          \"type\": \"retention_policy_type\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"count\": {\n          \"name\": \"count\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"days\": {\n          \"name\": \"days\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 30\n        },\n        \"gfs_daily\": {\n          \"name\": \"gfs_daily\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 7\n        },\n        \"gfs_weekly\": {\n          \"name\": \"gfs_weekly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 4\n        },\n        \"gfs_monthly\": {\n          \"name\": \"gfs_monthly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 12\n        },\n        \"gfs_yearly\": {\n          \"name\": \"gfs_yearly\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": 3\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"retention_policies_database_id_databases_id_fk\": {\n          \"name\": \"retention_policies_database_id_databases_id_fk\",\n          \"tableFrom\": \"retention_policies\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.agents\": {\n      \"name\": \"agents\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"slug\": {\n          \"name\": \"slug\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"version\": {\n          \"name\": \"version\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"health_error_count\": {\n          \"name\": \"health_error_count\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"is_archived\": {\n          \"name\": \"is_archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"last_contact\": {\n          \"name\": \"last_contact\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"agents_organization_id_organization_id_fk\": {\n          \"name\": \"agents_organization_id_organization_id_fk\",\n          \"tableFrom\": \"agents\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"agents_slug_unique\": {\n          \"name\": \"agents_slug_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"slug\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_agents\": {\n      \"name\": \"organization_agents\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"agent_id\": {\n          \"name\": \"agent_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_agents_organization_id_organization_id_fk\": {\n          \"name\": \"organization_agents_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_agents\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_agents_agent_id_agents_id_fk\": {\n          \"name\": \"organization_agents_agent_id_agents_id_fk\",\n          \"tableFrom\": \"organization_agents\",\n          \"tableTo\": \"agents\",\n          \"columnsFrom\": [\n            \"agent_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_agents_organization_id_agent_id_unique\": {\n          \"name\": \"organization_agents_organization_id_agent_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"agent_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_channel\": {\n      \"name\": \"notification_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"notification_channel_organization_id_organization_id_fk\": {\n          \"name\": \"notification_channel_organization_id_organization_id_fk\",\n          \"tableFrom\": \"notification_channel\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_notification_channels\": {\n      \"name\": \"organization_notification_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_notification_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_notification_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"organization_notification_channels_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"organization_notification_channels\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_notification_channels_organization_id_notification_channel_id_unique\": {\n          \"name\": \"organization_notification_channels_organization_id_notification_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"notification_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.alert_policy\": {\n      \"name\": \"alert_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"notification_channel_id\": {\n          \"name\": \"notification_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"event_kind\": {\n          \"name\": \"event_kind\",\n          \"type\": \"event_kind[]\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"alert_policy_notification_channel_id_notification_channel_id_fk\": {\n          \"name\": \"alert_policy_notification_channel_id_notification_channel_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"notification_channel\",\n          \"columnsFrom\": [\n            \"notification_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"alert_policy_database_id_databases_id_fk\": {\n          \"name\": \"alert_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"alert_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.notification_log\": {\n      \"name\": \"notification_log\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"channel_id\": {\n          \"name\": \"channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"policy_id\": {\n          \"name\": \"policy_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"event\": {\n          \"name\": \"event\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"provider_name\": {\n          \"name\": \"provider_name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"title\": {\n          \"name\": \"title\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"message\": {\n          \"name\": \"message\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"level\": {\n          \"name\": \"level\",\n          \"type\": \"level\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"payload\": {\n          \"name\": \"payload\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"success\": {\n          \"name\": \"success\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"error\": {\n          \"name\": \"error\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider_response\": {\n          \"name\": \"provider_response\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"sent_at\": {\n          \"name\": \"sent_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.organization_storage_channels\": {\n      \"name\": \"organization_storage_channels\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"organization_storage_channels_organization_id_organization_id_fk\": {\n          \"name\": \"organization_storage_channels_organization_id_organization_id_fk\",\n          \"tableFrom\": \"organization_storage_channels\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"organization_storage_channels_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"organization_storage_channels_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"organization_storage_channels\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"organization_storage_channels_organization_id_storage_channel_id_unique\": {\n          \"name\": \"organization_storage_channels_organization_id_storage_channel_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"organization_id\",\n            \"storage_channel_id\"\n          ]\n        }\n      },\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.storage_channel\": {\n      \"name\": \"storage_channel\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"organization_id\": {\n          \"name\": \"organization_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"provider\": {\n          \"name\": \"provider\",\n          \"type\": \"provider_storage_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"varchar(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"config\": {\n          \"name\": \"config\",\n          \"type\": \"jsonb\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"storage_channel_organization_id_organization_id_fk\": {\n          \"name\": \"storage_channel_organization_id_organization_id_fk\",\n          \"tableFrom\": \"storage_channel\",\n          \"tableTo\": \"organization\",\n          \"columnsFrom\": [\n            \"organization_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.storage_policy\": {\n      \"name\": \"storage_policy\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"enabled\": {\n          \"name\": \"enabled\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": true\n        },\n        \"database_id\": {\n          \"name\": \"database_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"storage_policy_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"storage_policy_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"storage_policy\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"storage_policy_database_id_databases_id_fk\": {\n          \"name\": \"storage_policy_database_id_databases_id_fk\",\n          \"tableFrom\": \"storage_policy\",\n          \"tableTo\": \"databases\",\n          \"columnsFrom\": [\n            \"database_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.backup_storage\": {\n      \"name\": \"backup_storage\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"backup_id\": {\n          \"name\": \"backup_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"storage_channel_id\": {\n          \"name\": \"storage_channel_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"backup_storage_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'pending'\"\n        },\n        \"path\": {\n          \"name\": \"path\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"size\": {\n          \"name\": \"size\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"checksum\": {\n          \"name\": \"checksum\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"backup_storage_backup_id_backups_id_fk\": {\n          \"name\": \"backup_storage_backup_id_backups_id_fk\",\n          \"tableFrom\": \"backup_storage\",\n          \"tableTo\": \"backups\",\n          \"columnsFrom\": [\n            \"backup_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        },\n        \"backup_storage_storage_channel_id_storage_channel_id_fk\": {\n          \"name\": \"backup_storage_storage_channel_id_storage_channel_id_fk\",\n          \"tableFrom\": \"backup_storage\",\n          \"tableTo\": \"storage_channel\",\n          \"columnsFrom\": [\n            \"storage_channel_id\"\n          ],\n          \"columnsTo\": [\n            \"id\"\n          ],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    },\n    \"public.healthcheck_log\": {\n      \"name\": \"healthcheck_log\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"kind\": {\n          \"name\": \"kind\",\n          \"type\": \"healthcheck_kind\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"date\": {\n          \"name\": \"date\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"status\": {\n          \"name\": \"status\",\n          \"type\": \"healthcheck_status\",\n          \"typeSchema\": \"public\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"object_id\": {\n          \"name\": \"object_id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"updated_at\": {\n          \"name\": \"updated_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"deleted_at\": {\n          \"name\": \"deleted_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {},\n      \"policies\": {},\n      \"checkConstraints\": {},\n      \"isRLSEnabled\": false\n    }\n  },\n  \"enums\": {\n    \"public.user_themes\": {\n      \"name\": \"user_themes\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"light\",\n        \"dark\",\n        \"system\"\n      ]\n    },\n    \"public.retention_policy_type\": {\n      \"name\": \"retention_policy_type\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"count\",\n        \"days\",\n        \"gfs\"\n      ]\n    },\n    \"public.provider_kind\": {\n      \"name\": \"provider_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"slack\",\n        \"smtp\",\n        \"discord\",\n        \"telegram\",\n        \"gotify\",\n        \"ntfy\",\n        \"webhook\"\n      ]\n    },\n    \"public.event_kind\": {\n      \"name\": \"event_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"error_backup\",\n        \"error_restore\",\n        \"success_restore\",\n        \"success_backup\",\n        \"weekly_report\",\n        \"error_health_agent\",\n        \"error_health_database\"\n      ]\n    },\n    \"public.level\": {\n      \"name\": \"level\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"critical\",\n        \"warning\",\n        \"info\"\n      ]\n    },\n    \"public.provider_storage_kind\": {\n      \"name\": \"provider_storage_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\",\n        \"google-drive\"\n      ]\n    },\n    \"public.backup_storage_status\": {\n      \"name\": \"backup_storage_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"pending\",\n        \"success\",\n        \"failed\"\n      ]\n    },\n    \"public.healthcheck_status\": {\n      \"name\": \"healthcheck_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"success\",\n        \"failed\"\n      ]\n    },\n    \"public.healthcheck_kind\": {\n      \"name\": \"healthcheck_kind\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"database\",\n        \"agent\"\n      ]\n    },\n    \"public.dbms_status\": {\n      \"name\": \"dbms_status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"postgresql\",\n        \"mysql\",\n        \"mariadb\",\n        \"mongodb\",\n        \"sqlite\",\n        \"redis\",\n        \"valkey\",\n        \"firebird\"\n      ]\n    },\n    \"public.status\": {\n      \"name\": \"status\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"waiting\",\n        \"ongoing\",\n        \"failed\",\n        \"success\"\n      ]\n    },\n    \"public.type_storage\": {\n      \"name\": \"type_storage\",\n      \"schema\": \"public\",\n      \"values\": [\n        \"local\",\n        \"s3\"\n      ]\n    }\n  },\n  \"schemas\": {},\n  \"sequences\": {},\n  \"roles\": {},\n  \"policies\": {},\n  \"views\": {},\n  \"_meta\": {\n    \"columns\": {},\n    \"schemas\": {},\n    \"tables\": {}\n  }\n}"
  },
  {
    "path": "src/db/migrations/meta/_journal.json",
    "content": "{\n  \"version\": \"7\",\n  \"dialect\": \"postgresql\",\n  \"entries\": [\n    {\n      \"idx\": 0,\n      \"version\": \"7\",\n      \"when\": 1752684754669,\n      \"tag\": \"0000_awesome_nomad\",\n      \"breakpoints\": true\n    },\n    {\n      \"idx\": 1,\n      \"version\": \"7\",\n      \"when\": 1752689557905,\n      \"tag\": \"0001_wealthy_leo\",\n      \"breakpoints\": true\n    },\n    {\n      \"idx\": 2,\n      \"version\": \"7\",\n      \"when\": 1753720983182,\n      \"tag\": \"0002_pink_groot\",\n      \"breakpoints\": true\n    },\n    {\n      \"idx\": 3,\n      \"version\": \"7\",\n      \"when\": 1756321312852,\n      \"tag\": \"0003_absent_maestro\",\n      \"breakpoints\": true\n    },\n    {\n      \"idx\": 4,\n      \"version\": \"7\",\n      \"when\": 1756473637441,\n      \"tag\": \"0004_dazzling_hawkeye\",\n      \"breakpoints\": true\n    },\n    {\n      \"idx\": 5,\n      \"version\": \"7\",\n      \"when\": 1762004436821,\n      \"tag\": \"0005_old_swarm\",\n      \"breakpoints\": true\n    },\n    {\n      \"idx\": 6,\n      \"version\": \"7\",\n      \"when\": 1762028639833,\n      \"tag\": \"0006_moaning_pete_wisdom\",\n      \"breakpoints\": true\n    },\n    {\n      \"idx\": 7,\n      \"version\": \"7\",\n      \"when\": 1762685571404,\n      \"tag\": \"0007_last_umar\",\n      \"breakpoints\": true\n    },\n    {\n      \"idx\": 8,\n      \"version\": \"7\",\n      \"when\": 1763914207236,\n      \"tag\": \"0008_aberrant_scorpion\",\n      \"breakpoints\": true\n    },\n    {\n      \"idx\": 9,\n      \"version\": \"7\",\n      \"when\": 1764364481615,\n      \"tag\": \"0009_lucky_edwin_jarvis\",\n      \"breakpoints\": true\n    },\n    {\n      \"idx\": 10,\n      \"version\": \"7\",\n      \"when\": 1764497732581,\n      \"tag\": \"0010_past_trauma\",\n      \"breakpoints\": true\n    },\n    {\n      \"idx\": 11,\n      \"version\": \"7\",\n      \"when\": 1765097874110,\n      \"tag\": \"0011_outgoing_blob\",\n      \"breakpoints\": true\n    },\n    {\n      \"idx\": 12,\n      \"version\": \"7\",\n      \"when\": 1766308683196,\n      \"tag\": \"0012_peaceful_leopardon\",\n      \"breakpoints\": true\n    },\n    {\n      \"idx\": 13,\n      \"version\": \"7\",\n      \"when\": 1766327760039,\n      \"tag\": \"0013_past_logan\",\n      \"breakpoints\": true\n    },\n    {\n      \"idx\": 14,\n      \"version\": \"7\",\n      \"when\": 1766424611387,\n      \"tag\": \"0014_strong_galactus\",\n      \"breakpoints\": true\n    },\n    {\n      \"idx\": 15,\n      \"version\": \"7\",\n      \"when\": 1766426190521,\n      \"tag\": \"0015_absurd_next_avengers\",\n      \"breakpoints\": true\n    },\n    {\n      \"idx\": 16,\n      \"version\": \"7\",\n      \"when\": 1767363779637,\n      \"tag\": \"0016_broken_morgan_stark\",\n      \"breakpoints\": true\n    },\n    {\n      \"idx\": 17,\n      \"version\": \"7\",\n      \"when\": 1767778503470,\n      \"tag\": \"0017_wild_purple_man\",\n      \"breakpoints\": true\n    },\n    {\n      \"idx\": 18,\n      \"version\": \"7\",\n      \"when\": 1767780819624,\n      \"tag\": \"0018_smiling_mole_man\",\n      \"breakpoints\": true\n    },\n    {\n      \"idx\": 19,\n      \"version\": \"7\",\n      \"when\": 1767782077775,\n      \"tag\": \"0019_overjoyed_butterfly\",\n      \"breakpoints\": true\n    },\n    {\n      \"idx\": 20,\n      \"version\": \"7\",\n      \"when\": 1768248015695,\n      \"tag\": \"0020_thankful_sunspot\",\n      \"breakpoints\": true\n    },\n    {\n      \"idx\": 21,\n      \"version\": \"7\",\n      \"when\": 1768337434929,\n      \"tag\": \"0021_soft_blockbuster\",\n      \"breakpoints\": true\n    },\n    {\n      \"idx\": 22,\n      \"version\": \"7\",\n      \"when\": 1768379186747,\n      \"tag\": \"0022_purple_retro_girl\",\n      \"breakpoints\": true\n    },\n    {\n      \"idx\": 23,\n      \"version\": \"7\",\n      \"when\": 1768412730102,\n      \"tag\": \"0023_common_the_captain\",\n      \"breakpoints\": true\n    },\n    {\n      \"idx\": 24,\n      \"version\": \"7\",\n      \"when\": 1768412750113,\n      \"tag\": \"0024_lush_blindfold\",\n      \"breakpoints\": true\n    },\n    {\n      \"idx\": 25,\n      \"version\": \"7\",\n      \"when\": 1768424936753,\n      \"tag\": \"0025_past_franklin_richards\",\n      \"breakpoints\": true\n    },\n    {\n      \"idx\": 26,\n      \"version\": \"7\",\n      \"when\": 1768665081232,\n      \"tag\": \"0026_storage-backend\",\n      \"breakpoints\": true\n    },\n    {\n      \"idx\": 27,\n      \"version\": \"7\",\n      \"when\": 1768676733859,\n      \"tag\": \"0027_special_the_santerians\",\n      \"breakpoints\": true\n    },\n    {\n      \"idx\": 28,\n      \"version\": \"7\",\n      \"when\": 1768733221276,\n      \"tag\": \"0028_graceful_ben_parker\",\n      \"breakpoints\": true\n    },\n    {\n      \"idx\": 29,\n      \"version\": \"7\",\n      \"when\": 1768743644834,\n      \"tag\": \"0029_lowly_white_tiger\",\n      \"breakpoints\": true\n    },\n    {\n      \"idx\": 30,\n      \"version\": \"7\",\n      \"when\": 1768763883339,\n      \"tag\": \"0030_dizzy_morlocks\",\n      \"breakpoints\": true\n    },\n    {\n      \"idx\": 31,\n      \"version\": \"7\",\n      \"when\": 1768931603846,\n      \"tag\": \"0031_chemical_edwin_jarvis\",\n      \"breakpoints\": true\n    },\n    {\n      \"idx\": 32,\n      \"version\": \"7\",\n      \"when\": 1769203863305,\n      \"tag\": \"0032_sparkling_thunderbolt_ross\",\n      \"breakpoints\": true\n    },\n    {\n      \"idx\": 33,\n      \"version\": \"7\",\n      \"when\": 1770923665015,\n      \"tag\": \"0033_handy_valeria_richards\",\n      \"breakpoints\": true\n    },\n    {\n      \"idx\": 34,\n      \"version\": \"7\",\n      \"when\": 1771790675240,\n      \"tag\": \"0034_lush_speed\",\n      \"breakpoints\": true\n    },\n    {\n      \"idx\": 35,\n      \"version\": \"7\",\n      \"when\": 1771922367910,\n      \"tag\": \"0035_late_young_avengers\",\n      \"breakpoints\": true\n    },\n    {\n      \"idx\": 36,\n      \"version\": \"7\",\n      \"when\": 1772200673674,\n      \"tag\": \"0036_chief_night_thrasher\",\n      \"breakpoints\": true\n    },\n    {\n      \"idx\": 37,\n      \"version\": \"7\",\n      \"when\": 1772200831628,\n      \"tag\": \"0037_neat_talon\",\n      \"breakpoints\": true\n    },\n    {\n      \"idx\": 38,\n      \"version\": \"7\",\n      \"when\": 1773433992397,\n      \"tag\": \"0038_misty_red_hulk\",\n      \"breakpoints\": true\n    },\n    {\n      \"idx\": 39,\n      \"version\": \"7\",\n      \"when\": 1773659096498,\n      \"tag\": \"0039_conscious_solo\",\n      \"breakpoints\": true\n    },\n    {\n      \"idx\": 40,\n      \"version\": \"7\",\n      \"when\": 1774375027038,\n      \"tag\": \"0040_quick_lester\",\n      \"breakpoints\": true\n    },\n    {\n      \"idx\": 41,\n      \"version\": \"7\",\n      \"when\": 1774378412843,\n      \"tag\": \"0041_spooky_radioactive_man\",\n      \"breakpoints\": true\n    },\n    {\n      \"idx\": 42,\n      \"version\": \"7\",\n      \"when\": 1774472168308,\n      \"tag\": \"0042_breezy_namora\",\n      \"breakpoints\": true\n    },\n    {\n      \"idx\": 43,\n      \"version\": \"7\",\n      \"when\": 1774643615673,\n      \"tag\": \"0043_peaceful_chat\",\n      \"breakpoints\": true\n    },\n    {\n      \"idx\": 44,\n      \"version\": \"7\",\n      \"when\": 1774648872657,\n      \"tag\": \"0044_steep_wiccan\",\n      \"breakpoints\": true\n    },\n    {\n      \"idx\": 45,\n      \"version\": \"7\",\n      \"when\": 1774696680244,\n      \"tag\": \"0045_needy_martin_li\",\n      \"breakpoints\": true\n    },\n    {\n      \"idx\": 46,\n      \"version\": \"7\",\n      \"when\": 1774706071024,\n      \"tag\": \"0046_mysterious_menace\",\n      \"breakpoints\": true\n    },\n    {\n      \"idx\": 47,\n      \"version\": \"7\",\n      \"when\": 1774768062658,\n      \"tag\": \"0047_wet_carnage\",\n      \"breakpoints\": true\n    },\n    {\n      \"idx\": 48,\n      \"version\": \"7\",\n      \"when\": 1774886139855,\n      \"tag\": \"0048_yellow_eddie_brock\",\n      \"breakpoints\": true\n    },\n    {\n      \"idx\": 49,\n      \"version\": \"7\",\n      \"when\": 1775585355435,\n      \"tag\": \"0049_chief_terrax\",\n      \"breakpoints\": true\n    },\n    {\n      \"idx\": 50,\n      \"version\": \"7\",\n      \"when\": 1775761395545,\n      \"tag\": \"0050_dark_saracen\",\n      \"breakpoints\": true\n    },\n    {\n      \"idx\": 51,\n      \"version\": \"7\",\n      \"when\": 1775762288699,\n      \"tag\": \"0051_young_senator_kelly\",\n      \"breakpoints\": true\n    },\n    {\n      \"idx\": 52,\n      \"version\": \"7\",\n      \"when\": 1775803959723,\n      \"tag\": \"0052_cute_punisher\",\n      \"breakpoints\": true\n    },\n    {\n      \"idx\": 53,\n      \"version\": \"7\",\n      \"when\": 1777204042208,\n      \"tag\": \"0053_lyrical_union_jack\",\n      \"breakpoints\": true\n    }\n  ]\n}"
  },
  {
    "path": "src/db/schema/00_common.ts",
    "content": "import {timestamp} from \"drizzle-orm/pg-core\";\nimport {z} from \"zod\";\n\nexport const timestamps = {\n    updatedAt: timestamp(\"updated_at\"),\n    createdAt: timestamp(\"created_at\").defaultNow().notNull(),\n    deletedAt: timestamp(\"deleted_at\"),\n}\n\nexport function schemaWithoutMeta<\n    T extends z.ZodTypeAny\n>(schema: T) {\n    // @ts-ignore\n    return schema.omit({id: true, createdAt: true, updatedAt: true, deletedAt: true});\n}\n"
  },
  {
    "path": "src/db/schema/01_setting.ts",
    "content": "import {boolean, pgTable, uuid, varchar} from \"drizzle-orm/pg-core\";\nimport {createSelectSchema} from \"drizzle-zod\";\nimport {z} from \"zod\";\nimport {timestamps} from \"@/db/schema/00_common\";\nimport {storageChannel} from \"@/db/schema/12_storage-channel\";\nimport {relations} from \"drizzle-orm\";\nimport {notificationChannel} from \"@/db/schema/09_notification-channel\";\n\nexport const setting = pgTable(\"settings\", {\n    id: uuid(\"id\").primaryKey().defaultRandom(),\n    name: varchar(\"name\", {length: 255}).unique().notNull(),\n    smtpPassword: varchar(\"smtp_password\", {length: 255}),\n    smtpFrom: varchar(\"smtp_from\", {length: 255}),\n    smtpHost: varchar(\"smtp_host\", {length: 255}),\n    smtpPort: varchar(\"smtp_port\", {length: 255}),\n    smtpUser: varchar(\"smtp_user\", {length: 255}),\n    smtpSecure: boolean(\"smtp_secure\"),\n    defaultNotificationChannelId: uuid('default_notification_channel_id')\n        .references(() => notificationChannel.id, {onDelete: \"set null\"}),\n    defaultStorageChannelId: uuid('default_storage_channel_id')\n        .references(() => storageChannel.id, {onDelete: \"set null\"}),\n    encryption: boolean(\"encryption\").default(false),\n    ...timestamps\n});\n\nexport const settingRelations = relations(setting, ({one, many}) => ({\n    storageChannel: one(storageChannel, {fields: [setting.defaultStorageChannelId], references: [storageChannel.id]}),\n    notificationChannel: one(notificationChannel, {fields: [setting.defaultNotificationChannelId], references: [notificationChannel.id]}),\n}));\n\n\nexport const settingSchema = createSelectSchema(setting);\nexport type Setting = z.infer<typeof settingSchema>;\n"
  },
  {
    "path": "src/db/schema/02_user.ts",
    "content": "import { relations } from \"drizzle-orm\";\nimport {\n  boolean,\n  integer,\n  pgEnum,\n  json,\n  pgTable,\n  text,\n  timestamp,\n  uuid,\n} from \"drizzle-orm/pg-core\";\nimport { createSelectSchema } from \"drizzle-zod\";\nimport { z } from \"zod\";\nimport { project } from \"./06_project\";\nimport { member } from \"@/db/schema/04_member\";\nimport { invitation } from \"@/db/schema/05_invitation\";\nimport { organization } from \"@/db/schema/03_organization\";\nimport { Account as BetterAuthAccount } from \"better-auth\";\nimport { timestamps } from \"@/db/schema/00_common\";\n\nexport const userThemeEnum = pgEnum(\"user_themes\", [\"light\", \"dark\", \"system\"]);\n\nexport const user = pgTable(\"user\", {\n  id: uuid(\"id\").defaultRandom().primaryKey(),\n  name: text(\"name\").notNull(),\n  email: text(\"email\").notNull().unique(),\n  emailVerified: boolean(\"email_verified\").notNull(),\n  image: text(\"image\"),\n  role: text(\"role\"),\n  theme: userThemeEnum().notNull().default(\"light\"),\n  banned: boolean(\"banned\"),\n  banReason: text(\"ban_reason\"),\n  banExpires: timestamp(\"ban_expires\"),\n  lastConnectedAt: timestamp(),\n  lastChangedPasswordAt: timestamp(),\n  twoFactorEnabled: boolean(\"two_factor_enabled\").default(false),\n  ...timestamps,\n});\n\nexport const session = pgTable(\"session\", {\n  id: uuid(\"id\").defaultRandom().primaryKey(),\n  expiresAt: timestamp(\"expires_at\").notNull(),\n  token: text(\"token\").notNull().unique(),\n  ipAddress: text(\"ip_address\"),\n  userAgent: text(\"user_agent\"),\n  userId: uuid(\"user_id\")\n    .notNull()\n    .references(() => user.id, { onDelete: \"cascade\" }),\n  providerId: text(\"provider_id\"),\n  impersonatedBy: text(\"impersonated_by\"), //id or name ????\n  activeOrganizationId: text(\"active_organization_id\"),\n  ...timestamps,\n});\n\nexport const account = pgTable(\"account\", {\n  id: uuid(\"id\").defaultRandom().primaryKey(),\n  accountId: text(\"account_id\").notNull(),\n  providerId: text(\"provider_id\").notNull(),\n  userId: uuid(\"user_id\")\n    .notNull()\n    .references(() => user.id, { onDelete: \"cascade\" }),\n  accessToken: text(\"access_token\"),\n  refreshToken: text(\"refresh_token\"),\n  idToken: text(\"id_token\"),\n  accessTokenExpiresAt: timestamp(\"access_token_expires_at\"),\n  refreshTokenExpiresAt: timestamp(\"refresh_token_expires_at\"),\n  scope: text(\"scope\"),\n  password: text(\"password\"),\n  ...timestamps,\n});\n\nexport const verification = pgTable(\"verification\", {\n  id: uuid(\"id\").defaultRandom().primaryKey(),\n  identifier: text(\"identifier\").notNull(),\n  value: text(\"value\").notNull(),\n  expiresAt: timestamp(\"expires_at\").notNull(),\n  ...timestamps,\n});\n\nexport const passkey = pgTable(\"passkey\", {\n  id: uuid(\"id\").defaultRandom().primaryKey(),\n  name: text(\"name\"),\n  publicKey: text().notNull(),\n  userId: uuid(\"user_id\")\n    .notNull()\n    .references(() => user.id, { onDelete: \"cascade\" }),\n  credentialID: text().notNull(),\n  counter: integer().notNull(),\n  deviceType: text().notNull(),\n  backedUp: boolean().notNull(),\n  transports: text(\"transports\"),\n  aaguid: text(\"aaguid\"),\n  ...timestamps,\n});\n\nexport const twoFactor = pgTable(\"two_factor\", {\n  id: uuid().defaultRandom().primaryKey(),\n  secret: text(\"secret\").notNull(),\n  backupCodes: text(\"backup_codes\").notNull(),\n  verified: boolean(\"verified\").notNull(),\n  userId: uuid(\"user_id\")\n    .notNull()\n    .references(() => user.id, { onDelete: \"cascade\" }),\n});\n\nexport const ssoProvider = pgTable(\"sso_provider\", {\n  id: uuid(\"id\").defaultRandom().primaryKey(),\n  issuer: text(\"issuer\").notNull(),\n  oidcConfig: json(\"oidc_config\"),\n  samlConfig: json(\"saml_config\"),\n  userId: uuid(\"user_id\").references(() => user.id, { onDelete: \"cascade\" }),\n  providerId: text(\"provider_id\").notNull().unique(),\n  organizationId: text(\"organization_id\"),\n  domain: text(\"domain\").notNull(),\n});\n\nexport const userRelations = relations(user, ({ many }) => ({\n  sessions: many(session),\n  accounts: many(account),\n  ssoProviders: many(ssoProvider),\n  memberships: many(member),\n  invitations: many(invitation),\n  passkeys: many(passkey),\n}));\n\nexport const sessionRelations = relations(session, ({ one }) => ({\n  user: one(user, {\n    fields: [session.userId],\n    references: [user.id],\n  }),\n}));\n\nexport const accountRelations = relations(account, ({ one }) => ({\n  user: one(user, {\n    fields: [account.userId],\n    references: [user.id],\n  }),\n}));\n\nexport const ssoProviderRelations = relations(ssoProvider, ({ one }) => ({\n  user: one(user, {\n    fields: [ssoProvider.userId],\n    references: [user.id],\n  }),\n}));\n\nexport const projectRelations = relations(project, ({ one }) => ({\n  organization: one(organization, {\n    fields: [project.organizationId],\n    references: [organization.id],\n  }),\n}));\n\nexport const passkeyRelations = relations(passkey, ({ one }) => ({\n  user: one(user, {\n    fields: [passkey.userId],\n    references: [user.id],\n  }),\n}));\n\nexport const userSchema = createSelectSchema(user);\nexport type User = z.infer<typeof userSchema>;\n\nexport const userThemeEnumSchema = createSelectSchema(userThemeEnum);\nexport type UserThemeEnum = z.infer<typeof userThemeEnumSchema>;\n\nexport const sessionSchema = createSelectSchema(session);\nexport type Session = z.infer<typeof sessionSchema>;\n\nexport const accountSchema = createSelectSchema(account);\nexport type Account = z.infer<typeof accountSchema>;\n\ntype FixedAccount = Omit<BetterAuthAccount, \"updatedAt\"> & {\n  updatedAt: Date | null;\n};\n\nexport type UserWithAccounts = User & {\n  accounts: FixedAccount[];\n};\n"
  },
  {
    "path": "src/db/schema/03_organization.ts",
    "content": "import {pgTable, text, uuid} from \"drizzle-orm/pg-core\";\nimport {relations} from \"drizzle-orm\";\nimport {Project, project} from \"./06_project\";\nimport {createSelectSchema} from \"drizzle-zod\";\nimport {z} from \"zod\";\nimport {invitation, OrganizationInvitation} from \"@/db/schema/05_invitation\";\nimport {member, OrganizationMember} from \"@/db/schema/04_member\";\nimport {User} from \"@/db/schema/02_user\";\nimport {timestamps} from \"@/db/schema/00_common\";\nimport {NotificationChannel, organizationNotificationChannel} from \"@/db/schema/09_notification-channel\";\nimport {organizationStorageChannel, StorageChannel} from \"@/db/schema/12_storage-channel\";\n\nexport const organization = pgTable(\"organization\", {\n    id: uuid(\"id\").defaultRandom().primaryKey(),\n    name: text(\"name\").notNull(),\n    slug: text(\"slug\").unique().notNull(),\n    logo: text(\"logo\"),\n    metadata: text(\"metadata\"),\n    ...timestamps\n});\n\n\nexport const organizationRelations = relations(organization, ({many}) => ({\n    members: many(member),\n    invitations: many(invitation),\n    projects: many(project),\n    notificationChannels: many(organizationNotificationChannel),\n    storageChannels: many(organizationStorageChannel),\n}));\n\n\nexport const organizationSchema = createSelectSchema(organization);\nexport type Organization = z.infer<typeof organizationSchema>;\n\nexport type OrganizationWithMembers = Organization & {\n    members: OrganizationMember[];\n};\n\nexport type MemberWithUser = OrganizationMember & {\n    user: User;\n};\n\nexport type OrganizationWithMembersAndUsers = Organization & {\n    members: MemberWithUser[];\n    invitations: OrganizationInvitation[];\n};\n\nexport type OrganizationWith = Organization & {\n    user?: User | null;\n    members?: MemberWithUser[] | null;\n    invitations?: OrganizationInvitation[] | null;\n    notificationChannels?: NotificationChannel[] | null;\n    storageChannels?: StorageChannel[] | null;\n    projects?: Project[] | null;\n};\n"
  },
  {
    "path": "src/db/schema/04_member.ts",
    "content": "import {pgTable, text, timestamp, uuid} from \"drizzle-orm/pg-core\";\nimport {User, user} from \"@/db/schema/02_user\";\nimport {organization} from \"@/db/schema/03_organization\";\nimport {relations} from \"drizzle-orm\";\nimport {createSelectSchema} from \"drizzle-zod\";\nimport {z} from \"zod\";\nimport {timestamps} from \"@/db/schema/00_common\";\n\n\nexport const member = pgTable(\"member\", {\n    id: uuid(\"id\").defaultRandom().primaryKey(),\n    organizationId: uuid(\"organization_id\")\n        .notNull()\n        .references(() => organization.id, { onDelete: \"cascade\" }),\n    userId: uuid(\"user_id\")\n        .notNull()\n        .references(() => user.id, { onDelete: \"cascade\" }),\n    role: text(\"role\").notNull(),\n    ...timestamps\n});\n\nexport const memberRelations = relations(member, ({ one }) => ({\n    user: one(user, {\n        fields: [member.userId],\n        references: [user.id],\n    }),\n    organization: one(organization, {\n        fields: [member.organizationId],\n        references: [organization.id],\n    }),\n}));\n\n\nexport const organizationMemberSchema = createSelectSchema(member);\nexport type OrganizationMember = z.infer<typeof organizationMemberSchema>;\n\n"
  },
  {
    "path": "src/db/schema/05_invitation.ts",
    "content": "import {relations} from \"drizzle-orm\";\nimport {user} from \"@/db/schema/02_user\";\nimport {organization} from \"@/db/schema/03_organization\";\nimport {createSelectSchema} from \"drizzle-zod\";\nimport {z} from \"zod\";\nimport {pgTable, text, timestamp, uuid} from \"drizzle-orm/pg-core\";\nimport {timestamps} from \"@/db/schema/00_common\";\n\n\nexport const invitation = pgTable(\"invitation\", {\n    id: uuid(\"id\").defaultRandom().primaryKey(),\n    organizationId: uuid(\"organization_id\")\n        .notNull()\n        .references(() => organization.id, { onDelete: \"cascade\" }),\n    email: text(\"email\").notNull(),\n    role: text(\"role\"),\n    status: text(\"status\").notNull(),\n    expiresAt: timestamp(\"expires_at\").notNull(),\n    inviterId: uuid(\"inviter_id\")\n        .notNull()\n        .references(() => user.id, { onDelete: \"cascade\" }),\n    ...timestamps\n});\n\n\n\nexport const invitationRelations = relations(invitation, ({ one }) => ({\n    organization: one(organization, {\n        fields: [invitation.organizationId],\n        references: [organization.id],\n    }),\n    inviter: one(user, {\n        fields: [invitation.inviterId],\n        references: [user.id],\n    }),\n}));\n\n\n\nexport const organizationInvitationSchema = createSelectSchema(invitation);\nexport type OrganizationInvitation = z.infer<typeof organizationInvitationSchema>;\n"
  },
  {
    "path": "src/db/schema/06_project.ts",
    "content": "import {pgTable, text, boolean, uuid} from \"drizzle-orm/pg-core\";\nimport {relations} from \"drizzle-orm\";\nimport {Organization, organization} from \"./03_organization\";\nimport {createSelectSchema} from \"drizzle-zod\";\nimport {z} from \"zod\";\nimport {Database, database, DatabaseWith} from \"./07_database\";\nimport {timestamps} from \"@/db/schema/00_common\";\n\nexport const project = pgTable(\"projects\", {\n    id: uuid(\"id\").primaryKey().defaultRandom(),\n    slug: text(\"slug\").notNull().unique(),\n    name: text(\"name\").notNull().notNull(),\n    isArchived: boolean(\"is_archived\").default(false),\n    organizationId: uuid(\"organization_id\")\n        .notNull()\n        .references(() => organization.id, {onDelete: \"cascade\"}),\n    ...timestamps\n});\n\nexport const projectRelations = relations(project, ({one, many}) => ({\n    organization: one(organization, {\n        fields: [project.organizationId],\n        references: [organization.id],\n    }),\n    databases: many(database),\n}));\n\nexport const projectSchema = createSelectSchema(project);\nexport type Project = z.infer<typeof projectSchema>;\n\nexport type ProjectWith = Project & {\n    databases: Database[];\n    organization: Organization;\n};\n\nexport type ProjectWithDatabasesAndBackups = Project & {\n    databases: DatabaseWith[];\n    organization: Organization;\n};\n\n"
  },
  {
    "path": "src/db/schema/07_database.ts",
    "content": "import {pgTable, text, boolean, timestamp, uuid, integer, pgEnum} from \"drizzle-orm/pg-core\";\nimport {Agent, agent, AgentWith} from \"./08_agent\";\nimport {Project, project} from \"./06_project\";\nimport {relations} from \"drizzle-orm\";\nimport {dbmsEnum, statusEnum} from \"./types\";\nimport {createSelectSchema} from \"drizzle-zod\";\nimport {z} from \"zod\";\nimport {timestamps} from \"@/db/schema/00_common\";\nimport {AlertPolicy, alertPolicy} from \"@/db/schema/10_alert-policy\";\nimport {StoragePolicy, storagePolicy} from \"@/db/schema/13_storage-policy\";\nimport {BackupStorage, backupStorage} from \"@/db/schema/14_storage-backup\";\n\nexport const database = pgTable(\"databases\", {\n    id: uuid(\"id\").primaryKey().defaultRandom(),\n    agentDatabaseId: uuid(\"agent_database_id\").notNull().defaultRandom(),\n    name: text(\"name\").notNull(),\n    dbms: dbmsEnum(\"dbms\").notNull(),\n    description: text(\"description\"),\n    backupPolicy: text(\"backup_policy\"),\n    isWaitingForBackup: boolean(\"is_waiting_for_backup\").default(false).notNull(),\n    backupToRestore: text(\"backup_to_restore\"),\n    healthErrorCount: integer(\"health_error_count\"),\n    agentId: uuid(\"agent_id\")\n        .notNull()\n        .references(() => agent.id, {onDelete: \"cascade\"}),\n    lastContact: timestamp(\"last_contact\"),\n    projectId: uuid(\"project_id\")\n        .references(() => project.id),\n    ...timestamps\n\n});\n\n\nexport const backup = pgTable(\n    \"backups\",\n    {\n        id: uuid(\"id\").primaryKey().defaultRandom(),\n        status: statusEnum(\"status\").default(\"waiting\").notNull(),\n        file: text(\"file\"),\n        fileSize: integer(\"file_size\"),\n        databaseId: uuid(\"database_id\")\n            .notNull()\n            .references(() => database.id, {onDelete: \"cascade\"}),\n        imported: boolean('imported').default(false),\n        migrated: boolean('migrated').default(false),\n        ...timestamps\n    },\n);\n\nexport const retentionPolicyType = pgEnum(\"retention_policy_type\", [\"count\", \"days\", \"gfs\"]);\n\nexport const retentionPolicy = pgTable(\"retention_policies\", {\n    id: uuid(\"id\").primaryKey().defaultRandom(),\n    databaseId: uuid(\"database_id\").notNull().references(() => database.id, {onDelete: \"cascade\"}),\n    type: retentionPolicyType(\"type\").notNull(),\n    count: integer(\"count\").default(7),   // for \"count\"\n    days: integer(\"days\").default(30),    // for \"days\"\n    gfsDaily: integer(\"gfs_daily\").default(7),\n    gfsWeekly: integer(\"gfs_weekly\").default(4),\n    gfsMonthly: integer(\"gfs_monthly\").default(12),\n    gfsYearly: integer(\"gfs_yearly\").default(3),\n    ...timestamps\n});\n\n\nexport const restoration = pgTable(\"restorations\", {\n    id: uuid(\"id\").primaryKey().defaultRandom(),\n    status: statusEnum(\"status\").default(\"waiting\").notNull(),\n\n    backupStorageId: uuid(\"backup_storage_id\")\n        .references(() => backupStorage.id, {onDelete: \"cascade\"}),\n    backupId: uuid(\"backup_id\")\n        .notNull()\n        .references(() => backup.id, {onDelete: \"cascade\"}),\n    databaseId: uuid(\"database_id\").references(() => database.id, {onDelete: \"cascade\"}),\n    ...timestamps\n\n});\n\nexport const databaseRelations = relations(database, ({one, many}) => ({\n    retentionPolicy: one(retentionPolicy, {\n        fields: [database.id],\n        references: [retentionPolicy.databaseId],\n    }),\n    agent: one(agent, {fields: [database.agentId], references: [agent.id]}),\n    project: one(project, {fields: [database.projectId], references: [project.id]}),\n    backups: many(backup),\n    restorations: many(restoration),\n    alertPolicies: many(alertPolicy),\n    storagePolicies: many(storagePolicy),\n}));\n\nexport const backupRelations = relations(backup, ({one, many}) => ({\n    database: one(database, {fields: [backup.databaseId], references: [database.id]}),\n    restorations: many(restoration),\n    storages: many(backupStorage),\n}));\n\nexport const restorationRelations = relations(restoration, ({one}) => ({\n    backup: one(backup, {fields: [restoration.backupId], references: [backup.id]}),\n    database: one(database, {fields: [restoration.databaseId], references: [database.id]}),\n    backupStorage: one(backupStorage, {fields: [restoration.backupStorageId], references: [backupStorage.id]}),\n}));\n\n\nexport const retentionPolicyRelations = relations(retentionPolicy, ({one}) => ({\n    database: one(database, {\n        fields: [retentionPolicy.databaseId],\n        references: [database.id],\n    }),\n}));\n\nexport const databaseSchema = createSelectSchema(database);\nexport type Database = z.infer<typeof databaseSchema>;\n\nexport const backupSchema = createSelectSchema(backup);\nexport type Backup = z.infer<typeof backupSchema>;\n\nexport const restorationSchema = createSelectSchema(restoration);\nexport type Restoration = z.infer<typeof restorationSchema>;\n\nexport const retentionPolicySchema = createSelectSchema(retentionPolicy);\nexport type RetentionPolicy = z.infer<typeof retentionPolicySchema>;\n\n\nexport type DatabaseWith = Database & {\n    agent?: Agent | AgentWith | null;\n    project?: Project | null;\n    backups?: Backup[] | null;\n    restorations?: Restoration[] | null;\n    retentionPolicy?: RetentionPolicy | null;\n    alertPolicies?: AlertPolicy[] | null;\n    storagePolicies?: StoragePolicy[] | null;\n};\n\n\nexport type BackupWith = Backup & {\n    restorations?: Restoration[] | null;\n    storages?: BackupStorage[] | null;\n};\n\n\n"
  },
  {
    "path": "src/db/schema/08_agent.ts",
    "content": "import {boolean, pgTable, text, timestamp, uuid, integer, unique} from \"drizzle-orm/pg-core\";\nimport {createSelectSchema} from \"drizzle-zod\";\nimport {z} from \"zod\";\nimport {Database, database} from \"@/db/schema/07_database\";\nimport {relations} from \"drizzle-orm\";\nimport {timestamps} from \"@/db/schema/00_common\";\nimport {organization} from \"@/db/schema/03_organization\";\n\nexport const agent = pgTable(\"agents\", {\n    id: uuid(\"id\").primaryKey().defaultRandom(),\n    slug: text(\"slug\").notNull().unique(),\n    version: text(\"version\"),\n    name: text(\"name\").notNull().notNull(),\n    healthErrorCount: integer(\"health_error_count\"),\n    description: text(\"description\").notNull(),\n    isArchived: boolean(\"is_archived\").default(false),\n    lastContact: timestamp(\"last_contact\"),\n    organizationId: uuid(\"organization_id\").references(() => organization.id, {onDelete: \"cascade\"}),\n    ...timestamps\n});\n\n\nexport const organizationAgent = pgTable(\n    \"organization_agents\",\n    {\n        organizationId: uuid('organization_id')\n            .notNull()\n            .references(() => organization.id, {onDelete: 'cascade'}),\n        agentId: uuid('agent_id')\n            .notNull()\n            .references(() => agent.id, {onDelete: 'cascade'}),\n        ...timestamps\n    },\n    (t) => [unique().on(t.organizationId, t.agentId)]\n\n);\n\nexport const agentSchema = createSelectSchema(agent);\nexport type Agent = z.infer<typeof agentSchema>;\n\n\nexport const agentRelations = relations(agent, ({many}) => ({\n    databases: many(database),\n    organizations: many(organizationAgent),\n}));\n\nexport const organizationAgentRelations = relations(organizationAgent, ({one}) => ({\n    organization: one(organization, {\n        fields: [organizationAgent.organizationId],\n        references: [organization.id],\n    }),\n    agent: one(agent, {\n        fields: [organizationAgent.agentId],\n        references: [agent.id],\n    }),\n}));\n\n\nexport type AgentWith = Agent & {\n    databases?: Database[] | null;\n    organizations: {\n        organizationId: string;\n        agentId: string;\n    }[];\n};\n\nexport type AgentWithDatabases = Agent & {\n    databases: Database[] | [];\n};\n\n"
  },
  {
    "path": "src/db/schema/09_notification-channel.ts",
    "content": "import {boolean, jsonb, pgEnum, pgTable, primaryKey, unique, uuid, varchar} from \"drizzle-orm/pg-core\";\nimport {timestamps} from \"@/db/schema/00_common\";\nimport {MemberWithUser, Organization, organization} from \"@/db/schema/03_organization\";\nimport {relations} from \"drizzle-orm\";\nimport {createSelectSchema} from \"drizzle-zod\";\nimport {z} from \"zod\";\nimport {OrganizationInvitation} from \"@/db/schema/05_invitation\";\n\n\nexport const providerKindEnum = pgEnum('provider_kind', ['slack', 'smtp', 'discord', 'telegram', 'gotify', 'ntfy', 'webhook']);\n\nexport const notificationChannel = pgTable('notification_channel', {\n    id: uuid(\"id\").defaultRandom().primaryKey(),\n    provider: providerKindEnum('provider').notNull(),\n    organizationId: uuid(\"organization_id\").references(() => organization.id, {onDelete: \"cascade\"}),\n    name: varchar('name', {length: 255}).notNull(),\n    config: jsonb('config').notNull(),\n    enabled: boolean('enabled').default(false).notNull(),\n    ...timestamps\n});\n\nexport const organizationNotificationChannel = pgTable(\n    \"organization_notification_channels\",\n    {\n        organizationId: uuid('organization_id')\n            .notNull()\n            .references(() => organization.id, {onDelete: 'cascade'}),\n        notificationChannelId: uuid('notification_channel_id')\n            .notNull()\n            .references(() => notificationChannel.id, {onDelete: 'cascade'}),\n    },\n    (t) => [unique().on(t.organizationId, t.notificationChannelId)]\n);\n\n\nexport const notificationChannelRelations = relations(notificationChannel, ({many}) => ({\n    organizations: many(organizationNotificationChannel),\n}));\n\nexport const organizationNotificationChannelRelations = relations(organizationNotificationChannel, ({one}) => ({\n    organization: one(organization, {\n        fields: [organizationNotificationChannel.organizationId],\n        references: [organization.id],\n    }),\n    notificationChannel: one(notificationChannel, {\n        fields: [organizationNotificationChannel.notificationChannelId],\n        references: [notificationChannel.id],\n    }),\n}));\n\nexport const notificationChannelSchema = createSelectSchema(notificationChannel);\nexport type NotificationChannel = z.infer<typeof notificationChannelSchema>;\n\n\nexport type NotificationChannelWith = NotificationChannel & {\n    organizations: {\n        organizationId: string;\n        notificationChannelId: string;\n    }[];\n};"
  },
  {
    "path": "src/db/schema/10_alert-policy.ts",
    "content": "import {boolean, pgEnum, pgTable, uuid} from \"drizzle-orm/pg-core\";\nimport {notificationChannel} from \"@/db/schema/09_notification-channel\";\nimport {timestamps} from \"@/db/schema/00_common\";\nimport {relations} from \"drizzle-orm\";\nimport {database} from \"@/db/schema/07_database\";\nimport {createSelectSchema} from \"drizzle-zod\";\nimport {z} from \"zod\";\n\nexport const eventKindEnum = pgEnum('event_kind', ['error_backup', 'error_restore', 'success_restore', 'success_backup', 'weekly_report', 'error_health_agent', 'error_health_database']);\n\nexport const alertPolicy = pgTable('alert_policy', {\n    id: uuid('id').defaultRandom().primaryKey(),\n    notificationChannelId: uuid('notification_channel_id')\n        .notNull()\n        .references(() => notificationChannel.id, {onDelete: 'cascade'}),\n    eventKinds: eventKindEnum(\"event_kind\").array().notNull(),\n    enabled: boolean('enabled').default(true).notNull(),\n    databaseId: uuid('database_id')\n        .notNull()\n        .references(() => database.id, { onDelete: 'cascade' }),\n    ...timestamps\n});\n\nexport const alertPolicyRelations = relations(alertPolicy, ({one}) => ({\n    notificationChannel: one(notificationChannel, {\n        fields: [alertPolicy.notificationChannelId],\n        references: [notificationChannel.id],\n    }),\n    database: one(database, {\n        fields: [alertPolicy.databaseId],\n        references: [database.id],\n    }),\n}));\n\n\n\n\nexport const alertPolicySchema = createSelectSchema(alertPolicy);\nexport type AlertPolicy = z.infer<typeof alertPolicySchema>;\n"
  },
  {
    "path": "src/db/schema/11_notification-log.ts",
    "content": "import {pgTable, uuid, timestamp, jsonb, varchar, boolean, text, pgEnum} from 'drizzle-orm/pg-core';\nimport {notificationChannel} from \"@/db/schema/09_notification-channel\";\nimport {alertPolicy} from \"@/db/schema/10_alert-policy\";\nimport {timestamps} from \"@/db/schema/00_common\";\nimport {createSelectSchema} from \"drizzle-zod\";\nimport {z} from \"zod\";\nimport {relations} from \"drizzle-orm\";\n\n\nexport const levelEnum = pgEnum('level', ['critical', 'warning', 'info']);\n\n\nexport const notificationLog = pgTable('notification_log', {\n    id: uuid('id').defaultRandom().primaryKey(),\n\n    channelId: uuid('channel_id').notNull(),\n    policyId: uuid('policy_id'),\n    organizationId: uuid('organization_id'),\n\n    event: text(\"event\"),\n    provider: text(\"provider\").notNull(),\n    providerName: text(\"provider_name\").notNull(),\n\n    title: varchar('title', {length: 255}).notNull(),\n    message: text('message').notNull(),\n    level: levelEnum('level').notNull(),\n    payload: jsonb('payload'),\n\n\n    success: boolean('success').notNull(),\n    error: text('error'),\n    providerResponse: jsonb('provider_response'),\n    sentAt: timestamp('sent_at').defaultNow().notNull(),\n\n    ...timestamps\n});\n\n\nexport const notificationChannelsToAlertPoliciesRelations = relations(notificationChannel, ({many}) => ({\n    alertPolicies: many(alertPolicy),\n}));\n\nexport const notificationLogSchema = createSelectSchema(notificationLog);\nexport type NotificationLog = z.infer<typeof notificationLogSchema>;\n\nexport type NotificationLevel = (typeof levelEnum.enumValues)[number];\n"
  },
  {
    "path": "src/db/schema/12_storage-channel.ts",
    "content": "import {boolean, jsonb, pgEnum, pgTable, unique, uuid, varchar} from \"drizzle-orm/pg-core\";\nimport {timestamps} from \"@/db/schema/00_common\";\nimport {organization} from \"@/db/schema/03_organization\";\nimport {relations} from \"drizzle-orm\";\nimport {createSelectSchema} from \"drizzle-zod\";\nimport {z} from \"zod\";\n\nexport const providerStorageKindEnum = pgEnum('provider_storage_kind', ['local', 's3', 'google-drive']);\n\nexport const storageChannel = pgTable('storage_channel', {\n    id: uuid(\"id\").defaultRandom().primaryKey(),\n    organizationId: uuid(\"organization_id\").references(() => organization.id, {onDelete: \"cascade\"}),\n    provider: providerStorageKindEnum('provider').notNull(),\n    name: varchar('name', {length: 255}).notNull(),\n    config: jsonb('config').notNull(),\n    enabled: boolean('enabled').default(false).notNull(),\n    ...timestamps\n});\n\nexport const organizationStorageChannel = pgTable(\n    \"organization_storage_channels\",\n    {\n        organizationId: uuid('organization_id')\n            .notNull()\n            .references(() => organization.id, {onDelete: 'cascade'}),\n        storageChannelId: uuid('storage_channel_id')\n            .notNull()\n            .references(() => storageChannel.id, {onDelete: 'cascade'}),\n    },\n    (t) => [unique().on(t.organizationId, t.storageChannelId)]\n);\n\nexport const storageChannelRelations = relations(storageChannel, ({many}) => ({\n    organizations: many(organizationStorageChannel),\n}));\n\nexport const organizationStorageChannelRelations = relations(organizationStorageChannel, ({one}) => ({\n    organization: one(organization, {\n        fields: [organizationStorageChannel.organizationId],\n        references: [organization.id],\n    }),\n    storageChannel: one(storageChannel, {\n        fields: [organizationStorageChannel.storageChannelId],\n        references: [storageChannel.id],\n    }),\n}));\n\nexport const storageChannelSchema = createSelectSchema(storageChannel);\nexport type StorageChannel = z.infer<typeof storageChannelSchema>;\n\n\nexport type StorageChannelWith = StorageChannel & {\n    organizations: {\n        organizationId: string;\n        storageChannelId: string;\n    }[];\n};"
  },
  {
    "path": "src/db/schema/13_storage-policy.ts",
    "content": "import {boolean, pgTable, uuid} from \"drizzle-orm/pg-core\";\nimport {timestamps} from \"@/db/schema/00_common\";\nimport {relations} from \"drizzle-orm\";\nimport {database} from \"@/db/schema/07_database\";\nimport {createSelectSchema} from \"drizzle-zod\";\nimport {z} from \"zod\";\nimport {StorageChannel, storageChannel} from \"@/db/schema/12_storage-channel\";\n\nexport const storagePolicy = pgTable('storage_policy', {\n    id: uuid('id').defaultRandom().primaryKey(),\n    storageChannelId: uuid('storage_channel_id')\n        .notNull()\n        .references(() => storageChannel.id, {onDelete: 'cascade'}),\n    enabled: boolean('enabled').default(true).notNull(),\n    databaseId: uuid('database_id')\n        .notNull()\n        .references(() => database.id, {onDelete: 'cascade'}),\n    ...timestamps\n});\n\nexport const storagePolicyRelations = relations(storagePolicy, ({one}) => ({\n    storageChannel: one(storageChannel, {\n        fields: [storagePolicy.storageChannelId],\n        references: [storageChannel.id],\n    }),\n    database: one(database, {\n        fields: [storagePolicy.databaseId],\n        references: [database.id],\n    }),\n}));\n\nexport const storagePolicySchema = createSelectSchema(storagePolicy);\nexport type StoragePolicy = z.infer<typeof storagePolicySchema>;\n\n\nexport type StoragePolicyWith = StoragePolicy & {\n    storageChannel: StorageChannel;\n};\n"
  },
  {
    "path": "src/db/schema/14_storage-backup.ts",
    "content": "import { pgTable, uuid, text, integer, pgEnum } from \"drizzle-orm/pg-core\";\nimport { timestamps } from \"@/db/schema/00_common\";\nimport {StorageChannel, storageChannel} from \"@/db/schema/12_storage-channel\";\nimport {Backup, backup, Restoration} from \"@/db/schema/07_database\";\nimport {relations} from \"drizzle-orm\";\nimport {createSelectSchema} from \"drizzle-zod\";\nimport {z} from \"zod\";\n\nexport const backupStorageStatusEnum = pgEnum(\"backup_storage_status\", [\n    \"pending\",\n    \"success\",\n    \"failed\",\n]);\n\nexport const backupStorage = pgTable(\"backup_storage\", {\n    id: uuid(\"id\").primaryKey().defaultRandom(),\n    backupId: uuid(\"backup_id\")\n        .notNull()\n        .references(() => backup.id, { onDelete: \"cascade\" }),\n    storageChannelId: uuid(\"storage_channel_id\")\n        .notNull()\n        .references(() => storageChannel.id, { onDelete: \"cascade\" }),\n    status: backupStorageStatusEnum(\"status\").notNull().default(\"pending\"),\n    path: text(\"path\"),\n    size: integer(\"size\"),\n    checksum: text(\"checksum\"),\n    ...timestamps,\n});\n\n\nexport const backupStorageRelations = relations(backupStorage, ({ one }) => ({\n    backup: one(backup, {\n        fields: [backupStorage.backupId],\n        references: [backup.id],\n    }),\n    storageChannel: one(storageChannel, {\n        fields: [backupStorage.storageChannelId],\n        references: [storageChannel.id],\n    }),\n}));\n\n\nexport const backupStorageSchema = createSelectSchema(backupStorage);\nexport type BackupStorage = z.infer<typeof backupStorageSchema>;\n\nexport type BackupStorageWith = BackupStorage & {\n    storageChannel?: StorageChannel | null;\n};\n\n\n"
  },
  {
    "path": "src/db/schema/15_healthcheck-log.ts",
    "content": "import {pgTable, uuid, timestamp, pgEnum} from 'drizzle-orm/pg-core';\nimport {timestamps} from \"@/db/schema/00_common\";\nimport {createSelectSchema} from \"drizzle-zod\";\nimport {z} from \"zod\";\n\nexport const healthcheckKindEnum = pgEnum('healthcheck_kind', ['database', 'agent']);\nexport const healthCheckStatusEnum = pgEnum('healthcheck_status', ['success', 'failed']);\n\n\nexport const healthcheckLog = pgTable('healthcheck_log', {\n    id: uuid('id').defaultRandom().primaryKey(),\n    kind: healthcheckKindEnum('kind').notNull(),\n    date: timestamp(\"date\").notNull(),\n    status: healthCheckStatusEnum(\"status\").notNull(),\n    objectId: uuid('object_id').notNull(),\n    ...timestamps\n});\n\nexport const healthcheckLogSchema = createSelectSchema(healthcheckLog);\nexport type HealthcheckLog = z.infer<typeof healthcheckLogSchema>;\n\nexport type HealthcheckKind = (typeof healthcheckKindEnum.enumValues)[number];\nexport type HealthcheckStatus = (typeof healthCheckStatusEnum.enumValues)[number];\n"
  },
  {
    "path": "src/db/schema/types.ts",
    "content": "import {pgEnum} from \"drizzle-orm/pg-core\";\nimport {createSelectSchema} from \"drizzle-zod\";\nimport {z} from \"zod\";\n\nexport const dbmsEnum = pgEnum(\"dbms_status\", [\"postgresql\", \"mysql\", \"mariadb\", \"mongodb\", \"sqlite\", \"redis\", \"valkey\", \"firebird\"]);\nexport const statusEnum = pgEnum(\"status\", [\"waiting\", \"ongoing\", \"failed\", \"success\"]);\nexport const typeStorageEnum = pgEnum(\"type_storage\", [\"local\", \"s3\"]);\n\nexport const dbmsEnumSchema = createSelectSchema(dbmsEnum);\nexport type EDbmsSchema = z.infer<typeof dbmsEnumSchema>;\n\nexport const statusEnumSchema = createSelectSchema(statusEnum);\nexport type EStatusSchema = z.infer<typeof statusEnumSchema>;\n\nexport const typeStorageEnumSchema = createSelectSchema(typeStorageEnum);\nexport type ETypeStorageSchema = z.infer<typeof typeStorageEnumSchema>;\n"
  },
  {
    "path": "src/db/services/agent.ts",
    "content": "import {and, desc, eq, sql} from \"drizzle-orm\";\nimport {db} from \"@/db\";\nimport {Agent, agent, organizationAgent} from \"@/db/schema/08_agent\";\nimport {Database, database} from \"@/db/schema/07_database\";\n\nexport async function getOrganizationAgents(organizationId: string) {\n\n    return await db\n        .select({\n            id: agent.id,\n            name: agent.name,\n            organizationId: agent.organizationId,\n            slug: agent.slug,\n            healthErrorCount: agent.healthErrorCount,\n            description: agent.description,\n            isArchived: agent.isArchived,\n            lastContact: agent.lastContact,\n            version: agent.version,\n            updatedAt: agent.updatedAt,\n            createdAt: agent.createdAt,\n            deletedAt: agent.deletedAt,\n            databases: sql<Database[]>`\n                COALESCE(\n                    json_agg(${database}.*) FILTER (WHERE ${database}.id IS NOT NULL),\n                    '[]'\n                )\n            `,\n        })\n        .from(organizationAgent)\n        .innerJoin(\n            agent,\n            eq(organizationAgent.agentId, agent.id)\n        )\n        .leftJoin(database, eq(database.agentId, agent.id))\n        .groupBy(agent.id)\n        .orderBy(desc(agent.createdAt))\n        .where(\n            and(\n                eq(organizationAgent.organizationId, organizationId),\n                eq(agent.isArchived, false)\n            )\n        ) as unknown as Agent[];\n}\n"
  },
  {
    "path": "src/db/services/backup.ts",
    "content": "\"use server\"\nimport {eq} from \"drizzle-orm\";\nimport * as drizzleDb from \"@/db\";\nimport {db} from \"@/db\";\n\nexport async function getDatabaseBackups(databaseId: string) {\n    return await db.query.backup.findMany({\n        where: eq(drizzleDb.schemas.backup.databaseId, databaseId),\n        with: {\n            restorations: true,\n            storages: {\n                with: {\n                    storageChannel: true,\n                },\n            },\n        },\n        orderBy: (b, {desc}) => [desc(b.createdAt)],\n    });\n}\n"
  },
  {
    "path": "src/db/services/database.ts",
    "content": "\"use server\"\nimport {db} from \"@/db\";\nimport {DatabaseWith} from \"@/db/schema/07_database\";\nimport {AgentWith} from \"@/db/schema/08_agent\";\n\nexport async function getOrganizationAvailableDatabases(\n    organizationId: string,\n    projectId?: string\n) {\n\n    const availableDatabases = (\n        await db.query.database.findMany({\n            where: (db, { eq, or, isNull }) =>\n                projectId\n                    ? or(isNull(db.projectId), eq(db.projectId, projectId))\n                    : isNull(db.projectId),\n            with: {\n                agent: {\n                    with: {\n                        organizations: true\n                    }\n                },\n                project: true,\n                backups: true,\n                restorations: true,\n            },\n            orderBy: (db, {desc}) => [desc(db.createdAt)],\n        })\n    ) as DatabaseWith[];\n\n    return availableDatabases.filter(db => {\n        const agent = db.agent as AgentWith;\n        if (agent?.isArchived) return false;\n        return (\n            agent?.organizationId === organizationId ||\n            agent?.organizations?.some(org => org.organizationId === organizationId)\n        );\n    })\n}\n"
  },
  {
    "path": "src/db/services/healthcheck.ts",
    "content": "import {db} from \"@/db\";\nimport * as drizzleDb from \"@/db\";\nimport {and, eq, gte, isNotNull, lt} from \"drizzle-orm\";\nimport {dispatchNotification} from \"@/features/notifications/dispatch\";\nimport {EventPayload} from \"@/features/notifications/types\";\nimport {logger} from \"@/lib/logger\";\n\nconst log = logger.child({module: \"tasks/healthcheck\"});\n\nexport async function getHealthLast12hLogs({id}: { id: string }) {\n    const now = new Date()\n    const since = new Date(now.getTime() - 12 * 60 * 60 * 1000)\n\n    return db\n        .select()\n        .from(drizzleDb.schemas.healthcheckLog)\n        .where(\n            and(\n                eq(drizzleDb.schemas.healthcheckLog.objectId, id),\n                gte(drizzleDb.schemas.healthcheckLog.date, since)\n            )\n        )\n}\n\nexport async function deleteHealthLogsOlderThan12h() {\n    const now = new Date()\n    const threshold = new Date(now.getTime() - 12 * 60 * 60 * 1000)\n\n    const logsToDelete = await db\n        .select()\n        .from(drizzleDb.schemas.healthcheckLog)\n        .where(\n            lt(drizzleDb.schemas.healthcheckLog.date, threshold)\n        )\n\n    log.info({name: \"deleteHealthLogsOlderThan12h\"},`Number of logs found to delete: ${logsToDelete.length}`)\n\n    await db\n        .delete(drizzleDb.schemas.healthcheckLog)\n        .where(\n            lt(drizzleDb.schemas.healthcheckLog.date, threshold)\n        )\n\n    return logsToDelete.length\n}\n\nexport async function checkAgentsHealthError() {\n    const agents = await db.query.agent.findMany({\n        where: isNotNull(drizzleDb.schemas.agent.lastContact),\n    });\n\n    const settings = await db.query.setting.findFirst({\n        where: (fields, {eq}) => eq(fields.name, \"system\"),\n    });\n\n    if (!settings) {\n        throw new Error(\"System settings not found\");\n    }\n\n    if (!settings.defaultNotificationChannelId) {\n        log.error({name: \"checkAgentsHealthError\"},`No default notification channel id found.`)\n        return\n    }\n\n    const now = new Date();\n\n    for (const agent of agents) {\n        if (!agent.lastContact) continue;\n\n        const lastContactDate = new Date(agent.lastContact);\n        const diffMinutes = (now.getTime() - lastContactDate.getTime()) / 1000 / 60;\n\n        if (diffMinutes > 10) {\n            if ((agent.healthErrorCount ?? 0) < 3) {\n\n                const newHealthErrorCount = (agent.healthErrorCount ?? 0) + 1\n                await db.update(drizzleDb.schemas.agent)\n                    .set({\n                        healthErrorCount: newHealthErrorCount,\n                    })\n                    .where(eq(drizzleDb.schemas.agent.id, agent.id));\n\n                const payload: EventPayload = {\n                    title: \"Agent down\",\n                    message: `Agent ${agent.name} is down, (notification number: ${newHealthErrorCount}/3)`,\n                    level: \"critical\",\n                    event: \"error_health_agent\",\n                    data: {\n                        agent: agent.name,\n                        id: agent.id,\n                        error: \"Agent is down\",\n                    },\n                };\n                log.info({name: \"checkAgentsHealthError\", payload: payload},`Agent Healthcheck Notification`)\n\n                await dispatchNotification(\n                    payload,\n                    undefined,\n                    settings.defaultNotificationChannelId,\n                    undefined\n                );\n            }\n\n        }\n    }\n}\n\n\n\nexport async function checkDatabasesHealthError() {\n\n    const databases = await db.query.database.findMany({\n        where: isNotNull(drizzleDb.schemas.database.lastContact),\n        with: {\n            agent: true,\n            alertPolicies: true\n        }\n    })\n\n    const now = new Date();\n\n    for (const database of databases) {\n        if (!database.lastContact) continue;\n\n        const lastContactDate = new Date(database.lastContact);\n        const diffMinutes = (now.getTime() - lastContactDate.getTime()) / 1000 / 60;\n\n        if (diffMinutes > 10) {\n            if ((database.healthErrorCount ?? 0) < 3) {\n\n                const newHealthErrorCount = (database.healthErrorCount ?? 0) + 1\n                await db.update(drizzleDb.schemas.database)\n                    .set({\n                        healthErrorCount: newHealthErrorCount,\n                    })\n                    .where(eq(drizzleDb.schemas.database.id, database.id));\n\n                const settings = await db.query.setting.findFirst({\n                    where: eq(drizzleDb.schemas.setting.name, \"system\"),\n                    with: { notificationChannel: true },\n                });\n\n                const defaultPolicy = settings?.notificationChannel\n                    ? [{\n                        id: null,\n                        notificationChannelId: settings.notificationChannel.id,\n                        enabled: settings.notificationChannel.enabled,\n                        eventKinds: [\"error_health_database\"]\n                    }]\n                    : [];\n\n                const policiesToUse = (database.alertPolicies && database.alertPolicies.length > 0)\n                    ? database.alertPolicies.filter(policy => policy.enabled && policy.eventKinds.includes(\"error_health_database\"))\n                    : defaultPolicy;\n\n                if (!policiesToUse || policiesToUse.length === 0) {\n                    continue\n                }\n\n                const promises = policiesToUse.map(alertPolicy => {\n\n                    const payload: EventPayload = {\n                        title: \"Database down\",\n                        message: `Database ${database.name} is down, (notification number: ${newHealthErrorCount}/3)`,\n                        level: \"critical\",\n                        event: \"error_health_database\",\n                        data: {\n                            agent: database.name,\n                            id: database.id,\n                            error: \"Database is down\",\n                        },\n                    };\n\n                    log.info({name: \"checkDatabasesHealthError\", payload: payload},`Database Healthcheck Notification`)\n\n                    return dispatchNotification(payload, alertPolicy.id == null ? undefined : alertPolicy.id, alertPolicy.id ? undefined : alertPolicy.notificationChannelId, undefined);\n                });\n\n                await Promise.all(promises);\n            }\n        }\n    }\n}\n\n\n"
  },
  {
    "path": "src/db/services/notification-channel.ts",
    "content": "import {desc, eq} from \"drizzle-orm\";\nimport {db} from \"@/db\";\nimport {\n    NotificationChannel,\n    notificationChannel,\n    organizationNotificationChannel\n} from \"@/db/schema/09_notification-channel\";\nimport {storageChannel} from \"@/db/schema/12_storage-channel\";\n\nexport async function getOrganizationChannels(organizationId: string) {\n    return await db\n        .select({\n            id: notificationChannel.id,\n            name: notificationChannel.name,\n            provider: notificationChannel.provider,\n            config: notificationChannel.config,\n            enabled: notificationChannel.enabled,\n            updatedAt: notificationChannel.updatedAt,\n            createdAt: notificationChannel.createdAt,\n            deletedAt: notificationChannel.deletedAt,\n            organizationId: notificationChannel.organizationId\n        })\n        .from(organizationNotificationChannel)\n        .innerJoin(\n            notificationChannel,\n            eq(organizationNotificationChannel.notificationChannelId, notificationChannel.id)\n        )\n        .orderBy(desc(notificationChannel.createdAt))\n        .where(eq(organizationNotificationChannel.organizationId, organizationId)) as unknown as NotificationChannel[];\n}\n"
  },
  {
    "path": "src/db/services/notification-log.ts",
    "content": "import {and, desc, eq, gte, lte} from 'drizzle-orm';\nimport {NotificationLevel, notificationLog} from \"@/db/schema/11_notification-log\";\nimport {notificationChannel} from \"@/db/schema/09_notification-channel\";\nimport {db} from \"@/db\";\nimport {Json} from \"drizzle-zod\";\n\nexport type NotificationLogWithRelations = {\n    id: string;\n    title: string;\n    level: NotificationLevel;\n    success: boolean;\n    error: string | null;\n    sentAt: Date;\n    payload: Json | null;\n    content: {\n        title: string;\n        message: string;\n    },\n    channel: {\n        name: string;\n        provider: string;\n    } | null;\n    policy: {\n        event: string | null;\n    } | null;\n};\n\nexport async function getNotificationHistory(\n    filters?: {\n        channelId?: string;\n        policyId?: string;\n        organizationId?: string;\n        level?: NotificationLevel;\n        success?: boolean;\n        from?: Date;\n        to?: Date;\n        limit?: number;\n    }\n): Promise<NotificationLogWithRelations[]> {\n    const where = [];\n    if (filters?.channelId) where.push(eq(notificationLog.channelId, filters.channelId));\n    if (filters?.policyId) where.push(eq(notificationLog.policyId, filters.policyId));\n    if (filters?.organizationId) where.push(eq(notificationLog.organizationId, filters.organizationId));\n    if (filters?.level) where.push(eq(notificationLog.level, filters.level));\n    if (typeof filters?.success === 'boolean') where.push(eq(notificationLog.success, filters.success));\n    if (filters?.from) where.push(gte(notificationLog.sentAt, filters.from));\n    if (filters?.to) where.push(lte(notificationLog.sentAt, filters.to));\n\n    const rows = await db\n        .select({\n            id: notificationLog.id,\n            title: notificationLog.title,\n            level: notificationLog.level,\n            success: notificationLog.success,\n            error: notificationLog.error,\n            sentAt: notificationLog.sentAt,\n            payload: notificationLog.payload,\n            content: {\n                title: notificationLog.title,\n                message: notificationLog.message,\n            },\n            channel: {\n                name: notificationLog.providerName,\n                provider: notificationLog.provider,\n            },\n            policy: {\n                event: notificationLog.event,\n            },\n        })\n        .from(notificationLog)\n        .leftJoin(notificationChannel, eq(notificationLog.channelId, notificationChannel.id))\n        // .leftJoin(alertPolicy, eq(notificationLog.policyId, alertPolicy.id))\n        .where(and(...where))\n        .orderBy(desc(notificationLog.sentAt))\n        .limit(filters?.limit || 100);\n\n    return rows.map(row => ({\n        ...row,\n        payload: row.payload as Json,\n    }));\n}\n"
  },
  {
    "path": "src/db/services/storage-channel.ts",
    "content": "import {desc, eq} from \"drizzle-orm\";\nimport {db} from \"@/db\";\nimport {organizationStorageChannel, StorageChannel, storageChannel} from \"@/db/schema/12_storage-channel\";\n\nexport async function getOrganizationStorageChannels(organizationId: string) {\n    return await db\n        .select({\n            id: storageChannel.id,\n            name: storageChannel.name,\n            provider: storageChannel.provider,\n            organizationId: storageChannel.organizationId,\n            config: storageChannel.config,\n            enabled: storageChannel.enabled,\n            updatedAt: storageChannel.updatedAt,\n            createdAt: storageChannel.createdAt,\n            deletedAt: storageChannel.deletedAt,\n        })\n        .from(organizationStorageChannel)\n        .innerJoin(\n            storageChannel,\n            eq(organizationStorageChannel.storageChannelId, storageChannel.id)\n        )\n        .orderBy(desc(storageChannel.createdAt))\n        .where(eq(organizationStorageChannel.organizationId, organizationId)) as unknown as StorageChannel[];\n}\n"
  },
  {
    "path": "src/db/services/user.ts",
    "content": "import {SignUpUser} from \"@/types/auth\";\nimport {hashPassword} from \"better-auth/crypto\";\nimport {db} from \"@/db\";\nimport * as drizzleDb from \"@/db\";\nimport {User, UserThemeEnum} from \"@/db/schema/02_user\";\n\n\nexport async function createUserDb(data: SignUpUser): Promise<User> {\n    const now = new Date();\n    const userId = crypto.randomUUID();\n\n    const [newUser] = await db.insert(drizzleDb.schemas.user).values({\n        id: userId,\n        name: data.name,\n        email: data.email,\n        emailVerified: true,\n        role: data.role,\n        createdAt: now,\n        updatedAt: now,\n        theme: data.theme as UserThemeEnum,\n    }).returning();\n\n    if (data.password) {\n        const hashedPassword = await hashPassword(data.password);\n        await db.insert(drizzleDb.schemas.account).values({\n            providerId: \"credential\",\n            accountId: userId,\n            userId: userId,\n            password: hashedPassword,\n            createdAt: now,\n            updatedAt: now,\n        });\n    }\n\n    return newUser\n}\n"
  },
  {
    "path": "src/db/utils/index.ts",
    "content": "export function withUpdatedAt<T extends object>(data: T): T & { updatedAt: Date } {\n    return {...data, updatedAt: new Date()};\n}"
  },
  {
    "path": "src/env.mjs",
    "content": "import { createEnv } from \"@t3-oss/env-nextjs\";\nimport path from \"path\";\nimport { z } from \"zod\";\nimport packageJson from \"../package.json\" with { type: \"json\" };\n\nconst { version } = packageJson;\n\nexport const env = createEnv({\n  server: {\n    NEXT_PUBLIC_PROJECT_VERSION: z.string().optional(),\n\n    NODE_ENV: z.enum([\"development\", \"production\"]).optional(),\n\n    DATABASE_URL: z.string().url().optional(),\n\n    PROJECT_NAME: z.string().optional(),\n    PROJECT_DESCRIPTION: z.string().optional(),\n    PROJECT_URL: z\n      .string()\n      .regex(/^https?:\\/\\//, \"URL must start with http:// or https://\"),\n    PROJECT_SECRET: z.string(),\n\n    TRUSTED_DOMAINS: z.string().optional(),\n\n    SMTP_PASSWORD: z.string().optional(),\n    SMTP_FROM: z.string().optional(),\n    SMTP_HOST: z.string().optional(),\n    SMTP_PORT: z.string().optional(),\n    SMTP_USER: z.string().optional(),\n\n\n    SMTP_SECURE: z\n        .enum([\"true\", \"false\"])\n        .transform((val) => val === \"true\")\n        .default(\"true\"),\n\n    AUTH_GOOGLE_ID: z.string().optional(),\n    AUTH_GOOGLE_SECRET: z.string().optional(),\n\n    AUTH_GITHUB_ID: z.string().optional(),\n    AUTH_GITHUB_SECRET: z.string().optional(),\n\n    RETENTION_CRON: z\n      .string()\n      .default(\n        process.env.NODE_ENV === \"production\" ? \"0 7 * * *\" : \"* * * * *\",\n      ),\n\n    CLEANING_HEALTHCHECK_LOGS_CRON: z\n      .string()\n      .default(\n        process.env.NODE_ENV === \"production\" ? \"0 * * * *\" : \"* * * * *\",\n      ),\n\n    HEALTHCHECK_CRON: z\n        .string()\n        .default(\n            process.env.NODE_ENV === \"production\" ? \"0 * * * *\" : \"* * * * *\",\n        ),\n\n\n\n    AUTH_OIDC_ID: z.string().optional().default(\"oidc\"),\n    AUTH_OIDC_TITLE: z.string().optional(),\n    AUTH_OIDC_DESC: z.string().optional(),\n    AUTH_OIDC_ICON: z.string().optional(),\n    AUTH_OIDC_CLIENT: z.string().optional(),\n    AUTH_OIDC_SECRET: z.string().optional(),\n    AUTH_OIDC_ISSUER_URL: z.string().optional(),\n    AUTH_OIDC_HOST: z.string().optional(),\n    AUTH_OIDC_SCOPES: z.string().optional(),\n    AUTH_OIDC_DISCOVERY_ENDPOINT: z.string().optional(),\n    AUTH_OIDC_JWKS_ENDPOINT: z.string().optional(),\n    AUTH_OIDC_PKCE: z.string().optional(),\n\n    AUTH_SOCIAL_ID: z.string().optional().default(\"social\"),\n    AUTH_SOCIAL_TITLE: z.string().optional(),\n    AUTH_SOCIAL_DESC: z.string().optional(),\n    AUTH_SOCIAL_ICON: z.string().optional(),\n    AUTH_SOCIAL_CLIENT: z.string().optional(),\n    AUTH_SOCIAL_SECRET: z.string().optional(),\n    AUTH_SOCIAL_APPLE_APP_BUNDLE_IDENTIFIER: z.string().optional(),\n\n    ALLOWED_GROUP: z.string().optional(),\n\n    AUTH_EMAIL_PASSWORD_ENABLED: z.string().optional().default(\"true\"),\n    AUTH_SIGNUP_ENABLED: z.string().optional().default(\"true\"),\n    AUTH_PASSKEY_ENABLED: z.string().optional().default(\"false\"),\n\n    AUTH_SYNC_OIDC_ROLES_ON_LOGIN: z.enum([\"true\", \"false\"]).default(\"true\"),\n    AUTH_ROLE_MAP: z.string().optional(),\n    AUTH_DEFAULT_ROLE: z.string().optional().default(\"pending\"),\n    AUTH_ALLOW_LINKING: z.enum([\"true\", \"false\"]).default(\"true\"),\n    AUTH_ALLOW_UNLINKING: z.enum([\"true\", \"false\"]).default(\"true\"),\n\n    PRIVATE_PATH: z.string().optional(),\n  },\n  client: {\n    NEXT_PUBLIC_PROJECT_VERSION: z.string().optional(),\n  },\n  runtimeEnv: {\n    NEXT_PUBLIC_PROJECT_VERSION: version || \"Unknown Version\",\n\n    PROJECT_NAME: process.env.PROJECT_NAME,\n    PROJECT_DESCRIPTION: process.env.PROJECT_DESCRIPTION,\n    PROJECT_URL: process.env.PROJECT_URL,\n    PROJECT_SECRET: process.env.PROJECT_SECRET,\n\n    DATABASE_URL: process.env.DATABASE_URL,\n\n    TRUSTED_DOMAINS: process.env.TRUSTED_DOMAINS,\n\n    SMTP_PASSWORD: process.env.SMTP_PASSWORD,\n    SMTP_FROM: process.env.SMTP_FROM,\n    SMTP_HOST: process.env.SMTP_HOST,\n    SMTP_PORT: process.env.SMTP_PORT,\n    SMTP_USER: process.env.SMTP_USER,\n    SMTP_SECURE: process.env.SMTP_SECURE,\n\n    RETENTION_CRON: process.env.RETENTION_CRON,\n    CLEANING_HEALTHCHECK_LOGS_CRON: process.env.CLEANING_HEALTHCHECK_LOGS_CRON,\n\n    AUTH_OIDC_ID: process.env.AUTH_OIDC_ID,\n    AUTH_OIDC_TITLE: process.env.AUTH_OIDC_TITLE,\n    AUTH_OIDC_DESC: process.env.AUTH_OIDC_DESC,\n    AUTH_OIDC_ICON: process.env.AUTH_OIDC_ICON,\n    AUTH_OIDC_CLIENT: process.env.AUTH_OIDC_CLIENT,\n    AUTH_OIDC_SECRET: process.env.AUTH_OIDC_SECRET,\n    AUTH_OIDC_ISSUER_URL: process.env.AUTH_OIDC_ISSUER_URL,\n    AUTH_OIDC_HOST: process.env.AUTH_OIDC_HOST,\n    AUTH_OIDC_SCOPES: process.env.AUTH_OIDC_SCOPES,\n    AUTH_OIDC_DISCOVERY_ENDPOINT: process.env.AUTH_OIDC_DISCOVERY_ENDPOINT,\n    AUTH_OIDC_JWKS_ENDPOINT: process.env.AUTH_OIDC_JWKS_ENDPOINT,\n    AUTH_OIDC_PKCE: process.env.AUTH_OIDC_PKCE,\n\n    AUTH_GOOGLE_ID: process.env.AUTH_GOOGLE_ID,\n    AUTH_GOOGLE_SECRET: process.env.AUTH_GOOGLE_SECRET,\n\n    AUTH_GITHUB_ID: process.env.AUTH_GITHUB_ID,\n    AUTH_GITHUB_SECRET: process.env.AUTH_GITHUB_SECRET,\n\n    AUTH_SOCIAL_ID: process.env.AUTH_SOCIAL_ID,\n    AUTH_SOCIAL_TITLE: process.env.AUTH_SOCIAL_TITLE,\n    AUTH_SOCIAL_DESC: process.env.AUTH_SOCIAL_DESC,\n    AUTH_SOCIAL_ICON: process.env.AUTH_SOCIAL_ICON,\n    AUTH_SOCIAL_CLIENT: process.env.AUTH_SOCIAL_CLIENT,\n    AUTH_SOCIAL_SECRET: process.env.AUTH_SOCIAL_SECRET,\n\n    ALLOWED_GROUP: process.env.ALLOWED_GROUP,\n\n    AUTH_EMAIL_PASSWORD_ENABLED: process.env.AUTH_EMAIL_PASSWORD_ENABLED,\n    AUTH_SIGNUP_ENABLED: process.env.AUTH_SIGNUP_ENABLED,\n    AUTH_PASSKEY_ENABLED: process.env.AUTH_PASSKEY_ENABLED,\n\n    AUTH_SYNC_OIDC_ROLES_ON_LOGIN: process.env.AUTH_SYNC_OIDC_ROLES_ON_LOGIN,\n\n    AUTH_ROLE_MAP: process.env.AUTH_ROLE_MAP,\n\n    AUTH_ALLOW_LINKING: process.env.AUTH_ALLOW_LINKING,\n    AUTH_ALLOW_UNLINKING: process.env.AUTH_ALLOW_UNLINKING,\n\n    PRIVATE_PATH:\n      process.env.PRIVATE_PATH || path.join(process.cwd(), \"private\"),\n  },\n});\n"
  },
  {
    "path": "src/features/agents/agents.action.ts",
    "content": "\"use server\";\nimport {ActionError, userAction} from \"@/lib/safe-actions/actions\";\nimport {AgentSchema} from \"@/features/agents/agents.schema\";\nimport {z} from \"zod\";\nimport {eq, and, ne, count} from \"drizzle-orm\";\nimport {db} from \"@/db\";\nimport * as drizzleDb from \"@/db\";\nimport {slugify} from \"@/utils/slugify\";\nimport {getHealthLast12hLogs} from \"@/db/services/healthcheck\";\n\nconst verifySlugUniqueness = async (slug: string, agentId?: string) => {\n    const conditions = agentId ? and(eq(drizzleDb.schemas.agent.slug, slug), ne(drizzleDb.schemas.agent.id, agentId)) : eq(drizzleDb.schemas.agent.slug, slug);\n    const [countResult] = await db.select({count: count()}).from(drizzleDb.schemas.agent).where(conditions);\n    if (countResult.count > 0) {\n        throw new ActionError(\"Slug already exists\");\n    }\n};\n\nexport const createAgentAction = userAction.schema(\n    z.object({\n        organizationId: z.string().optional(),\n        data: AgentSchema,\n    })\n).action(async ({parsedInput}) => {\n    const slug = slugify(parsedInput.data.name);\n    await verifySlugUniqueness(slug);\n\n    const [createdAgent] = await db.insert(drizzleDb.schemas.agent).values({...parsedInput.data, slug: slug, organizationId: parsedInput.organizationId}).returning();\n\n    if (createdAgent && parsedInput.organizationId){\n            await db.insert(drizzleDb.schemas.organizationAgent).values({\n                organizationId: parsedInput.organizationId,\n                agentId: createdAgent.id,\n            });\n    }\n\n    return {\n        data: createdAgent,\n    };\n});\n\nexport const updateAgentAction = userAction\n    .schema(\n        z.object({\n            id: z.string(),\n            data: AgentSchema,\n        })\n    )\n    .action(async ({parsedInput}) => {\n        const slug = slugify(parsedInput.data.name);\n        await verifySlugUniqueness(slug, parsedInput.id);\n\n        const [updatedAgent] = await db.update(drizzleDb.schemas.agent).set({\n            ...parsedInput.data,\n            slug: slug\n        }).where(eq(drizzleDb.schemas.agent.id, parsedInput.id)).returning();\n\n        return {\n            data: updatedAgent,\n        };\n    });\n\nexport const getAgentAction = userAction.schema(z.string()).action(async ({parsedInput}) => {\n    const agent = await db.query.agent.findFirst({\n        where: eq(drizzleDb.schemas.agent.id, parsedInput),\n        with: {\n            databases: true\n        }\n    });\n\n    return {\n        data: agent,\n        health: agent ? await getHealthLast12hLogs({ id: agent.id }) : []\n    };\n});\n\n"
  },
  {
    "path": "src/features/agents/agents.schema.ts",
    "content": "import { z } from \"zod\";\n\nexport const AgentSchema = z.object({\n    name: z.string().nonempty(\"Name is required\"),\n    description: z.string(),\n\n});\n\nexport type AgentType = z.infer<typeof AgentSchema>;\n"
  },
  {
    "path": "src/features/agents/components/agent-organizations.action.ts",
    "content": "\"use server\"\nimport {userAction} from \"@/lib/safe-actions/actions\";\nimport {z} from \"zod\";\nimport {ServerActionResult} from \"@/types/action-type\";\nimport {db} from \"@/db\";\nimport {and, eq, inArray} from \"drizzle-orm\";\nimport * as drizzleDb from \"@/db\";\nimport {AgentWith} from \"@/db/schema/08_agent\";\nimport {withUpdatedAt} from \"@/db/utils\";\n\n\nexport const updateAgentOrganizationsAction = userAction\n    .schema(\n        z.object({\n            data: z.array(z.string()),\n            id: z.string(),\n        })\n    )\n    .action(async ({parsedInput , ctx}): Promise<ServerActionResult<null>> => {\n        try {\n            const organizationsIds = parsedInput.data;\n            const agentId = parsedInput.id;\n\n            const agent = await db.query.agent.findFirst({\n                where: eq(drizzleDb.schemas.agent.id, agentId),\n                with: {\n                    organizations: true,\n                    databases: true\n                }\n            }) as AgentWith;\n\n\n            if (!agent) {\n                return {\n                    success: false,\n                    actionError: {\n                        message: \"Agent not found.\",\n                        status: 404,\n                        cause: \"not_found\",\n                    },\n                };\n            }\n\n            const existingItemIds = agent.organizations.map((organization) => organization.organizationId);\n\n            const organizationsToAdd = organizationsIds.filter((id) => !existingItemIds.includes(id));\n            const organizationsToRemove = existingItemIds.filter((id) => !organizationsIds.includes(id));\n\n            if (organizationsToAdd.length > 0) {\n                for (const organizationToAdd of organizationsToAdd) {\n                    await db.insert(drizzleDb.schemas.organizationAgent).values({\n                        organizationId: organizationToAdd,\n                        agentId: agentId\n                    });\n                }\n            }\n            if (organizationsToRemove.length > 0) {\n                await db.delete(drizzleDb.schemas.organizationAgent).where(and(inArray(drizzleDb.schemas.organizationAgent.organizationId, organizationsToRemove), eq(drizzleDb.schemas.organizationAgent.agentId,agentId))).execute();\n\n                const organizationsToRemoveDetails = await db.query.organization.findMany({\n                    where: inArray(drizzleDb.schemas.organization.id, organizationsToRemove),\n                    with: {\n                        projects: true\n                    }\n                });\n\n                const projectIds = organizationsToRemoveDetails.flatMap(org =>\n                    org.projects.map(project => project.id)\n                );\n\n                if (projectIds.length > 0) {\n                    const databases = await db.query.database.findMany({\n                        where: (db, { inArray }) => inArray(db.projectId, projectIds),\n                        columns: { id: true }\n                    });\n\n                    const databaseIds = databases.map(d => d.id);\n\n                    await db\n                        .update(drizzleDb.schemas.database)\n                        .set(withUpdatedAt({\n                            backupPolicy: null,\n                            projectId: null\n                        }))\n                        .where(inArray(drizzleDb.schemas.database.projectId, projectIds))\n                        .execute();\n\n                    await db.delete(drizzleDb.schemas.retentionPolicy)\n                        .where(inArray(drizzleDb.schemas.retentionPolicy.databaseId, databaseIds))\n                        .execute();\n\n                    await db.delete(drizzleDb.schemas.alertPolicy)\n                        .where(inArray(drizzleDb.schemas.alertPolicy.databaseId, databaseIds))\n                        .execute();\n\n                    await db.delete(drizzleDb.schemas.storagePolicy)\n                        .where(inArray(drizzleDb.schemas.storagePolicy.databaseId, databaseIds))\n                        .execute();\n\n\n\n\n                }\n\n\n            }\n\n            return {\n                success: true,\n                value: null,\n                actionSuccess: {\n                    message: \"Agent organizations has been successfully updated.\",\n                    messageParams: {agentId: agentId},\n                },\n            };\n        } catch (error) {\n            console.error(\"Error updating agent organizations:\", error);\n            return {\n                success: false,\n                actionError: {\n                    message: \"Failed to update agent organizations.\",\n                    status: 500,\n                    cause: \"server_error\",\n                    messageParams: {message: \"Error updating the agent organizations\"},\n                },\n            };\n        }\n    });\n\n"
  },
  {
    "path": "src/features/agents/components/agent-organizations.form.tsx",
    "content": "\"use client\";\n\nimport {useRouter} from \"next/navigation\";\nimport {useMutation} from \"@tanstack/react-query\";\nimport {Form, FormControl, FormField, FormItem, useZodForm} from \"@/components/ui/form\";\nimport {ButtonWithLoading} from \"@/components/wrappers/common/button/button-with-loading\";\nimport {OrganizationWithMembers} from \"@/db/schema/03_organization\";\nimport {MultiSelect} from \"@/components/wrappers/common/multiselect/multi-select\";\nimport {toast} from \"sonner\";\nimport {AgentWith} from \"@/db/schema/08_agent\";\nimport {AgentOrganizationSchema, AgentOrganizationType} from \"@/features/agents/components/agent-organizations.schema\";\nimport {updateAgentOrganizationsAction} from \"@/features/agents/components/agent-organizations.action\";\n\n\ntype AgentOrganisationFormProps = {\n    organizations?: OrganizationWithMembers[];\n    defaultValues?: AgentWith\n};\n\nexport const AgentOrganisationForm = ({\n                                          organizations,\n                                          defaultValues,\n                                      }: AgentOrganisationFormProps) => {\n\n    const router = useRouter();\n\n    const defaultOrganizationIds = defaultValues?.organizations?.map(organization => organization.organizationId) ?? []\n\n\n    const form = useZodForm({\n        schema: AgentOrganizationSchema,\n        // @ts-ignore\n        defaultValues: {\n            organizations: defaultOrganizationIds\n        },\n    });\n\n    const formatOrganizationsList = (organizations: OrganizationWithMembers[]) => {\n        return organizations\n            .map((organization) => ({\n                value: organization.id,\n                label: `${organization.name}`,\n            }));\n    };\n\n\n    const mutation = useMutation({\n        mutationFn: async (values: AgentOrganizationType) => {\n\n            const payload = {\n                data: values.organizations,\n                id: defaultValues?.id ?? \"\"\n            };\n\n            const result =  await updateAgentOrganizationsAction(payload)\n            const inner = result?.data;\n\n            if (inner?.success) {\n                toast.success(inner.actionSuccess?.message);\n                router.refresh();\n            } else {\n                toast.error(inner?.actionError?.message);\n            }\n        }\n    });\n\n\n    return (\n\n        <Form\n            form={form}\n            className=\"flex flex-col gap-4\"\n            onSubmit={async (values) => {\n                await mutation.mutateAsync(values);\n            }}\n        >\n            <FormField\n                control={form.control}\n                name={`organizations`}\n                render={({field}) => (\n                    <FormItem>\n                        <FormControl>\n                            <MultiSelect\n                                options={formatOrganizationsList(organizations ?? [])}\n                                onValueChange={field.onChange}\n                                defaultValue={field.value ?? []}\n                                placeholder=\"Select organization(s)\"\n                                variant=\"inverted\"\n                                animation={0}\n                            />\n                        </FormControl>\n                    </FormItem>\n                )}\n            />\n\n            <div className=\"flex justify-end\">\n                <div className=\"flex gap-2 justify-end\">\n                    <ButtonWithLoading isPending={mutation.isPending}>\n                        Save\n                    </ButtonWithLoading>\n                </div>\n\n            </div>\n        </Form>\n    );\n};\n"
  },
  {
    "path": "src/features/agents/components/agent-organizations.schema.ts",
    "content": "import {z} from \"zod\";\n\nexport const AgentOrganizationSchema = z.object({\n    organizations: z.array(z.string().uuid())\n});\n\nexport type AgentOrganizationType = z.infer<typeof AgentOrganizationSchema>;\n"
  },
  {
    "path": "src/features/agents/components/agent.dialog.tsx",
    "content": "\"use client\";\n\nimport {\n    Dialog,\n    DialogContent,\n    DialogHeader,\n    DialogTitle,\n    DialogTrigger,\n} from \"@/components/ui/dialog\";\nimport {AgentForm} from \"@/features/agents/components/agent.form\";\nimport {Button, buttonVariants} from \"@/components/ui/button\";\nimport {Plus} from \"lucide-react\";\nimport {GearIcon} from \"@radix-ui/react-icons\";\nimport {EmptyStatePlaceholder} from \"@/components/wrappers/common/empty-state-placeholder\";\nimport {useState} from \"react\";\nimport {useRouter} from \"next/navigation\";\nimport {OrganizationWithMembers} from \"@/db/schema/03_organization\";\nimport {Tabs, TabsContent, TabsList, TabsTrigger} from \"@/components/ui/tabs\";\nimport {AgentOrganisationForm} from \"@/features/agents/components/agent-organizations.form\";\nimport {AgentWith} from \"@/db/schema/08_agent\";\n\ntype AgentDialogProps = {\n    agent?: AgentWith;\n    typeTrigger: \"edit\" | \"empty\" | \"create\";\n    organization?: OrganizationWithMembers;\n    adminView?: boolean,\n    organizations?: OrganizationWithMembers[];\n};\n\nexport const AgentDialog = ({agent, typeTrigger, organization, adminView, organizations}: AgentDialogProps) => {\n    const [open, setOpen] = useState(false);\n    const isEdit = !!agent;\n    const router = useRouter();\n\n    const getTrigger = () => {\n        switch (typeTrigger) {\n            case \"edit\":\n                return (\n                    <div className={buttonVariants({variant: \"outline\", className: \"cursor-pointer\"})}>\n                        <GearIcon className=\"w-7 h-7\"/>\n                    </div>\n                );\n            case \"empty\":\n                return <EmptyStatePlaceholder className=\"h-full\" text=\"Create new Agent\"/>;\n            case \"create\":\n                return <Button><Plus className=\"mr-2 h-4 w-4\"/> Create Agent</Button>;\n            default:\n                return <Button><Plus className=\"mr-2 h-4 w-4\"/> Create Agent</Button>;\n        }\n    };\n\n    return (\n        <Dialog open={open} onOpenChange={setOpen}>\n            <DialogTrigger asChild>{getTrigger()}</DialogTrigger>\n            <DialogContent\n                onOpenAutoFocus={(e) => e.preventDefault()}\n            >\n                <DialogHeader>\n                    <DialogTitle>{isEdit ? `Edit ${agent.name}` : \"Create new agent\"}</DialogTitle>\n                </DialogHeader>\n                <>\n                    {adminView ?\n                        <Tabs className=\"flex flex-col flex-1\" defaultValue=\"configuration\">\n                            <TabsList className=\"grid w-full grid-cols-2\">\n                                <TabsTrigger value=\"configuration\">Configuration</TabsTrigger>\n                                <TabsTrigger value=\"organizations\">Organizations</TabsTrigger>\n                            </TabsList>\n                            <TabsContent className=\"h-full justify-between\" value=\"configuration\">\n                                <AgentForm\n                                    organization={organization}\n                                    onSuccess={() => {\n                                        setOpen(false)\n                                        router.refresh()\n                                    }}\n                                    defaultValues={agent}\n                                    agentId={agent?.id}\n                                />\n                            </TabsContent>\n                            <TabsContent className=\"h-full justify-between\" value=\"organizations\">\n                                <AgentOrganisationForm\n                                    defaultValues={agent}\n                                    organizations={organizations}\n                                />\n                            </TabsContent>\n                        </Tabs>\n                        :\n                        <>\n                            <AgentForm\n                                organization={organization}\n                                onSuccess={() => {\n                                    setOpen(false)\n                                    router.refresh()\n                                }}\n                                defaultValues={agent}\n                                agentId={agent?.id}\n                            />\n                        </>\n                    }\n                </>\n            </DialogContent>\n        </Dialog>\n    );\n};\n"
  },
  {
    "path": "src/features/agents/components/agent.form.tsx",
    "content": "\"use client\";\n\nimport {\n    FormControl,\n    FormDescription,\n    FormField,\n    FormItem,\n    FormLabel,\n    FormMessage,\n    useZodForm\n} from \"@/components/ui/form\";\nimport {Input} from \"@/components/ui/input\";\nimport {Form} from \"@/components/ui/form\";\nimport {Button} from \"@/components/ui/button\";\nimport {useRouter} from \"next/navigation\";\nimport {useMutation, useQueryClient} from \"@tanstack/react-query\";\nimport {TooltipProvider} from \"@/components/ui/tooltip\";\nimport {AgentSchema, AgentType} from \"@/features/agents/agents.schema\";\nimport {toast} from \"sonner\";\nimport {createAgentAction, updateAgentAction} from \"@/features/agents/agents.action\";\nimport {OrganizationWithMembers} from \"@/db/schema/03_organization\";\n\nexport type agentFormProps = {\n    defaultValues?: AgentType;\n    agentId?: string;\n    onSuccess?: (data: any) => void;\n    organization?: OrganizationWithMembers;\n\n};\n\nexport const AgentForm = (props: agentFormProps) => {\n    const isCreate = !Boolean(props.defaultValues);\n    const queryClient = useQueryClient();\n\n    const form = useZodForm({\n        schema: AgentSchema,\n        defaultValues: props.defaultValues,\n    });\n\n    const router = useRouter();\n\n    const mutation = useMutation({\n        mutationFn: async (values: AgentType) => {\n\n            const createAgent = isCreate\n                ? await createAgentAction({\n                    organizationId: props.organization?.id ?? undefined,\n                    data: values\n                })\n                : await updateAgentAction({\n                    id: props.agentId ?? \"-\",\n                    data: values,\n                });\n\n            const data = createAgent?.data?.data;\n\n            if (createAgent?.serverError || !data) {\n                toast.error(createAgent?.serverError);\n                return;\n            }\n            toast.success(`Success ${isCreate ? \"creating\" : \"updating\"} agent`);\n            \n            if (!isCreate && props.agentId) {\n                queryClient.invalidateQueries({ queryKey: [\"agent-data\", props.agentId] });\n            }\n            \n            if (props.onSuccess) {\n                props.onSuccess(data);\n            } else {\n                router.push(props.organization ?`/dashboard/settings/agents/${data.id}` : `/dashboard/agents/${data.id}`);\n            }\n        },\n    });\n\n\n    return (\n        <TooltipProvider>\n            <Form\n                form={form}\n                className=\"flex flex-col gap-4\"\n                onSubmit={async (values) => {\n                    await mutation.mutateAsync(values);\n                }}\n            >\n                <FormField\n                    control={form.control}\n                    name=\"name\"\n                    defaultValue=\"\"\n                    render={({field}) => (\n                        <FormItem>\n                            <FormLabel>Name</FormLabel>\n                            <FormControl>\n                                <Input placeholder=\"Agent 1\" {...field} />\n                            </FormControl>\n                            <FormDescription>Your agent project name</FormDescription>\n                            <FormMessage/>\n                        </FormItem>\n                    )}\n                />\n                <FormField\n                    control={form.control}\n                    defaultValue=\"\"\n                    name=\"description\"\n                    render={({field}) => (\n                        <FormItem>\n                            <FormLabel>Description</FormLabel>\n                            <FormControl>\n                                <Input placeholder=\"This agent is for the client example.com\" {...field}\n                                       value={field.value ?? \"\"}/>\n                            </FormControl>\n                            <FormDescription>Enter your project agent description</FormDescription>\n                            <FormMessage/>\n                        </FormItem>\n                    )}\n                />\n                <div className=\"flex justify-end\">\n                    <Button type=\"submit\">\n                        {isCreate ? \"Create\" : \"Update\"}\n                    </Button>\n                </div>\n            </Form>\n\n        </TooltipProvider>\n    );\n};\n"
  },
  {
    "path": "src/features/agents/hooks/use-agent-update-check.ts",
    "content": "\"use client\";\n\nimport {useQuery} from \"@tanstack/react-query\";\nimport {getNewAgentRelease} from \"@/features/updates/services/github\";\n\nexport const useAgentUpdateCheck = (currentVersion?: string | null) => {\n    const {data: newRelease, isLoading} = useQuery({\n        queryKey: [\"agent-new-release\", currentVersion],\n        queryFn: () => currentVersion ? getNewAgentRelease(currentVersion) : Promise.resolve(null),\n        staleTime: 1000 * 60 * 60,\n        enabled: !!currentVersion,\n    });\n\n    return {\n        newRelease,\n        isLoading,\n        isUpdateAvailable: !!newRelease,\n    };\n};\n"
  },
  {
    "path": "src/features/browser/theme-meta-updater-root.tsx",
    "content": "\"use client\";\n\nimport {useTheme} from \"next-themes\";\nimport {useEffect, useState} from \"react\";\n\nexport function ThemeMetaUpdaterRoot() {\n    const {resolvedTheme} = useTheme();\n    const [mounted, setMounted] = useState(false);\n\n    useEffect(() => {\n        setMounted(true);\n    }, []);\n\n    useEffect(() => {\n        if (!mounted || !resolvedTheme) return;\n\n        const color = resolvedTheme === \"dark\" ? \"#000000\" : \"#ffffff\";\n        let tag = document.querySelector<HTMLMetaElement>('meta[name=\"theme-color\"]');\n        if (!tag) {\n            tag = document.createElement(\"meta\");\n            tag.name = \"theme-color\";\n            document.head.appendChild(tag);\n        }\n        tag.content = color;\n    }, [mounted, resolvedTheme]);\n\n    return null;\n}\n"
  },
  {
    "path": "src/features/browser/theme-meta-updater.tsx",
    "content": "\"use client\";\n\nimport {useTheme} from \"next-themes\";\nimport {useEffect, useState} from \"react\";\nimport {authClient} from \"@/lib/auth/auth-client\";\n\nexport function ThemeMetaUpdater() {\n    const {setTheme, resolvedTheme} = useTheme();\n    const {data: session, isPending} = authClient.useSession();\n    const [mounted, setMounted] = useState(false);\n\n    useEffect(() => {\n        setMounted(true);\n    }, []);\n\n    useEffect(() => {\n        if (isPending || !session?.user?.theme) return;\n        setTheme(session.user.theme);\n    }, [session, isPending, setTheme]);\n\n    useEffect(() => {\n        if (!mounted || !resolvedTheme) return;\n\n        const color = resolvedTheme === \"dark\" ? \"#000000\" : \"#ffffff\";\n        let tag = document.querySelector<HTMLMetaElement>('meta[name=\"theme-color\"]');\n        if (!tag) {\n            tag = document.createElement(\"meta\");\n            tag.name = \"theme-color\";\n            document.head.appendChild(tag);\n        }\n        tag.content = color;\n    }, [mounted, resolvedTheme]);\n\n    return null;\n}\n"
  },
  {
    "path": "src/features/dashboard/backup/columns.tsx",
    "content": "\"use client\";\n\nimport {ColumnDef} from \"@tanstack/react-table\";\nimport {StatusBadge} from \"@/components/wrappers/common/status-badge\";\nimport {Backup, DatabaseWith} from \"@/db/schema/07_database\";\nimport {Setting} from \"@/db/schema/01_setting\";\nimport {cn} from \"@/lib/utils\";\nimport {Tooltip, TooltipContent, TooltipProvider, TooltipTrigger} from \"@/components/ui/tooltip\";\nimport {MemberWithUser} from \"@/db/schema/03_organization\";\nimport {formatLocalizedDate} from \"@/utils/date-formatting\";\nimport {formatBytes} from \"@/utils/text\";\nimport {DatabaseActionsCell} from \"@/components/wrappers/dashboard/database/backup/actions/backup-actions-cell\";\nimport { Badge as BadgeC } from \"@/components/ui/badge\";\nimport {backupOnly} from \"@/components/wrappers/dashboard/projects/database/database-tabs\";\n\nexport function backupColumns(\n    isAlreadyRestore: boolean,\n    settings: Setting,\n    database: DatabaseWith,\n    activeMember: MemberWithUser\n): ColumnDef<Backup>[] {\n\n    const isBackupOnly = backupOnly.some((type) => database.dbms === type)\n\n\n    return [\n        {\n            id: \"availability\",\n            cell: ({row}) => {\n                const statusColors: Record<string, string> = {\n                    waiting: \"bg-gray-400 border-gray-600\",\n                    ongoing: \"bg-orange-400 border-orange-600\",\n                    success: \"bg-green-400 border-green-600\",\n                };\n\n                const colorStatus =\n                    row.original.deletedAt != null\n                        ? \"bg-red-400 border-red-600\"\n                        : statusColors[row.original.status] ?? \"bg-gray-400 border-gray-600\";\n\n                return (\n                    <TooltipProvider>\n                        <Tooltip>\n                            <TooltipTrigger asChild>\n                                <div className={cn(\"w-5 h-5 rounded-full border-4\", colorStatus)}/>\n                            </TooltipTrigger>\n                            {row.original.deletedAt != null && (\n                                <TooltipContent>\n                                    <p>{formatLocalizedDate(row.original.deletedAt)}</p>\n                                </TooltipContent>\n                            )}\n                        </Tooltip>\n                    </TooltipProvider>\n                )\n            },\n        },\n        {\n            accessorKey: \"id\",\n            header: \"Reference\",\n            cell: ({row}) => {\n                const reference = row.original.id\n                const isImported = row.original.imported\n                const isMigrated = row.original.migrated\n                return (\n                    <div className=\"flex items-center space-x-2\">\n                        <span>{reference}</span>\n                       {isImported && (\n                            <BadgeC variant=\"outline\" className=\"bg-orange-400/10 border-orange-600/50 text-orange-600\">\n                                Imported\n                            </BadgeC>\n                        )}\n                        {isMigrated && (\n                            <BadgeC variant=\"outline\" className=\"bg-blue-400/10 border-blue-600/50 text-blue-600\">\n                                Migrated\n                            </BadgeC>\n                        )}\n                    </div>\n                )\n            },\n        },\n        {\n            accessorKey: \"fileSize\",\n            header: \"Size\",\n            cell: ({row}) => {\n                return formatBytes(row.getValue(\"fileSize\"))\n            },\n        },\n        {\n            accessorKey: \"createdAt\",\n            header: \"Created At\",\n            cell: ({row}) => {\n                return formatLocalizedDate(row.getValue(\"createdAt\"))\n            },\n        },\n        {\n            accessorKey: \"status\",\n            header: \"Status\",\n            cell: ({row}) => {\n                return <StatusBadge status={row.getValue(\"status\")}/>;\n            },\n        },\n        {\n            id: \"actions\",\n            cell: ({row}) => <DatabaseActionsCell isAlreadyRestore={isAlreadyRestore} activeMember={activeMember} backup={row.original} isBackupOnly={isBackupOnly}/>,\n        },\n    ];\n}"
  },
  {
    "path": "src/features/dashboard/organization-cookie.ts",
    "content": "'use server';\n\nimport {cookies} from 'next/headers';\n\nconst COOKIE_NAME = 'PORTABASE_ORGANIZATION_SLUG';\n\nexport async function getCurrentOrganizationSlug() {\n    return (await cookies()).get(COOKIE_NAME)?.value || \"\";\n}\n\nexport async function setCurrentOrganizationSlug(slug: string) {\n    return (await cookies()).set(COOKIE_NAME, slug).get(COOKIE_NAME)?.value;\n}\n\nexport async function deleteOrganizationCookie() {\n    return (await cookies()).delete(COOKIE_NAME);\n}\n"
  },
  {
    "path": "src/features/dashboard/restore/columns.tsx",
    "content": "\"use client\";\n\nimport { ColumnDef } from \"@tanstack/react-table\";\nimport {\n  DropdownMenu,\n  DropdownMenuContent,\n  DropdownMenuItem,\n  DropdownMenuLabel,\n  DropdownMenuSeparator,\n  DropdownMenuTrigger,\n} from \"@/components/ui/dropdown-menu\";\nimport { Button } from \"@/components/ui/button\";\nimport { Check, MoreHorizontal, Trash2, X } from \"lucide-react\";\nimport { ReloadIcon } from \"@radix-ui/react-icons\";\nimport { StatusBadge } from \"@/components/wrappers/common/status-badge\";\nimport { Restoration } from \"@/db/schema/07_database\";\nimport { formatLocalizedDate } from \"@/utils/date-formatting\";\nimport { useMutation, useQueryClient } from \"@tanstack/react-query\";\nimport {\n  deleteRestoreAction,\n  rerunRestorationAction,\n} from \"@/features/dashboard/restore/restore.action\";\nimport { toast } from \"sonner\";\nimport { TooltipCustom } from \"@/components/wrappers/common/tooltip-custom\";\nimport { MemberWithUser } from \"@/db/schema/03_organization\";\nimport { ButtonWithConfirm } from \"@/components/wrappers/common/button/button-with-confirm\";\n\nexport function restoreColumns(\n  isAlreadyRestore: boolean,\n  activeMember: MemberWithUser,\n): ColumnDef<Restoration>[] {\n  return [\n    {\n      accessorKey: \"id\",\n      header: \"Reference\",\n    },\n    {\n      accessorKey: \"createdAt\",\n      header: \"Created At\",\n      cell: ({ row }) => {\n        return formatLocalizedDate(row.getValue(\"createdAt\"));\n      },\n    },\n    {\n      accessorKey: \"status\",\n      header: \"Status\",\n      cell: ({ row }) => {\n        return <StatusBadge status={row.getValue(\"status\")} />;\n      },\n    },\n    {\n      id: \"actions\",\n      cell: ({ row }) => {\n        const status = row.getValue(\"status\");\n\n        const queryClient = useQueryClient();\n        const rowData: Restoration = row.original;\n\n        const mutationDeleteRestore = useMutation({\n          mutationFn: async () => {\n            const restoration = await deleteRestoreAction({\n              restorationId: rowData.id,\n            });\n            // @ts-ignore\n            if (restoration.data.success) {\n              // @ts-ignore\n              toast.success(restoration.data.actionSuccess.message);\n              queryClient.invalidateQueries({\n                queryKey: [\"database-data\", rowData.databaseId],\n              });\n            } else {\n              // @ts-ignore\n              toast.error(restoration.data.actionError.message);\n            }\n          },\n        });\n\n        const mutationRerunRestore = useMutation({\n          mutationFn: async () => {\n            const restoration = await rerunRestorationAction({\n              restorationId: rowData.id,\n            });\n            // @ts-ignore\n            if (restoration.data.success) {\n              // @ts-ignore\n              toast.success(restoration.data.actionSuccess.message);\n              queryClient.invalidateQueries({\n                queryKey: [\"database-data\", rowData.databaseId],\n              });\n            } else {\n              // @ts-ignore\n              toast.error(restoration.data.actionError.message);\n            }\n          },\n        });\n\n        const handleDelete = async () => {\n          await mutationDeleteRestore.mutateAsync();\n        };\n\n        const handleRerunRestore = async () => {\n          await mutationRerunRestore.mutateAsync();\n        };\n\n        return (\n          <>\n            {activeMember.role !== \"member\" && (\n              <DropdownMenu>\n                <DropdownMenuTrigger asChild>\n                  <Button\n                    variant=\"ghost\"\n                    className=\"h-8 w-8 p-0\"\n                    type=\"button\"\n                    onClick={(e) => e.stopPropagation()}\n                  >\n                    <span className=\"sr-only\">Open menu</span>\n                    <MoreHorizontal className=\"h-4 w-4\" />\n                  </Button>\n                </DropdownMenuTrigger>\n                <DropdownMenuContent align=\"end\">\n                  <DropdownMenuLabel>Actions</DropdownMenuLabel>\n                  {rowData.backupStorageId && (\n                    <TooltipCustom\n                      disabled={isAlreadyRestore}\n                      text=\"Already a restoration waiting\"\n                    >\n                      <DropdownMenuItem\n                        disabled={\n                          mutationRerunRestore.isPending || isAlreadyRestore\n                        }\n                        onClick={async () => {\n                          await handleRerunRestore();\n                        }}\n                      >\n                        <ReloadIcon /> Rerun\n                      </DropdownMenuItem>\n                    </TooltipCustom>\n                  )}\n                  <DropdownMenuSeparator />\n                  <DropdownMenuItem>\n                    <ButtonWithConfirm\n                      title=\"Delete Restoration\"\n                      description={\n                        \"Are you sure you want to delete this restoration?\"\n                      }\n                      button={{\n                        main: {\n                          text: \"Delete\",\n                          variant: \"ghost\",\n                          icon: (\n                            <Trash2 className=\"text-red-500 size-4 mr-px\" />\n                          ),\n                          disabled: status === \"waiting\",\n                          className:\n                            \"text-red-500 hover:text-red-500 p-0 h-auto has-[>svg]:px-0\",\n                        },\n                        confirm: {\n                          className: \"w-full\",\n                          text: \"Yes, delete\",\n                          icon: <Check />,\n                          variant: \"destructive\",\n                          onClick: async () => {\n                            await handleDelete();\n                          },\n                        },\n                        cancel: {\n                          className: \"w-full\",\n                          text: \"No, cancel\",\n                          icon: <X />,\n                          variant: \"outline\",\n                        },\n                      }}\n                      isPending={mutationDeleteRestore.isPending}\n                    />\n                  </DropdownMenuItem>\n                </DropdownMenuContent>\n              </DropdownMenu>\n            )}\n          </>\n        );\n      },\n    },\n  ];\n}\n"
  },
  {
    "path": "src/features/dashboard/restore/restore.action.ts",
    "content": "\"use server\"\nimport {userAction} from \"@/lib/safe-actions/actions\";\nimport {z} from \"zod\";\nimport {ServerActionResult} from \"@/types/action-type\";\nimport * as drizzleDb from \"@/db\";\n\nimport {db} from \"@/db\";\nimport {and, eq} from \"drizzle-orm\";\nimport {Backup, Restoration} from \"@/db/schema/07_database\";\n\nexport const deleteRestoreAction = userAction\n    .schema(\n        z.object({\n            restorationId: z.string(),\n        })\n    )\n    .action(async ({parsedInput}): Promise<ServerActionResult<Backup>> => {\n        try {\n            await db\n                .delete(drizzleDb.schemas.restoration)\n                .where(and(eq(drizzleDb.schemas.restoration.id, parsedInput.restorationId)))\n                .execute();\n\n\n            return {\n                success: true,\n                actionSuccess: {\n                    message: \"Restoration deleted successfully.\",\n                },\n            };\n\n        } catch (error) {\n            return {\n                success: false,\n                actionError: {\n                    message: \"Failed to delete restoration.\",\n                    status: 500,\n                    cause: error instanceof Error ? error.message : \"Unknown error\",\n                    messageParams: {message: \"Error deleting the restoration\"},\n                },\n            };\n        }\n    });\n\nexport const rerunRestorationAction = userAction\n    .schema(\n        z.object({\n            restorationId: z.string(),\n        })\n    )\n    .action(async ({parsedInput}): Promise<ServerActionResult<Restoration>> => {\n        try {\n            const updateResult = await db\n                .update(drizzleDb.schemas.restoration)\n                .set({status: \"waiting\"})\n                .where(eq(drizzleDb.schemas.restoration.id, parsedInput.restorationId))\n                .returning()\n                .execute();\n\n            const updatedRestoration = updateResult[0];\n\n            if (!updatedRestoration) {\n                return {\n                    success: false,\n                    actionError: {\n                        message: \"Restoration not found.\",\n                        status: 404,\n                        cause: \"No restoration with the given ID exists.\",\n                        messageParams: {message: \"Restoration not found\"},\n                    },\n                };\n            }\n\n            return {\n                success: true,\n                value: updatedRestoration,\n                actionSuccess: {\n                    message: \"Restoration has been requeued.\",\n                    messageParams: {restorationId: updatedRestoration.id},\n                },\n            };\n        } catch (error) {\n            return {\n                success: false,\n                actionError: {\n                    message: \"Failed to rerun restoration.\",\n                    status: 500,\n                    cause: error instanceof Error ? error.message : \"Unknown error\",\n                    messageParams: {message: \"Error updating the restoration\"},\n                },\n            };\n        }\n    });\n"
  },
  {
    "path": "src/features/keys/keys.action.ts",
    "content": "\"use server\"\nimport fs from \"node:fs\";\nimport {env} from \"@/env.mjs\";\nimport path from \"path\";\n\n\n/**\n * Get Public server key content\n */\nexport async function getPublicServerKeyContent() {\n    try {\n        const keyPath = path.join(env.PRIVATE_PATH, '/keys/server_public.pem')\n        return fs.readFileSync(keyPath, \"utf8\");\n    } catch (error: any) {\n        console.error(\"Error :\", error);\n        return {\n            success: false,\n            message: `An error occurred while getting public server key`,\n        };\n    }\n}\n\n\n/**\n * Get Master server key\n */\nexport async function getMasterServerKeyContent() {\n    try {\n        const keyPath = path.join(env.PRIVATE_PATH, '/keys/master_key.bin')\n        return fs.readFileSync(keyPath);\n    } catch (error: any) {\n        console.error(\"Error :\", error);\n        return {\n            success: false,\n            message: `An error occurred while getting master server key`,\n        };\n    }\n}\n\n\nexport async function downloadMasterKeyAction() {\n    try {\n        const keyPath = path.join(env.PRIVATE_PATH, \"keys/master_key.bin\");\n        const fileBuffer = fs.readFileSync(keyPath);\n\n        return {\n            success: true,\n            data: fileBuffer.toString(\"base64\"),\n        };\n    } catch (error) {\n        return {\n            success: false,\n            message: \"Unable to download master key\",\n        };\n    }\n}"
  },
  {
    "path": "src/features/layout/Header.tsx",
    "content": "import {notFound} from \"next/navigation\";\n\nimport {SidebarTrigger} from \"@/components/ui/sidebar\";\nimport {ModeToggle} from \"@/features/theme/mode-toggle\";\nimport {currentUser} from \"@/lib/auth/current-user\";\nimport {BreadCrumbsWrapper} from \"@/components/wrappers/common/bread-crumbs/bread-crumbs\";\nimport GitHubStarsButtonCustom from \"@/components/wrappers/common/github/github-button\";\nimport {LoggedInButton} from \"@/components/wrappers/dashboard/common/logged-in/logged-in-button.server\";\n\nexport const Header = async () => {\n    const user = await currentUser();\n    if (!user) {\n        return notFound();\n    }\n    return (\n        <header className=\"flex h-16 shrink-0 items-center justify-between border-b px-4\">\n            <div className=\"flex items-center justify-between\">\n                <SidebarTrigger className=\"-ml-1\"/>\n                <BreadCrumbsWrapper/>\n            </div>\n\n            <div className=\"flex items-center gap-2\">\n                <GitHubStarsButtonCustom/>\n                <ModeToggle/>\n                <LoggedInButton/>\n            </div>\n        </header>\n    );\n};\n"
  },
  {
    "path": "src/features/layout/card-auth.tsx",
    "content": "import {cn} from \"@/lib/utils\";\nimport * as React from \"react\";\n\n\nexport function CardAuth({ className, ...props }: React.ComponentProps<\"div\">) {\n    return (\n        <div\n            data-slot=\"card\"\n            className={cn(\n                \"bg-transparent border-none py-3\",\n                \"md:bg-card text-card-foreground flex flex-col gap-6 rounded-xl md:border-solid md:border md:py-6 md:shadow-sm\",\n                className\n            )}\n            {...props}\n        />\n    )\n}"
  },
  {
    "path": "src/features/layout/page.tsx",
    "content": "import { twx } from \"@/lib/twx\";\nimport { cn } from \"@/lib/utils\";\n\nexport const Page = twx.div((props) => [cn(`flex flex-col h-full px-5 md:px-10 py-6`, props.className)]);\n\nexport const PageHeader = twx.div((props) => [cn(`flex justify-between`, props.className)]);\n\nexport const PageTitle = twx.h1((props) => [cn(`text-3xl font-bold mb-6 flex gap-4 items-center`, props.className)]);\n\nexport const PageDescription = twx.h2((props) => [cn(`text-s mb-6 `, props.className)]);\n\nexport const PageActions = twx.h1((props) => [cn(`flex gap-4 h-fit`, props.className)]);\n\nexport const PageContent = twx.div((props) => [cn(`h-full`, props.className)]);\n"
  },
  {
    "path": "src/features/notifications/dispatch.ts",
    "content": "\"use server\";\nimport {eq} from \"drizzle-orm\";\nimport {dispatchViaProvider} from \"./providers\";\nimport type {EventPayload, DispatchResult, EventKind} from \"./types\";\nimport * as drizzleDb from \"@/db\";\nimport {db} from \"@/db\";\nimport {notificationLog} from \"@/db/schema/11_notification-log\";\nimport {NotificationChannel} from \"@/db/schema/09_notification-channel\";\nimport {Json} from \"drizzle-zod\";\n\nexport async function dispatchNotification(\n    payload: EventPayload,\n    policyId?: string,\n    channelId?: string,\n    organizationId?: string\n): Promise<DispatchResult> {\n    try {\n        let channel: NotificationChannel | null = null;\n\n        if (policyId) {\n            const policyDb = await db.query.alertPolicy.findFirst({\n                where: eq(drizzleDb.schemas.alertPolicy.id, policyId),\n                with: {\n                    notificationChannel: true\n                },\n            });\n\n            if (!policyDb || !policyDb.notificationChannel) {\n                return {\n                    success: false,\n                    channelId: \"\",\n                    provider: null,\n                    error: \"Policy or associated channel not found\",\n                };\n            }\n\n            if (!policyDb.enabled || !policyDb.notificationChannel.enabled) {\n                return {\n                    success: false,\n                    channelId: policyDb.notificationChannel.id,\n                    provider: policyDb.notificationChannel.provider as any,\n                    error: \"Policy or channel is disabled\",\n                };\n            }\n\n            channel = {\n                ...policyDb.notificationChannel,\n                config: policyDb.notificationChannel.config as Json,\n            };\n        }\n\n        if (channelId) {\n            const fetchedChannel = await db.query.notificationChannel.findFirst({\n                where: eq(drizzleDb.schemas.notificationChannel.id, channelId),\n            });\n\n            if (!fetchedChannel) {\n                return {\n                    success: false,\n                    channelId: channelId,\n                    provider: null,\n                    error: \"Channel not found\",\n                };\n            }\n\n            channel = {\n                ...fetchedChannel,\n                config: fetchedChannel.config as Json,\n            };\n        }\n\n        if (!channel) {\n            return {\n                success: false,\n                channelId: channelId || \"\",\n                provider: null,\n                error: \"No valid channel to dispatch notification\",\n            };\n        }\n\n\n        if (!channel.enabled) {\n            return {\n                success: false,\n                channelId: channelId || \"\",\n                provider: null,\n                error: \"Channel not active\",\n            };\n        }\n\n        const result = await dispatchViaProvider(\n            channel.provider,\n            channel.config,\n            {...payload, timestamp: payload.timestamp || new Date()},\n            channel.id\n        );\n\n        const [log] = await db\n            .insert(notificationLog)\n            .values({\n                channelId: channel.id,\n                policyId: policyId || null,\n                organizationId: organizationId || null,\n\n                provider: channel.provider,\n                providerName: channel.name,\n                event: payload.event as EventKind,\n\n                title: payload.title,\n                message: payload.message,\n                level: payload.level,\n                payload: payload.data || null,\n                success: result.success,\n                error: result.success ? null : result.error,\n                providerResponse: result.response || null,\n            })\n            .returning({id: notificationLog.id});\n\n        return {...result, channelId: channel.id};\n\n    } catch (err: any) {\n        return {\n            success: false,\n            channelId: channelId || \"\",\n            provider: null,\n            error: err?.message || \"Unexpected error during dispatch\",\n        };\n    }\n}\n"
  },
  {
    "path": "src/features/notifications/helpers.ts",
    "content": "import { DatabaseWith } from \"@/db/schema/07_database\";\nimport { EventKind, EventPayload } from \"@/features/notifications/types\";\nimport { dispatchNotification } from \"@/features/notifications/dispatch\";\nimport {db} from \"@/db\";\nimport {eq} from \"drizzle-orm\";\nimport * as drizzleDb from \"@/db\";\n\nexport async function sendNotificationsBackupRestore(database: DatabaseWith, event: EventKind) {\n\n    const settings = await db.query.setting.findFirst({\n        where: eq(drizzleDb.schemas.setting.name, \"system\"),\n        with: { notificationChannel: true },\n    });\n\n    const defaultPolicy = settings?.notificationChannel\n        ? [{\n            id: null,\n            notificationChannelId: settings.notificationChannel.id,\n            enabled: settings.notificationChannel.enabled,\n            eventKinds: [\"error_backup\" , \"error_restore\"]\n        }]\n        : [];\n\n    const policiesToUse = (database.alertPolicies && database.alertPolicies.length > 0)\n        ? database.alertPolicies.filter(policy => policy.enabled && policy.eventKinds.includes(event))\n        : defaultPolicy.filter(policy => policy.eventKinds.includes(event));\n\n    if (!policiesToUse || policiesToUse.length === 0) {\n        return [];\n    }\n\n    const promises = policiesToUse.map(alertPolicy => {\n        const date = new Date();\n        let level: \"info\" | \"critical\" = \"info\";\n        let message = \"\";\n        let error: string | null = null;\n\n        switch (event) {\n            case \"error_backup\":\n            case \"error_restore\":\n                level = \"critical\";\n                message = `An error occurred during ${event.includes(\"backup\") ? \"backup\" : \"restore\"} on ${date.toISOString()}.`;\n                error = \"Check database connection or agent\";\n                break;\n            case \"success_backup\":\n            case \"success_restore\":\n                level = \"info\";\n                message = `${event.includes(\"backup\") ? \"Backup\" : \"Restore\"} completed successfully at ${date.toISOString()}.`;\n                break;\n            case \"weekly_report\":\n                level = \"info\";\n                message = `Weekly report generated at ${date.toISOString()}.`;\n                break;\n        }\n\n        const titleMap: Record<EventKind, string> = {\n            error_backup: `Backup Notification`,\n            error_restore: `Restore Notification`,\n            success_backup: `Backup Notification`,\n            success_restore: `Restore Notification`,\n            weekly_report: `Weekly Report Notification`,\n            error_health_agent: \"Health Agent Notification\",\n            error_health_database: \"Health Database Notification\",\n        };\n\n        const payload: EventPayload = {\n            title: titleMap[event],\n            message,\n            level: level,\n            event: event,\n            data: {\n                host: database.name,\n                id: database.id,\n                agentDatabaseId: database.agentDatabaseId,\n                error,\n            },\n        };\n\n        return dispatchNotification(payload, alertPolicy.id == null ? undefined : alertPolicy.id, alertPolicy.id ? undefined : alertPolicy.notificationChannelId, undefined);\n    });\n\n\n    return Promise.all(promises);\n}"
  },
  {
    "path": "src/features/notifications/providers/discord.ts",
    "content": "import type {EventPayload, DispatchResult} from '../types';\n\nexport async function sendDiscord(\n    config: { discordWebhook: string },\n    payload: EventPayload\n): Promise<DispatchResult> {\n    const {discordWebhook: webhookUrl} = config;\n\n    const embeds = [\n        {\n            title: `[${payload.level.toUpperCase()}] ${payload.title}`,\n            description: payload.message,\n            color: payload.level === 'critical' ? 15158332 : payload.level === 'warning' ? 16776960 : 3447003,\n            fields: payload.data ? [\n                {\n                    name: 'Data',\n                    value: `\n                    ${JSON.stringify(payload.data, null, 2).substring(0, 1000)}\n                    `,\n                    inline: false\n                }\n            ] : [],\n            timestamp: new Date().toISOString(),\n        }\n    ];\n\n    const body = {\n        embeds,\n    };\n\n    const res = await fetch(webhookUrl, {\n        method: 'POST',\n        body: JSON.stringify(body),\n        headers: {'Content-Type': 'application/json'},\n    });\n\n    if (!res.ok) {\n        const err = await res.text();\n        throw new Error(`Discord error: ${res.status} ${err}`);\n    }\n\n    return {\n        success: true,\n        provider: 'discord',\n        message: 'Sent to Discord',\n        response: res.statusText,\n    };\n}\n"
  },
  {
    "path": "src/features/notifications/providers/gotify.ts",
    "content": "import type {EventPayload, DispatchResult} from '../types';\n\nexport async function sendGotify(\n    config: { gotifyServerUrl: string; gotifyAppToken: string },\n    payload: EventPayload\n): Promise<DispatchResult> {\n    const {gotifyServerUrl, gotifyAppToken} = config;\n\n    const baseUrl = gotifyServerUrl.replace(/\\/$/, \"\");\n\n    const body = {\n        title: `[${payload.level.toUpperCase()}] ${payload.title}`,\n        message: `${payload.message}\\n\\n${payload.data ? `Data:\\n${JSON.stringify(payload.data, null, 2)}` : ''}`,\n        priority: payload.level === 'critical' ? 8 : payload.level === 'warning' ? 5 : 2,\n    };\n\n    const res = await fetch(`${baseUrl}/message?token=${gotifyAppToken}`, {\n        method: 'POST',\n        body: JSON.stringify(body),\n        headers: {'Content-Type': 'application/json'},\n    });\n\n    if (!res.ok) {\n        const err = await res.text();\n        throw new Error(`Gotify error: ${res.status} ${err}`);\n    }\n\n    return {\n        success: true,\n        provider: 'gotify',\n        message: 'Sent to Gotify',\n        response: await res.json(),\n    };\n}\n"
  },
  {
    "path": "src/features/notifications/providers/index.ts",
    "content": "\"use server\"\nimport type {ProviderKind, EventPayload, DispatchResult} from '../types';\nimport {sendSlack} from './slack';\nimport {sendSmtp} from './smtp';\nimport {sendDiscord} from \"@/features/notifications/providers/discord\";\nimport {sendTelegram} from \"@/features/notifications/providers/telegram\";\nimport {sendGotify} from \"@/features/notifications/providers/gotify\";\nimport {sendNtfy} from \"@/features/notifications/providers/ntfy\";\nimport {sendWebhook} from \"@/features/notifications/providers/webhook\";\n\nconst handlers: Record<\n    ProviderKind,\n    (config: any, payload: EventPayload) => Promise<DispatchResult>\n> = {\n    slack: sendSlack,\n    smtp: sendSmtp,\n    discord: sendDiscord,\n    telegram: sendTelegram,\n    gotify: sendGotify,\n    ntfy: sendNtfy,\n    webhook: sendWebhook\n};\n\nexport async function dispatchViaProvider(\n    kind: ProviderKind,\n    config: any,\n    payload: EventPayload,\n    channelId: string\n): Promise<DispatchResult> {\n    const handler = handlers[kind];\n    if (!handler) {\n        return {\n            success: false,\n            channelId,\n            provider: kind,\n            error: `Unsupported provider: ${kind}`,\n        };\n    }\n\n    try {\n        return await handler(config, payload);\n    } catch (err: any) {\n        return {\n            success: false,\n            channelId,\n            provider: kind,\n            error: err.message || 'Unknown error',\n        };\n    }\n}"
  },
  {
    "path": "src/features/notifications/providers/ntfy.ts",
    "content": "import type {EventPayload, DispatchResult} from '../types';\n\nconst getPriority = (level?: string): number => {\n    switch (level) {\n        case 'critical': return 5;\n        case 'error': return 4;\n        case 'warning': return 3;\n        case 'info':\n        default: return 2;\n    }\n};\n\nconst formatData = (data: any): string => {\n    if (!data || typeof data !== 'object') return '';\n    return '\\n\\nDetails:\\n' + Object.entries(data)\n        .map(([key, value]) => {\n            const stringVal = value !== null && typeof value === 'object' ? JSON.stringify(value) : String(value);\n            return `- ${key}: ${stringVal}`;\n        })\n        .join('\\n');\n};\n\nconst getTags = (level?: string): string[] => {\n    const baseTags = ['floppy_disk'];\n    \n    if (level === 'critical') baseTags.push('rotating_light');\n    else if (level === 'error') baseTags.push('x');\n    else if (level === 'warning') baseTags.push('warning');\n    else baseTags.push('information_source');\n\n    return baseTags;\n};\n\nexport async function sendNtfy(\n    config: { ntfyServerUrl?: string; ntfyTopic: string; ntfyToken?: string, ntfyUsername?: string, ntfyPassword?: string },\n    payload: EventPayload\n): Promise<DispatchResult> {\n    const {ntfyServerUrl, ntfyTopic, ntfyToken, ntfyUsername, ntfyPassword} = config;\n\n    const baseUrl = (ntfyServerUrl || \"https://ntfy.sh\").replace(/\\/$/, \"\");\n\n    const body = {\n        topic: ntfyTopic,\n        title: payload.title,\n        message: payload.message + formatData(payload.data),\n        priority: getPriority(payload.level),\n        tags: getTags(payload.level),\n    };\n\n    const headers: Record<string, string> = {\n        'Content-Type': 'application/json',\n    };\n\n    if (ntfyToken) {\n        headers['Authorization'] = `Bearer ${ntfyToken}`;\n    }\n\n    if (ntfyUsername && ntfyPassword) {\n        const credentials = btoa(`${ntfyUsername}:${ntfyPassword}`);\n        headers['Authorization'] = `Basic ${credentials}`;\n    }\n\n    const res = await fetch(`${baseUrl}`, {\n        method: 'POST',\n        body: JSON.stringify(body),\n        headers: headers,\n    });\n\n    if (!res.ok) {\n        const err = await res.text();\n        throw new Error(`ntfy error: ${res.status} ${err}`);\n    }\n\n    return {\n        success: true,\n        provider: 'ntfy',\n        message: 'Sent to ntfy',\n        response: await res.json(),\n    };\n}\n"
  },
  {
    "path": "src/features/notifications/providers/slack.ts",
    "content": "import type {EventPayload, DispatchResult} from '../types';\n\nexport async function sendSlack(\n    config: { slackWebhook: string },\n    payload: EventPayload\n): Promise<DispatchResult> {\n    const {slackWebhook: webhookUrl} = config;\n\n    const text = `*[${payload.level}] ${payload.title}*\\n${payload.message}`;\n    const blocks = [\n        {\n            type: 'section',\n            text: {type: 'mrkdwn', text: `*[${payload.level.toUpperCase()}] ${payload.title}*`},\n        },\n        {type: 'section', text: {type: 'mrkdwn', text: payload.message}},\n        payload.data\n            ? {\n                type: 'context',\n                elements: [{type: 'mrkdwn', text: `*Data:* \\`\\`\\`${JSON.stringify(payload.data, null, 2)}\\`\\`\\``}],\n            }\n            : null,\n    ].filter(Boolean);\n\n    const body = {\n        text,\n        blocks,\n    };\n\n    const res = await fetch(webhookUrl, {\n        method: 'POST',\n        body: JSON.stringify(body),\n        headers: {'Content-Type': 'application/json'},\n    });\n\n    if (!res.ok) {\n        const err = await res.text();\n        throw new Error(`Slack error: ${res.status} ${err}`);\n    }\n\n    return {\n        success: true,\n        provider: 'slack',\n        message: 'Sent to Slack',\n        response: await res.text(),\n    };\n}"
  },
  {
    "path": "src/features/notifications/providers/smtp.ts",
    "content": "\"use server\";\nimport { render } from \"@react-email/render\";\nimport nodemailer from \"nodemailer\";\nimport type { EventPayload, DispatchResult } from '../types';\nimport EmailNotification from \"@/components/emails/email-notification\";\n\nexport async function sendSmtp(\n    config: {\n        host: string;\n        port: number;\n        secure: boolean;\n        user: string;\n        password: string;\n        from: string;\n        to: string | string[];\n    },\n    payload: EventPayload\n): Promise<DispatchResult> {\n\n    const transporter = nodemailer.createTransport({\n        pool: true,\n        host: config.host,\n        port: config.port,\n        secure: config.secure,\n        auth: { user: config.user, pass: config.password },\n    });\n\n    await transporter.verify();\n\n\n    const info = await transporter.sendMail({\n        from: config.from,\n        to: Array.isArray(config.to) ? config.to.join(\", \") : config.to,\n        subject: `[${payload.level.toUpperCase()}] ${payload.title}`,\n        html: await render(EmailNotification({\n            payload: payload\n        })),\n    });\n\n    return {\n        success: true,\n        provider: \"smtp\",\n        message: `Email sent: ${config.to}`,\n        response: info,\n    };\n}\n"
  },
  {
    "path": "src/features/notifications/providers/telegram.ts",
    "content": "import type { EventPayload, DispatchResult } from \"../types\";\n\nexport async function sendTelegram(\n  config: {\n    telegramBotToken: string;\n    telegramChatId: string;\n    telegramTopicId?: string;\n  },\n  payload: EventPayload,\n): Promise<DispatchResult> {\n  const { telegramBotToken, telegramChatId, telegramTopicId } = config;\n\n  // Helper to escape HTML characters\n  const escapeHtml = (unsafe: string) => {\n    return unsafe\n      .replace(/&/g, \"&amp;\")\n      .replace(/</g, \"&lt;\")\n      .replace(/>/g, \"&gt;\")\n      .replace(/\"/g, \"&quot;\")\n      .replace(/'/g, \"&#039;\");\n  };\n\n  const title = escapeHtml(payload.title);\n  const message = escapeHtml(payload.message);\n  const level = escapeHtml(payload.level.toUpperCase());\n  const dataString = payload.data\n    ? escapeHtml(JSON.stringify(payload.data, null, 2).substring(0, 1000))\n    : \"\";\n\n  const text = `<b>${title}</b>\\n\\n${message}\\n\\nLevel: <code>${level}</code>${payload.data ? `\\n\\nData:\\n<pre>${dataString}</pre>` : \"\"}`;\n\n  const body: Record<string, any> = {\n    chat_id: telegramChatId,\n    text,\n    parse_mode: \"HTML\",\n  };\n\n  if (telegramTopicId) {\n    body.message_thread_id = Number(telegramTopicId);\n  }\n\n  const res = await fetch(\n    `https://api.telegram.org/bot${telegramBotToken}/sendMessage`,\n    {\n      method: \"POST\",\n      body: JSON.stringify(body),\n      headers: { \"Content-Type\": \"application/json\" },\n    },\n  );\n\n  if (!res.ok) {\n    const err = await res.text();\n    throw new Error(`Telegram error: ${res.status} ${err}`);\n  }\n\n  return {\n    success: true,\n    provider: \"telegram\",\n    message: \"Sent to Telegram\",\n    response: await res.text(),\n  };\n}\n"
  },
  {
    "path": "src/features/notifications/providers/webhook.ts",
    "content": "import type {EventPayload, DispatchResult} from '../types';\n\nexport async function sendWebhook(\n    config: { webhookUrl: string; webhookSecret?: string; webhookSecretHeader?: string },\n    payload: EventPayload\n): Promise<DispatchResult> {\n    const {webhookUrl, webhookSecret, webhookSecretHeader} = config;\n\n    const headers: Record<string, string> = {\n        'Content-Type': 'application/json',\n        'User-Agent': 'Portabase-Notifier/1.0'\n    };\n\n    if (webhookSecret) {\n        headers[webhookSecretHeader || 'X-Webhook-Secret'] = webhookSecret;\n    }\n\n    const res = await fetch(webhookUrl, {\n        method: 'POST',\n        body: JSON.stringify(payload),\n        headers: headers,\n    });\n\n    if (!res.ok) {\n        const err = await res.text();\n        throw new Error(`Webhook error: ${res.status} ${err}`);\n    }\n\n    return {\n        success: true,\n        provider: 'webhook',\n        message: 'Sent to Webhook',\n        response: await res.text(),\n    };\n}\n"
  },
  {
    "path": "src/features/notifications/types.ts",
    "content": "export type ProviderKind = 'slack' | 'smtp' | 'discord' | 'telegram' | 'gotify' | 'ntfy' | 'webhook';\n\nexport interface DispatchResult {\n    success: boolean;\n    channelId?: string;\n    provider: ProviderKind | null;\n    message?: string;\n    error?: string;\n    response?: any;\n}\n\nexport interface EventPayload {\n    title: string;\n    message: string;\n    level: 'critical' | 'warning' | 'info';\n    timestamp?: Date;\n    event?: EventKind\n    data?: Record<string, any>;\n}\n\nexport type EventKind = (\"error_backup\" | \"error_restore\" | \"success_restore\" | \"success_backup\" | \"weekly_report\" | \"error_health_agent\" | \"error_health_database\")\n"
  },
  {
    "path": "src/features/organization/components/edit-organization.dialog.tsx",
    "content": "\"use client\";\n\nimport {\n    Dialog,\n    DialogContent,\n    DialogHeader,\n    DialogTitle,\n    DialogTrigger,\n} from \"@/components/ui/dialog\";\nimport {OrganizationForm} from \"@/features/organization/components/organization.form\";\nimport {ReactNode, useState} from \"react\";\nimport {Button, buttonVariants} from \"@/components/ui/button\";\nimport {GearIcon} from \"@radix-ui/react-icons\";\nimport {OrganizationWithMembers} from \"@/db/schema/03_organization\";\nimport {User} from \"@/db/schema/02_user\";\nimport {User as BetterAuthUser} from \"better-auth\";\nimport {useRouter} from \"next/navigation\";\n\ntype EditOrganizationDialogProps = {\n    organization: OrganizationWithMembers;\n    users: User[];\n    currentUser: BetterAuthUser;\n};\n\nexport const EditOrganizationDialog = ({\n                                           organization,\n                                           users,\n                                           currentUser,\n                                       }: EditOrganizationDialogProps) => {\n    const [open, setOpen] = useState(false);\n    const router = useRouter();\n\n    return (\n        <Dialog open={open} onOpenChange={setOpen}>\n            <DialogTrigger asChild>\n                <div className={buttonVariants({variant: \"outline\", className: \"cursor-pointer\"})}>\n                    <GearIcon className=\"w-7 h-7\"/>\n                </div>\n            </DialogTrigger>\n            <DialogContent\n                onOpenAutoFocus={(e) => e.preventDefault()}\n            >\n                <DialogHeader>\n                    <DialogTitle>Edit {organization.name}</DialogTitle>\n                </DialogHeader>\n                <OrganizationForm\n                    onSuccess={() => {\n                        setOpen(false)\n                        router.refresh()\n                    }}\n                    defaultValues={organization}\n                    users={users}\n                    currentUser={currentUser}\n                />\n            </DialogContent>\n        </Dialog>\n    );\n};\n"
  },
  {
    "path": "src/features/organization/components/organization.form.tsx",
    "content": "\"use client\";\n\nimport {\n    FormControl,\n    FormDescription,\n    FormField,\n    FormItem,\n    FormLabel,\n    FormMessage,\n    useZodForm\n} from \"@/components/ui/form\";\nimport {Input} from \"@/components/ui/input\";\nimport {Form} from \"@/components/ui/form\";\nimport {Button} from \"@/components/ui/button\";\nimport {useMutation} from \"@tanstack/react-query\";\nimport {useRouter} from \"next/navigation\";\nimport {MultiSelect} from \"@/components/wrappers/common/multiselect/multi-select\";\nimport {\n    UpdateOrganizationSchema,\n    UpdateOrganizationType\n} from \"@/features/organization/organization.schema\";\nimport {MemberWithUser, OrganizationWithMembers} from \"@/db/schema/03_organization\";\nimport {\n    updateOrganizationAction\n} from \"@/features/organization/organization.action\";\nimport {toast} from \"sonner\";\nimport {User as BetterAuthUser} from \"better-auth\";\nimport {User} from \"@/db/schema/02_user\";\nimport {authClient} from \"@/lib/auth/auth-client\";\n\nexport type organizationFormProps = {\n    defaultValues?: OrganizationWithMembers;\n    users: User[];\n    currentUser: BetterAuthUser;\n    onSuccess?: (data: any) => void;\n};\n\nexport const OrganizationForm = (props: organizationFormProps) => {\n    const {data: activeOrganization, refetch: refetchActiveOrga} = authClient.useActiveOrganization();\n    const {data: organizations, refetch} = authClient.useListOrganizations();\n\n    const router = useRouter();\n    const isCreate = !Boolean(props.defaultValues);\n\n    const formatUsersList = (users: User[]) => {\n\n        return users\n            .filter((user) => user.id !== props.currentUser.id)\n            .map((user) => ({\n                value: user.id,\n                label: `${user.name} | ${user.email}`,\n            }));\n    };\n\n    const formatDefaultUsers = (members: MemberWithUser[]): string[] => {\n        return members\n            .filter((member) => member.userId !== props.currentUser.id)\n            .map((member) => member.userId);\n    };\n\n    const formattedDefaultValues = {\n        name: props.defaultValues?.name,\n        slug: props.defaultValues?.slug,\n        users: !isCreate ? formatDefaultUsers(props.defaultValues?.members as MemberWithUser[]) : [],\n    };\n\n    const form = useZodForm({\n        schema: UpdateOrganizationSchema,\n        defaultValues: formattedDefaultValues,\n    });\n\n    const mutation = useMutation({\n        mutationFn: (values: UpdateOrganizationType) => updateOrganizationAction({\n            data: values,\n            organizationId: props.defaultValues?.id ?? \"\"\n        }),\n        onSuccess: async (result) => {\n            if (result?.data?.success) {\n                toast.success(result.data.actionSuccess?.message || \"Organization updated successfully.\");\n                refetch()\n                refetchActiveOrga()\n                if (props.onSuccess) {\n                    props.onSuccess(result.data.value);\n                } else {\n                    router.push(\"/dashboard/settings\");\n                }\n            } else {\n                // @ts-ignore\n                const errorMsg = result?.data?.actionError?.message || result?.data?.actionError?.messageParams?.message || \"Failed to update the organization.\";\n                toast.error(errorMsg);\n            }\n        },\n        onError: (error: any) => {\n            console.error(\"Mutation network error:\", error);\n            toast.error(error?.message || \"A network error occurred.\");\n        },\n    });\n\n\n    return (\n        <Form\n            form={form}\n            className=\"flex flex-col gap-4\"\n            onSubmit={async (values) => {\n                await mutation.mutateAsync(values);\n            }}\n        >\n            <FormField\n                control={form.control}\n                name=\"name\"\n                defaultValue=\"\"\n                render={({field}) => (\n                    <FormItem>\n                        <FormLabel>Name</FormLabel>\n                        <FormControl>\n                            <Input placeholder=\"Organization 1\" {...field} />\n                        </FormControl>\n                        <FormMessage/>\n                    </FormItem>\n                )}\n            />\n            <FormField\n                control={form.control}\n                name=\"slug\"\n                defaultValue=\"\"\n                render={({field}) => (\n                    <FormItem>\n                        <FormLabel>Slug</FormLabel>\n                        <FormControl>\n                            <Input\n                                placeholder=\"project-1\"\n                                {...field}\n                                onChange={(e) => {\n                                    const value = e.target.value.replaceAll(\" \", \"-\").toLowerCase();\n                                    field.onChange(value);\n                                }}\n                            />\n                        </FormControl>\n                        <FormMessage/>\n                    </FormItem>\n                )}\n            />\n            <FormField\n                control={form.control}\n                name=\"users\"\n                render={({field}) => (\n                    <FormItem>\n                        <FormLabel>Users</FormLabel>\n                        <FormControl>\n                            <MultiSelect\n                                options={formatUsersList(props.users)}\n                                onValueChange={field.onChange}\n                                defaultValue={field.value ?? []}\n                                placeholder=\"Select users\"\n                                variant=\"inverted\"\n                                animation={2}\n                                // maxCount={100}\n                            />\n                        </FormControl>\n                        <FormDescription>Select users you want to add to this organization</FormDescription>\n                        <FormMessage/>\n                    </FormItem>\n                )}\n            />\n            <div className=\"flex justify-end\">\n                <Button type=\"submit\">\n                    {isCreate ? \"Create\" : \"Update\"}\n                </Button>\n            </div>\n        </Form>\n    );\n};\n"
  },
  {
    "path": "src/features/organization/organization.action.ts",
    "content": "\"use server\";\n\nimport {userAction} from \"@/lib/safe-actions/actions\";\nimport {CreateOrganizationSchema, UpdateOrganizationSchema} from \"@/features/organization/organization.schema\";\nimport {ServerActionResult} from \"@/types/action-type\";\nimport {z} from \"zod\";\nimport {db} from \"@/db\";\nimport {and, eq, inArray, or} from \"drizzle-orm\";\nimport {auth, checkSlugOrganization, createOrganization} from \"@/lib/auth/auth\";\nimport {slugify} from \"@/utils/slugify\";\nimport {Organization} from \"@/db/schema/03_organization\";\nimport * as drizzleDb from \"@/db\";\n\nexport const createOrganizationAction = userAction.schema(CreateOrganizationSchema).action(async ({parsedInput}): Promise<ServerActionResult<Organization>> => {\n    try {\n        const slug = slugify(parsedInput.name);\n        if (!await checkSlugOrganization(slug)) {\n            return {\n                success: false,\n                actionError: {\n                    message: \"Slug is already taken\",\n                    status: 500,\n                    messageParams: {message: \"Error creating the organization\"},\n                },\n            };\n        }\n\n        let createdOrganization: Organization;\n\n        try {\n            createdOrganization = await createOrganization(parsedInput.name, slug) as unknown as Organization;\n        } catch (authError: any) {\n            console.error(\"Auth deletion failed:\", authError);\n            return {\n                success: false,\n                actionError: {\n                    message: authError.message || \"Authentication service error.\",\n                    status: authError.status || 500,\n                    cause: \"auth_error\",\n                    messageParams: {message: authError.message},\n                },\n            };\n        }\n\n        return {\n            success: true,\n            value: createdOrganization,\n            actionSuccess: {\n                message: \"Organization has been successfully created.\",\n                messageParams: {organizationId: createdOrganization!.id},\n            },\n        };\n    } catch (error) {\n        console.error(\"Error creating organization:\", error);\n        return {\n            success: false,\n            actionError: {\n                message: \"Failed to create organization.\",\n                status: 500,\n                messageParams: {message: \"Error creating the organization\"},\n            },\n        };\n    }\n});\n\nexport const updateOrganizationAction = userAction\n    .schema(\n        z.object({\n            data: UpdateOrganizationSchema,\n            organizationId: z.string(),\n        })\n    )\n    .action(async ({parsedInput, ctx}): Promise<ServerActionResult<Organization>> => {\n        try {\n            const newUserList = parsedInput.data.users;\n            const organization = await db.query.organization.findFirst({\n                where: eq(drizzleDb.schemas.organization.id, parsedInput.organizationId),\n                with: {\n                    members: true,\n                }\n            });\n\n            if (!organization) {\n                return {\n                    success: false,\n                    actionError: {\n                        message: \"Organization not found.\",\n                        status: 404,\n                        cause: \"not_found\",\n                    },\n                };\n            }\n\n            const existingItemIds = organization.members\n                .filter((member) => member.userId !== ctx.user.id)\n                .map((member) => member.userId);\n            const usersToAdd = newUserList.filter((id) => !existingItemIds.includes(id));\n            const usersToRemove = existingItemIds.filter((id) => !newUserList.includes(id));\n\n            if (usersToAdd.length > 0) {\n                for (const userToAdd of usersToAdd) {\n                    await auth.api.addMember({\n                        body: {\n                            userId: userToAdd,\n                            role: \"member\",\n                            organizationId: organization.id,\n                        },\n\n                    });\n                }\n            }\n            if (usersToRemove.length > 0) {\n                await db.delete(drizzleDb.schemas.member).where(and(inArray(drizzleDb.schemas.member.userId, usersToRemove), eq(drizzleDb.schemas.member.organizationId, organization.id))).execute();\n\n            }\n            const updatedOrganization = await db\n                .update(drizzleDb.schemas.organization)\n                .set({\n                    name: parsedInput.data.name,\n                    slug: parsedInput.data.slug,\n                })\n                .where(eq(drizzleDb.schemas.organization.id, parsedInput.organizationId))\n                .returning()\n                .execute();\n\n            return {\n                success: true,\n                value: updatedOrganization as unknown as Organization,\n                actionSuccess: {\n                    message: \"Organization has been successfully updated.\",\n                    messageParams: {organizationId: organization.id},\n                },\n            };\n        } catch (error) {\n            console.error(\"Error updating organization:\", error);\n            return {\n                success: false,\n                actionError: {\n                    message: \"Failed to update organization.\",\n                    status: 500,\n                    cause: \"server_error\",\n                    messageParams: {message: \"Error updating the organization\"},\n                },\n            };\n        }\n    });\n\nexport const deleteOrganizationAction = userAction.schema(\n    z.object({\n        id: z.string().optional(),\n        slug: z.string().optional(),\n    })\n).action(\n    async ({parsedInput, ctx}): Promise<ServerActionResult<Organization>> => {\n        try {\n            const conditions = [];\n            if (parsedInput.id) {\n                conditions.push(eq(drizzleDb.schemas.organization.id, parsedInput.id));\n            }\n            if (parsedInput.slug) {\n                conditions.push(eq(drizzleDb.schemas.organization.slug, parsedInput.slug));\n            }\n\n            const org = await db.query.organization.findFirst({\n                where: or(...conditions),\n            });\n\n            if (!org) {\n                return {\n                    success: false,\n                    actionError: {\n                        message: \"Organization not found.\",\n                        status: 404,\n                        cause: \"not_found\",\n                    },\n                };\n            }\n\n            let deletedOrganization: Organization;\n\n            try {\n                [deletedOrganization] = await db\n                    .delete(drizzleDb.schemas.organization)\n                    .where(eq(drizzleDb.schemas.organization.id, org.id))\n                    .returning();\n\n            } catch (authError: any) {\n                console.error(\"Auth deletion failed:\", authError);\n                return {\n                    success: false,\n                    actionError: {\n                        message: authError.message || \"Authentication service error.\",\n                        status: authError.status || 500,\n                        cause: \"auth_error\",\n                        messageParams: {message: authError.message},\n                    },\n                };\n            }\n\n            return {\n                success: true,\n                value: deletedOrganization,\n                actionSuccess: {\n                    message: \"Organization has been successfully deleted.\",\n                    messageParams: {organizationId: deletedOrganization.id},\n                },\n            };\n        } catch (error) {\n            console.error(\"Unexpected error in deleteOrganizationAction:\", error);\n            return {\n                success: false,\n                actionError: {\n                    message: \"Failed to delete organization due to a server error.\",\n                    status: 500,\n                    cause: \"server_error\",\n                    messageParams: {message: \"Internal server error while deleting the organization\"},\n                },\n            };\n        }\n    }\n);\n"
  },
  {
    "path": "src/features/organization/organization.schema.ts",
    "content": "import { z } from \"zod\";\n\nexport const CreateOrganizationSchema = z.object({\n    name: z.string().min(5, \"Name must be at least 5 characters long\").max(40, \"Name must be at most 40 characters long\"),\n});\n\nexport const UpdateOrganizationSchema = z.object({\n    name: z.string().min(5, 'Name must be at least 5 characters long').max(40, 'Name must be at most 40 characters long'),\n    slug: z.string()\n        .regex(/^[a-zA-Z0-9_-]*$/, 'Slug can only contain letters, numbers, underscores, and hyphens')\n        .min(5, 'Slug must be at least 5 characters long')\n        .max(20, 'Slug must be at most 20 characters long'),\n    users: z.array(z.string()),\n});\n\nexport type CreateOrganizationType = z.infer<typeof CreateOrganizationSchema>;\nexport type UpdateOrganizationType = z.infer<typeof UpdateOrganizationSchema>;\n"
  },
  {
    "path": "src/features/projects/components/project.dialog.tsx",
    "content": "\"use client\";\n\nimport {\n    Dialog,\n    DialogContent,\n    DialogHeader,\n    DialogTitle,\n    DialogTrigger,\n} from \"@/components/ui/dialog\";\nimport {ProjectForm} from \"@/features/projects/components/project.form\";\nimport {ReactNode, useState} from \"react\";\nimport {Button, buttonVariants} from \"@/components/ui/button\";\nimport {Plus} from \"lucide-react\";\nimport {DatabaseWith} from \"@/db/schema/07_database\";\nimport {Organization} from \"@/db/schema/03_organization\";\nimport {ProjectWith} from \"@/db/schema/06_project\";\nimport {GearIcon} from \"@radix-ui/react-icons\";\nimport {EmptyStatePlaceholder} from \"@/components/wrappers/common/empty-state-placeholder\";\nimport {useRouter} from \"next/navigation\";\n\ntype ProjectDialogProps = {\n    databases: DatabaseWith[];\n    organization: Organization;\n    project?: ProjectWith;\n    isEdit?: boolean;\n    isEmpty?: boolean;\n};\n\nexport const ProjectDialog = ({\n                                  databases,\n                                  organization,\n                                  project,\n                                  isEdit = false,\n                                  isEmpty = false\n                              }: ProjectDialogProps) => {\n    const [open, setOpen] = useState(false);\n    const router = useRouter();\n\n    return (\n        <Dialog open={open} onOpenChange={setOpen}>\n            <DialogTrigger asChild>\n                <div>\n                    {isEdit ?\n                        <div className={buttonVariants({variant: \"outline\", className: \"cursor-pointer\"})}>\n                            <GearIcon className=\"w-7 h-7\"/>\n                        </div>\n                        :\n                        <>\n                            {isEmpty ?\n                                <EmptyStatePlaceholder text=\"Create new Project\"/>\n                                :\n                                <Button><Plus className=\"mr-2 h-4 w-4\"/> Create Project</Button>\n                            }\n                        </>\n                    }\n                </div>\n            </DialogTrigger>\n            <DialogContent\n                onOpenAutoFocus={(e) => e.preventDefault()}\n            >\n                <DialogHeader>\n                    <DialogTitle>{isEdit ? `Edit ${project?.name}` : \"Create new project\"}</DialogTitle>\n                </DialogHeader>\n                <ProjectForm\n                    onSuccess={() => {\n                        setOpen(false)\n                        router.refresh()\n                    }}\n                    databases={databases}\n                    organization={organization}\n                    defaultValues={project ? {\n                        ...project,\n                        databases: project.databases.map(db => db.id)\n                    } : undefined}\n                    projectId={project?.id}\n                />\n            </DialogContent>\n        </Dialog>\n    );\n};"
  },
  {
    "path": "src/features/projects/components/project.form.tsx",
    "content": "\"use client\";\n\nimport { FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, useZodForm } from \"@/components/ui/form\";\nimport { Input } from \"@/components/ui/input\";\nimport { Form } from \"@/components/ui/form\";\nimport { Button } from \"@/components/ui/button\";\nimport { useMutation, useQueryClient } from \"@tanstack/react-query\";\nimport { ProjectSchema, ProjectType } from \"@/features/projects/projects.schema\";\nimport { createProjectAction, updateProjectAction } from \"@/features/projects/projects.action\";\nimport { useRouter } from \"next/navigation\";\nimport { MultiSelect } from \"@/components/wrappers/common/multiselect/multi-select\";\nimport { toast } from \"sonner\";\nimport {DatabaseWith} from \"@/db/schema/07_database\";\nimport {Organization} from \"@/db/schema/03_organization\";\n\nexport type projectFormProps = {\n    defaultValues?: ProjectType;\n    databases: DatabaseWith[];\n    organization: Organization;\n    projectId?: string;\n    onSuccess?: (data: any) => void;\n};\n\n\nexport const ProjectForm = (props: projectFormProps) => {\n    const router = useRouter();\n    const queryClient = useQueryClient();\n    const isCreate = !Boolean(props.defaultValues);\n    const formatDatabasesList = (databases: DatabaseWith[]) => {\n        return databases.map((database) => ({\n            value: database.id,\n            label: `${database.name} | ${database.agent?.name}`,\n        }));\n    };\n\n    const formatDefaultDatabases = (databases: string[]): string[] => {\n        return databases;\n    };\n\n    const formattedDefaultValues = {\n        ...props.defaultValues,\n        databases: !isCreate ? formatDefaultDatabases(props.defaultValues?.databases ?? []) : [],\n    };\n\n    const form = useZodForm({\n        schema: ProjectSchema,\n        defaultValues: formattedDefaultValues,\n    });\n\n    const mutation = useMutation({\n        mutationFn: async (values: ProjectType) => {\n            if (!isCreate && !props.projectId) {\n                throw new Error(\"Project ID is required for updates\");\n            }\n            const project = isCreate\n                ? await createProjectAction({\n                      data: values,\n                      organizationId: props.organization.id,\n                  })\n                : await updateProjectAction({\n                      data: values,\n                      organizationId: props.organization.id,\n                      projectId: props.projectId!,\n                  });\n\n            if (project && project.data) {\n                if (project.data.success) {\n                    project.data.actionSuccess && toast.success(project.data.actionSuccess.message);\n                    \n                    if (!isCreate && values.databases) {\n                        values.databases.forEach(dbId => {\n                            queryClient.invalidateQueries({ queryKey: [\"database-data\", dbId] });\n                        });\n                    }\n\n                    if (props.onSuccess) {\n                        props.onSuccess(project.data.value);\n                    } else {\n                        router.push(`/dashboard/projects/${project.data.value!.id}`);\n                    }\n                } else {\n                    project.data.actionError && toast.error(project.data.actionError.message || \"Unknown error occurred.\");\n                }\n            } else {\n                toast.error(\"Failed to process request. No response received.\");\n            }\n        },\n    });\n\n    return (\n                <Form\n                    form={form}\n                    className=\"flex flex-col gap-4\"\n                    onSubmit={async (values) => {\n                        await mutation.mutateAsync(values);\n                    }}\n                >\n\n                    <FormField\n                        control={form.control}\n                        name=\"name\"\n                        render={({ field }) => (\n                            <FormItem>\n                                <FormLabel>Name</FormLabel>\n                                <FormControl>\n                                    <Input placeholder=\"Project 1\" {...field} value={field.value ?? \"\"} />\n                                </FormControl>\n                                <FormMessage />\n                            </FormItem>\n                        )}\n                    />\n                    <FormField\n                        control={form.control}\n                        name=\"databases\"\n                        render={({ field }) => (\n                            <FormItem>\n                                <FormLabel>Databases</FormLabel>\n                                <FormControl>\n                                    <MultiSelect\n                                        options={formatDatabasesList(props.databases)}\n                                        onValueChange={field.onChange}\n                                        defaultValue={field.value ?? []}\n                                        placeholder=\"Select databases\"\n                                        variant=\"inverted\"\n                                        animation={2}\n                                        // maxCount={100}\n                                    />\n                                </FormControl>\n                                <FormDescription>Select databases you want to add to this project</FormDescription>\n                                <FormMessage />\n                            </FormItem>\n                        )}\n                    />\n                    <div className=\"flex justify-end\">\n                        <Button type=\"submit\">\n                            {isCreate ? \"Create\" : \"Update\"}\n                        </Button>\n                    </div>\n                </Form>\n    );\n};\n"
  },
  {
    "path": "src/features/projects/projects.action.ts",
    "content": "\"use server\";\n\nimport {userAction} from \"@/lib/safe-actions/actions\";\nimport {ProjectSchema} from \"@/features/projects/projects.schema\";\nimport {z} from \"zod\";\nimport {ServerActionResult} from \"@/types/action-type\";\nimport {db} from \"@/db\";\nimport {and, eq, inArray} from \"drizzle-orm\";\nimport {Project} from \"@/db/schema/06_project\";\nimport * as drizzleDb from \"@/db\";\nimport {Database} from \"@/db/schema/07_database\";\nimport {slugify} from \"@/utils/slugify\";\n\nexport const createProjectAction = userAction\n    .schema(\n        z.object({\n            data: ProjectSchema,\n            organizationId: z.string(),\n        })\n    )\n    .action(async ({parsedInput}): Promise<ServerActionResult<Project>> => {\n        try {\n            const slug = slugify(parsedInput.data.name);\n\n            const existingProject = await db.query.project.findFirst({\n                where: and(eq(drizzleDb.schemas.project.name, parsedInput.data.name)),\n            })\n\n            if (existingProject) {\n                return {\n                    success: false,\n                    actionError: {\n                        message: \"A project with this name already exists.\",\n                        status: 400,\n                        messageParams: {projectName: parsedInput.data.name},\n                    },\n                };\n            }\n\n            const [createdProject] = await db\n                .insert(drizzleDb.schemas.project)\n                .values({\n                    name: parsedInput.data.name,\n                    slug: slug,\n                    organizationId: parsedInput.organizationId,\n                })\n                .returning();\n\n            if (parsedInput.data.databases.length > 0) {\n                await db\n                    .update(drizzleDb.schemas.database)\n                    .set({projectId: createdProject.id})\n                    .where(inArray(drizzleDb.schemas.database.id, parsedInput.data.databases));\n            }\n\n            return {\n                success: true,\n                value: createdProject,\n                actionSuccess: {\n                    message: \"Project has been successfully created.\",\n                    messageParams: {projectName: parsedInput.data.name},\n                },\n            };\n        } catch (error) {\n            return {\n                success: false,\n                actionError: {\n                    message: \"Failed to create project.\",\n                    status: 500,\n                    cause: error instanceof Error ? error.message : \"Unknown error\",\n                    messageParams: {projectName: parsedInput.data.name},\n                },\n            };\n        }\n    });\n\n\nexport const updateProjectAction = userAction\n    .schema(\n        z.object({\n            data: ProjectSchema,\n            organizationId: z.string(),\n            projectId: z.string(),\n        })\n    )\n    .action(async ({parsedInput}): Promise<ServerActionResult<Project>> => {\n        try {\n            const existing = await db.query.project.findFirst({\n                where: eq(drizzleDb.schemas.project.id, parsedInput.projectId),\n                with: {\n                    databases: true,\n                },\n            });\n\n            if (!existing) {\n                throw new Error(\"Project not found.\");\n            }\n\n            const existingDbIds = existing.databases.map((db: Database) => db.id);\n            const newDbIds = parsedInput.data.databases;\n\n            const databasesToAdd = newDbIds.filter((id) => !existingDbIds.includes(id));\n            const databasesToRemove = existingDbIds.filter((id: string) => !newDbIds.includes(id));\n\n            if (databasesToAdd.length > 0) {\n                await db.update(drizzleDb.schemas.database).set({projectId: parsedInput.projectId}).where(inArray(drizzleDb.schemas.database.id, databasesToAdd));\n            }\n\n            if (databasesToRemove.length > 0) {\n                await db.update(drizzleDb.schemas.database).set({\n                    projectId: null,\n                    backupPolicy: null\n                }).where(inArray(drizzleDb.schemas.database.id, databasesToRemove));\n\n                await db.delete(drizzleDb.schemas.retentionPolicy)\n                    .where(inArray(drizzleDb.schemas.retentionPolicy.databaseId, databasesToRemove)).execute();\n\n                await db.delete(drizzleDb.schemas.alertPolicy)\n                    .where(inArray(drizzleDb.schemas.alertPolicy.databaseId, databasesToRemove)).execute();\n\n            }\n\n            const [updatedProject] = await db\n                .update(drizzleDb.schemas.project)\n                .set({\n                    name: parsedInput.data.name,\n                })\n                .where(eq(drizzleDb.schemas.project.id, parsedInput.projectId))\n                .returning();\n\n            return {\n                success: true,\n                value: updatedProject,\n                actionSuccess: {\n                    message: \"Project has been successfully updated.\",\n                    messageParams: {projectName: parsedInput.data.name},\n                },\n            };\n        } catch (error) {\n            return {\n                success: false,\n                actionError: {\n                    message: \"Failed to update project.\",\n                    status: 500,\n                    cause: error instanceof Error ? error.message : \"Unknown error\",\n                    messageParams: {projectName: parsedInput.data.name},\n                },\n            };\n        }\n    });\n"
  },
  {
    "path": "src/features/projects/projects.schema.ts",
    "content": "import { z } from \"zod\";\n\nexport const ProjectSchema = z.object({\n    name: z.string().nonempty(\"Name is required\"),\n    databases: z.array(z.string()),\n});\n\nexport type ProjectType = z.infer<typeof ProjectSchema>;\n"
  },
  {
    "path": "src/features/shared/event.ts",
    "content": "import { EventEmitter } from \"events\";\n\nexport const eventEmitter = new EventEmitter();"
  },
  {
    "path": "src/features/storages/dispatch.ts",
    "content": "\"use server\";\n\nimport {eq} from 'drizzle-orm';\nimport {Json} from \"drizzle-zod\";\n\nimport * as drizzleDb from '@/db';\nimport {db} from '@/db';\nimport type {StorageInput, StorageProviderKind, StorageResult,} from './types';\nimport {dispatchViaProvider} from \"@/features/storages/providers\";\nimport {StorageChannel} from \"@/db/schema/12_storage-channel\";\nimport {\n    StorageChannelFormType\n} from \"@/components/wrappers/dashboard/admin/channels/channel/channel-form/channel-form.schema\";\n\n\nexport async function dispatchStorage(\n    input: StorageInput,\n    policyId?: string,\n    channelId?: string,\n    channelData?: StorageChannelFormType,\n    organizationId?: string\n): Promise<StorageResult> {\n    try {\n\n        let channel: StorageChannel | null = null;\n\n        if (policyId) {\n            const policyDb = await db.query.storagePolicy.findFirst({\n                where: eq(drizzleDb.schemas.storagePolicy.id, policyId),\n                with: {\n                    storageChannel: true\n                },\n            });\n\n            if (!policyDb || !policyDb.storageChannel) {\n                return {\n                    success: false,\n                    provider: null,\n                    error: \"Policy or associated channel not found\",\n                };\n            }\n\n            if (!policyDb.enabled || !policyDb.storageChannel.enabled) {\n                return {\n                    success: false,\n                    provider: policyDb.storageChannel.provider as any,\n                    error: \"Policy or channel is disabled\",\n                };\n            }\n\n            channel = {\n                ...policyDb.storageChannel,\n                config: policyDb.storageChannel.config as Json,\n            };\n        }\n\n\n        if (channelId) {\n            const fetchedChannel = await db.query.storageChannel.findFirst({\n                where: eq(drizzleDb.schemas.storageChannel.id, channelId),\n            });\n\n            if (!fetchedChannel) {\n                return {\n                    success: false,\n                    provider: null,\n                    error: \"Channel not found\",\n                };\n            }\n\n            channel = {\n                ...fetchedChannel,\n                config: fetchedChannel.config as Json,\n            };\n        }\n\n        if (channelData) {\n            // @ts-ignore\n            channel = {...channelData, config: channelData.config as Json};\n        }\n\n        if (!channel) {\n            return {\n                success: false,\n                provider: null,\n                error: \"No valid channel to dispatch on storage\",\n            };\n        }\n\n\n        if (!channel.enabled) {\n            return {\n                success: false,\n                provider: null,\n                error: \"Channel not active\",\n            };\n        }\n\n\n        const dispatchResult = await dispatchViaProvider(\n            channel.provider as StorageProviderKind,\n            channel.config,\n            input,\n        );\n\n        console.log(dispatchResult);\n        return dispatchResult;\n\n    } catch (err: any) {\n        return {\n            success: false,\n            provider: null,\n            error: err.message || 'Unexpected storage dispatch error',\n        };\n    }\n}\n"
  },
  {
    "path": "src/features/storages/helpers.ts",
    "content": "import {Backup, DatabaseWith} from \"@/db/schema/07_database\";\nimport {dispatchStorage} from \"@/features/storages/dispatch\";\nimport type {\n    StorageGetInput,\n    StorageInput,\n    StorageMetaData,\n    StorageResult,\n    StorageUploadInput\n} from \"@/features/storages/types\";\nimport * as drizzleDb from \"@/db\";\nimport {withUpdatedAt} from \"@/db/utils\";\nimport {eq} from \"drizzle-orm\";\nimport {db} from \"@/db\";\nimport {createHash} from \"crypto\";\nimport {getServerUrl} from \"@/utils/get-server-url\";\nimport path from \"path\";\n\nfunction computeChecksum(buffer: Buffer): string {\n    return createHash(\"sha256\").update(buffer).digest(\"hex\");\n}\n\nexport async function storeBackupFiles(\n    backup: Backup,\n    database: DatabaseWith,\n    file: Buffer,\n    fileName: string\n): Promise<StorageResult[]> {\n\n    const settings = await db.query.setting.findFirst({\n        where: eq(drizzleDb.schemas.setting.name, \"system\"),\n        with: {storageChannel: true},\n    });\n\n    const defaultPolicy = settings?.storageChannel\n        ? [{\n            id: null,\n            storageChannelId: settings.storageChannel.id,\n            enabled: settings.storageChannel.enabled,\n        }]\n        : [];\n\n    const enabledPolicies = database.storagePolicies?.filter(p => p.enabled) ?? [];\n\n    const policies = enabledPolicies.length > 0\n        ? enabledPolicies\n        : defaultPolicy;\n\n    console.debug(\"Policies\", policies);\n\n    if (!policies.length) {\n        await db\n            .update(drizzleDb.schemas.backup)\n            .set(withUpdatedAt({\n                status: \"failed\",\n            }))\n            .where(eq(drizzleDb.schemas.backup.id, backup.id));\n        return [];\n    }\n\n    const path = `backups/${database.project?.slug}/${fileName}`;\n    const size = file.length;\n    const checksum = computeChecksum(file);\n\n    const results = await Promise.all(\n        policies.map(async policy => {\n            const [backupStorage] = await db\n                .insert(drizzleDb.schemas.backupStorage)\n                .values({\n                    backupId: backup.id,\n                    storageChannelId: policy.storageChannelId,\n                    status: \"pending\",\n                    path,\n                    size,\n                    checksum,\n                })\n                .returning();\n\n            const input: StorageInput = {\n                action: \"upload\",\n                data: {path, file},\n            };\n\n            let result: StorageResult;\n\n            try {\n                if (policy.id) {\n                    result = await dispatchStorage(input, policy.id);\n                } else {\n                    result = await dispatchStorage(input, undefined, policy.storageChannelId);\n                }\n\n            } catch (err) {\n                console.error(err);\n                result = {\n                    success: false,\n                    provider: null,\n                    error: err instanceof Error ? err.message : \"Unknown error\"\n                };\n            }\n\n            await db\n                .update(drizzleDb.schemas.backupStorage)\n                .set(withUpdatedAt({status: result.success ? \"success\" : \"failed\"}))\n                .where(eq(drizzleDb.schemas.backupStorage.id, backupStorage.id));\n\n            return result;\n        })\n    );\n\n\n    console.debug(\"Storage backup results\", results);\n\n    const backupStatus = results.some(r => r.success) ? \"success\" : \"failed\";\n\n    await db\n        .update(drizzleDb.schemas.backup)\n        .set(withUpdatedAt({\n            status: backupStatus,\n            fileSize: size\n        }))\n        .where(eq(drizzleDb.schemas.backup.id, backup.id));\n\n    return results;\n}\n\n\n\nexport async function generateFileUrl(input: { data: StorageGetInput | StorageUploadInput, metadata?: StorageMetaData }): Promise<string | null> {\n    const fileName = path.basename(input.data.path);\n    const baseUrl = getServerUrl();\n    const metadata = input.metadata;\n\n    if (!metadata){\n        return null;\n    }\n\n    let params = new URLSearchParams({\n        storageId: metadata.storageId,\n    });\n\n    if (metadata.fileKind === \"backups\") {\n        const crypto = require(\"crypto\");\n        const expiresAt = Date.now() + 60 * 1000;\n        const token = crypto.createHash(\"sha256\").update(`${fileName}${expiresAt}`).digest(\"hex\");\n\n        params.set(\"path\", input.data.path);\n        params.set(\"token\", token);\n        params.set(\"expires\", expiresAt.toString());\n        return `${baseUrl}/api/files/${metadata.fileKind}/?${params.toString()}`\n    }else if (metadata.fileKind === \"images\") {\n        return `${baseUrl}/api/files/${metadata.fileKind}/${fileName}?${params.toString()}`\n    }else {\n        return null\n    }\n}"
  },
  {
    "path": "src/features/storages/providers/google-drive/helpers.ts",
    "content": "import {drive_v3, google} from \"googleapis\";\nimport {GoogleDriveConfig} from \"@/features/storages/providers/google-drive/types\";\nimport Drive = drive_v3.Drive;\nimport {getServerUrl} from \"@/utils/get-server-url\";\n\nexport async function getGoogleDriveClient(config: GoogleDriveConfig): Promise<Drive> {\n    const baseUrl = getServerUrl();\n\n    const oauth2Client = new google.auth.OAuth2(\n        config.clientId,\n        config.clientSecret,\n        baseUrl\n    );\n\n    oauth2Client.setCredentials({\n        refresh_token: config.refreshToken\n    });\n\n    return google.drive({\n        version: \"v3\",\n        auth: oauth2Client\n    });\n}\n\nexport async function findFileByName(\n    drive: drive_v3.Drive,\n    name: string,\n    folderId: string\n): Promise<string | null> {\n    const res = await drive.files.list({\n        q: `name='${name}' and '${folderId}' in parents and trashed=false`,\n        fields: \"files(id)\",\n        pageSize: 1,\n        supportsAllDrives: true,\n        includeItemsFromAllDrives: true,\n    });\n\n    return res.data.files?.[0]?.id ?? null;\n}\n\n\nexport async function ensureFolderPath(client: any, path: string, rootFolderId: string): Promise<string> {\n    const parts = path.split(\"/\").filter(Boolean); // [\"backups\", \"project-1\"]\n    let parentId = rootFolderId;\n\n    for (const part of parts) {\n        const res = await client.files.list({\n            q: `'${parentId}' in parents and name='${part}' and mimeType='application/vnd.google-apps.folder' and trashed=false`,\n            fields: \"files(id, name)\",\n            supportsAllDrives: true,\n            includeItemsFromAllDrives: true,\n        });\n\n        if (res.data.files && res.data.files.length > 0) {\n            parentId = res.data.files[0].id!;\n        } else {\n            const folder = await client.files.create({\n                requestBody: {\n                    name: part,\n                    mimeType: \"application/vnd.google-apps.folder\",\n                    parents: [parentId],\n                },\n                fields: \"id\",\n                supportsAllDrives: true,\n            });\n            parentId = folder.data.id!;\n        }\n    }\n\n    return parentId;\n}\n\n\nexport async function resolveFilePath(client: any, fullPath: string, rootFolderId: string): Promise<string | null> {\n    const parts = fullPath.split(\"/\").filter(Boolean);\n    const fileName = parts.pop()!;\n    let parentId = rootFolderId;\n\n    for (const part of parts) {\n        const res = await client.files.list({\n            q: `'${parentId}' in parents and name='${part}' and mimeType='application/vnd.google-apps.folder' and trashed=false`,\n            fields: \"files(id, name)\",\n            supportsAllDrives: true,\n            includeItemsFromAllDrives: true,\n        });\n        if (res.data.files && res.data.files.length > 0) {\n            parentId = res.data.files[0].id!;\n        } else {\n            return null;\n        }\n    }\n\n    const fileRes = await client.files.list({\n        q: `'${parentId}' in parents and name='${fileName}' and trashed=false`,\n        fields: \"files(id, name)\",\n        supportsAllDrives: true,\n        includeItemsFromAllDrives: true,\n    });\n\n    return fileRes.data.files?.[0]?.id || null;\n}"
  },
  {
    "path": "src/features/storages/providers/google-drive/index.ts",
    "content": "\"use server\"\nimport {\n    StorageCopyInput,\n    StorageDeleteInput,\n    StorageGetInput,\n    StorageMetaData,\n    StorageResult,\n    StorageUploadInput\n} from '../../types';\nimport {GoogleDriveConfig} from \"@/features/storages/providers/google-drive/types\";\nimport {\n    ensureFolderPath,\n    findFileByName,\n    getGoogleDriveClient, resolveFilePath\n} from \"@/features/storages/providers/google-drive/helpers\";\nimport {Readable} from \"node:stream\";\nimport {generateFileUrl} from \"@/features/storages/helpers\";\n\nexport async function uploadGoogleDrive(\n    config: GoogleDriveConfig,\n    input: { data: StorageUploadInput, metadata?: StorageMetaData },\n): Promise<StorageResult> {\n    const client = await getGoogleDriveClient(config);\n\n    const fullPath = input.data.path;\n    const pathParts = fullPath.split(\"/\").filter(Boolean);\n    const fileName = pathParts.pop()!;\n    const folderPath = pathParts.join(\"/\");\n\n    const folderId = folderPath\n        ? await ensureFolderPath(client, folderPath, config.folderId)\n        : config.folderId;\n\n    const existing = await findFileByName(client, fileName, folderId);\n    if (existing) return {success: false, provider: \"google-drive\", error: \"File already exists\"};\n\n    let fileStream: Readable;\n    const file = input.data.file;\n    if (Buffer.isBuffer(file) || file instanceof Uint8Array) {\n        fileStream = Readable.from(file);\n    } else if ((file as any).pipe) {\n        fileStream = file as Readable;\n    } else {\n        throw new Error(\"Unsupported file type for streaming upload\");\n    }\n\n    await client.files.create({\n        requestBody: {name: fileName, parents: [folderId]},\n        media: {body: fileStream},\n        fields: \"id\",\n        supportsAllDrives: true,\n    });\n\n\n    if (input.data.url) {\n        const url = await generateFileUrl(input);\n        if (!url) {\n            return {\n                success: false,\n                provider: \"google-drive\",\n                response: \"Unable to get url file\"\n            };\n        }\n        return {\n            success: true,\n            provider: 'google-drive',\n            url: url\n        };\n    }\n    return {\n        success: true,\n        provider: 'google-drive',\n    };\n\n\n}\n\nexport async function getGoogleDrive(\n    config: GoogleDriveConfig,\n    input: { data: StorageGetInput, metadata: StorageMetaData },\n): Promise<StorageResult> {\n    const client = await getGoogleDriveClient(config);\n\n    const fileId = await resolveFilePath(client, input.data.path, config.folderId);\n    if (!fileId) return {success: false, provider: \"google-drive\", error: \"File not found\"};\n\n    const res = await client.files.get(\n        {fileId, alt: \"media\", supportsAllDrives: true},\n        {responseType: \"stream\"}\n    );\n\n    const stream = res.data as Readable;\n\n\n    if (input.data.signedUrl) {\n        const url = await generateFileUrl(input);\n\n        if (!url) {\n            return {\n                success: false,\n                provider: \"google-drive\",\n                response: \"Unable to get url\"\n            };\n        }\n\n        return {\n            success: true,\n            provider: \"google-drive\",\n            file: stream,\n            url: url,\n        };\n    }\n\n    return {\n        success: true,\n        provider: \"google-drive\",\n        file: stream,\n    };\n}\n\nexport async function deleteGoogleDrive(\n    config: GoogleDriveConfig,\n    input: { data: StorageDeleteInput, metadata?: StorageMetaData },\n): Promise<StorageResult> {\n    const client = await getGoogleDriveClient(config);\n    const fileId = await resolveFilePath(client, input.data.path, config.folderId);\n    if (!fileId) return {success: false, provider: \"google-drive\", error: \"File not found\"};\n\n    await client.files.delete({fileId, supportsAllDrives: true});\n\n    return {success: true, provider: \"google-drive\"};\n}\n\nexport async function pingGoogleDrive(config: GoogleDriveConfig): Promise<StorageResult> {\n    try {\n        const drive = await getGoogleDriveClient(config);\n        const name = `ping-${Date.now()}.txt`;\n        const buffer = Buffer.from(\"ping\");\n\n        const file = await drive.files.create({\n            requestBody: {name, parents: [config.folderId]},\n            media: {mimeType: \"text/plain\", body: Readable.from(buffer)},\n            fields: \"id\",\n            supportsAllDrives: true,\n        });\n\n        await drive.files.get({fileId: file.data.id!, supportsAllDrives: true});\n        await drive.files.delete({fileId: file.data.id!, supportsAllDrives: true});\n\n        return {success: true, provider: \"google-drive\", response: \"Google Drive storage OK\"};\n    } catch (err: any) {\n        return {success: false, provider: \"google-drive\", response: err.message};\n    }\n}\n\n\nexport async function copyGoogleDrive(\n    config: GoogleDriveConfig,\n    input: {\n        data: StorageCopyInput,\n        metadata?: StorageMetaData;\n    },\n): Promise<StorageResult> {\n    const client = await getGoogleDriveClient(config);\n\n    const sourceFileId = await resolveFilePath(\n        client,\n        input.data.from,\n        config.folderId,\n    );\n\n    if (!sourceFileId) {\n        return {\n            success: false,\n            provider: \"google-drive\",\n            error: \"Source file not found\",\n        };\n    }\n\n    const fullPath = input.data.to;\n    const parts = fullPath.split(\"/\").filter(Boolean);\n    const fileName = parts.pop()!;\n    const folderPath = parts.join(\"/\");\n\n    const folderId = folderPath\n        ? await ensureFolderPath(client, folderPath, config.folderId)\n        : config.folderId;\n\n    try {\n        const copied = await client.files.copy({\n            fileId: sourceFileId,\n            requestBody: {\n                name: fileName,\n                parents: [folderId],\n            },\n            fields: \"id\",\n            supportsAllDrives: true,\n        });\n\n        const newFileId = copied.data.id;\n\n        if (!newFileId) {\n            return {\n                success: false,\n                provider: \"google-drive\",\n                error: \"Copy failed (no file id returned)\",\n            };\n        }\n\n        return {\n            success: true,\n            provider: \"google-drive\",\n        };\n    } catch (err: any) {\n        return {\n            success: false,\n            provider: \"google-drive\",\n            error: err.message || \"Copy failed\",\n        };\n    }\n}"
  },
  {
    "path": "src/features/storages/providers/google-drive/types.ts",
    "content": "\nexport type GoogleDriveConfig = {\n    clientId: string;\n    clientSecret: string;\n    refreshToken: string;\n    folderId: string;\n};"
  },
  {
    "path": "src/features/storages/providers/index.ts",
    "content": "import {\n    StorageProviderKind,\n    StorageInput,\n    StorageResult,\n} from '../types';\n\nimport {uploadLocal, getLocal, deleteLocal, pingLocal, copyLocal} from './local';\nimport {copyS3, deleteS3, getS3, pingS3, uploadS3} from \"@/features/storages/providers/s3\";\nimport {\n    copyGoogleDrive,\n    deleteGoogleDrive,\n    getGoogleDrive,\n    pingGoogleDrive,\n    uploadGoogleDrive\n} from \"@/features/storages/providers/google-drive\";\n\ntype ProviderHandler = {\n    upload: (config: any, input: StorageInput & { action: 'upload' }) => Promise<StorageResult>;\n    get: (config: any, input: StorageInput & { action: 'get' }) => Promise<StorageResult>;\n    delete: (config: any, input: StorageInput & { action: 'delete' }) => Promise<StorageResult>;\n    ping: (config: any, input: { action: 'ping' }) => Promise<StorageResult>;\n    copy: (config: any, input: StorageInput & { action: 'copy' }) => Promise<StorageResult>;\n};\n\nconst handlers: Record<StorageProviderKind, ProviderHandler> = {\n    local: {\n        upload: uploadLocal,\n        get: getLocal,\n        delete: deleteLocal,\n        ping: pingLocal,\n        copy: copyLocal,\n    },\n    s3: {\n        upload: uploadS3,\n        get: getS3,\n        delete: deleteS3,\n        ping: pingS3,\n        copy: copyS3\n    },\n    \"google-drive\": {\n        upload: uploadGoogleDrive,\n        get: getGoogleDrive,\n        delete: deleteGoogleDrive,\n        ping: pingGoogleDrive,\n        copy: copyGoogleDrive,\n    }\n};\n\nexport async function dispatchViaProvider(\n    kind: StorageProviderKind,\n    config: any,\n    input: StorageInput,\n): Promise<StorageResult> {\n    const provider = handlers[kind];\n\n    if (!provider) {\n        return {\n            success: false,\n            provider: kind,\n            error: `Unsupported storage provider: ${kind}`,\n        };\n    }\n\n    try {\n        return await provider[input.action](config, input as any);\n    } catch (err: any) {\n        return {\n            success: false,\n            provider: kind,\n            error: err.message || 'Storage provider error',\n        };\n    }\n}\n"
  },
  {
    "path": "src/features/storages/providers/local.ts",
    "content": "\"use server\";\nimport { mkdir, unlink } from \"fs/promises\";\nimport path from \"path\";\nimport {\n  StorageCopyInput,\n  StorageDeleteInput,\n  StorageGetInput,\n  StorageMetaData,\n  StorageResult,\n  StorageUploadInput,\n} from \"../types\";\nimport fs from \"node:fs\";\nimport { generateFileUrl } from \"@/features/storages/helpers\";\nimport { Readable } from \"node:stream\";\nimport { env } from \"@/env.mjs\";\n\nconst BASE_DIR = path.join(env.PRIVATE_PATH!, \"/uploads\");\n\nexport async function uploadLocal(\n  config: { baseDir?: string },\n  input: { data: StorageUploadInput; metadata?: StorageMetaData },\n): Promise<StorageResult> {\n  const base = config.baseDir\n    ? path.join(process.cwd(), config.baseDir ?? \"\")\n    : BASE_DIR;\n\n  const fullPath = path.join(base, input.data.path);\n  const dir = path.dirname(fullPath);\n\n  await mkdir(dir, { recursive: true });\n\n  try {\n    const file = input.data.file;\n    if (Buffer.isBuffer(file)) {\n      await fs.promises.writeFile(fullPath, input.data.file);\n    } else if (file instanceof Readable) {\n      await new Promise<void>((resolve, reject) => {\n        const writable = fs.createWriteStream(fullPath);\n        file.pipe(writable);\n        writable.on(\"finish\", resolve);\n        writable.on(\"error\", reject);\n      });\n    } else {\n      return {\n        success: false,\n        provider: \"local\",\n        error: \"Unsupported file type. Must be Buffer or ReadableStream\",\n      };\n    }\n\n    if (input.data.url) {\n      const url = await generateFileUrl(input);\n      if (!url) {\n        return {\n          success: false,\n          provider: \"local\",\n          response: \"Unable to get URL\",\n        };\n      }\n      return { success: true, provider: \"local\", url };\n    }\n\n    return { success: true, provider: \"local\" };\n  } catch (err: any) {\n    try {\n      await unlink(fullPath);\n    } catch {}\n    return {\n      success: false,\n      provider: \"local\",\n      error: err.message || \"Upload failed\",\n    };\n  }\n}\n\nexport async function getLocal(\n  config: { baseDir?: string },\n  input: { data: StorageGetInput; metadata: StorageMetaData },\n): Promise<StorageResult> {\n  const base = config.baseDir\n    ? path.join(process.cwd(), config.baseDir ?? \"\")\n    : BASE_DIR;\n  const filePath = path.join(base, input.data.path);\n\n  if (!fs.existsSync(filePath)) {\n    console.error(\"File not found at:\", filePath);\n    return {\n      success: false,\n      provider: \"local\",\n      error: \"File not found\",\n    };\n  }\n\n  let fileStream: fs.ReadStream | undefined;\n\n  try {\n    fileStream = fs.createReadStream(filePath);\n  } catch (err: any) {\n    console.error(\"Error creating read stream:\", err);\n    return {\n      success: false,\n      provider: \"local\",\n      error: err.message,\n    };\n  }\n\n  if (input.data.signedUrl) {\n    const url = await generateFileUrl(input);\n    if (!url) {\n      return {\n        success: false,\n        provider: \"local\",\n        error: \"Unable to generate signed URL\",\n      };\n    }\n\n    return {\n      success: true,\n      provider: \"local\",\n      file: fileStream,\n      url,\n    };\n  }\n\n  return {\n    success: true,\n    provider: \"local\",\n    file: fileStream,\n  };\n}\n\nexport async function deleteLocal(\n  config: { baseDir?: string },\n  input: { data: StorageDeleteInput; metadata?: StorageMetaData },\n): Promise<StorageResult> {\n  const base = config.baseDir\n    ? path.join(process.cwd(), config.baseDir ?? \"\")\n    : BASE_DIR;\n  const fullPath = path.join(base, input.data.path);\n\n  await unlink(fullPath);\n  return {\n    success: true,\n    provider: \"local\",\n  };\n}\n\nexport async function pingLocal(config: {\n  baseDir?: string;\n}): Promise<StorageResult> {\n  const base = path.join(process.cwd(), config.baseDir ?? \"\") || BASE_DIR;\n  const fullPath = path.join(base, \"ping.txt\");\n\n  await fs.promises.writeFile(fullPath, \"ping\");\n  await fs.promises.readFile(fullPath);\n  await fs.promises.unlink(fullPath);\n  return {\n    success: true,\n    provider: \"local\",\n    response: \"Local storage OK\",\n  };\n}\n\nexport async function copyLocal(\n    config: { baseDir?: string },\n    input: {\n      data: StorageCopyInput,\n      metadata?: StorageMetaData;\n    },\n): Promise<StorageResult> {\n  const base = config.baseDir\n      ? path.join(process.cwd(), config.baseDir ?? \"\")\n      : BASE_DIR;\n\n  const sourcePath = path.join(base, input.data.from);\n  const destinationPath = path.join(base, input.data.to);\n\n  const dir = path.dirname(destinationPath);\n  await mkdir(dir, { recursive: true });\n\n  if (!fs.existsSync(sourcePath)) {\n    return {\n      success: false,\n      provider: \"local\",\n      error: \"Source file not found\",\n    };\n  }\n\n  try {\n    await new Promise<void>((resolve, reject) => {\n      const readStream = fs.createReadStream(sourcePath);\n      const writeStream = fs.createWriteStream(destinationPath);\n\n      readStream.on(\"error\", reject);\n      writeStream.on(\"error\", reject);\n      writeStream.on(\"finish\", resolve);\n\n      readStream.pipe(writeStream);\n    });\n\n\n    return {\n      success: true,\n      provider: \"local\",\n    };\n  } catch (err: any) {\n    try {\n      await unlink(destinationPath);\n    } catch {}\n\n    return {\n      success: false,\n      provider: \"local\",\n      error: err.message || \"Copy failed\",\n    };\n  }\n}"
  },
  {
    "path": "src/features/storages/providers/s3.ts",
    "content": "import * as Minio from \"minio\";\nimport {\n    StorageCopyInput,\n    StorageDeleteInput,\n    StorageGetInput,\n    StorageMetaData,\n    StorageResult,\n    StorageUploadInput\n} from \"../types\";\nimport {Readable} from \"node:stream\";\n\ntype S3Config = {\n    endPointUrl: string;\n    region?: string;\n    accessKey: string;\n    secretKey: string;\n    bucketName: string;\n    port?: number;\n    ssl?: boolean;\n};\n\nasync function getS3Client(config: S3Config) {\n    return new Minio.Client({\n        endPoint: config.endPointUrl,\n        region: config.region ?? \"us-east-1\",\n        accessKey: config.accessKey,\n        secretKey: config.secretKey,\n        port: config.port ? Number(config.port) : 443,\n        useSSL: config.ssl ?? true,\n    });\n}\n\nconst BASE_DIR = \"\";\n\n\nasync function ensureBucket(config: S3Config) {\n    const client = await getS3Client(config);\n    const exists = await client.bucketExists(config.bucketName);\n    if (!exists) await client.makeBucket(config.bucketName);\n}\n\nexport async function uploadS3(\n    config: S3Config,\n    input: { data: StorageUploadInput, metadata?: StorageMetaData }\n): Promise<StorageResult> {\n    const client = await getS3Client(config);\n    await ensureBucket(config);\n\n    const key = `${BASE_DIR}${input.data.path}`;\n    const file = input.data.file;\n\n    let uploadStream: Readable;\n    if (Buffer.isBuffer(file) || file instanceof Uint8Array) {\n        uploadStream = Readable.from(file);\n    } else if ((file as any).pipe) {\n        uploadStream = file;\n    } else {\n        return {success: false, provider: \"s3\", error: \"Unsupported file type for streaming upload\"};\n    }\n\n    try {\n        const result = await client.putObject(config.bucketName, key, uploadStream, input.data.size);\n    } catch (err: any) {\n        return {success: false, provider: \"s3\", error: err.message};\n    }\n\n    return {success: true, provider: \"s3\"};\n}\n\n\nexport async function getS3(\n    config: S3Config,\n    input: { data: StorageGetInput, metadata: StorageMetaData }\n): Promise<StorageResult> {\n    const client = await getS3Client(config);\n    const key = `${BASE_DIR}${input.data.path}`;\n\n    try {\n        await client.statObject(config.bucketName, key);\n    } catch {\n        return {success: false, provider: \"s3\", error: \"File not found\"};\n    }\n\n    const fileStream = await client.getObject(config.bucketName, key);\n\n    let presignedUrl: string | undefined;\n    if (input.data.signedUrl) {\n        presignedUrl = await client.presignedGetObject(config.bucketName, key, input.data.expiresInSeconds ?? 60);\n    }\n\n    return {\n        success: true,\n        provider: \"s3\",\n        file: fileStream as unknown as Buffer | Readable,\n        url: presignedUrl,\n    };\n}\n\n\nexport async function deleteS3(config: S3Config, input: {\n    data: StorageDeleteInput,\n    metadata?: StorageMetaData\n}): Promise<StorageResult> {\n    const client = await getS3Client(config);\n    const key = `${BASE_DIR}${input.data.path}`;\n\n    try {\n        await client.removeObject(config.bucketName, key);\n        return {success: true, provider: \"s3\"};\n    } catch (err: any) {\n        return {success: false, provider: \"s3\", error: err.message};\n    }\n}\n\nexport async function pingS3(config: S3Config): Promise<StorageResult> {\n    try {\n        const client = await getS3Client(config);\n        const exists = await client.bucketExists(config.bucketName);\n        if (!exists) return {\n            success: false,\n            provider: \"s3\",\n            response: \"Bucket does not exist\"\n        };\n        const key = `${BASE_DIR}ping.txt`;\n        await client.putObject(config.bucketName, key, Buffer.from(\"ping\"));\n        await client.getObject(config.bucketName, key);\n        await client.removeObject(config.bucketName, key);\n\n        return {\n            success: true,\n            provider: \"s3\",\n            response: \"S3 storage OK\"\n        };\n    } catch (err: any) {\n        return {\n            success: false,\n            provider: \"s3\",\n            response: err.message\n        };\n    }\n}\n\n\nexport async function copyS3(\n    config: S3Config,\n    input: {\n        data: StorageCopyInput,\n    },\n): Promise<StorageResult> {\n    const client = await getS3Client(config);\n    await ensureBucket(config);\n\n    const sourceKey = `${BASE_DIR}${input.data.from}`;\n    const destinationKey = `${BASE_DIR}${input.data.to}`;\n\n    try {\n        await client.copyObject(\n            config.bucketName,\n            destinationKey,\n            `/${config.bucketName}/${sourceKey}`\n        );\n\n        return {\n            success: true,\n            provider: \"s3\",\n        };\n    } catch (err: any) {\n        return {\n            success: false,\n            provider: \"s3\",\n            error: err.message,\n        };\n    }\n}"
  },
  {
    "path": "src/features/storages/types.ts",
    "content": "import {Readable} from \"node:stream\";\n\nexport type StorageProviderKind =\n    | 'local'\n    | 's3'\n    | 'google-drive'\n    ;\n\nexport type StorageAction =\n    | 'upload'\n    | 'get'\n    | 'delete';\n\nexport type StorageFileKind =\n    | 'backups'\n    | 'images'\n\nexport type StorageMetaData = {\n    storageId: string,\n    fileKind: StorageFileKind\n}\n\nexport interface StorageUploadInput {\n    path: string;\n    file: Readable | Buffer | Uint8Array;\n    url?: boolean;\n    contentType?: string;\n    size?: number;\n}\n\nexport interface StorageGetInput {\n    path: string;\n    signedUrl?: boolean;\n    expiresInSeconds?: number;\n}\n\nexport interface StorageDeleteInput {\n    path: string;\n}\n\n\nexport interface StorageCopyInput {\n    from: string;\n    to: string;\n}\n\nexport type StorageInput =\n    | { action: 'upload'; data: StorageUploadInput, metadata?: StorageMetaData }\n    | { action: 'get'; data: StorageGetInput, metadata: StorageMetaData }\n    | { action: 'delete'; data: StorageDeleteInput, metadata?: StorageMetaData }\n    | { action: 'ping'; }\n    | { action: 'copy'; data: StorageCopyInput, metadata?: StorageMetaData };\n\nexport interface StorageResult {\n    success: boolean;\n    provider: StorageProviderKind | null;\n    url?: string;\n    file?: Buffer | Readable;\n    error?: string;\n    response?: any;\n}\n"
  },
  {
    "path": "src/features/theme/mode-toggle.tsx",
    "content": "\"use client\"\nimport { Moon, Sun, Check, SunMoon } from \"lucide-react\"\nimport { useTheme } from \"next-themes\"\nimport { authClient } from \"@/lib/auth/auth-client\"\n\nimport { Button } from \"@/components/ui/button\"\nimport {\n    DropdownMenu,\n    DropdownMenuContent,\n    DropdownMenuItem,\n    DropdownMenuTrigger,\n} from \"@/components/ui/dropdown-menu\"\nimport { cn } from \"@/lib/utils\"\n\nconst themes = [\n    { id: \"light\", icon: Sun, label: \"Light\" },\n    { id: \"dark\", icon: Moon, label: \"Dark\" },\n    { id: \"system\", icon: SunMoon, label: \"System\" },\n] as const\n\nexport function ModeToggle() {\n    const { theme } = useTheme()\n\n    const handleThemeChange = async (newTheme: \"light\" | \"system\" | \"dark\") => {\n        await authClient.updateUser({ theme: newTheme })\n    }\n\n    return (\n        <DropdownMenu>\n            <DropdownMenuTrigger asChild>\n                <Button variant=\"ghost\" size=\"icon\" className=\"size-8 rounded-full border border-input bg-transparent shadow-xs transition-transform active:scale-95\">\n                    {theme === \"light\" ? <Sun className=\"size-4\" /> : theme === \"dark\" ? <Moon className=\"size-4\" /> : <SunMoon className=\"size-4\" />}\n                    <span className=\"sr-only\">Toggle theme</span>\n                </Button>\n            </DropdownMenuTrigger>\n            <DropdownMenuContent align=\"end\" className=\"min-w-37.5 rounded-xl border-2 border-border p-1 shadow-none\">\n                {themes.map((t) => {\n                    const ThemeIcon = t.icon\n                    const isActive = theme === t.id\n                    return (\n                        <DropdownMenuItem\n                            key={t.id}\n                            onClick={() => handleThemeChange(t.id)}\n                            className={cn(\n                                \"group gap-2 p-2 cursor-pointer rounded-lg mb-1 last:mb-0 transition-colors\",\n                                isActive\n                                    ? \"bg-primary/10 text-primary border border-primary/20\"\n                                    : \"focus:bg-accent hover:bg-accent/50 border border-transparent\"\n                            )}\n                        >\n                            <div className={cn(\n                                \"flex size-7 shrink-0 items-center justify-center rounded-md border shadow-sm transition-all group-hover:shadow-md\",\n                                isActive ? \"bg-primary text-primary-foreground border-primary/30\" : \"bg-muted/50 border-border\"\n                            )}>\n                                <ThemeIcon className={cn(\n                                    \"size-4\",\n                                    isActive ? \"text-primary-foreground\" : \"text-muted-foreground\"\n                                )} />\n                            </div>\n                            <span className={cn(\n                                \"text-sm font-medium leading-none flex-1\",\n                                isActive ? \"text-primary\" : \"\"\n                            )}>\n                                {t.label}\n                            </span>\n                            {isActive && (\n                                <div className=\"flex size-4 items-center justify-center rounded-full bg-primary shadow-sm ml-auto\">\n                                    <Check className=\"size-2.5 text-primary-foreground\" strokeWidth={3} />\n                                </div>\n                            )}\n                        </DropdownMenuItem>\n                    )\n                })}\n            </DropdownMenuContent>\n        </DropdownMenu>\n    )\n}"
  },
  {
    "path": "src/features/theme/theme-provider.tsx",
    "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { ThemeProvider as NextThemesProvider } from \"next-themes\"\n//@ts-ignore\nimport { type ThemeProviderProps } from \"next-themes/dist/types\"\n\nexport function ThemeProvider({ children, ...props }: ThemeProviderProps) {\n    return <NextThemesProvider {...props}>{children}</NextThemesProvider>\n}"
  },
  {
    "path": "src/features/updates/components/update-notification.tsx",
    "content": "\"use client\";\n\nimport {useUpdateCheck} from \"../hooks/use-update-check\";\nimport {useSidebar, SidebarGroup, SidebarGroupContent, SidebarMenu, SidebarMenuItem} from \"@/components/ui/sidebar\";\nimport {X, ArrowUpCircle, MoveRight} from \"lucide-react\";\nimport Link from \"next/link\";\n\n\nexport const UpdateNotification = () => {\n    const {isUpdateAvailable, newRelease, dismissUpdate} = useUpdateCheck();\n    const {state} = useSidebar();\n\n    if (!isUpdateAvailable || !newRelease || state !== \"expanded\") {\n        return null;\n    }\n\n    return (\n        <SidebarGroup className=\"py-0\">\n            <SidebarGroupContent>\n                <SidebarMenu>\n                    <SidebarMenuItem>\n                        <div\n                            className=\"w-[var(--radix-popper-anchor-width)] relative flex flex-col gap-2 rounded-lg border bg-primary/5 p-3 text-sidebar-foreground border-primary/20\">\n                            <button\n                                onClick={dismissUpdate}\n                                className=\"absolute right-2 top-2 rounded-md p-0.5 text-muted-foreground/50 hover:bg-sidebar-accent hover:text-foreground transition-colors\"\n                            >\n                                <X className=\"size-3\"/>\n                                <span className=\"sr-only\">Dismiss</span>\n                            </button>\n\n                            <div className=\"flex items-center gap-2\">\n                                <div\n                                    className=\"flex size-7 shrink-0 items-center justify-center rounded-full bg-primary/10 text-primary\">\n                                    <ArrowUpCircle className=\"size-4\"/>\n                                </div>\n                                <div className=\"flex flex-col min-w-0\">\n                                    <div className=\"flex items-center gap-1\">\n                                        <span className=\"text-[10px] font-semibold leading-none\">Update available</span>\n                                        {newRelease.tag_name && (\n                                            <span\n                                                className=\"text-[10px] text-muted-foreground font-medium px-1 py-0.5 bg-primary/10 rounded-full\">\n                                                v{newRelease.tag_name.replace(/^v/, \"\")}\n                                            </span>\n                                        )}\n                                    </div>\n                                    <Link\n                                        href={newRelease.html_url}\n                                        target=\"_blank\"\n                                        className=\"group inline-flex items-center gap-1 text-[11px] text-primary hover:underline font-medium mt-1\"\n                                    >\n                                        See what's new\n                                        <MoveRight className=\"size-3 transition-transform group-hover:translate-x-0.5\"/>\n                                    </Link>\n                                </div>\n                            </div>\n                        </div>\n                    </SidebarMenuItem>\n                </SidebarMenu>\n            </SidebarGroupContent>\n        </SidebarGroup>\n    );\n};"
  },
  {
    "path": "src/features/updates/hooks/use-update-check.ts",
    "content": "\"use client\";\n\nimport {useQuery} from \"@tanstack/react-query\";\nimport {getNewRelease} from \"../services/github\";\nimport {env} from \"@/env.mjs\";\nimport {useEffect, useState} from \"react\";\n\nconst DISMISS_KEY = \"portabase-update-dismissed\";\nconst DISMISS_DURATION = 1000 * 60 * 60 * 24;\n\nexport const useUpdateCheck = () => {\n        const [isDismissed, setIsDismissed] = useState(true);\n\n        const currentVersion = env.NEXT_PUBLIC_PROJECT_VERSION!;\n\n        const {data: newRelease, isLoading} = useQuery({\n            queryKey: [\"new-release\"],\n            queryFn: () => getNewRelease(currentVersion),\n            staleTime: 1000 * 60 * 60,\n        });\n\n\n        useEffect(() => {\n            if (!newRelease) return;\n\n            const dismissedData = localStorage.getItem(DISMISS_KEY);\n            if (dismissedData) {\n                const {version, timestamp} = JSON.parse(dismissedData);\n                const now = Date.now();\n                if (version === newRelease.name && now - timestamp < DISMISS_DURATION) {\n                    setIsDismissed(true);\n                    return;\n                }\n            }\n            setIsDismissed(false);\n\n        }, [newRelease])\n\n\n        const dismissUpdate = () => {\n            if (newRelease) {\n                localStorage.setItem(DISMISS_KEY, JSON.stringify({\n                    version: newRelease.name,\n                    timestamp: Date.now()\n                }));\n                setIsDismissed(true);\n            }\n        };\n\n        return {\n            newRelease,\n            isLoading,\n            isUpdateAvailable: !isDismissed && newRelease,\n            dismissUpdate\n        };\n    }\n;\n"
  },
  {
    "path": "src/features/updates/services/github.ts",
    "content": "export interface GitHubRelease {\n    tag_name: string;\n    html_url: string;\n    prerelease: boolean;\n    name: string;\n    body: string;\n}\n\ntype ParsedVersion = {\n    major: number;\n    minor: number;\n    patch: number;\n    rc?: number;\n};\n\nfunction parseVersion(version: string): ParsedVersion {\n    const match = version.match(/^v?(\\d+)\\.(\\d+)\\.(\\d+)(?:-rc\\.(\\d+))?$/);\n    if (!match) return {\n        major: 0,\n        minor: 0,\n        patch: 0,\n        rc: undefined,\n    };\n\n    return {\n        major: Number(match[1]),\n        minor: Number(match[2]),\n        patch: Number(match[3]),\n        rc: match[4] ? Number(match[4]) : undefined,\n    };\n}\n\nconst findLatestVersion = (currentVersion: string, releases: GitHubRelease[]): GitHubRelease | null => {\n    const cleanCurrentVersion = currentVersion.replace(/^v/, \"\");\n    const isStable = /^\\d+\\.\\d+\\.\\d+$/.test(cleanCurrentVersion);\n    const isRc = /^\\d+\\.\\d+\\.\\d+-rc\\.\\d+$/.test(cleanCurrentVersion);\n\n    const currentParsedVersion = parseVersion(cleanCurrentVersion);\n    \n    if (isRc) {\n        const latestStableVersion = releases.find(r => !r.prerelease);\n        const latestRcVersion = releases.find(r => r.prerelease && (r.tag_name.includes(\"rc\") || (r.name && r.name.includes(\"rc\"))));\n\n        if (latestStableVersion) {\n            const versionStr = latestStableVersion.tag_name || latestStableVersion.name;\n            const latestStableParsedVersion = parseVersion(versionStr);\n            if (latestStableParsedVersion.major > currentParsedVersion.major) return latestStableVersion;\n            if (latestStableParsedVersion.major === currentParsedVersion.major && latestStableParsedVersion.minor > currentParsedVersion.minor) return latestStableVersion;\n            if (latestStableParsedVersion.major === currentParsedVersion.major && latestStableParsedVersion.minor === currentParsedVersion.minor && latestStableParsedVersion.patch >= currentParsedVersion.patch) return latestStableVersion;\n        }\n\n        if (latestRcVersion) {\n            const versionStr = latestRcVersion.tag_name || latestRcVersion.name;\n            const latestRcParsedVersion = parseVersion(versionStr);\n            if (latestRcParsedVersion.major > currentParsedVersion.major) return latestRcVersion;\n            if (latestRcParsedVersion.major === currentParsedVersion.major && latestRcParsedVersion.minor > currentParsedVersion.minor) return latestRcVersion;\n            if (latestRcParsedVersion.major === currentParsedVersion.major && latestRcParsedVersion.minor === currentParsedVersion.minor && latestRcParsedVersion.patch > currentParsedVersion.patch) return latestRcVersion;\n            if (latestRcParsedVersion.major === currentParsedVersion.major && latestRcParsedVersion.minor === currentParsedVersion.minor && latestRcParsedVersion.patch === currentParsedVersion.patch && \n                latestRcParsedVersion.rc !== undefined && currentParsedVersion.rc !== undefined && latestRcParsedVersion.rc > currentParsedVersion.rc) return latestRcVersion;\n        }\n    } else if (isStable) {\n        const latestStableVersion = releases.find(r => !r.prerelease);\n        if (latestStableVersion) {\n            const versionStr = latestStableVersion.tag_name || latestStableVersion.name;\n            const latestStableParsedVersion = parseVersion(versionStr);\n            \n            if (latestStableParsedVersion.major > currentParsedVersion.major) return latestStableVersion;\n            if (latestStableParsedVersion.major === currentParsedVersion.major && latestStableParsedVersion.minor > currentParsedVersion.minor) return latestStableVersion;\n            if (latestStableParsedVersion.major === currentParsedVersion.major && latestStableParsedVersion.minor === currentParsedVersion.minor && latestStableParsedVersion.patch > currentParsedVersion.patch) return latestStableVersion;\n        }\n    }\n\n    return null;\n};\n\nexport const getNewRelease = async (currentVersion: string): Promise<GitHubRelease | null> => {\n    try {\n        const response = await fetch(\"https://api.github.com/repos/Portabase/portabase/releases\");\n        if (!response.ok) {\n            return null;\n        }\n\n        const releases: GitHubRelease[] = await response.json();\n        return findLatestVersion(currentVersion, releases);\n\n    } catch (error) {\n        console.error(\"Failed to fetch latest release\", error);\n        return null;\n    }\n};\n\nexport const getNewAgentRelease = async (currentVersion: string): Promise<GitHubRelease | null> => {\n    try {\n        const response = await fetch(\"https://api.github.com/repos/Portabase/agent-rust/releases\", {\n            next: { revalidate: 3600 }\n        });\n        if (!response.ok) {\n            return null;\n        }\n\n        const releases: GitHubRelease[] = await response.json();\n        return findLatestVersion(currentVersion, releases);\n\n    } catch (error) {\n        console.error(\"Failed to fetch latest agent release\", error);\n        return null;\n    }\n};"
  },
  {
    "path": "src/features/upload/public/upload.action.ts",
    "content": "\"use server\";\nimport {userAction} from \"@/lib/safe-actions/actions\";\nimport {z} from \"zod\";\nimport {v4 as uuidv4} from \"uuid\";\nimport {db} from \"@/db\";\nimport {eq} from \"drizzle-orm\";\nimport * as drizzleDb from \"@/db\";\nimport {ServerActionResult} from \"@/types/action-type\";\nimport {dispatchStorage} from \"@/features/storages/dispatch\";\nimport {StorageInput} from \"@/features/storages/types\";\nimport sharp from \"sharp\";\n\n\nexport const uploadUserImageAction = userAction.schema(\n    z.instanceof(FormData)\n).action(async ({parsedInput: formData}): Promise<ServerActionResult<string>> => {\n    try {\n\n        const file = formData.get(\"file\") as File;\n        const uuid = uuidv4();\n        const fileFormat = file.name.split(\".\").pop();\n        const arrayBuffer = await file.arrayBuffer();\n        const buffer = Buffer.from(arrayBuffer);\n\n\n        const isPng = fileFormat === \"png\";\n        const isWebp = fileFormat === \"webp\";\n\n        const compressedBuffer = await sharp(buffer)\n            .resize({ width: 1024 })\n            .toFormat(isPng ? \"png\" : isWebp ? \"webp\" : \"jpeg\", {\n                quality: 80,\n                compressionLevel: isPng ? 9 : undefined\n            })\n            .toBuffer();\n\n\n\n        const settings = await db.query.setting.findFirst({\n            where: eq(drizzleDb.schemas.setting.name, \"system\"),\n            with: {\n                storageChannel: true\n            }\n        });\n\n        if (!settings || !settings.storageChannel) {\n            return {\n                success: false,\n                actionError: {\n                    message: \"An error occurred with default settings.\",\n                    status: 500,\n                },\n            };\n        }\n\n        const path = `images/${uuid}.${fileFormat?.toLowerCase()}`;\n\n        const input: StorageInput = {\n            action: \"upload\",\n            data: {\n                path: path,\n                file: compressedBuffer,\n                url: true\n            },\n            metadata: {\n                storageId: settings.storageChannel.id,\n                fileKind: \"images\"\n            }\n        }\n\n        const result = await dispatchStorage(input, undefined, settings.storageChannel.id);\n        console.log(result);\n        if (!result.success) {\n            return {\n                success: false,\n                actionError: {\n                    message: \"Failed to upload user avatar.\",\n                    status: 500,\n                    cause: result.error\n                },\n            };\n        }\n\n        return {\n            success: true,\n            value: result.url,\n            actionSuccess: {\n                message: \"Avatar successfully updated\",\n            },\n        };\n    } catch (error) {\n        return {\n            success: false,\n            actionError: {\n                message: \"Failed to upload user avatar.\",\n                status: 500,\n                cause: error instanceof Error ? error.message : \"Unknown error\",\n            },\n        };\n    }\n});\n\n\n\n"
  },
  {
    "path": "src/fonts/fonts.ts",
    "content": "import {Poppins} from \"next/font/google\";\nimport localFont from \"next/font/local\";\n\nexport const poppins = Poppins({\n    subsets: [\"latin\"],\n    weight: [\"400\", \"500\", \"600\", \"700\"],\n    variable: \"--font-poppins\",\n});\n\nexport const author = localFont({\n    src: [\n        {\n            path: \"./author/Author-Variable.ttf\",\n            style: \"normal\",\n        },\n        {\n            path: \"./author/Author-VariableItalic.ttf\",\n            style: \"italic\",\n        },\n    ],\n    variable: \"--font-author\",\n});\n\nexport const geistMono = localFont({\n    src: \"./geist/GeistMonoVF.woff\",\n    variable: \"--font-geist-mono\",\n});\n"
  },
  {
    "path": "src/hooks/use-mobile.ts",
    "content": "import * as React from \"react\"\n\nconst MOBILE_BREAKPOINT = 768\n\nexport function useIsMobile() {\n  const [isMobile, setIsMobile] = React.useState<boolean | undefined>(undefined)\n\n  React.useEffect(() => {\n    const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`)\n    const onChange = () => {\n      setIsMobile(window.innerWidth < MOBILE_BREAKPOINT)\n    }\n    mql.addEventListener(\"change\", onChange)\n    setIsMobile(window.innerWidth < MOBILE_BREAKPOINT)\n    return () => mql.removeEventListener(\"change\", onChange)\n  }, [])\n\n  return !!isMobile\n}\n"
  },
  {
    "path": "src/hooks/use-mobile.tsx",
    "content": "import * as React from \"react\"\n\nconst MOBILE_BREAKPOINT = 768\n\nexport function useIsMobile() {\n    const [isMobile, setIsMobile] = React.useState<boolean | undefined>(undefined)\n\n    React.useEffect(() => {\n        const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`)\n        const onChange = () => {\n            setIsMobile(window.innerWidth < MOBILE_BREAKPOINT)\n        }\n        mql.addEventListener(\"change\", onChange)\n        setIsMobile(window.innerWidth < MOBILE_BREAKPOINT)\n        return () => mql.removeEventListener(\"change\", onChange)\n    }, [])\n\n    return !!isMobile\n}\n"
  },
  {
    "path": "src/hooks/use-organization-permissions.ts",
    "content": "\"use client\";\n\nimport {MemberWithUser} from \"@/db/schema/03_organization\";\nimport {computeOrganizationPermissions} from \"@/lib/acl/organization-acl\";\n\nexport const useOrganizationPermissions = (activeMember: MemberWithUser | null) => {\n    return computeOrganizationPermissions(activeMember);\n};\n"
  },
  {
    "path": "src/lib/acl/organization-acl.ts",
    "content": "import {MemberWithUser} from \"@/db/schema/03_organization\";\n\n\nexport type OrganizationPermissions = {\n    role: string | null;\n    isOwner: boolean;\n    isAdmin: boolean;\n    isMember: boolean;\n\n    canManageAgents: boolean;\n    canManageSettings: boolean;\n    canManageUsers: boolean;\n    canManageNotifications: boolean;\n    canManageStorages: boolean;\n    canManageDangerZone: boolean;\n};\n\n\nexport const computeOrganizationPermissions = (\n    activeMember: MemberWithUser | null\n): OrganizationPermissions => {\n    const role = activeMember?.role ?? null;\n\n    const isOwner = role === \"owner\";\n    const isAdmin = role === \"admin\";\n    const isMember = role === \"member\";\n\n    return {\n        role,\n        isOwner,\n        isAdmin,\n        isMember,\n\n        canManageSettings: isOwner || isAdmin,\n        canManageAgents: isOwner || isAdmin,\n        canManageUsers: isOwner || isAdmin,\n        canManageNotifications: isOwner || isAdmin,\n        canManageStorages: isOwner || isAdmin,\n        canManageDangerZone: isOwner,\n    };\n};\n"
  },
  {
    "path": "src/lib/auth/auth-client.ts",
    "content": "\"use client\"\nimport {createAuthClient} from \"better-auth/react\";\n\nimport {adminClient, inferAdditionalFields, organizationClient, twoFactorClient} from \"better-auth/client/plugins\";\nimport {ac, user, admin as adminRole, pending, superadmin, orgAdmin, orgMember, orgOwner} from \"./permissions\";\nimport type {auth} from \"@/lib/auth/auth\";\nimport {getServerUrl} from \"@/utils/get-server-url\";\nimport { ssoClient } from \"@better-auth/sso/client\";\nimport { passkeyClient } from \"@better-auth/passkey/client\"\n\nconst res = await fetch(`${getServerUrl()}/api/config`);\nconst {PROJECT_URL} = await res.json();\n\nexport const authClient = createAuthClient({\n    baseURL: PROJECT_URL,\n    plugins: [\n        passkeyClient(),\n        twoFactorClient(),\n        ssoClient(),\n        organizationClient({\n            ac,\n            roles: {\n                owner: orgOwner,\n                admin: orgAdmin,\n                member: orgMember,\n            },\n        }),\n        adminClient({\n            ac,\n            roles: {\n                admin: adminRole,\n                user,\n                pending,\n                superadmin,\n            },\n        }),\n        inferAdditionalFields<typeof auth>(),\n    ],\n\n});\n\nexport const { signIn, signOut, signUp, deleteUser, useSession, listAccounts, passkey, admin, twoFactor, requestPasswordReset, sso } = authClient;"
  },
  {
    "path": "src/lib/auth/auth.ts",
    "content": "import {betterAuth} from \"better-auth\";\nimport {drizzleAdapter} from \"better-auth/adapters/drizzle\";\nimport * as drizzleDb from \"@/db\";\nimport {db} from \"@/db\";\nimport {env} from \"@/env.mjs\";\nimport {nextCookies} from \"better-auth/next-js\";\nimport {admin as adminPlugin, openAPI, Organization, organization, twoFactor} from \"better-auth/plugins\";\nimport {ac, admin, orgAdmin, orgMember, orgOwner, pending, superadmin, user} from \"@/lib/auth/permissions\";\nimport {headers} from \"next/headers\";\nimport {count, eq} from \"drizzle-orm\";\nimport {MemberWithUser, OrganizationWithMembersAndUsers,} from \"@/db/schema/03_organization\";\nimport {sendEmail} from \"@/lib/email\";\nimport {render} from \"@react-email/render\";\nimport {withUpdatedAt} from \"@/db/utils\";\nimport EmailVerification from \"@/components/emails/auth/email-verification\";\nimport EmailForgotPassword from \"@/components/emails/auth/email-forgot-password\";\nimport {getDeviceDetails} from \"@/utils/detection\";\nimport EmailNewLogin from \"@/components/emails/auth/email-new-login\";\nimport {sso} from \"@better-auth/sso\";\nimport {SUPPORTED_PROVIDERS} from \"@/lib/auth/config\";\nimport {passkey} from \"@better-auth/passkey\";\nimport {getOidcProviders} from \"./oidc\";\nimport {APIError} from \"better-auth/api\";\nimport {getOAuthProviders} from \"./oauth\";\n\n\nconst oidcProviders = getOidcProviders();\n\nexport const auth = betterAuth({\n    onAPIError: {\n        errorURL: \"/error\",\n        onError: (error, ctx) => {\n            //TODO: capture errors in a monitoring service\n        },\n    },\n    database: drizzleAdapter(db, {\n        provider: \"pg\",\n        schema: drizzleDb.schemas,\n    }),\n    appName: env.PROJECT_NAME!,\n    baseURL: env.PROJECT_URL,\n    secret: env.PROJECT_SECRET,\n    emailAndPassword: {\n        enabled: env.AUTH_EMAIL_PASSWORD_ENABLED === \"true\",\n        requireEmailVerification: false,\n        sendResetPassword: async ({user, token}, request) => {\n            if (env.AUTH_EMAIL_PASSWORD_ENABLED !== \"true\") {\n                throw new APIError(\"FORBIDDEN\", {\n                    message: \"Password reset is disabled.\",\n                });\n            }\n            await db\n                .update(drizzleDb.schemas.user)\n                .set(\n                    withUpdatedAt({\n                        emailVerified: true,\n                    }),\n                )\n                .where(eq(drizzleDb.schemas.user.id, user.id))\n                .returning();\n\n            await sendEmail({\n                to: user.email,\n                subject: \"Reset your password\",\n                html: await render(\n                    EmailForgotPassword({\n                        firstname: user.name!,\n                        token,\n                    }),\n                    {},\n                ),\n            });\n        },\n    },\n    emailVerification: {\n        async sendVerificationEmail({user, token, url}) {\n            await sendEmail({\n                to: user.email,\n                subject: \"Portabase Email Verification\",\n                html: await render(\n                    EmailVerification({\n                        firstname: user.name,\n                        url: url,\n                    }),\n                ),\n            });\n\n            await (\n                await auth.$context\n            ).internalAdapter.updateUser(user.id, {\n                emailVerified: false,\n            });\n        },\n        async afterEmailVerification(user) {\n            await (\n                await auth.$context\n            ).internalAdapter.updateUser(user.id, {\n                emailVerified: true,\n            });\n        },\n    },\n    socialProviders: getOAuthProviders().reduce<\n        Record<string, { clientId: string; clientSecret: string }>\n    >((acc, provider) => {\n        const configEntry = SUPPORTED_PROVIDERS.find((p) => p.id === provider.id);\n\n        if (!configEntry?.isActive) {\n            return acc;\n        }\n\n        acc[provider.id] = {\n            clientId: provider.client,\n            clientSecret: provider.secret,\n            ...(provider.id === \"apple\" && provider.appleBundleIdentifier\n                ? {appBundleIdentifier: provider.appleBundleIdentifier}\n                : {}),\n        };\n        return acc;\n    }, {}),\n    account: {\n        accountLinking: {\n            enabled: true,\n            trustedProviders: [\n                \"credential\",\n                ...getOAuthProviders().map((p) => p.id),\n                ...oidcProviders.map((p) => p.id),\n            ],\n            allowDifferentEmails: true,\n        },\n    },\n\n    plugins: [\n        sso({\n            defaultSSO: oidcProviders.map((p) => ({\n                oidcConfig: {\n                    issuer: p.issuerUrl,\n                    discoveryEndpoint: p.discoveryEndpoint,\n                    jwksEndpoint: p.jwksEndpoint,\n                    clientId: p.client,\n                    clientSecret: p.secret,\n                    scopes: p.scopes?.split(\" \") ?? [\"openid\", \"profile\", \"email\"],\n                    pkce: p.pkce,\n                    mapping: {\n                        extraFields: {\n                            groups: \"groups\",\n                        },\n                    },\n                },\n                providerId: p.id,\n                domain: p.host,\n                //@ts-ignore\n                issuer: p.issuerUrl,\n            })),\n            provisionUser: async ({user: usr, userInfo, provider}) => {\n                const existingUser = await db.query.user.findFirst({\n                    where: eq(drizzleDb.schemas.user.email, usr.email),\n                });\n\n                if (existingUser && existingUser.role === \"superadmin\") {\n                    return;\n                }\n\n                if (existingUser && env.AUTH_SYNC_OIDC_ROLES_ON_LOGIN === \"false\") {\n                    return;\n                }\n\n                const providerId = provider.providerId;\n                const oidcProvider = oidcProviders.find((p) => p.id === providerId);\n                const allowedGroup = oidcProvider?.allowedGroup || env.ALLOWED_GROUP;\n                const roleMapStr = oidcProvider?.roleMap;\n\n                const rawGroups = userInfo?.groups || userInfo?.roles || [];\n\n                const userGroups: string[] = Array.isArray(rawGroups)\n                    ? rawGroups.reduce((carry: string[], group) => {\n                        carry.push(String(group).toLowerCase());\n                        return carry;\n                    }, [])\n                    : [String(rawGroups).toLowerCase()];\n\n                let roleToAssign: string | undefined;\n\n                if (roleMapStr) {\n                    const mappings = roleMapStr.split(\",\").map((m) => m.split(\":\"));\n                    for (const [group, role] of mappings) {\n                        if (userGroups.includes(group.trim())) {\n                            roleToAssign = role.trim();\n                            break;\n                        }\n                    }\n                }\n\n                if (!roleToAssign && allowedGroup) {\n                    const hasAccess = userGroups.includes(allowedGroup);\n\n                    if (hasAccess) {\n                        const userCount = (\n                            await db.select({count: count()}).from(drizzleDb.schemas.user)\n                        )[0].count;\n                        const isSuperadmin = userCount === 0;\n\n                        roleToAssign =\n                            allowedGroup.includes(\"admin\") ||\n                            allowedGroup.includes(\"superadmin\")\n                                ? isSuperadmin\n                                    ? \"superadmin\"\n                                    : \"admin\"\n                                : \"pending\";\n                    }\n                }\n\n                if (!roleToAssign && oidcProvider?.defaultRole) {\n                    roleToAssign = oidcProvider.defaultRole;\n                }\n\n                if (!roleToAssign) {\n                    console.warn(\n                        `Access Denied for user ${usr.email}: No matching group/role found in ${providerId} config.`,\n                    );\n                    throw new APIError(\"FORBIDDEN\", {\n                        message: `Access Denied: No matching roles found (${roleToAssign})`,\n                    });\n                }\n\n                const userCount = (\n                    await db.select({count: count()}).from(drizzleDb.schemas.user)\n                )[0].count;\n                if (\n                    userCount === 0 &&\n                    (roleToAssign === \"admin\" || roleToAssign === \"superadmin\")\n                ) {\n                    roleToAssign = \"superadmin\";\n                }\n\n                if (existingUser) {\n                    await db\n                        .update(drizzleDb.schemas.user)\n                        .set({role: roleToAssign, emailVerified: true})\n                        .where(eq(drizzleDb.schemas.user.id, existingUser.id));\n                } else {\n                    return {\n                        ...usr,\n                        role: roleToAssign,\n                        emailVerified: true,\n                    };\n                }\n            },\n        }),\n        ...(env.AUTH_PASSKEY_ENABLED === \"true\"\n            ? [\n                passkey({\n                    rpName: env.PROJECT_NAME || \"Portabase\",\n                    rpID: env.PROJECT_URL\n                        ? new URL(env.PROJECT_URL).hostname\n                        : \"localhost\",\n                }),\n            ]\n            : []),\n        openAPI(),\n        nextCookies(),\n        twoFactor(),\n        organization({\n            ac,\n            roles: {\n                owner: orgOwner,\n                admin: orgAdmin,\n                member: orgMember,\n            },\n        }),\n        adminPlugin({\n            adminRoles: [\"admin\", \"superadmin\"],\n            defaultRole: \"pending\",\n            ac,\n            roles: {\n                admin,\n                user,\n                pending,\n                superadmin,\n            },\n        }),\n    ],\n    advanced: {\n        database: {\n            generateId: false,\n        },\n        cookies: {\n            state: {\n                attributes: {\n                    sameSite: \"none\",\n                    secure: true,\n                },\n            },\n        },\n    },\n    user: {\n        deleteUser: {\n            enabled: true,\n        },\n        changeEmail: {\n            enabled: true,\n        },\n        additionalFields: {\n            deletedAt: {\n                type: \"number\",\n                nullable: true,\n                required: false,\n            },\n            theme: {\n                type: \"string\",\n            },\n            lastConnectedAt: {\n                type: \"date\",\n            },\n            lastChangedPasswordAt: {\n                type: \"date\",\n            },\n        },\n    },\n    databaseHooks: {\n        account: {\n            create: {\n                before: async (account) => {\n                    const provider = SUPPORTED_PROVIDERS.find(\n                        (p) => p.id === account.providerId,\n                    );\n\n                    if (provider && provider.allowLinking === false) {\n                        throw new APIError(\"FORBIDDEN\", {\n                            message: \"Linking is disabled for this provider.\",\n                        });\n                    }\n                },\n            },\n        },\n        user: {\n            update: {\n                async before(user, context) {\n                    if (env.AUTH_EMAIL_PASSWORD_ENABLED !== \"true\") {\n                        if (user.password || user.lastChangedPasswordAt) {\n                            throw new APIError(\"FORBIDDEN\", {\n                                message: \"Password updates are disabled\",\n                            });\n                        }\n                    }\n                    return {\n                        data: user,\n                    };\n                },\n            },\n            create: {\n                async before(user, context) {\n                    const userCount = (\n                        await db.select({count: count()}).from(drizzleDb.schemas.user)\n                    )[0].count;\n\n                    if (env.AUTH_SIGNUP_ENABLED !== \"true\" && userCount > 0) {\n                        throw new APIError(\"FORBIDDEN\", {\n                            message: \"Sign up is disabled\",\n                        });\n                    }\n\n                    const role = userCount === 0 ? \"superadmin\" : \"pending\";\n\n                    return {\n                        data: {\n                            ...user,\n                            role,\n                        },\n                    };\n                },\n                async after(user, context) {\n                    const userCount = (\n                        await db.select({count: count()}).from(drizzleDb.schemas.user)\n                    )[0].count;\n                    const role = userCount === 0 ? \"owner\" : \"admin\";\n\n                    const defaultOrgSlug = \"default\";\n                    const defaultOrg = await db.query.organization.findFirst({\n                        where: eq(drizzleDb.schemas.organization.slug, defaultOrgSlug),\n                    });\n\n                    if (defaultOrg) {\n                        await db.insert(drizzleDb.schemas.member).values({\n                            userId: user.id,\n                            organizationId: defaultOrg.id,\n                            role: role,\n                        });\n                    } else {\n                        console.warn(\n                            \"Default organization not found. Cannot assign member.\",\n                        );\n                    }\n                },\n            },\n        },\n        session: {\n            create: {\n                before: async (session, context) => {\n                    const userId = session.userId;\n\n                    const memberships = await db.query.member.findMany({\n                        where: eq(drizzleDb.schemas.member.userId, userId),\n                    });\n\n                    const url =\n                        context?.request?.url || context?.headers?.get(\"referer\") || \"\";\n\n                    let providerId: string | undefined;\n\n                    if (url) {\n                        const urlPath = new URL(url).pathname;\n                        const pathParts = urlPath.split(\"/\");\n                        const lastPathPart = pathParts[pathParts.length - 1];\n\n                        if (urlPath.startsWith(\"/api/auth/sso/callback/\")) {\n                            providerId = lastPathPart;\n                        } else if (urlPath.startsWith(\"/api/auth/callback/\")) {\n                            providerId = lastPathPart;\n                        }\n                    }\n\n                    return {\n                        data: {\n                            activeOrganizationId: memberships[0]?.organizationId,\n                            providerId: providerId,\n                        },\n                    };\n                },\n                after: async (session) => {\n                    const user = await db.query.user.findFirst({\n                        where: eq(drizzleDb.schemas.user.id, session.userId),\n                    });\n\n                    if (!user) return;\n\n                    const createdAtDiff =\n                        new Date(session.createdAt).getTime() -\n                        new Date(user.createdAt).getTime();\n\n                    if (createdAtDiff < 5000) {\n                        console.log(\n                            `Skipping new login email for freshly created user ${user.email}`,\n                        );\n                        return;\n                    }\n\n                    const lastDiff = user.lastConnectedAt\n                        ? new Date(session.createdAt).getTime() -\n                        new Date(user.lastConnectedAt).getTime()\n                        : Infinity;\n\n                    if (lastDiff < 30000) return;\n\n                    if (user.role === \"pending\") return;\n\n                    const deviceInfo = getDeviceDetails(session.userAgent);\n\n\n                    try {\n                        await sendEmail({\n                            to: user.email,\n                            subject: \"New login to your account\",\n                            html: await render(\n                                EmailNewLogin({\n                                    firstname: user.name!,\n                                    os: deviceInfo.os,\n                                    browser: deviceInfo.browser,\n                                    ipAddress: session.ipAddress!,\n                                }),\n                                {},\n                            ),\n                        });\n                    } catch (error) {\n                        console.log(\"sendEmail failed\", {\n                            userId: user.id,\n                            details: \"Please Check your env variables or system config\",\n                            email: user.email,\n                            error,\n                        });\n                    }\n\n                    (await auth.$context).internalAdapter.updateUser(user.id, {\n                        lastConnectedAt: new Date(),\n                    });\n                },\n            },\n        },\n    },\n    session: {\n        additionalFields: {\n            activeOrganizationId: {\n                type: \"string\",\n                required: false,\n            },\n            providerId: {\n                type: \"string\",\n                required: false,\n            },\n        },\n    },\n    /*    databaseHooks: {\n          session: {\n              create: {\n                  before: async (session) => {\n                      const organizationId = await getLastOrganizationOrFirst(session.userId);\n\n                      if (!organizationId) {\n                          return {\n                              ...session,\n                          };\n                      }\n\n\n                      const [aa] = await db\n                          .update(drizzleUser.session)\n                          .set({ activeOrganizationId: organizationId })\n                          .where(eq(drizzleUser.session.id, session.id))\n                          .returning();\n\n\n                      return {\n                          ...session,\n                          activeOrganizationId: organizationId,\n                      };\n                  },\n              },\n          },\n      },*/\n    // trustedOrigins: [env.PROJECT_URL!, \"http://app\"],\n    trustedOrigins: async (request) => {\n        const trustedOrigins = await queryTrustedDomains();\n        return trustedOrigins;\n    }\n});\n\n\nconst queryTrustedDomains = async (): Promise<string[]> => {\n    const envDomains = env.TRUSTED_DOMAINS || \"\";\n    const domains = envDomains\n        .split(\",\")\n        .map((d) => d.trim())\n        .filter(Boolean);\n\n    if (env.PROJECT_URL) domains.push(env.PROJECT_URL);\n    domains.push(\"http://app\")\n\n    return domains;\n};\n\n/*export const signUpUser = async (email: string, password: string, name: string) => {\n    const user = await auth.api.signUpEmail({\n        body: {\n            email,\n            password,\n            name,\n        },\n    });\n\n    return user;\n};\n\nexport const signInUser = async (email: string, password: string) => {\n    const user = await auth.api.signInEmail({\n        body: {\n            email,\n            password,\n        },\n    });\n\n    return user;\n};*/\n\nexport const createUser = async (\n    name: string,\n    email: string,\n    password: string,\n    role: \"user\" | \"pending\" | \"admin\" | \"superadmin\" = \"pending\",\n) => {\n    return await auth.api.createUser({\n        headers: await headers(),\n        body: {\n            name,\n            email,\n            password,\n            role,\n        },\n    });\n};\n\nexport const getSessions = async () => {\n    return await auth.api.listSessions({\n        headers: await headers(),\n    });\n};\n\nexport const getSession = async () => {\n    return await auth.api.getSession({\n        headers: await headers(),\n    });\n};\n\nexport const revokeSession = async (e: string) => {\n    try {\n        const {status} = await auth.api.revokeSession({\n            body: {\n                token: e,\n            },\n            headers: await headers(),\n        });\n        return status;\n    } catch (e) {\n    }\n};\n\nexport const getAccounts = async () => {\n    return await auth.api.listUserAccounts({\n        headers: await headers(),\n    });\n};\n\nexport const unlinkAccount = async (provider: string, account: string) => {\n    try {\n        const {status} = await auth.api.unlinkAccount({\n            body: {\n                providerId: provider,\n                accountId: account,\n            },\n            headers: await headers(),\n        });\n\n        return status;\n    } catch (e) {\n    }\n};\n\nexport const getOrganization = async ({\n                                          organizationId,\n                                          organizationSlug,\n                                      }: {\n    organizationId?: string;\n    organizationSlug?: string;\n} = {}): Promise<OrganizationWithMembersAndUsers | null> => {\n    const query =\n        organizationId != null\n            ? {organizationId}\n            : organizationSlug != null\n                ? {organizationSlug}\n                : undefined;\n\n    try {\n        const response = await auth.api.getFullOrganization({\n            headers: await headers(),\n            ...(query ? {query} : {}),\n        });\n\n        return response as OrganizationWithMembersAndUsers;\n    } catch (e) {\n        console.error(e);\n        return null;\n    }\n};\n\nexport const getPasskeys = async () => {\n    if (env.AUTH_PASSKEY_ENABLED !== \"true\") return [];\n    const passkeys = await auth.api.listPasskeys({\n        headers: await headers(),\n    });\n\n    return passkeys;\n};\n\nexport const revokePasskey = async (e: string) => {\n    if (env.AUTH_PASSKEY_ENABLED !== \"true\") return;\n    await auth.api.deletePasskey({\n        body: {\n            id: e,\n        },\n        headers: await headers(),\n    });\n};\n\nexport const listOrganizations = async (): Promise<Organization[] | null> => {\n    try {\n        return (await auth.api.listOrganizations({\n            headers: await headers(),\n        })) as Organization[];\n    } catch (e) {\n        return null;\n    }\n};\n\nexport const getLastOrganizationOrFirst = async (userId: string) => {\n    try {\n        const organizations = await db.query.organization.findMany({\n            where: eq(drizzleDb.schemas.member.userId, userId),\n        });\n\n        if (organizations.length > 0) {\n            return organizations[0].id;\n        }\n\n        return null;\n    } catch (e) {\n        return null;\n    }\n};\n\nexport const createOrganization = async (name: string, slug: string) => {\n    try {\n        return await auth.api.createOrganization({\n            headers: await headers(),\n            body: {\n                name,\n                slug,\n            },\n        });\n    } catch (e: any) {\n        const errorMessage =\n            e?.response?.data?.message || e?.message || \"Unknown auth error\";\n        const status = e?.response?.status || 500;\n\n        console.error(\"Auth API createOrganization error:\", {\n            message: errorMessage,\n            status,\n            raw: e,\n        });\n\n        throw {\n            name: \"AuthCreateOrganizationError\",\n            message: errorMessage,\n            status,\n            cause: e,\n        };\n    }\n};\n\nexport const deleteOrganization = async (organizationId: string) => {\n    try {\n        return await auth.api.deleteOrganization({\n            body: {\n                organizationId,\n            },\n            headers: await headers(),\n        });\n    } catch (e: any) {\n        const errorMessage =\n            e?.response?.data?.message || e?.message || \"Unknown auth error\";\n        const status = e?.response?.status || 500;\n\n        console.error(\"Auth API deleteOrganization error:\", {\n            message: errorMessage,\n            status,\n            raw: e,\n        });\n\n        throw {\n            name: \"AuthDeleteOrganizationError\",\n            message: errorMessage,\n            status,\n            cause: e,\n        };\n    }\n};\n\nexport const checkSlugOrganization = async (slug: string) => {\n    try {\n        const {status} = await auth.api.checkOrganizationSlug({\n            headers: await headers(),\n            body: {\n                slug,\n            },\n        });\n\n        return status;\n    } catch {\n    }\n};\n\nexport const getActiveMember = async () => {\n    try {\n        const member = await auth.api.getActiveMember({\n            headers: await headers(),\n        });\n\n        return member as MemberWithUser;\n    } catch (e) {\n        console.log(\"err\", e);\n    }\n};\n\nexport const setActiveOrganization = async (slug: string) => {\n    try {\n        return await auth.api.setActiveOrganization({\n            headers: await headers(),\n            body: {\n                organizationSlug: slug,\n            },\n        });\n    } catch {\n    }\n};\n"
  },
  {
    "path": "src/lib/auth/config.ts",
    "content": "import { env } from \"@/env.mjs\";\nimport { getOidcProviders } from \"./oidc\";\nimport { getOAuthProviders } from \"./oauth\";\nimport * as BetterAuthSocialProviders from \"better-auth/social-providers\";\n\nexport interface AuthProviderConfig {\n  id: string;\n  isActive: boolean;\n  name?: string;\n  icon: string;\n  isManual?: boolean;\n  title?: string;\n  description?: string;\n  type: \"social\" | \"sso\" | \"credential\" | \"passkey\";\n  allowLinking?: boolean;\n  allowUnlinking?: boolean;\n}\n\nconst oidcProviders = getOidcProviders();\nconst oauthProviders = getOAuthProviders();\n\nconst availableSocialProviders = Object.keys(BetterAuthSocialProviders);\n\nexport const SUPPORTED_PROVIDERS: AuthProviderConfig[] = [\n  {\n    id: \"credential\",\n    isActive: env.AUTH_EMAIL_PASSWORD_ENABLED === \"true\",\n    name: \"Password\",\n    icon: \"lucide:lock\",\n    title: \"Password\",\n    description: \"Standard email and password login.\",\n    isManual: true,\n    type: \"credential\",\n    allowLinking: true,\n    allowUnlinking: true,\n  },\n  ...oauthProviders.map((p) => {\n    const isSupported = availableSocialProviders.includes(p.id.toLowerCase());\n\n    if (!isSupported) {\n      console.warn(`Provider ${p.id} is not supported. Skipping...`);\n    }\n\n    return {\n      id: p.id,\n      isActive: isSupported,\n      name: p.title,\n      icon: p.icon,\n      title: p.title,\n      description: p.description,\n      isManual: false,\n      type: \"social\" as const,\n      allowLinking: p.allowLinking,\n      allowUnlinking: p.allowUnlinking,\n    };\n  }),\n  ...oidcProviders.map((p) => ({\n    id: p.id,\n    isActive: true,\n    name: p.title,\n    icon: p.icon,\n    title: p.title,\n    description: p.description,\n    isManual: false,\n    type: \"sso\" as const,\n    allowLinking: p.allowLinking,\n    allowUnlinking: p.allowUnlinking,\n  })),\n  {\n    id: \"passkey\",\n    isActive: env.AUTH_PASSKEY_ENABLED === \"true\",\n    name: \"Passkey\",\n    icon: \"lucide:fingerprint\",\n    title: \"Passkey\",\n    description: \"Sign in with your passkey.\",\n    isManual: false,\n    type: \"passkey\",\n  },\n];\n"
  },
  {
    "path": "src/lib/auth/current-user.ts",
    "content": "\"use server\";\nimport { auth } from \"@/lib/auth/auth\";\nimport { headers } from \"next/headers\";\n\nexport const currentUser = async () => {\n    const session = await auth.api.getSession({\n        headers: await headers(),\n    });\n\n    if (!session?.user) {\n        return null;\n    }\n\n    return session.user;\n};\n"
  },
  {
    "path": "src/lib/auth/oauth.ts",
    "content": "import { env } from \"@/env.mjs\";\n\nexport interface OAuthProvider {\n  id: string;\n  title: string;\n  description: string;\n  icon: string;\n  client: string;\n  secret: string;\n  allowedGroup?: string;\n  roleMap?: string;\n  defaultRole?: string;\n  allowLinking: boolean;\n  allowUnlinking: boolean;\n  appleBundleIdentifier?: string;\n}\n\nconst PROVIDER_ICONS: Record<string, string> = {\n  google: \"logos:google-icon\",\n  github: \"logos:github-icon\",\n  gitlab: \"logos:gitlab-icon\",\n  discord: \"logos:discord-icon\",\n  facebook: \"logos:facebook\",\n  twitter: \"logos:twitter\",\n  x: \"logos:x\",\n  linkedin: \"logos:linkedin-icon\",\n  apple: \"logos:apple\",\n  microsoft: \"logos:microsoft-icon\",\n  twitch: \"logos:twitch\",\n  spotify: \"logos:spotify-icon\",\n  slack: \"logos:slack-icon\",\n  tiktok: \"logos:tiktok-icon\",\n  figma: \"logos:figma\",\n  dropbox: \"logos:dropbox\",\n  notion: \"logos:notion-icon\",\n  paypal: \"logos:paypal\",\n  reddit: \"logos:reddit-icon\",\n  salesforce: \"logos:salesforce\",\n  vercel: \"logos:vercel-icon\",\n  zoom: \"logos:zoom-icon\",\n  altassian: \"logos:jira\",\n};\n\nfunction getProviderIcon(providerId: string, envIcon?: string): string {\n  if (envIcon) return envIcon;\n\n  const normalizedId = providerId.toLowerCase();\n\n  if (PROVIDER_ICONS[normalizedId]) {\n    return PROVIDER_ICONS[normalizedId];\n  }\n\n  return `lucide:building`;\n}\n\nexport function getOAuthProviders(): OAuthProvider[] {\n  const providers: OAuthProvider[] = [];\n\n  if (env.AUTH_GOOGLE_ID && env.AUTH_GOOGLE_SECRET) {\n    providers.push({\n      id: \"google\",\n      title: \"Google\",\n      description: \"Sign in with your Google account.\",\n      icon: getProviderIcon(\"google\"),\n      client: env.AUTH_GOOGLE_ID,\n      secret: env.AUTH_GOOGLE_SECRET,\n      allowedGroup: env.ALLOWED_GROUP,\n      roleMap: env.AUTH_ROLE_MAP ?? undefined,\n      defaultRole: env.AUTH_DEFAULT_ROLE ?? \"pending\",\n      allowLinking: env.AUTH_ALLOW_LINKING !== \"false\",\n      allowUnlinking: env.AUTH_ALLOW_UNLINKING !== \"false\",\n    });\n  }\n\n  if (env.AUTH_GITHUB_ID && env.AUTH_GITHUB_SECRET) {\n    providers.push({\n      id: \"github\",\n      title: \"GitHub\",\n      description: \"Sign in with your GitHub account.\",\n      icon: getProviderIcon(\"github\"),\n      client: env.AUTH_GITHUB_ID,\n      secret: env.AUTH_GITHUB_SECRET,\n      allowedGroup: env.ALLOWED_GROUP,\n      roleMap: env.AUTH_ROLE_MAP,\n      defaultRole: env.AUTH_DEFAULT_ROLE,\n      allowLinking: env.AUTH_ALLOW_LINKING !== \"false\",\n      allowUnlinking: env.AUTH_ALLOW_UNLINKING !== \"false\",\n    });\n  }\n\n  if (env.AUTH_SOCIAL_CLIENT && env.AUTH_SOCIAL_ID) {\n    providers.push({\n      id: env.AUTH_SOCIAL_ID,\n      title: env.AUTH_SOCIAL_TITLE || \"OAuth\",\n      description: env.AUTH_SOCIAL_DESC || \"Sign in with your OAuth account.\",\n      icon: env.AUTH_SOCIAL_ICON || \"lucide:building\",\n      client: env.AUTH_SOCIAL_CLIENT,\n      secret: env.AUTH_SOCIAL_SECRET || \"\",\n      allowedGroup: env.ALLOWED_GROUP,\n      roleMap: env.AUTH_ROLE_MAP,\n      defaultRole: env.AUTH_DEFAULT_ROLE,\n      allowLinking: env.AUTH_ALLOW_LINKING !== \"false\",\n      allowUnlinking: env.AUTH_ALLOW_UNLINKING !== \"false\",\n      appleBundleIdentifier: env.AUTH_SOCIAL_APPLE_APP_BUNDLE_IDENTIFIER,\n    });\n  }\n\n  const prefixes = new Set<string>();\n  Object.keys(process.env).forEach((key) => {\n    const match = key.match(/^AUTH_SOCIAL_(.+)_CLIENT$/);\n    if (match) {\n      prefixes.add(match[1]);\n    }\n  });\n\n  prefixes.forEach((prefix) => {\n    const client = process.env[`AUTH_SOCIAL_${prefix}_CLIENT`];\n    if (!client) return;\n\n    const providerId =\n      prefix.toLowerCase() === \"x\" ? \"twitter\" : prefix.toLowerCase();\n\n    const envTitle = process.env[`AUTH_SOCIAL_${prefix}_TITLE`];\n    const envDesc = process.env[`AUTH_SOCIAL_${prefix}_DESC`];\n    const envIcon = process.env[`AUTH_SOCIAL_${prefix}_ICON`];\n    const envSecret = process.env[`AUTH_SOCIAL_${prefix}_SECRET`];\n    const envAllowedGroup = process.env[`AUTH_SOCIAL_${prefix}_ALLOWED_GROUP`];\n    const envRoleMap = process.env[`AUTH_SOCIAL_${prefix}_ROLE_MAP`];\n    const envDefaultRole = process.env[`AUTH_SOCIAL_${prefix}_DEFAULT_ROLE`];\n\n    const envAppleBundleId =\n      process.env[`AUTH_SOCIAL_APPLE_APP_BUNDLE_IDENTIFIER`];\n\n    providers.push({\n      id: providerId,\n      title:\n        envTitle ||\n        prefix.charAt(0).toUpperCase() + prefix.slice(1).toLowerCase(),\n      description:\n        envDesc ||\n        `Sign in with ${prefix.charAt(0).toUpperCase() + prefix.slice(1).toLowerCase()}`,\n      icon: getProviderIcon(providerId, envIcon),\n      client: client,\n      secret: envSecret || \"\",\n      allowedGroup: envAllowedGroup || env.ALLOWED_GROUP,\n      roleMap: envRoleMap,\n      defaultRole: envDefaultRole,\n      allowLinking: env.AUTH_ALLOW_LINKING !== \"false\",\n      allowUnlinking: env.AUTH_ALLOW_UNLINKING !== \"false\",\n      appleBundleIdentifier: envAppleBundleId,\n    });\n  });\n\n  return providers;\n}\n"
  },
  {
    "path": "src/lib/auth/oidc.ts",
    "content": "import { env } from \"@/env.mjs\";\n\nexport interface OIDCProvider {\n  id: string;\n  title: string;\n  description: string;\n  icon: string;\n  client: string;\n  secret: string;\n  issuerUrl: string;\n  host: string;\n  scopes?: string;\n  discoveryEndpoint?: string;\n  jwksEndpoint?: string;\n  pkce: boolean;\n  allowedGroup?: string;\n  roleMap?: string;\n  defaultRole?: string;\n  allowLinking: boolean;\n  allowUnlinking: boolean;\n}\n\nexport function getOidcProviders(): OIDCProvider[] {\n  const providers: OIDCProvider[] = [];\n\n  if (\n    env.AUTH_OIDC_CLIENT &&\n    (env.AUTH_OIDC_ISSUER_URL || env.AUTH_OIDC_DISCOVERY_ENDPOINT)\n  ) {\n    providers.push({\n      id: env.AUTH_OIDC_ID || \"oidc\",\n      title: env.AUTH_OIDC_TITLE || \"SSO\",\n      description: env.AUTH_OIDC_DESC || \"Sign in with your SSO account.\",\n      icon: env.AUTH_OIDC_ICON || \"lucide:building\",\n      client: env.AUTH_OIDC_CLIENT,\n      secret: env.AUTH_OIDC_SECRET || \"\",\n      issuerUrl: env.AUTH_OIDC_ISSUER_URL || \"\",\n      host: env.AUTH_OIDC_HOST || \"\",\n      scopes: env.AUTH_OIDC_SCOPES,\n      discoveryEndpoint: env.AUTH_OIDC_DISCOVERY_ENDPOINT,\n      jwksEndpoint: env.AUTH_OIDC_JWKS_ENDPOINT,\n      pkce: env.AUTH_OIDC_PKCE === \"true\",\n      allowedGroup: env.ALLOWED_GROUP,\n      roleMap: env.AUTH_ROLE_MAP,\n      defaultRole: env.AUTH_DEFAULT_ROLE,\n      allowLinking: env.AUTH_ALLOW_LINKING !== \"false\",\n      allowUnlinking: env.AUTH_ALLOW_UNLINKING !== \"false\",\n    });\n  }\n\n  const prefixes = new Set<string>();\n  Object.keys(process.env).forEach((key) => {\n    const match = key.match(/^AUTH_OIDC_(.+)_CLIENT$/);\n    if (match) {\n      prefixes.add(match[1]);\n    }\n  });\n\n  prefixes.forEach((prefix) => {\n    const client = process.env[`AUTH_OIDC_${prefix}_CLIENT`];\n    const issuer = process.env[`AUTH_OIDC_${prefix}_ISSUER_URL`];\n    const discovery = process.env[`AUTH_OIDC_${prefix}_DISCOVERY_ENDPOINT`];\n\n    if (!client || (!issuer && !discovery)) return;\n\n    providers.push({\n      id: process.env[`AUTH_OIDC_${prefix}_ID`] || prefix.toLowerCase(),\n      title: process.env[`AUTH_OIDC_${prefix}_TITLE`] || prefix,\n      description:\n        process.env[`AUTH_OIDC_${prefix}_DESC`] || `Sign in with ${prefix}`,\n      icon: process.env[`AUTH_OIDC_${prefix}_ICON`] || \"lucide:building\",\n      client: client,\n      secret: process.env[`AUTH_OIDC_${prefix}_SECRET`] || \"\",\n      issuerUrl: issuer || \"\",\n      host: process.env[`AUTH_OIDC_${prefix}_HOST`] || \"\",\n      scopes: process.env[`AUTH_OIDC_${prefix}_SCOPES`],\n      discoveryEndpoint: discovery,\n      jwksEndpoint: process.env[`AUTH_OIDC_${prefix}_JWKS_ENDPOINT`],\n      pkce: process.env[`AUTH_OIDC_${prefix}_PKCE`] === \"true\",\n      allowedGroup:\n        process.env[`AUTH_OIDC_${prefix}_ALLOWED_GROUP`] ||\n        process.env.ALLOWED_GROUP,\n      roleMap: process.env[`AUTH_OIDC_${prefix}_ROLE_MAP`],\n      defaultRole: process.env[`AUTH_OIDC_${prefix}_DEFAULT_ROLE`],\n      allowLinking:\n        process.env[`AUTH_OIDC_${prefix}_ALLOW_LINKING`] !== \"false\",\n      allowUnlinking:\n        process.env[`AUTH_OIDC_${prefix}_ALLOW_UNLINKING`] !== \"false\",\n    });\n  });\n\n  return providers;\n}\n"
  },
  {
    "path": "src/lib/auth/permissions.ts",
    "content": "import { createAccessControl } from \"better-auth/plugins/access\";\nimport { defaultStatements, adminAc } from \"better-auth/plugins/admin/access\";\nimport {\n  defaultStatements as orgDefaultStatements,\n  adminAc as orgAdminAc,\n  ownerAc as orgOwnerAc,\n  memberAc as orgMemberAc,\n} from \"better-auth/plugins/organization/access\";\n\nconst statement = {\n  ...defaultStatements,\n  ...orgDefaultStatements,\n  project: [\"create\", \"list\", \"update\", \"delete\"],\n  database: [\"create\", \"list\", \"update\", \"delete\", \"backup\"],\n  agent: [\"create\", \"list\", \"update\", \"delete\"],\n} as const;\n\nconst ac = createAccessControl(statement);\n\nconst superadmin = ac.newRole({\n  project: [\"create\", \"list\", \"update\", \"delete\"],\n  database: [\"create\", \"list\", \"update\", \"delete\"],\n  agent: [\"create\", \"list\", \"update\", \"delete\"],\n  ...adminAc.statements,\n  ...orgMemberAc.statements,\n  ...orgAdminAc.statements,\n  ...orgOwnerAc.statements,\n});\n\nconst admin = ac.newRole({\n  project: [\"create\", \"list\", \"update\", \"delete\"],\n  database: [\"create\", \"list\", \"update\", \"delete\"],\n  agent: [\"create\", \"list\", \"update\", \"delete\"],\n  ...adminAc.statements,\n  ...orgMemberAc.statements,\n  ...orgAdminAc.statements,\n});\n\nconst user = ac.newRole({\n  project: [],\n  database: [],\n  agent: [],\n});\n\nconst pending = ac.newRole({\n  project: [],\n  database: [],\n  agent: [],\n});\n\n//org\nconst orgMember = ac.newRole({\n  project: [\"list\"],\n  database: [\"list\"],\n  agent: [\"list\"],\n  ...orgMemberAc.statements,\n});\n\nconst orgAdmin = ac.newRole({\n  project: [\"create\", \"update\"],\n  ...orgMemberAc.statements,\n  ...orgAdminAc.statements,\n});\n\nconst orgOwner = ac.newRole({\n  project: [\"create\", \"update\", \"delete\"],\n  ...orgMemberAc.statements,\n  ...orgAdminAc.statements,\n  ...orgOwnerAc.statements,\n});\n\nexport { ac, admin, superadmin, user, pending, orgAdmin, orgMember, orgOwner };\n"
  },
  {
    "path": "src/lib/email/helpers.ts",
    "content": "import nodemailer from \"nodemailer\";\nimport {Server} from \"./types\"\n\nexport const createTransporter = (server: Server) => {\n    const portNumber = Number(server.port);\n    return nodemailer.createTransport({\n        pool: true,\n        host: server.host,\n        port: portNumber,\n        secure: server.secure ?? portNumber === 465,\n        auth: {\n            user: server.user,\n            pass: server.pass,\n        },\n    });\n};"
  },
  {
    "path": "src/lib/email/index.ts",
    "content": "\"use server\"\nimport {db} from \"@/db\";\nimport {eq} from \"drizzle-orm\";\nimport * as drizzleDb from \"@/db\";\nimport {createTransporter} from \"@/lib/email/helpers\";\nimport {Payload} from \"@/lib/email/types\";\n\nexport const sendEmail = async (data: Payload) => {\n    const settings = await db\n        .select()\n        .from(drizzleDb.schemas.setting)\n        .where(eq(drizzleDb.schemas.setting.name, \"system\"))\n        .then((res) => res[0]);\n\n    if (!settings) {\n        throw new Error(\"SMTP system settings not found.\");\n    }\n\n    if (!settings.smtpHost || !settings.smtpPort || !settings.smtpUser || !settings.smtpPassword || !settings.smtpFrom) {\n        console.warn(\"Incomplete SMTP settings. Email not sent.\");\n        return;\n    }\n\n    const emailsArray = data.to.split(\",\")\n        .map(email => email.trim());\n\n    const transporter = createTransporter({\n        host: settings.smtpHost,\n        port: Number(settings.smtpPort),\n        user: settings.smtpUser,\n        pass: settings.smtpPassword,\n        from: settings.smtpFrom,\n        secure: settings.smtpSecure ?? false,\n    });\n    await transporter.verify();\n\n    return await transporter.sendMail({\n        ...data,\n        to: emailsArray,\n        from: settings.smtpFrom ?? undefined,\n    });\n};\n"
  },
  {
    "path": "src/lib/email/types.ts",
    "content": "\"use server\";\n\n\nexport type Payload = {\n    to: string;\n    from?: string;\n    subject: string;\n    html: any;\n};\n\nexport type Server = {\n    host: string;\n    port: number;\n    user: string;\n    pass: string;\n    from: string;\n    secure: boolean;\n};\n\n"
  },
  {
    "path": "src/lib/logger.ts",
    "content": "import pino, { type Logger } from \"pino\";\n\nconst isProd = process.env.NODE_ENV === \"production\";\n\nfunction getLocalTimestamp() {\n    const date = new Date();\n\n    const formatted = new Intl.DateTimeFormat(\"en-US\", {\n        timeZone: process.env.TZ,\n        year: \"numeric\",\n        month: \"2-digit\",\n        day: \"2-digit\",\n        hour: \"2-digit\",\n        minute: \"2-digit\",\n        second: \"2-digit\"\n    }).format(date).replace(\" \", \"T\");\n\n    return `,\"time\":\"${formatted}\"`;\n}\n\nexport const logger: Logger = pino({\n    level: isProd ? \"info\" : \"debug\",\n    base: null,\n\n    ...(isProd\n        ? {\n            timestamp: getLocalTimestamp,\n            formatters: {\n                level(label) {\n                    return { level: label.toUpperCase() };\n                }\n            }\n        }\n        : {\n            timestamp: getLocalTimestamp,\n            transport: {\n                target: \"pino-pretty\",\n                options: {\n                    colorize: true,\n                    translateTime: \"yyyy-mm-dd HH:MM:ss\",\n                    ignore: \"pid,hostname\",\n                    levelFirst: true\n                }\n            }\n        })\n});\n"
  },
  {
    "path": "src/lib/safe-actions/actions.ts",
    "content": "import {createSafeActionClient} from \"next-safe-action\";\nimport {currentUser} from \"@/lib/auth/current-user\";\n\nexport class ActionError extends Error {\n    constructor(message: string) {\n        super(message);\n        this.name = \"ActionError\";\n    }\n}\n\nconst handleReturnedServerError = (error: Error) => {\n    if (error instanceof ActionError) {\n        return error.message;\n    } else {\n        return \"An unexpected error occurred.\";\n    }\n};\n\nexport const action = createSafeActionClient({\n    handleServerError: handleReturnedServerError,\n});\n\nexport const userAction = action.use(async ({next, ctx}) => {\n    const user = await currentUser();\n    if (!user) {\n        throw new ActionError(\"You must be logged in\");\n    }\n    return next({ctx: {user}});\n});\n"
  },
  {
    "path": "src/lib/services.ts",
    "content": "import {auth, getOrganization} from \"@/lib/auth/auth\";\nimport {db} from \"@/db\";\nimport {and, eq} from \"drizzle-orm\";\nimport * as drizzleDb from \"@/db\";\n\n\nexport const getOrganizationProjectDatabases = async ({organizationSlug, projectId}: {\n    organizationSlug: string, projectId: string\n}) => {\n    try {\n\n        const organization = await getOrganization({});\n\n        if (!organization) {\n            return {\n                name: \"ErrorGettingOrganizationProjectDatabases\",\n                message: \"No organization found.\",\n                status: 400,\n                cause: \"Unknown error occurred.\",\n            };\n        }\n        const databasesProject = await db.query.project.findFirst({\n            where: and(eq(drizzleDb.schemas.project.organizationId, organization.id), eq(drizzleDb.schemas.project.id, projectId)),\n            with: {\n                databases: true\n            }\n        });\n\n        if (!databasesProject) {\n            return {\n                name: \"ErrorGettingOrganizationProjectDatabases\",\n                message: \"No organization found.\",\n                status: 400,\n                cause: \"Unknown error occurred.\",\n            };\n        }\n\n        return {\n            data: databasesProject.databases,\n            ids: databasesProject.databases.map((project) => project.id)\n        }\n\n\n    } catch (e: any) {\n        const errorMessage = e?.response?.data?.message || e?.message || \"Unknown auth error\";\n        const status = e?.response?.status || 500;\n\n        console.error(\"API GettingOrganizationProjectDatabases error:\", {\n            message: errorMessage,\n            status,\n            raw: e,\n        });\n\n        throw {\n            name: \"ErrorGettingOrganizationProjectDatabases\",\n            message: errorMessage,\n            status,\n            cause: e,\n        };\n    }\n};\n\n"
  },
  {
    "path": "src/lib/tasks/cleaning/index.ts",
    "content": "import {db} from \"@/db\";\nimport {and, eq, isNotNull, isNull} from \"drizzle-orm\";\nimport * as drizzleDb from \"@/db\";\nimport {withUpdatedAt} from \"@/db/utils\";\nimport {logger} from \"@/lib/logger\";\n\nconst log = logger.child({module: \"tasks/cleaning\"});\n\nexport const backupCleanTask = async () => {\n    try {\n        const backups = await db.query.backup.findMany({\n            where: and(\n                isNotNull(drizzleDb.schemas.backup.deletedAt),\n                eq(drizzleDb.schemas.backup.status, \"ongoing\")\n            )\n        });\n        log.info(`Backups to clean: ${backups.length}`);\n\n        for (const backup of backups) {\n            await db.update(drizzleDb.schemas.backup).set(withUpdatedAt({\n                status: \"failed\",\n            }))\n                .where(eq(drizzleDb.schemas.backup.id, backup.id));\n        }\n\n    } catch (e: any) {\n        log.info({name: \"backupCleanTask\", error: e},`Backup cleanup failed`);\n        throw e;\n    }\n};"
  },
  {
    "path": "src/lib/tasks/database/index.ts",
    "content": "import {db} from \"@/db\";\nimport {enforceRetentionCount} from \"@/lib/tasks/database/retention-count\";\nimport {enforceRetentionDays} from \"@/lib/tasks/database/retention-days\";\nimport {enforceRetentionGFS} from \"@/lib/tasks/database/retention-gsf\";\nimport {retentionPolicy} from \"@/db/schema/07_database\";\nimport {isNull} from \"drizzle-orm\";\nimport * as drizzleDb from \"@/db\";\nimport {logger} from \"@/lib/logger\";\n\nconst log = logger.child({module: \"tasks/database\"});\n\nexport const retentionCleanTask = async () => {\n    try {\n        const databases = await db.query.database.findMany({\n            with: {\n                retentionPolicy: true,\n                backups: {\n                    where: isNull(drizzleDb.schemas.backup.deletedAt),\n                },\n            },\n        });\n        log.info(`Retention databases number: ${databases.length}`);\n        for (const db of databases) {\n            if (!db.retentionPolicy) continue;\n            await enforceRetention(db.id, db.retentionPolicy);\n        }\n    } catch (e: any) {\n        log.error({error: e},\"Retention cleanup failed\");\n        throw e;\n    }\n};\n\nexport async function enforceRetention(\n    databaseId: string,\n    policy: typeof retentionPolicy.$inferSelect\n) {\n;\n    log.info({name: \"enforceRetention\"},`Retention started for ${databaseId}`);\n\n    switch (policy.type) {\n        case \"count\":\n            await enforceRetentionCount(databaseId, policy.count ?? 7);\n            break;\n\n        case \"days\":\n            await enforceRetentionDays(databaseId, policy.days ?? 30);\n            break;\n\n        case \"gfs\":\n            await enforceRetentionGFS(databaseId, {\n                daily: policy.gfsDaily ?? 7,\n                weekly: policy.gfsWeekly ?? 4,\n                monthly: policy.gfsMonthly ?? 12,\n                yearly: policy.gfsYearly ?? 3,\n            });\n            break;\n    }\n}\n"
  },
  {
    "path": "src/lib/tasks/database/retention-count.ts",
    "content": "import * as drizzleDb from \"@/db\";\nimport {db} from \"@/db\";\nimport {and, desc, eq, isNull} from \"drizzle-orm\";\nimport {deleteBackupCronAction} from \"@/lib/tasks/database/utils/delete\";\nimport {logger} from \"@/lib/logger\";\n\nconst log = logger.child({module: \"tasks/database/retention-count\"});\n\nexport async function enforceRetentionCount(databaseId: string, count: number) {\n    log.info({ name: \"enforceRetentionCount\"}, `Retention count started for databaseId: ${databaseId}`);\n    const backups = await db.query.backup.findMany({\n        where: and(eq(drizzleDb.schemas.backup.databaseId, databaseId), isNull(drizzleDb.schemas.backup.deletedAt)),\n        orderBy: desc(drizzleDb.schemas.backup.createdAt),\n        with: {\n            database: {\n                with: {\n                    project: true\n                }\n            }\n        }\n    });\n\n    const toDelete = backups.slice(count);\n    log.info({ name: \"enforceRetentionCount\"}, `Found ${toDelete.length} backups to delete for databaseId: ${databaseId}`);\n\n    for (const b of toDelete) {\n        const result = await deleteBackupCronAction({\n            backupId: b.id,\n            databaseId: b.databaseId,\n        });\n\n        const inner = result?.data;\n        if (inner?.success) {\n            log.info({ name: \"enforceRetentionCount\"}, `(databaseId:${b.databaseId}) - (backupId: ${b.id}) : successfully deleted`);\n        } else {\n            log.info({ name: \"enforceRetentionCount\"}, `(databaseId:${b.databaseId}) - (backupId: ${b.id}) : an error occurred - ${inner?.actionError?.message}`);\n        }\n    }\n}"
  },
  {
    "path": "src/lib/tasks/database/retention-days.ts",
    "content": "import {db} from \"@/db\";\nimport {eq, lt, and, desc, isNull} from \"drizzle-orm\";\nimport * as drizzleDb from \"@/db\";\nimport {deleteBackupCronAction} from \"@/lib/tasks/database/utils/delete\";\nimport {logger} from \"@/lib/logger\";\n\nconst log = logger.child({module: \"tasks/database/retention-days\"});\n\nexport async function enforceRetentionDays(databaseId: string, days: number) {\n    log.info({ name: \"enforceRetentionDays\"}, `Enforce Retention Days starting for ${databaseId}`);\n\n    const cutoff = new Date(Date.now() - days * 86400000);\n\n    const expiredBackups = await db.query.backup.findMany({\n        where: and(\n            eq(drizzleDb.schemas.backup.databaseId, databaseId),\n            lt(drizzleDb.schemas.backup.createdAt, cutoff),\n            isNull(drizzleDb.schemas.backup.deletedAt)\n        ),\n        with: {\n            database: {\n                with: {\n                    project: true\n                }\n            }\n        }\n    });\n\n    for (const backup of expiredBackups) {\n\n        const result = await deleteBackupCronAction({\n            backupId: backup.id,\n            databaseId: backup.databaseId,\n        });\n\n        const inner = result?.data;\n        if (inner?.success) {\n            log.info({ name: \"enforceRetentionDays\"}, `(databaseId:${backup.databaseId}) - (backupId: ${backup.id}) : successfully deleted`);\n        } else {\n            log.info({ name: \"enforceRetentionDays\"}, `(databaseId:${backup.databaseId}) - (backupId: ${backup.id}) : an error occurred - ${inner?.actionError?.message}`);\n        }\n    }\n\n}\n\n"
  },
  {
    "path": "src/lib/tasks/database/retention-gsf.ts",
    "content": "import {db} from \"@/db\";\nimport {subDays, subWeeks, subMonths, subYears, startOfWeek, startOfMonth, startOfYear} from \"date-fns\";\nimport {eq, desc, isNull, and} from \"drizzle-orm\";\nimport * as drizzleDb from \"@/db\";\nimport {deleteBackupCronAction} from \"@/lib/tasks/database/utils/delete\";\nimport {logger} from \"@/lib/logger\";\n\nconst log = logger.child({module: \"tasks/database/retention-gsf\"});\n\nexport async function enforceRetentionGFS(databaseId: string, gfsSettings: {\n    daily: number;\n    weekly: number;\n    monthly: number;\n    yearly: number;\n}) {\n    log.info({ name: \"enforceRetentionGFS\"}, `Retention GFS started for databaseId: ${databaseId}`);\n\n    const backups = await db.query.backup.findMany({\n        where: and(eq(drizzleDb.schemas.backup.databaseId, databaseId), isNull(drizzleDb.schemas.backup.deletedAt)),\n        orderBy: desc(drizzleDb.schemas.backup.createdAt),\n        with: {\n            database: {\n                with: {\n                    project: true\n                }\n            }\n        }\n    });\n\n    const now = new Date();\n    const toKeep: Set<string> = new Set();\n\n    // DAILY\n    backups.forEach((b) => {\n        if (b.createdAt >= subDays(now, gfsSettings.daily)) toKeep.add(b.id);\n    });\n\n    const weekStartDates = Array.from({length: gfsSettings.weekly}, (_, i) => startOfWeek(subWeeks(now, i), {weekStartsOn: 1}));\n    weekStartDates.forEach((weekStart) => {\n        const backupOfWeek = backups.find(\n            (b) => b.createdAt >= weekStart && b.createdAt < subWeeks(weekStart, -1)\n        );\n        if (backupOfWeek) toKeep.add(backupOfWeek.id);\n    });\n\n    // MONTHLY\n    const monthStartDates = Array.from({length: gfsSettings.monthly}, (_, i) => startOfMonth(subMonths(now, i)));\n    monthStartDates.forEach((monthStart) => {\n        const backupOfMonth = backups.find(\n            (b) => b.createdAt >= monthStart && b.createdAt < subMonths(monthStart, -1)\n        );\n        if (backupOfMonth) toKeep.add(backupOfMonth.id);\n    });\n\n    // YEARLY\n    const yearStartDates = Array.from({length: gfsSettings.yearly}, (_, i) => startOfYear(subYears(now, i)));\n    yearStartDates.forEach((yearStart) => {\n        const backupOfYear = backups.find(\n            (b) => b.createdAt >= yearStart && b.createdAt < subYears(yearStart, -1)\n        );\n        if (backupOfYear) toKeep.add(backupOfYear.id);\n    });\n\n    // Delete backups not in `toKeep`\n    for (const b of backups) {\n        if (!toKeep.has(b.id)) {\n\n            const result = await deleteBackupCronAction({\n                backupId: b.id,\n                databaseId: b.databaseId,\n            });\n\n            const inner = result?.data;\n            if (inner?.success) {\n                log.info({ name: \"enforceRetentionGFS\"}, `(databaseId:${b.databaseId}) - (backupId: ${b.id}) : successfully deleted`);\n            } else {\n                log.info({ name: \"enforceRetentionGFS\"}, `(databaseId:${b.databaseId}) - (backupId: ${b.id}) : an error occurred - ${inner?.actionError?.message}`);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "src/lib/tasks/database/utils/delete.ts",
    "content": "\"use server\"\nimport {action} from \"@/lib/safe-actions/actions\";\nimport {z} from \"zod\";\nimport {ServerActionResult} from \"@/types/action-type\";\nimport {Backup} from \"@/db/schema/07_database\";\nimport {db} from \"@/db\";\nimport * as drizzleDb from \"@/db\";\nimport {and, eq} from \"drizzle-orm\";\nimport {withUpdatedAt} from \"@/db/utils\";\nimport type {StorageInput} from \"@/features/storages/types\";\nimport {dispatchStorage} from \"@/features/storages/dispatch\";\n\n\nexport const deleteBackupCronAction = action\n    .schema(\n        z.object({\n            backupId: z.string(),\n            databaseId: z.string(),\n        })\n    )\n    .action(async ({parsedInput}): Promise<ServerActionResult<Backup>> => {\n        try {\n\n            const backup = await db.query.backup.findFirst({\n                where: and(eq(drizzleDb.schemas.backup.id, parsedInput.backupId), eq(drizzleDb.schemas.backup.databaseId, parsedInput.databaseId))\n            });\n\n\n            if (!backup) {\n                return {\n                    success: false,\n                    actionError: {\n                        message: \"Backup not found.\",\n                        status: 404,\n                        messageParams: {backupId: parsedInput.backupId},\n                    },\n                }\n            }\n\n\n            const backupStorages = await db.query.backupStorage.findMany({\n                where: eq(drizzleDb.schemas.backupStorage.backupId, parsedInput.backupId),\n            });\n\n\n            for (const backupStorage of backupStorages) {\n\n                await db\n                    .update(drizzleDb.schemas.backupStorage)\n                    .set(withUpdatedAt({\n                        deletedAt: new Date(),\n                    }))\n                    .where(eq(drizzleDb.schemas.backupStorage.id, backupStorage.id))\n\n                if (backupStorage.status != \"success\" || !backupStorage.path) {\n                    continue;\n                }\n\n                const input: StorageInput = {\n                    action: \"delete\",\n                    data: {\n                        path: backupStorage.path,\n                    },\n                };\n\n                await dispatchStorage(input, undefined, backupStorage.storageChannelId);\n            }\n\n            await db\n                .update(drizzleDb.schemas.backup)\n                .set(withUpdatedAt({\n                    deletedAt: new Date(),\n                    status: backup.status == \"ongoing\" ? \"failed\" : backup.status\n\n                }))\n                .where(and(eq(drizzleDb.schemas.backup.id, parsedInput.backupId), eq(drizzleDb.schemas.backup.databaseId, parsedInput.databaseId)))\n\n            return {\n                success: true,\n                actionSuccess: {\n                    message: `Backup deleted successfully (${parsedInput.backupId}).`,\n                },\n            };\n\n        } catch (error) {\n            console.error(error);\n            return {\n                success: false,\n                actionError: {\n                    message: `Failed to delete backup(${parsedInput.backupId}).`,\n                    status: 500,\n                    cause: error instanceof Error ? error.message : \"Unknown error\",\n                    messageParams: {message: \"Error deleting the backup\"},\n                },\n            };\n        }\n    });"
  },
  {
    "path": "src/lib/tasks/index.ts",
    "content": "import cron from \"node-cron\";\nimport {retentionCleanTask} from \"@/lib/tasks/database\";\nimport {env} from \"@/env.mjs\";\nimport {backupCleanTask} from \"@/lib/tasks/cleaning\";\nimport {\n    checkAgentsHealthError,\n    checkDatabasesHealthError,\n    deleteHealthLogsOlderThan12h\n} from \"@/db/services/healthcheck\";\nimport {logger} from \"@/lib/logger\";\n\nconst log = logger.child({module: \"tasks\"});\n\nexport const retentionJob = cron.schedule(env.RETENTION_CRON, async () => {\n    try {\n        log.info({ job: \"cron\", action: \"start\", name: \"retentionJob\" }, \"Retention Job started\");\n        await retentionCleanTask();\n    } catch (err) {\n        log.error({ job: \"cron\", name: \"retentionJob\", error: err }, \"Retention Job Error\");\n    }\n});\n\nexport const cleaningJob = cron.schedule(\"* * * * *\", async () => {\n    try {\n        log.info({ job: \"cron\", action: \"start\", name: \"cleaningJob\" }, \"Cleaning Job started\");\n        await backupCleanTask();\n    } catch (err) {\n        log.error({ job: \"cron\", name: \"cleaningJob\", error: err }, \"Cleaning Job Error\");\n    }\n});\n\nexport const cleaningHealthcheckLogsJob = cron.schedule(env.CLEANING_HEALTHCHECK_LOGS_CRON, async () => {\n    try {\n        log.info({ job: \"cron\", action: \"start\", name: \"cleaningHealthcheckLogsJob\" }, \"Cleaning Health Logs Job started\");\n        await deleteHealthLogsOlderThan12h();\n    } catch (err) {\n        log.error({ job: \"cron\", name: \"cleaningHealthcheckLogsJob\", error: err }, \"Cleaning Health Logs Job Error\");\n    }\n});\n\n\nexport const healthcheckAgentAndDatabaseJob = cron.schedule(env.HEALTHCHECK_CRON, async () => {\n    try {\n        log.info({ job: \"cron\", action: \"start\", name: \"healthcheckAgentAndDatabaseJob\" }, \"Healthcheck Jobs started\");\n        await checkAgentsHealthError();\n        await checkDatabasesHealthError()\n    } catch (err) {\n        log.error({ job: \"cron\", name: \"healthcheckAgentAndDatabaseJob\", error: err }, \"Healthcheck Jobs Error\");\n    }\n});"
  },
  {
    "path": "src/lib/twx.tsx",
    "content": "import { createTwc } from \"react-twc\";\nimport { cn } from \"./utils\";\n\nexport const twx = createTwc({ compose: cn});\n"
  },
  {
    "path": "src/lib/utils.ts",
    "content": "import { clsx, type ClassValue } from \"clsx\"\nimport { twMerge } from \"tailwind-merge\"\n\nexport function cn(...inputs: ClassValue[]) {\n  return twMerge(clsx(inputs))\n}\n"
  },
  {
    "path": "src/lib/zod.ts",
    "content": "import { z } from \"zod\";\n\nexport const zString = () =>\n    z.string();\n\nexport const zEnum = <T extends [string, ...string[]]>(values: T) => z.enum(values, { message: \"Field required\" });\n\nexport const zEmail = () => z.string().email({ message: \"Invalid email\" });\n\nconst passwordRegex = /^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@$%^&*-])/;\n\nexport const zPassword = () => zString().min(8, { message: \"New Password too short\" }).regex(passwordRegex, { message: \"New password too weak\" });\n\nexport const zDate = () =>\n    z.preprocess(\n        (arg) => {\n            if (typeof arg === \"string\" || arg instanceof Date) {\n                const date = new Date(arg);\n                return isNaN(date.getTime()) ? undefined : date;\n            }\n            return undefined;\n        },\n        z.date()\n    );\n"
  },
  {
    "path": "src/middleware/errorHandler.ts",
    "content": "import {NextResponse} from \"next/server\";\n\nexport const errorHandler = (error: any) => {\n    return new NextResponse(\n        JSON.stringify({ message: 'An error occurred while processing your request.', status: 500 }),\n        { status: 500, headers: { 'Content-Type': 'application/json' } }\n    );\n};"
  },
  {
    "path": "src/middleware/loggingMiddleware.ts",
    "content": "import { NextRequest, NextResponse } from 'next/server';\n\nexport function loggingMiddleware(request: NextRequest) {\n    if (request.url.includes('/api')) {\n        console.log(`[API] Received ${request.method} request : ${request.url} at ${new Date()}`);\n    }\n    return NextResponse.next();\n}"
  },
  {
    "path": "src/types/action-type.ts",
    "content": "import { SafeActionResult } from \"next-safe-action\";\nimport { ZodString } from \"zod\";\n\nexport type ServerActionResult<T> =\n    | { success: true; value?: T; actionSuccess?: ActionSuccessMessage }\n    | {\n          success: false;\n          actionError?: ActionErrorMessage;\n      };\n\nexport type ActionErrorMessage = {\n    message?: string;\n    status?: number;\n    cause?: string;\n    messageParams?: Record<string, string | number>;\n};\n\nexport type ActionSuccessMessage = { message?: string; messageParams?: Record<string, string | number> };\n\nexport type ActionResult<T> = SafeActionResult<\n    string,\n    ZodString,\n    readonly [],\n    {\n        formErrors: string[];\n        fieldErrors: {};\n    },\n    readonly [],\n    ServerActionResult<T>,\n    object\n>;\n"
  },
  {
    "path": "src/types/auth.ts",
    "content": "\nexport type SignUpUser = {\n    name: string\n    email: string\n    password?: string\n    callbackURL?: string\n    role?: string\n    theme: string\n}\n\n\nexport type BetterAuthError = {\n    code?: string;\n    message?: string;\n    status: number;\n    statusText: string;\n};"
  },
  {
    "path": "src/types/common.ts",
    "content": "export type MemberRole = \"member\" | \"admin\" | \"owner\";\nexport type MemberRoleType = MemberRole | MemberRole[];"
  },
  {
    "path": "src/types/next.ts",
    "content": "export type LayoutParams<T extends Record<string, string | string[]>> = {\n    children: React.ReactNode;\n    params: T;\n};\n\nexport type PageParams<T extends Record<string, string | string[]>> = {\n    params: Promise<T>;\n    searchParams: Promise<{ [key: string]: string | string[] | undefined }>;\n};\n"
  },
  {
    "path": "src/utils/common.ts",
    "content": "import {MemberWithUser, Organization, OrganizationWithMembersAndUsers} from \"@/db/schema/03_organization\";\nimport {OrganizationMember} from \"@/db/schema/04_member\";\nimport {OrganizationInvitation} from \"@/db/schema/05_invitation\";\nimport {User} from \"@/db/schema/02_user\";\n\n\nexport function buildOrganizationWithMembers(\n    rows: {\n        organization: Organization;\n        member: OrganizationMember | null;\n        invitation: OrganizationInvitation | null;\n        user: User | null;\n    }[]\n): OrganizationWithMembersAndUsers | null {\n    if (rows.length === 0) return null;\n\n    const org = rows[0].organization;\n\n\n    const invitations: OrganizationInvitation[] = rows\n        .filter(r => r.invitation)\n        .map(r => ({\n            ...r.invitation!,\n        }));\n\n    const members: MemberWithUser[] = rows\n        .filter(r => r.member && r.user)\n        .map(r => ({\n            ...r.member!,\n            user: r.user!,\n        }));\n\n    return {\n        ...org,\n        invitations,\n        members,\n    };\n}\n\n\nexport function getFileExtension(dbType: string) {\n    switch (dbType) {\n        case \"postgresql\":\n            return \".dump\";\n        case \"mysql\":\n            return \".sql\";\n        default:\n            return \".dump\";\n    }\n}\n\nexport function getFileHeadersBasedOnDbms(dbType: string): Record<string, string[]> {\n    switch (dbType) {\n        case \"postgresql\":\n            return {\n                \"application/octet-stream\": [\".dump\"],\n            };\n        case \"mysql\":\n        case \"mariadb\":\n            return {\n                \"application/sql\": [\".sql\"],\n                \"application/x-sql\": [\".sql\"],\n            };\n        case \"mongodb\":\n            return {\n                \"application/gzip\": [\".archive.gz\"],\n            };\n        case \"firebird\":\n            return {\n                \"application/octet-stream\": [\".fbk\"],\n            };\n        case \"valkey\":\n        case \"redis\":\n            return {\n                \"application/octet-stream\": [\".rdb\"],\n            };\n        case \"sqlite\":\n            return {\n                \"application/octet-stream\": [\".backup\"],\n            };\n        default:\n            throw new Error(`Unsupported database type: ${dbType}`);\n\n    }\n}\n"
  },
  {
    "path": "src/utils/cron.ts",
    "content": "export const isValidCronPart = (type: string, value: string): boolean => {\n    const regexMap: Record<string, RegExp> = {\n        minute: /^(\\*|([0-5]?\\d)|(\\d+(,\\d+)*|(\\d+-\\d+)|(\\*\\/\\d+)))$/,\n        hour: /^(\\*|([01]?\\d|2[0-3])|(\\d+(,\\d+)*|(\\d+-\\d+)|(\\*\\/\\d+)))$/,\n        \"day-of-month\": /^(\\*|([1-9]|[12]\\d|3[01])|(\\d+(,\\d+)*|(\\d+-\\d+)|(\\*\\/\\d+)))$/,\n        month: /^(\\*|([1-9]|1[0-2])|(\\d+(,\\d+)*|(\\d+-\\d+)|(\\*\\/\\d+)))$/,\n        \"day-of-week\": /^(\\*|[0-6]|(\\d+(,\\d+)*|(\\d+-\\d+)|(\\*\\/\\d+)))$/,\n    };\n    return regexMap[type]?.test(value) ?? false;\n};"
  },
  {
    "path": "src/utils/date-formatting.ts",
    "content": "import {formatDistanceToNow} from \"date-fns\";\nimport {format} from \"date-fns\";\n\n/**\n * Get user's locale and timezone from the browser\n */\nconst TIMEZONE = Intl.DateTimeFormat().resolvedOptions().timeZone;\nconst LOCALE = Intl.DateTimeFormat().resolvedOptions().locale;\n\n/**\n * Format a date in DD/MM/YYYY HH:mm 24-hour format\n */\nexport function formatLocalizedDate(date: string | number | Date) {\n    const d = new Date(date);\n    return new Intl.DateTimeFormat(LOCALE, {\n        day: \"2-digit\",\n        month: \"2-digit\",\n        year: \"numeric\",\n        hour: \"2-digit\",\n        minute: \"2-digit\",\n        hour12: false, // 24-hour format\n        timeZone: TIMEZONE,\n    }).format(d);\n}\n\nexport function humanReadableDate(rawDate: string | number | Date) {\n    return formatLocalizedDate(rawDate);\n}\n\nexport function timeAgo(rawDate: string | number | Date) {\n    const date = new Date(rawDate);\n    return formatDistanceToNow(date, { addSuffix: true });\n}\n\nexport function formatDateLastContact(lastContact: string | number | Date | null) {\n    return lastContact\n        ? formatLocalizedDate(lastContact)\n        : \"Never connected.\";\n}\n\nexport function formatDayOnly(date: Date) {\n    return new Intl.DateTimeFormat(LOCALE, {\n        day: \"2-digit\",\n        month: \"2-digit\",\n        year: \"numeric\",\n        timeZone: TIMEZONE,\n    }).format(date);\n}\n\nexport function getTodayISODate() {\n    const today = new Date();\n    const year = today.getFullYear();\n    const month = String(today.getMonth() + 1).padStart(2, '0');\n    const day = String(today.getDate()).padStart(2, '0');\n\n    return `${year}-${month}-${day}`;\n}\n"
  },
  {
    "path": "src/utils/detection.ts",
    "content": "import { Smartphone, Laptop, type LucideIcon } from \"lucide-react\";\n\ninterface DeviceDetails {\n    os: string;\n    browser: string;\n    isMobile: boolean;\n    Icon: LucideIcon;\n    deviceType: \"Mobile\" | \"Desktop\";\n}\n\nexport const getDeviceDetails = (userAgent: string | undefined | null): DeviceDetails => {\n    const ua = (userAgent || \"\").toLowerCase();\n\n    const isMobile = /mobile|iphone|android/.test(ua);\n\n    const os = /mac os/.test(ua)\n        ? \"macOS\"\n        : /windows/.test(ua)\n          ? \"Windows\"\n          : /linux/.test(ua)\n            ? \"Linux\"\n            : /android/.test(ua)\n              ? \"Android\"\n              : /ios/.test(ua)\n                ? \"iOS\"\n                : \"Unknown OS\";\n\n    const browser = /chrome/.test(ua) ? \"Chrome\" : /firefox/.test(ua) ? \"Firefox\" : /safari/.test(ua) ? \"Safari\" : /edg/.test(ua) ? \"Edge\" : \"Browser\";\n\n    return {\n        os,\n        browser,\n        isMobile,\n        deviceType: isMobile ? \"Mobile\" : \"Desktop\",\n        Icon: isMobile ? Smartphone : Laptop,\n    };\n};\n"
  },
  {
    "path": "src/utils/edge_key.ts",
    "content": "\"use server\"\nimport {getMasterServerKeyContent} from \"@/features/keys/keys.action\";\n\nexport async function generateEdgeKey(serverUrl: string, agentId: string): Promise<string> {\n    const masterKey = await getMasterServerKeyContent()\n    const edgeKeyData = {\n        serverUrl,\n        agentId,\n        masterKeyB64: masterKey.toString('base64')\n    };\n    const edgeKeyJson = JSON.stringify(edgeKeyData);\n    return Buffer.from(edgeKeyJson, 'utf-8').toString('base64');\n}\n\nfunction decodeEdgeKey(edgeKey: string): object {\n    let edgeKeyWithPadding = edgeKey.replace(/-/g, '+').replace(/_/g, '/');\n    const paddingNeeded = edgeKeyWithPadding.length % 4;\n    if (paddingNeeded !== 0) {\n        edgeKeyWithPadding += '='.repeat(4 - paddingNeeded);\n    }\n    const edgeKeyBuffer = Buffer.from(edgeKeyWithPadding, 'base64');\n    const edgeKeyJson = edgeKeyBuffer.toString('utf-8');\n    return JSON.parse(edgeKeyJson);\n}\n"
  },
  {
    "path": "src/utils/get-server-url.ts",
    "content": "import { env } from \"@/env.mjs\";\n\nexport const getServerUrl = () => {\n    if (typeof window !== \"undefined\") {\n        return window.location.origin;\n    }\n    if (env.NODE_ENV === \"development\") {\n        return `${env.PROJECT_URL}`;\n    }\n    return `${env.PROJECT_URL}`;\n};\n"
  },
  {
    "path": "src/utils/init.ts",
    "content": "import { env } from \"@/env.mjs\";\nimport { db, makeMigration } from \"@/db\";\nimport { eq } from \"drizzle-orm\";\nimport * as drizzleDb from \"@/db\";\nimport {cleaningHealthcheckLogsJob, cleaningJob, healthcheckAgentAndDatabaseJob, retentionJob} from \"@/lib/tasks\";\nimport { generateRSAKeys, getOrCreateMasterKey } from \"@/utils/rsa-keys\";\nimport { StorageProviderKind } from \"@/features/storages/types\";\nimport {logger} from \"@/lib/logger\";\nimport {withUpdatedAt} from \"@/db/utils\";\n\nconst log = logger.child({module: \"init\"});\n\nexport async function init() {\n  consoleAscii();\n\n  log.info(\"====Init Functions====\");\n  await getOrCreateMasterKey();\n  await generateRSAKeys();\n  await makeMigration();\n  await createDefaultOrganization();\n  await createSettingsIfNotExist();\n  log.info(\"====Initialization completed====\");\n  await setupCronJobs();\n\n  if (\n    (env.AUTH_GOOGLE_ID && env.AUTH_GOOGLE_SECRET) ||\n    (env.AUTH_GITHUB_ID && env.AUTH_GITHUB_SECRET)\n  ) {\n    log.warn(\n        {\n          deprecated: true,\n          provider: \"oauth_env\",\n          message: \"You have set up OAuth credentials in your environment variables, but the format is now different. Please update your environment variables to use the new format. For example, if you were using AUTH_GOOGLE_ID and AUTH_GOOGLE_SECRET, you should now use AUTH_SOCIAL_GOOGLE_CLIENT and AUTH_SOCIAL_GOOGLE_SECRET. Please refer to the documentation for more details. (https://portabase.io/docs/dashboard/auth/oauth2/setup#dynamic-providers)\"\n        },\n        \"Deprecated OAuth environment variables detected\",\n    );\n  }\n}\n\nasync function setupCronJobs() {\n\n  log.info(\"==== Setting up Cron Jobs ====\");\n  retentionJob.start();\n  cleaningJob.start();\n  cleaningHealthcheckLogsJob.start();\n  healthcheckAgentAndDatabaseJob.start();\n  log.info(\"==== Cron jobs started ====\");\n}\n\nasync function createSettingsIfNotExist() {\n  await db.transaction(async (tx) => {\n\n    const systemSettingsValues = {\n      name: \"system\",\n      smtpPassword: env.SMTP_PASSWORD ?? null,\n      smtpFrom: env.SMTP_FROM ?? null,\n      smtpHost: env.SMTP_HOST ?? null,\n      smtpPort: env.SMTP_PORT ?? null,\n      smtpUser: env.SMTP_USER ?? null,\n      smtpSecure: env.SMTP_SECURE ?? false,\n    };\n\n    const [systemSetting] = await tx\n      .select()\n      .from(drizzleDb.schemas.setting)\n      .where(eq(drizzleDb.schemas.setting.name, \"system\"))\n      .limit(1);\n\n    const [finalSystemSetting] = systemSetting\n      ? await tx\n          .update(drizzleDb.schemas.setting)\n          .set(systemSettingsValues)\n          .where(eq(drizzleDb.schemas.setting.name, \"system\"))\n          .returning()\n      : await tx\n          .insert(drizzleDb.schemas.setting)\n          .values(systemSettingsValues)\n          .returning();\n\n    const localStorageValues = {\n      provider: \"local\" as StorageProviderKind,\n      enabled: true,\n      name: \"System\",\n      config: {},\n    };\n\n    const [existingLocalStorage] = await tx\n      .select()\n      .from(drizzleDb.schemas.storageChannel)\n      .where(eq(drizzleDb.schemas.storageChannel.provider, \"local\"))\n      .limit(1);\n\n    const [localStorage] = existingLocalStorage\n      ? await tx\n          .update(drizzleDb.schemas.storageChannel)\n          .set(localStorageValues)\n          .where(eq(drizzleDb.schemas.storageChannel.provider, \"local\"))\n          .returning()\n      : await tx\n          .insert(drizzleDb.schemas.storageChannel)\n          .values(localStorageValues)\n          .returning();\n\n    if (!finalSystemSetting.defaultStorageChannelId) {\n      await tx\n        .update(drizzleDb.schemas.setting)\n        .set(withUpdatedAt({ defaultStorageChannelId: localStorage.id }))\n        .where(eq(drizzleDb.schemas.setting.id, finalSystemSetting.id));\n    }\n  });\n}\n\nasync function createDefaultOrganization() {\n  const defaultOrganizationConf = {\n    slug: \"default\",\n    name: \"Default Organization\",\n    createdAt: new Date(),\n  };\n\n  const [existing] = await db\n    .select()\n    .from(drizzleDb.schemas.organization)\n    .where(eq(drizzleDb.schemas.organization.slug, \"default\"))\n    .limit(1);\n\n  if (!existing) {\n    log.info(\"==== Creating default Organization... ====\");\n    await db\n      .insert(drizzleDb.schemas.organization)\n      .values(defaultOrganizationConf);\n  }\n}\n\nfunction consoleAscii() {\n  console.log(\n    \"                                                          \\n\" +\n      \"     ____             __        __                        \\n\" +\n      \"    / __ \\\\____  _____/ /_____ _/ /_  ____ _________       \\n\" +\n      \"   / /_/ / __ \\\\/ ___/ __/ __  / __ \\\\/ __  / ___/ _ \\\\      \\n\" +\n      \"  / ____/ /_/ / /  / /_/ /_/ / /_/ / /_/ (__  )  __/           \\n\" +\n      \" /_/    \\\\____/_/   \\\\__/\\\\__,_/_.___/\\\\__,_/____/\\\\___/       \\n\" +\n      \"                                                          \\n\" +\n      ` Community Edition v${env.NEXT_PUBLIC_PROJECT_VERSION}   \\n ` +\n      \"                                                          \\n\",\n  );\n}\n"
  },
  {
    "path": "src/utils/mock-data.ts",
    "content": "export const organizations = [\n    {\n        slug: \"default\",\n        name: \"Default Organization\",\n        createdAt: \"2024-01-10T10:00:00.000Z\",\n        projects: [],\n    },\n    {\n        slug: \"tech-corp\",\n        name: \"Tech Corp\",\n        createdAt: \"2024-01-10T10:00:00.000Z\",\n        projects: [],\n    },\n    {\n        slug: \"design-studio\",\n        name: \"Design Studio\",\n        createdAt: \"2023-09-15T15:45:00.000Z\",\n        projects: [],\n    },\n];\n\nexport const projects = [\n    {\n        slug: \"backend-system\",\n        name: \"Backend System\",\n        createdAt: \"2024-02-20T11:30:00.000Z\",\n        organizationId: \"org-1a2b3c4d\",\n        databases: [],\n    },\n    {\n        slug: \"creative-suite\",\n        name: \"Creative Suite\",\n        createdAt: \"2023-10-10T08:20:00.000Z\",\n        organizationId: \"org-2e3f4g5h\",\n        databases: [],\n    },\n];\n\nexport const databases = [\n    {\n        name: \"Main Production DB\",\n        dbms: \"postgresql\",\n        generatedId: \"prod-db-1\",\n        description: \"Primary database for production environment\",\n        backupPolicy: \"daily\",\n        createdAt: \"2024-11-01T12:00:00.000Z\",\n        agentId: \"agent-1234\",\n        lastContact: \"2024-11-28T08:30:00.000Z\",\n        projectId: \"proj-789\",\n        backups: [],\n        restorations: [],\n    },\n    {\n        name: \"Staging DB\",\n        dbms: \"mysql\",\n        generatedId: \"staging-db-2\",\n        description: \"Database for testing and staging environment\",\n        backupPolicy: \"weekly\",\n        createdAt: \"2024-10-15T09:45:00.000Z\",\n        agentId: \"agent-5678\",\n        lastContact: \"2024-11-25T10:15:00.000Z\",\n        projectId: null,\n        backups: [],\n        restorations: [],\n    },\n    {\n        name: \"Development DB\",\n        dbms: \"mongodb\",\n        generatedId: \"dev-db-3\",\n        description: null,\n        backupPolicy: null,\n        createdAt: \"2024-09-20T16:20:00.000Z\",\n        agentId: \"agent-9012\",\n        lastContact: null,\n        projectId: \"proj-456\",\n        backups: [],\n        restorations: [],\n    },\n];\n\nexport const backups = [\n    { createdAt: \"2023-11-27T11:26:54.870914Z\", status: \"pending\" },\n    { createdAt: \"2023-12-03T11:26:54.870927Z\", status: \"failed\" },\n    { createdAt: \"2023-12-12T11:26:54.870937Z\", status: \"success\" },\n    { createdAt: \"2023-11-23T11:26:54.870946Z\", status: \"processing\" },\n    { createdAt: \"2023-12-09T11:26:54.870955Z\", status: \"pending\" },\n    { createdAt: \"2023-11-29T11:26:54.870964Z\", status: \"failed\" },\n    { createdAt: \"2023-12-07T11:26:54.870973Z\", status: \"success\" },\n    { createdAt: \"2023-11-18T11:26:54.870982Z\", status: \"processing\" },\n    { createdAt: \"2023-12-01T11:26:54.870991Z\", status: \"pending\" },\n    { createdAt: \"2023-11-25T11:26:54.871000Z\", status: \"failed\" },\n    { createdAt: \"2023-11-27T11:26:54.870914Z\", status: \"pending\" },\n    { createdAt: \"2023-12-03T11:26:54.870927Z\", status: \"failed\" },\n    { createdAt: \"2023-12-12T11:26:54.870937Z\", status: \"success\" },\n    { createdAt: \"2023-11-23T11:26:54.870946Z\", status: \"processing\" },\n    { createdAt: \"2023-12-09T11:26:54.870955Z\", status: \"pending\" },\n    { createdAt: \"2023-11-29T11:26:54.870964Z\", status: \"failed\" },\n    { createdAt: \"2023-12-07T11:26:54.870973Z\", status: \"success\" },\n    { createdAt: \"2023-11-18T11:26:54.870982Z\", status: \"processing\" },\n    { createdAt: \"2023-12-01T11:26:54.870991Z\", status: \"pending\" },\n    { createdAt: \"2023-11-25T11:26:54.871000Z\", status: \"failed\" },\n];\n\nexport const restorations = [\n    { backupId: \"backup-1\", createdAt: \"2023-11-27T11:26:54.870914Z\", status: \"pending\" },\n    { backupId: \"backup-2\", createdAt: \"2023-12-03T11:26:54.870927Z\", status: \"failed\" },\n    { backupId: \"backup-3\", createdAt: \"2023-12-12T11:26:54.870937Z\", status: \"success\" },\n    { backupId: \"backup-4\", createdAt: \"2023-11-23T11:26:54.870946Z\", status: \"processing\" },\n    { backupId: \"backup-5\", createdAt: \"2023-12-09T11:26:54.870955Z\", status: \"pending\" },\n    { backupId: \"backup-6\", createdAt: \"2023-11-29T11:26:54.870964Z\", status: \"failed\" },\n    { backupId: \"backup-7\", createdAt: \"2023-12-07T11:26:54.870973Z\", status: \"success\" },\n    { backupId: \"backup-8\", createdAt: \"2023-11-18T11:26:54.870982Z\", status: \"processing\" },\n    { backupId: \"backup-9\", createdAt: \"2023-12-01T11:26:54.870991Z\", status: \"pending\" },\n    { backupId: \"backup-10\", createdAt: \"2023-11-25T11:26:54.871000Z\", status: \"failed\" },\n];\n"
  },
  {
    "path": "src/utils/name-from-email.ts",
    "content": "export function extractNameFromEmail(email: string): string {\n    const localPart = email.split(\"@\")[0];\n    const nameParts = localPart\n        .replace(/[_\\.\\-]/g, \" \") // Replace underscores, dots, and hyphens with spaces\n        .split(\" \") // Split into parts\n        .filter(Boolean); // Remove empty strings\n\n    return nameParts\n        .map((part) => part.charAt(0).toUpperCase() + part.slice(1)) // Capitalize each part\n        .join(\" \");\n}\n"
  },
  {
    "path": "src/utils/os-parser.ts",
    "content": "export default function detectOSWithUA(userAgent: string) {\n    const osList = [\n        {\n            name: \"Windows\",\n            keywords: [\"Win\", \"NT\", \"Windows\"],\n            icon: {\n                name: \"microsoft-windows-icon\",\n                size: {\n                    width: 24,\n                    height: 0,\n                },\n            },\n            showText: true,\n        },\n        {\n            name: \"Ubuntu\",\n            keywords: [\"Ubuntu\"],\n            icon: {\n                name: \"ubuntu\",\n                size: {\n                    width: 24,\n                    height: 0,\n                },\n            },\n            showText: true,\n        },\n        {\n            name: \"iOS\",\n            keywords: [\"iOS\"],\n            icon: {\n                name: \"ios\",\n                size: {\n                    width: 24,\n                    height: 0,\n                },\n            },\n            showText: false,\n        },\n        {\n            name: \"iPadOS\",\n            keywords: [\"iPadOS\", \"iPad\"],\n            icon: {\n                name: \"ios\",\n                size: {\n                    width: 24,\n                    height: 0,\n                },\n            },\n            showText: true,\n        },\n        {\n            name: \"MacOS\",\n            keywords: [\"MacOS\", \"Macintosh\", \"Mac OS\", \"Mac OS X\"],\n            icon: {\n                name: \"macos\",\n                size: {\n                    width: 0,\n                    height: 16,\n                },\n            },\n            showText: false,\n        },\n        {\n            name: \"Android\",\n            keywords: [\"Android\"],\n            icon: {\n                name: \"android-icon\",\n                size: {\n                    width: 24,\n                    height: 0,\n                },\n            },\n            showText: true,\n        },\n        {\n            name: \"Linux\",\n            keywords: [\"X11\", \"Linux\"],\n            icon: {\n                name: \"linux-tux\",\n                size: {\n                    width: 24,\n                    height: 0,\n                },\n            },\n            showText: true,\n        },\n        {\n            name: \"Playstation 4\",\n            keywords: [\"PlayStation 4\"],\n            showText: true,\n        },\n        {\n            name: \"Playstation 5\",\n            keywords: [\"PlayStation 5\"],\n            showText: true,\n        },\n        {\n            name: \"Xbox Series X\",\n            keywords: [\"Xbox Series X\"],\n            showText: true,\n        },\n        {\n            name: \"Xbox One S\",\n            keywords: [\"XBOX_ONE_ED\"],\n            showText: true,\n        },\n        {\n            name: \"Xbox One\",\n            keywords: [\"Xbox One\"],\n            showText: true,\n        },\n        {\n            name: \"Nintendo Switch\",\n            keywords: [\"Nintendo Switch\"],\n            showText: true,\n        },\n        {\n            name: \"AppleTV\",\n            keywords: [\"AppleTV\"],\n            icon: {\n                name: \"apple\",\n                size: {\n                    width: 24,\n                    height: 0,\n                },\n            },\n            showText: true,\n        },\n    ];\n\n    for (let os of osList) {\n        if (os.keywords.some((keyword) => userAgent.includes(keyword))) {\n            return os;\n        }\n    }\n\n    return {\n        name: \"Unknown OS\",\n        icon: {\n            name: \"unknown\",\n            size: {\n                width: 24,\n                height: 0,\n            },\n        },\n        showText: true,\n    };\n}\n"
  },
  {
    "path": "src/utils/password.ts",
    "content": "export function generateValidPassword(length = 12) {\n    const upper = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';\n    const lower = 'abcdefghijklmnopqrstuvwxyz';\n    const numbers = '0123456789';\n    const special = '#?!@$%^&*-';\n    const all = upper + lower + numbers + special;\n\n    const getRandomChar = (set: string) => set[Math.floor(Math.random() * set.length)];\n\n    const passwordChars = [\n        getRandomChar(upper),\n        getRandomChar(lower),\n        getRandomChar(numbers),\n        getRandomChar(special),\n    ];\n\n    for (let i = passwordChars.length; i < length; i++) {\n        passwordChars.push(getRandomChar(all));\n    }\n\n    for (let i = passwordChars.length - 1; i > 0; i--) {\n        const j = Math.floor(Math.random() * (i + 1));\n        [passwordChars[i], passwordChars[j]] = [passwordChars[j], passwordChars[i]];\n    }\n\n    return passwordChars.join('');\n}"
  },
  {
    "path": "src/utils/rsa-keys.ts",
    "content": "import {promises as fs} from 'fs';\nimport path from 'path';\nimport {generateKeyPair} from 'crypto';\nimport {promisify} from 'util';\nimport {randomBytes} from 'crypto';\nimport {env} from \"@/env.mjs\";\nimport {logger} from \"@/lib/logger\";\n\nconst log = logger.child({module: \"rsa-keys\"});\n\n\n\nconst generateKeyPairAsync = promisify(generateKeyPair);\n\n/**\n * Generate RSA keypair into a directory (default: ./private).\n * - Skips generation if both files already exist.\n * - Private key mode 0o600. Public key mode 0o644.\n * @param {string} [dir] path to directory\n * @returns {Promise<{privateKeyPath:string, publicKeyPath:string}>}\n */\nexport async function generateRSAKeys(dir = path.join(env.PRIVATE_PATH!, '/keys')) {\n    await fs.mkdir(dir, {recursive: true});\n\n    const privateKeyPath = path.join(dir, 'server_private.pem');\n    const publicKeyPath = path.join(dir, 'server_public.pem');\n\n    try {\n        await fs.access(privateKeyPath);\n        await fs.access(publicKeyPath);\n        log.info('RSA keys already exist. Skipping generation.');\n        return {privateKeyPath, publicKeyPath};\n    } catch {\n    }\n\n    const {publicKey, privateKey} = await generateKeyPairAsync('rsa', {\n        modulusLength: 2048,\n        publicKeyEncoding: {type: 'pkcs1', format: 'pem'},\n        privateKeyEncoding: {type: 'pkcs1', format: 'pem'},\n    });\n\n    await fs.writeFile(privateKeyPath, privateKey, {mode: 0o600});\n    await fs.writeFile(publicKeyPath, publicKey, {mode: 0o644});\n\n    return {privateKeyPath, publicKeyPath};\n}\n\n\n/**\n * Generate a 256-bit AES master key for AES-256-GCM.\n * - Skips generation if the file already exists.\n * - File mode 0o600 for private key.\n * @param {string} [filePath] Path to store the key\n * @returns {Promise<Buffer>} The master key\n */\nexport async function getOrCreateMasterKey(filePath = path.join(env.PRIVATE_PATH!, '/keys', 'master_key.bin')) {\n\n    await fs.mkdir(path.dirname(filePath), {recursive: true});\n\n    try {\n        const existing = await fs.readFile(filePath);\n        log.info('Master key already exists. Skipping generation.');\n        return existing;\n    } catch {\n        // File does not exist, generate\n    }\n\n    const key = randomBytes(32); // 256-bit key\n\n    await fs.writeFile(filePath, key, {mode: 0o600});\n    log.info(\"Master key already exists. Skipping generation.\");\n\n    return key;\n}\n\n"
  },
  {
    "path": "src/utils/slugify.ts",
    "content": "export const slugify = (text: string) => {\n    return text\n        .toString()\n        .normalize('NFKD')                   // Normalize accents\n        .replace(/[\\u0300-\\u036f]/g, '')     // Remove diacritics\n        .toLowerCase()\n        .trim()\n        .replace(/\\_/g, '-')                // _ → dash\n        .replace(/\\s+/g, '-')               // spaces → dash\n        .replace(/[^\\w\\-]+/g, '')           // Remove non-word chars\n        .replace(/\\-\\-+/g, '-')             // multiple dashes → one\n        .replace(/^-+/, '')                 // Remove leading dash\n        .replace(/-+$/, '');                // Remove trailing dash\n};"
  },
  {
    "path": "src/utils/text.ts",
    "content": "export function truncateWords(text: string, wordLimit: number = 10): string {\n    if (!text) return \"\";\n    const words = text.trim().split(/\\s+/);\n    if (words.length <= wordLimit) return text;\n    return words.slice(0, wordLimit).join(\" \") + \"…\";\n}\n\nexport function capitalizeFirstLetter(text: string): string {\n    return text ? text.charAt(0).toUpperCase() + text.slice(1) : \"\";\n}\n\nexport function isUUID(str: string) {\n    return /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(str);\n}\n\nexport function isImportedFilename(name: string): boolean {\n    return name.startsWith(\"imported_\");\n}\n\nexport function formatBytes(bytes: number | null, decimals = 2): string {\n    if (!bytes) return \"N/A\";\n    if (bytes === 0) return \"0 Bytes\";\n    const k = 1024;\n    const dm = decimals < 0 ? 0 : decimals;\n    const sizes = [\"Bytes\", \"KB\", \"MB\", \"GB\", \"TB\"];\n    const i = Math.floor(Math.log(bytes) / Math.log(k));\n    return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + \" \" + sizes[i];\n}"
  },
  {
    "path": "src/utils/verify-uuid.ts",
    "content": "const uuidv4Regex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\n\nexport function isUuidv4(value: string): value is string {\n    return uuidv4Regex.test(value);\n}\n"
  },
  {
    "path": "tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"lib\": [\n      \"dom\",\n      \"dom.iterable\",\n      \"esnext\"\n    ],\n    \"allowJs\": true,\n    \"skipLibCheck\": true,\n    \"strict\": true,\n    \"noEmit\": true,\n    \"esModuleInterop\": true,\n    \"module\": \"esnext\",\n    \"moduleResolution\": \"bundler\",\n    \"resolveJsonModule\": true,\n    \"isolatedModules\": true,\n    \"jsx\": \"react-jsx\",\n    \"incremental\": true,\n    \"plugins\": [\n      {\n        \"name\": \"next\"\n      }\n    ],\n    \"paths\": {\n      \"@/*\": [\n        \"./src/*\"\n      ]\n    },\n    \"target\": \"ES2017\"\n  },\n  \"include\": [\n    \"next-env.d.ts\",\n    \"**/*.ts\",\n    \"**/*.tsx\",\n    \".next/types/**/*.ts\",\n    \".next/dev/types/**/*.ts\"\n  ],\n  \"exclude\": [\n    \"node_modules\"\n  ]\n}\n"
  }
]