Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: delete demo mode (#20393)

Danny Xue672b489a59f
diff --git a/.github/workflows/build-push-cloud-image.yml b/.github/workflows/build-push-cloud-image.yml
index 5ad093920e..e0ec27006c 100644
--- a/.github/workflows/build-push-cloud-image.yml
+++ b/.github/workflows/build-push-cloud-image.yml
@@ -50,7 +50,6 @@ jobs:
build-args: |
VERSION=cloud
GIT_COMMIT=${{ env.GIT_COMMIT }}
- RELEASE=release
- name: Get GKE credentials
uses: google-github-actions/get-gke-credentials@v3
diff --git a/.github/workflows/build-push-demo-image.yml b/.github/workflows/build-push-demo-image.yml
deleted file mode 100644
index 5f82cbe25c..0000000000
--- a/.github/workflows/build-push-demo-image.yml
+++ /dev/null
@@ -1,62 +0,0 @@
-name: Build and Push Demo Image to GAR
-
-on:
- workflow_dispatch:
-
-permissions:
- contents: read
-
-env:
- GAR_LOCATION: us-central1
- GAR_REPOSITORY: bytebase
- IMAGE_NAME: bytebase-demo
-
-jobs:
- build-and-push:
- runs-on: depot-ubuntu-24.04-arm-4
- steps:
- - name: Checkout code
- uses: actions/checkout@v6
-
- - name: Extract build args
- run: |
- echo "GIT_COMMIT=$(git rev-parse HEAD)" >> $GITHUB_ENV
-
- - name: Authenticate to Google Cloud
- uses: google-github-actions/auth@v3
- with:
- credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }}
-
- - name: Set up Cloud SDK
- uses: google-github-actions/setup-gcloud@v3
- with:
- project_id: ${{ secrets.GCP_PROJECT_ID }}
-
- - name: Configure Docker for Artifact Registry
- run: |
- gcloud auth configure-docker ${{ env.GAR_LOCATION }}-docker.pkg.dev
-
- - name: Set up Docker Buildx
- uses: docker/setup-buildx-action@v4
-
- - name: Build and push Docker image
- uses: docker/build-push-action@v7
- with:
- context: .
- file: scripts/Dockerfile
- push: true
- tags: |
- ${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/${{ env.GAR_REPOSITORY }}/${{ env.IMAGE_NAME }}:latest
- build-args: |
- VERSION=demo
- GIT_COMMIT=${{ env.GIT_COMMIT }}
- RELEASE=dev
-
- - name: Get GKE credentials
- uses: google-github-actions/get-gke-credentials@v3
- with:
- cluster_name: ${{ secrets.GKE_CLUSTER_NAME }}
- location: ${{ secrets.GKE_CLUSTER_LOCATION }}
-
- - name: Restart deployment
- run: kubectl rollout restart deployment/bytebase-demo --namespace website
\ No newline at end of file
diff --git a/.github/workflows/demo-daily-deploy.yml b/.github/workflows/demo-daily-deploy.yml
deleted file mode 100644
index f34e836772..0000000000
--- a/.github/workflows/demo-daily-deploy.yml
+++ /dev/null
@@ -1,26 +0,0 @@
-name: Demo Daily Deploy
-on:
- schedule:
- - cron: '0 0 * * *'
- workflow_dispatch:
-
-permissions: {}
-
-jobs:
- deploy:
- if: github.repository == 'bytebase/bytebase'
- runs-on: ubuntu-latest
- steps:
- - name: Authenticate to Google Cloud
- uses: google-github-actions/auth@v3
- with:
- credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }}
-
- - name: Get GKE credentials
- uses: google-github-actions/get-gke-credentials@v3
- with:
- cluster_name: ${{ secrets.GKE_CLUSTER_NAME }}
- location: ${{ secrets.GKE_CLUSTER_LOCATION }}
-
- - name: Restart deployment
- run: kubectl rollout restart deployment/bytebase-demo --namespace website
diff --git a/README.md b/README.md
index c0d4cb7bbc..f969610608 100644
--- a/README.md
+++ b/README.md
@@ -12,7 +12,6 @@
<p align="center">
<a href="https://docs.bytebase.com/get-started/self-host-vs-cloud" target="_blank">⚙️ Install</a> •
<a href="https://docs.bytebase.com">📚 Docs</a> •
- <a href="https://demo.bytebase.com">🎮 Demo</a> •
<a href="https://discord.gg/huyw7gRsyA">💬 Discord</a> •
<a href="https://www.bytebase.com/request-demo/">🙋‍♀️ Book Demo</a>
</p>
diff --git a/action/README.md b/action/README.md
index 85865d1ac0..960530aeef 100644
--- a/action/README.md
+++ b/action/README.md
@@ -35,8 +35,7 @@ These flags apply to the main `bytebase-action` command and its subcommands (`ch
- For `check` command: outputs detailed check results including advices, affected rows, and risk levels
- For `rollout` command: outputs created resource names (release, plan, rollout)
-- **`--url`**: The Bytebase instance URL.
- - Default: `https://demo.bytebase.com`
+- **`--url`**: The Bytebase instance URL. Required.
- **`--service-account`**: The service account email.
- Default: `""` (empty string). If not provided via flag, reads from the `BYTEBASE_SERVICE_ACCOUNT` environment variable.
diff --git a/action/command/root.go b/action/command/root.go
index ae98615ad1..679ced197a 100644
--- a/action/command/root.go
+++ b/action/command/root.go
@@ -26,7 +26,7 @@ func NewRootCommand(w *world.World) *cobra.Command {
}
// bytebase-action flags
cmd.PersistentFlags().StringVar(&w.Output, "output", "", "Output file location. The output file is a JSON file with the created resource names")
- cmd.PersistentFlags().StringVar(&w.URL, "url", "https://demo.bytebase.com", "Bytebase URL")
+ cmd.PersistentFlags().StringVar(&w.URL, "url", "", "Bytebase URL (required)")
cmd.PersistentFlags().DurationVar(&w.Timeout, "timeout", 120*time.Second, "HTTP timeout for API requests (e.g. 120s, 5m)")
cmd.PersistentFlags().StringVar(&w.ServiceAccount, "service-account", "", "Bytebase Service account")
cmd.PersistentFlags().StringVar(&w.ServiceAccountSecret, "service-account-secret", "", "Bytebase Service account secret")
diff --git a/action/command/validation/flags.go b/action/command/validation/flags.go
index 67d7450569..4f13d1cdbd 100644
--- a/action/command/validation/flags.go
+++ b/action/command/validation/flags.go
@@ -40,11 +40,17 @@ func ValidateFlags(w *world.World) error {
}
}
- // Validate URL format
+ // Validate URL: must be a non-empty absolute URL.
+ if w.URL == "" {
+ return errors.Errorf("--url is required")
+ }
u, err := url.Parse(w.URL)
if err != nil {
return errors.Wrapf(err, "invalid URL format: %s", w.URL)
}
+ if u.Scheme == "" || u.Host == "" {
+ return errors.Errorf("--url must be an absolute URL (e.g. https://bytebase.example.com), got %q", w.URL)
+ }
w.URL = strings.TrimSuffix(u.String(), "/") // update the URL to the canonical form
// Validate project format
diff --git a/backend/api/mcp/gen/openapi.yaml b/backend/api/mcp/gen/openapi.yaml
index 875e96096a..3c77f47a7a 100644
--- a/backend/api/mcp/gen/openapi.yaml
+++ b/backend/api/mcp/gen/openapi.yaml
@@ -7921,10 +7921,6 @@ components:
type: boolean
title: saas
description: Whether the Bytebase instance is running in SaaS mode where some features cannot be edited by users.
- demo:
- type: boolean
- title: demo
- description: Whether the Bytebase instance is running in demo mode.
host:
type: string
title: host
diff --git a/backend/api/v1/actuator_service.go b/backend/api/v1/actuator_service.go
index e31f40be5f..79c5c289fb 100644
--- a/backend/api/v1/actuator_service.go
+++ b/backend/api/v1/actuator_service.go
@@ -133,7 +133,6 @@ func (s *ActuatorService) getServerInfo(ctx context.Context, workspaceID string)
Version: s.profile.Version,
GitCommit: s.profile.GitCommit,
Saas: s.profile.SaaS,
- Demo: s.profile.Demo,
LastActiveTime: timestamppb.New(time.Unix(s.profile.LastActiveTS.Load(), 0)),
Docker: s.profile.IsDocker,
ExternalUrlFromFlag: s.profile.ExternalURL != "",
diff --git a/backend/bin/server/cmd/profile.go b/backend/bin/server/cmd/profile.go
index 0d18a6ddb7..aa065c2c8a 100644
--- a/backend/bin/server/cmd/profile.go
+++ b/backend/bin/server/cmd/profile.go
@@ -19,7 +19,6 @@ func getBaseProfile(dataDir string) *config.Profile {
Debug: flags.debug,
IsDocker: isDocker(),
DataDir: dataDir,
- Demo: flags.demo,
Version: version,
GitCommit: gitcommit,
PgURL: os.Getenv("PG_URL"),
diff --git a/backend/bin/server/cmd/root.go b/backend/bin/server/cmd/root.go
index 5dc6e3219c..74100f85b6 100644
--- a/backend/bin/server/cmd/root.go
+++ b/backend/bin/server/cmd/root.go
@@ -9,7 +9,6 @@ import (
"os"
"os/signal"
"path/filepath"
- "strings"
"syscall"
"github.com/jackc/pgconn"
@@ -67,8 +66,6 @@ var (
debug bool
// output logs in json format
enableJSONLogging bool
- // demo mode.
- demo bool
// memoryProfileThreshold is the threshold of memory usage in bytes to trigger a memory profile.
memoryProfileThreshold uint64
}
@@ -111,8 +108,6 @@ func init() {
rootCmd.PersistentFlags().BoolVar(&flags.saas, "saas", false, "run in SaaS mode")
rootCmd.PersistentFlags().BoolVar(&flags.debug, "debug", false, "enable debug level log")
rootCmd.PersistentFlags().BoolVar(&flags.enableJSONLogging, "enable-json-logging", false, "enable output logs in bytebase in json format")
- // Must be one of the subpath name in the ../migrator/demo directory
- rootCmd.PersistentFlags().BoolVar(&flags.demo, "demo", false, "run in demo mode.")
rootCmd.PersistentFlags().Uint64Var(&flags.memoryProfileThreshold, "memory-profile-threshold", 0, "the threshold of memory usage in bytes to trigger a memory profile")
}
@@ -173,21 +168,6 @@ func start() {
fmt.Printf("Starting Bytebase %s(%s)...\n", profile.Version, profile.GitCommit)
- // A safety measure to prevent accidentally resetting user's actual data with demo data.
- // For embedded mode, we control where data is stored and we put demo data in a separate directory
- // from the non-demo data.
- // For external mode, only allow localhost bbdev database for demo purposes.
- if flags.demo && profile.PgURL != "" {
- if !strings.Contains(profile.PgURL, "localhost") && !strings.Contains(profile.PgURL, "127.0.0.1") {
- slog.Error("demo mode only allows localhost PostgreSQL connections")
- return
- }
- if !strings.Contains(profile.PgURL, "/bbdev") || !strings.Contains(profile.PgURL, "bbdev@") {
- slog.Error("demo mode requires database and username to be 'bbdev'")
- return
- }
- }
-
// The ideal bootstrap order is:
// 1. Connect to the metadb
// 2. Start echo server
diff --git a/backend/component/config/profile.go b/backend/component/config/profile.go
index 68cb8507e9..2b35fb0e91 100644
--- a/backend/component/config/profile.go
+++ b/backend/component/config/profile.go
@@ -28,8 +28,6 @@ type Profile struct {
LicensePrivateKey string
// DataDir is the directory stores the data including Bytebase's own database, backups, etc.
DataDir string
- // Demo mode.
- Demo bool
// HA replica mode.
HA bool
// Enable debug level. Only works when SaaS is true.
diff --git a/backend/demo/AGENTS.md b/backend/demo/AGENTS.md
deleted file mode 100644
index a7c885434d..0000000000
--- a/backend/demo/AGENTS.md
+++ /dev/null
@@ -1,107 +0,0 @@
-# Demo Data Automation Guide
-
-This directory contains demo data for https://demo.bytebase.com.
-
-`dump.sql` is dumped from the meta database and holds schema and data for the demo.
-
-## Updating Demo Data
-
-### Automated Steps
-
-**Step 1: Start Postgres 16 in Docker**
-
-```bash
-docker run -d --name bytebase-demo-pg -e POSTGRES_USER=bbdev -e POSTGRES_DB=bbdev -e POSTGRES_HOST_AUTH_METHOD=trust -p 5433:5432 postgres:16-alpine
-```
-
-**Step 2: Build and start Bytebase backend in demo mode**
-
-```bash
-go build -p=16 -ldflags "-w -s" -o ./bytebase-build/bytebase ./backend/bin/server/main.go && PG_URL=postgresql://bbdev@localhost:5433/bbdev ./bytebase-build/bytebase --port 8080 --data . --debug --demo
-```
-
-In a separate terminal:
-```bash
-pnpm --dir frontend dev
-```
-
----
-
-### Manual Step Required
-
-**Step 3: Make changes through the UI**
-
-1. Navigate to http://localhost:3000
-2. Make the desired changes to the demo data through the UI
-
----
-
-### Automated Steps (continued)
-
-**Step 4: Dump the database using Docker**
-
-```bash
-docker exec bytebase-demo-pg pg_dump -U bbdev bbdev --disable-triggers --no-owner --column-inserts --on-conflict-do-nothing > backend/demo/data/dump.sql
-```
-
-Remove the restrict/unrestrict lines from the dump:
-
-```bash
-sed -i '' '/^\\restrict /d; /^\\unrestrict /d' backend/demo/data/dump.sql
-```
-
-Verify the dump versions match at the top of `backend/demo/data/dump.sql`:
-```sql
--- Dumped from database version 16.0
--- Dumped by pg_dump version 16.0
-```
-
-**Step 5: Test the updated dump**
-
-Stop the running Bytebase instance from Step 2, clean the Docker database, and restart:
-
-```bash
-# Clean the Docker Postgres database
-docker exec bytebase-demo-pg psql -U bbdev -d postgres -c "DROP DATABASE IF EXISTS bbdev;" -c "CREATE DATABASE bbdev;"
-
-# Restart Bytebase with the updated dump
-PG_URL=postgresql://bbdev@localhost:5433/bbdev ./bytebase-build/bytebase --port 8080 --data . --debug --demo
-```
-
-Verify the demo data loads correctly by checking the frontend at http://localhost:3000.
-
-**Step 6: Cleanup**
-
-Stop the Bytebase backend and frontend servers, then remove the Docker container:
-
-```bash
-# Stop backend server on port 8080
-lsof -ti:8080 | xargs kill -9 2>/dev/null || true
-
-# Stop frontend server on port 3000
-lsof -ti:3000 | xargs kill -9 2>/dev/null || true
-
-# Remove Docker container
-docker stop bytebase-demo-pg && docker rm bytebase-demo-pg
-```
-
-## Service Account
-
-Demo data service account credentials:
-- Email: `[email protected]`
-- Password: `bbs_EDyd8zleJVBEZyw81kLL`
-
-## AGENTS.md Usage
-
-To automate the demo data update using an AI coding agent:
-
-**Initial prompt (Steps 1-2):**
-```
-Update the demo data following backend/demo/AGENTS.md
-```
-
-**After completing manual UI changes in Step 3:**
-```
-I've finished making changes through the UI. Continue with Steps 4-6.
-```
-
diff --git a/backend/demo/CLAUDE.md b/backend/demo/CLAUDE.md
deleted file mode 100644
index 43c994c2d3..0000000000
--- a/backend/demo/CLAUDE.md
+++ /dev/null
@@ -1 +0,0 @@
diff --git a/backend/demo/data/dump.sql b/backend/demo/data/dump.sql
deleted file mode 100644
index e4e7a17416..0000000000
--- a/backend/demo/data/dump.sql
+++ /dev/null
@@ -1,5511 +0,0 @@
---
--- PostgreSQL database dump
---
-
--- Dumped from database version 16.8
--- Dumped by pg_dump version 16.8
-
-SET statement_timeout = 0;
-SET lock_timeout = 0;
-SET idle_in_transaction_session_timeout = 0;
-SET client_encoding = 'UTF8';
-SET standard_conforming_strings = on;
-SELECT pg_catalog.set_config('search_path', '', false);
-SET check_function_bodies = false;
-SET xmloption = content;
-SET client_min_messages = warning;
-SET row_security = off;
-
-SET default_tablespace = '';
-
-SET default_table_access_method = heap;
-
---
--- Name: access_grant; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.access_grant (
- id text NOT NULL,
- project text NOT NULL,
- creator text NOT NULL,
- status text DEFAULT 'PENDING'::text NOT NULL,
- expire_time timestamp with time zone,
- payload jsonb DEFAULT '{}'::jsonb NOT NULL,
- created_at timestamp with time zone DEFAULT now() NOT NULL,
- updated_at timestamp with time zone DEFAULT now() NOT NULL
-);
-
-
---
--- Name: audit_log; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.audit_log (
- id bigint NOT NULL,
- created_at timestamp with time zone DEFAULT now() NOT NULL,
- payload jsonb DEFAULT '{}'::jsonb NOT NULL
-);
-
-
---
--- Name: audit_log_id_seq; Type: SEQUENCE; Schema: public; Owner: -
---
-
-CREATE SEQUENCE public.audit_log_id_seq
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1;
-
-
---
--- Name: audit_log_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
---
-
-ALTER SEQUENCE public.audit_log_id_seq OWNED BY public.audit_log.id;
-
-
---
--- Name: changelog; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.changelog (
- id bigint NOT NULL,
- created_at timestamp with time zone DEFAULT now() NOT NULL,
- instance text NOT NULL,
- db_name text NOT NULL,
- status text NOT NULL,
- sync_history_id bigint,
- payload jsonb DEFAULT '{}'::jsonb NOT NULL,
- CONSTRAINT changelog_status_check CHECK ((status = ANY (ARRAY['PENDING'::text, 'DONE'::text, 'FAILED'::text])))
-);
-
-
---
--- Name: changelog_id_seq; Type: SEQUENCE; Schema: public; Owner: -
---
-
-CREATE SEQUENCE public.changelog_id_seq
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1;
-
-
---
--- Name: changelog_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
---
-
-ALTER SEQUENCE public.changelog_id_seq OWNED BY public.changelog.id;
-
-
---
--- Name: db; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.db (
- deleted boolean DEFAULT false NOT NULL,
- project text NOT NULL,
- instance text NOT NULL,
- name text NOT NULL,
- environment text,
- metadata jsonb DEFAULT '{}'::jsonb NOT NULL
-);
-
-
---
--- Name: db_group; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.db_group (
- project text NOT NULL,
- resource_id text NOT NULL,
- name text DEFAULT ''::text NOT NULL,
- expression jsonb DEFAULT '{}'::jsonb NOT NULL,
- payload jsonb DEFAULT '{}'::jsonb NOT NULL
-);
-
-
---
--- Name: db_schema; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.db_schema (
- instance text NOT NULL,
- db_name text NOT NULL,
- metadata json DEFAULT '{}'::json NOT NULL,
- raw_dump text DEFAULT ''::text NOT NULL,
- config jsonb DEFAULT '{}'::jsonb NOT NULL
-);
-
-
---
--- Name: export_archive; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.export_archive (
- id integer NOT NULL,
- created_at timestamp with time zone DEFAULT now() NOT NULL,
- bytes bytea,
- payload jsonb DEFAULT '{}'::jsonb NOT NULL
-);
-
-
---
--- Name: export_archive_id_seq; Type: SEQUENCE; Schema: public; Owner: -
---
-
-CREATE SEQUENCE public.export_archive_id_seq
- AS integer
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1;
-
-
---
--- Name: export_archive_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
---
-
-ALTER SEQUENCE public.export_archive_id_seq OWNED BY public.export_archive.id;
-
-
---
--- Name: idp; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.idp (
- resource_id text NOT NULL,
- name text NOT NULL,
- domain text NOT NULL,
- type text NOT NULL,
- config jsonb DEFAULT '{}'::jsonb NOT NULL,
- CONSTRAINT idp_type_check CHECK ((type = ANY (ARRAY['OAUTH2'::text, 'OIDC'::text, 'LDAP'::text])))
-);
-
-
---
--- Name: instance; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.instance (
- deleted boolean DEFAULT false NOT NULL,
- environment text,
- resource_id text NOT NULL,
- metadata jsonb DEFAULT '{}'::jsonb NOT NULL
-);
-
-
---
--- Name: instance_change_history; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.instance_change_history (
- id bigint NOT NULL,
- version text NOT NULL
-);
-
-
---
--- Name: instance_change_history_id_seq; Type: SEQUENCE; Schema: public; Owner: -
---
-
-CREATE SEQUENCE public.instance_change_history_id_seq
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1;
-
-
---
--- Name: instance_change_history_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
---
-
-ALTER SEQUENCE public.instance_change_history_id_seq OWNED BY public.instance_change_history.id;
-
-
---
--- Name: issue; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.issue (
- id integer NOT NULL,
- created_at timestamp with time zone DEFAULT now() NOT NULL,
- updated_at timestamp with time zone DEFAULT now() NOT NULL,
- project text NOT NULL,
- plan_id bigint,
- name text NOT NULL,
- status text NOT NULL,
- type text NOT NULL,
- description text DEFAULT ''::text NOT NULL,
- payload jsonb DEFAULT '{}'::jsonb NOT NULL,
- ts_vector tsvector,
- creator text NOT NULL,
- CONSTRAINT issue_status_check CHECK ((status = ANY (ARRAY['OPEN'::text, 'DONE'::text, 'CANCELED'::text])))
-);
-
-
---
--- Name: issue_comment; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.issue_comment (
- id bigint NOT NULL,
- created_at timestamp with time zone DEFAULT now() NOT NULL,
- updated_at timestamp with time zone DEFAULT now() NOT NULL,
- issue_id integer NOT NULL,
- payload jsonb DEFAULT '{}'::jsonb NOT NULL,
- creator text NOT NULL
-);
-
-
---
--- Name: issue_comment_id_seq; Type: SEQUENCE; Schema: public; Owner: -
---
-
-CREATE SEQUENCE public.issue_comment_id_seq
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1;
-
-
---
--- Name: issue_comment_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
---
-
-ALTER SEQUENCE public.issue_comment_id_seq OWNED BY public.issue_comment.id;
-
-
---
--- Name: issue_id_seq; Type: SEQUENCE; Schema: public; Owner: -
---
-
-CREATE SEQUENCE public.issue_id_seq
- AS integer
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1;
-
-
---
--- Name: issue_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
---
-
-ALTER SEQUENCE public.issue_id_seq OWNED BY public.issue.id;
-
-
---
--- Name: oauth2_authorization_code; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.oauth2_authorization_code (
- code text NOT NULL,
- client_id text NOT NULL,
- user_email text NOT NULL,
- config jsonb NOT NULL,
- expires_at timestamp with time zone NOT NULL
-);
-
-
---
--- Name: oauth2_client; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.oauth2_client (
- client_id text NOT NULL,
- client_secret_hash text NOT NULL,
- config jsonb NOT NULL,
- last_active_at timestamp with time zone DEFAULT now() NOT NULL
-);
-
-
---
--- Name: oauth2_refresh_token; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.oauth2_refresh_token (
- token_hash text NOT NULL,
- client_id text NOT NULL,
- user_email text NOT NULL,
- expires_at timestamp with time zone NOT NULL
-);
-
-
---
--- Name: plan; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.plan (
- id bigint NOT NULL,
- created_at timestamp with time zone DEFAULT now() NOT NULL,
- updated_at timestamp with time zone DEFAULT now() NOT NULL,
- project text NOT NULL,
- name text NOT NULL,
- description text NOT NULL,
- config jsonb DEFAULT '{}'::jsonb NOT NULL,
- deleted boolean DEFAULT false NOT NULL,
- creator text NOT NULL
-);
-
-
---
--- Name: plan_check_run; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.plan_check_run (
- id integer NOT NULL,
- created_at timestamp with time zone DEFAULT now() NOT NULL,
- updated_at timestamp with time zone DEFAULT now() NOT NULL,
- plan_id bigint NOT NULL,
- status text NOT NULL,
- result jsonb DEFAULT '{}'::jsonb NOT NULL,
- CONSTRAINT plan_check_run_status_check CHECK ((status = ANY (ARRAY['AVAILABLE'::text, 'RUNNING'::text, 'DONE'::text, 'FAILED'::text, 'CANCELED'::text])))
-);
-
-
---
--- Name: plan_check_run_id_seq; Type: SEQUENCE; Schema: public; Owner: -
---
-
-CREATE SEQUENCE public.plan_check_run_id_seq
- AS integer
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1;
-
-
---
--- Name: plan_check_run_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
---
-
-ALTER SEQUENCE public.plan_check_run_id_seq OWNED BY public.plan_check_run.id;
-
-
---
--- Name: plan_id_seq; Type: SEQUENCE; Schema: public; Owner: -
---
-
-CREATE SEQUENCE public.plan_id_seq
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1;
-
-
---
--- Name: plan_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
---
-
-ALTER SEQUENCE public.plan_id_seq OWNED BY public.plan.id;
-
-
---
--- Name: plan_webhook_delivery; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.plan_webhook_delivery (
- plan_id bigint NOT NULL,
- event_type text NOT NULL,
- delivered_at timestamp with time zone DEFAULT now() NOT NULL
-);
-
-
---
--- Name: policy; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.policy (
- enforce boolean DEFAULT true NOT NULL,
- updated_at timestamp with time zone DEFAULT now() NOT NULL,
- resource_type text NOT NULL,
- resource text NOT NULL,
- type text NOT NULL,
- payload jsonb DEFAULT '{}'::jsonb NOT NULL,
- inherit_from_parent boolean DEFAULT true NOT NULL
-);
-
-
---
--- Name: principal; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.principal (
- id integer NOT NULL,
- deleted boolean DEFAULT false NOT NULL,
- created_at timestamp with time zone DEFAULT now() NOT NULL,
- name text NOT NULL,
- email text NOT NULL,
- password_hash text NOT NULL,
- phone text DEFAULT ''::text NOT NULL,
- mfa_config jsonb DEFAULT '{}'::jsonb NOT NULL,
- profile jsonb DEFAULT '{}'::jsonb NOT NULL
-);
-
-
---
--- Name: principal_id_seq; Type: SEQUENCE; Schema: public; Owner: -
---
-
-CREATE SEQUENCE public.principal_id_seq
- AS integer
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1;
-
-
---
--- Name: principal_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
---
-
-ALTER SEQUENCE public.principal_id_seq OWNED BY public.principal.id;
-
-
---
--- Name: project; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.project (
- deleted boolean DEFAULT false NOT NULL,
- name text NOT NULL,
- resource_id text NOT NULL,
- setting jsonb DEFAULT '{}'::jsonb NOT NULL
-);
-
-
---
--- Name: project_webhook; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.project_webhook (
- id integer NOT NULL,
- project text NOT NULL,
- payload jsonb DEFAULT '{}'::jsonb NOT NULL
-);
-
-
---
--- Name: project_webhook_id_seq; Type: SEQUENCE; Schema: public; Owner: -
---
-
-CREATE SEQUENCE public.project_webhook_id_seq
- AS integer
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1;
-
-
---
--- Name: project_webhook_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
---
-
-ALTER SEQUENCE public.project_webhook_id_seq OWNED BY public.project_webhook.id;
-
-
---
--- Name: query_history; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.query_history (
- id bigint NOT NULL,
- created_at timestamp with time zone DEFAULT now() NOT NULL,
- project_id text NOT NULL,
- database text NOT NULL,
- statement text NOT NULL,
- type text NOT NULL,
- payload jsonb DEFAULT '{}'::jsonb NOT NULL,
- creator text NOT NULL
-);
-
-
---
--- Name: query_history_id_seq; Type: SEQUENCE; Schema: public; Owner: -
---
-
-CREATE SEQUENCE public.query_history_id_seq
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1;
-
-
---
--- Name: query_history_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
---
-
-ALTER SEQUENCE public.query_history_id_seq OWNED BY public.query_history.id;
-
-
---
--- Name: release; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.release (
- deleted boolean DEFAULT false NOT NULL,
- project text NOT NULL,
- created_at timestamp with time zone DEFAULT now() NOT NULL,
- payload jsonb DEFAULT '{}'::jsonb NOT NULL,
- creator text NOT NULL,
- release_id text DEFAULT ''::text NOT NULL,
- train text DEFAULT ''::text NOT NULL,
- iteration integer DEFAULT 0 NOT NULL,
- category text DEFAULT ''::text NOT NULL
-);
-
-
---
--- Name: replica_heartbeat; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.replica_heartbeat (
- replica_id text NOT NULL,
- last_heartbeat timestamp with time zone NOT NULL
-);
-
-
---
--- Name: review_config; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.review_config (
- id text NOT NULL,
- enabled boolean DEFAULT true NOT NULL,
- name text NOT NULL,
- payload jsonb DEFAULT '{}'::jsonb NOT NULL
-);
-
-
---
--- Name: revision; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.revision (
- id bigint NOT NULL,
- instance text NOT NULL,
- db_name text NOT NULL,
- created_at timestamp with time zone DEFAULT now() NOT NULL,
- deleted_at timestamp with time zone,
- version text NOT NULL,
- payload jsonb DEFAULT '{}'::jsonb NOT NULL,
- deleter text
-);
-
-
---
--- Name: revision_id_seq; Type: SEQUENCE; Schema: public; Owner: -
---
-
-CREATE SEQUENCE public.revision_id_seq
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1;
-
-
---
--- Name: revision_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
---
-
-ALTER SEQUENCE public.revision_id_seq OWNED BY public.revision.id;
-
-
---
--- Name: role; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.role (
- resource_id text NOT NULL,
- name text NOT NULL,
- description text NOT NULL,
- permissions jsonb DEFAULT '{}'::jsonb NOT NULL,
- payload jsonb DEFAULT '{}'::jsonb NOT NULL
-);
-
-
---
--- Name: service_account; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.service_account (
- deleted boolean DEFAULT false NOT NULL,
- created_at timestamp with time zone DEFAULT now() NOT NULL,
- name text NOT NULL,
- email text NOT NULL,
- service_key_hash text NOT NULL,
- project text
-);
-
-
---
--- Name: setting; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.setting (
- name text NOT NULL,
- value jsonb NOT NULL
-);
-
-
---
--- Name: sheet_blob; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.sheet_blob (
- sha256 bytea NOT NULL,
- content text NOT NULL
-);
-
-
---
--- Name: sync_history; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.sync_history (
- id bigint NOT NULL,
- created_at timestamp with time zone DEFAULT now() NOT NULL,
- instance text NOT NULL,
- db_name text NOT NULL,
- metadata json DEFAULT '{}'::json NOT NULL,
- raw_dump text DEFAULT ''::text NOT NULL
-);
-
-
---
--- Name: sync_history_id_seq; Type: SEQUENCE; Schema: public; Owner: -
---
-
-CREATE SEQUENCE public.sync_history_id_seq
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1;
-
-
---
--- Name: sync_history_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
---
-
-ALTER SEQUENCE public.sync_history_id_seq OWNED BY public.sync_history.id;
-
-
---
--- Name: task; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.task (
- id integer NOT NULL,
- instance text NOT NULL,
- db_name text,
- type text NOT NULL,
- payload jsonb DEFAULT '{}'::jsonb NOT NULL,
- environment text,
- plan_id bigint NOT NULL
-);
-
-
---
--- Name: task_id_seq; Type: SEQUENCE; Schema: public; Owner: -
---
-
-CREATE SEQUENCE public.task_id_seq
- AS integer
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1;
-
-
---
--- Name: task_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
---
-
-ALTER SEQUENCE public.task_id_seq OWNED BY public.task.id;
-
-
---
--- Name: task_run; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.task_run (
- id integer NOT NULL,
- created_at timestamp with time zone DEFAULT now() NOT NULL,
- updated_at timestamp with time zone DEFAULT now() NOT NULL,
- task_id integer NOT NULL,
- attempt integer NOT NULL,
- status text NOT NULL,
- started_at timestamp with time zone,
- result jsonb DEFAULT '{}'::jsonb NOT NULL,
- run_at timestamp with time zone,
- creator text,
- replica_id text,
- payload jsonb DEFAULT '{}'::jsonb NOT NULL,
- CONSTRAINT task_run_status_check CHECK ((status = ANY (ARRAY['PENDING'::text, 'AVAILABLE'::text, 'RUNNING'::text, 'DONE'::text, 'FAILED'::text, 'CANCELED'::text])))
-);
-
-
---
--- Name: task_run_id_seq; Type: SEQUENCE; Schema: public; Owner: -
---
-
-CREATE SEQUENCE public.task_run_id_seq
- AS integer
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1;
-
-
---
--- Name: task_run_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
---
-
-ALTER SEQUENCE public.task_run_id_seq OWNED BY public.task_run.id;
-
-
---
--- Name: task_run_log; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.task_run_log (
- task_run_id integer NOT NULL,
- created_at timestamp with time zone DEFAULT now() NOT NULL,
- payload jsonb DEFAULT '{}'::jsonb NOT NULL
-);
-
-
---
--- Name: user_group; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.user_group (
- email text,
- name text NOT NULL,
- description text DEFAULT ''::text NOT NULL,
- payload jsonb DEFAULT '{}'::jsonb NOT NULL,
- id text DEFAULT (gen_random_uuid())::text NOT NULL
-);
-
-
---
--- Name: web_refresh_token; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.web_refresh_token (
- token_hash text NOT NULL,
- user_email text NOT NULL,
- expires_at timestamp with time zone NOT NULL
-);
-
-
---
--- Name: workload_identity; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.workload_identity (
- deleted boolean DEFAULT false NOT NULL,
- created_at timestamp with time zone DEFAULT now() NOT NULL,
- name text NOT NULL,
- email text NOT NULL,
- project text,
- config jsonb DEFAULT '{}'::jsonb NOT NULL
-);
-
-
---
--- Name: worksheet; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.worksheet (
- id integer NOT NULL,
- created_at timestamp with time zone DEFAULT now() NOT NULL,
- updated_at timestamp with time zone DEFAULT now() NOT NULL,
- project text NOT NULL,
- instance text,
- db_name text,
- name text NOT NULL,
- statement text NOT NULL,
- visibility text NOT NULL,
- payload jsonb DEFAULT '{}'::jsonb NOT NULL,
- creator text NOT NULL
-);
-
-
---
--- Name: worksheet_id_seq; Type: SEQUENCE; Schema: public; Owner: -
---
-
-CREATE SEQUENCE public.worksheet_id_seq
- AS integer
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1;
-
-
---
--- Name: worksheet_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
---
-
-ALTER SEQUENCE public.worksheet_id_seq OWNED BY public.worksheet.id;
-
-
---
--- Name: worksheet_organizer; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.worksheet_organizer (
- id integer NOT NULL,
- worksheet_id integer NOT NULL,
- payload jsonb DEFAULT '{}'::jsonb NOT NULL,
- principal text NOT NULL
-);
-
-
---
--- Name: worksheet_organizer_id_seq; Type: SEQUENCE; Schema: public; Owner: -
---
-
-CREATE SEQUENCE public.worksheet_organizer_id_seq
- AS integer
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1;
-
-
---
--- Name: worksheet_organizer_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
---
-
-ALTER SEQUENCE public.worksheet_organizer_id_seq OWNED BY public.worksheet_organizer.id;
-
-
---
--- Name: audit_log id; Type: DEFAULT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.audit_log ALTER COLUMN id SET DEFAULT nextval('public.audit_log_id_seq'::regclass);
-
-
---
--- Name: changelog id; Type: DEFAULT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.changelog ALTER COLUMN id SET DEFAULT nextval('public.changelog_id_seq'::regclass);
-
-
---
--- Name: export_archive id; Type: DEFAULT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.export_archive ALTER COLUMN id SET DEFAULT nextval('public.export_archive_id_seq'::regclass);
-
-
---
--- Name: instance_change_history id; Type: DEFAULT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.instance_change_history ALTER COLUMN id SET DEFAULT nextval('public.instance_change_history_id_seq'::regclass);
-
-
---
--- Name: issue id; Type: DEFAULT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.issue ALTER COLUMN id SET DEFAULT nextval('public.issue_id_seq'::regclass);
-
-
---
--- Name: issue_comment id; Type: DEFAULT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.issue_comment ALTER COLUMN id SET DEFAULT nextval('public.issue_comment_id_seq'::regclass);
-
-
---
--- Name: plan id; Type: DEFAULT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.plan ALTER COLUMN id SET DEFAULT nextval('public.plan_id_seq'::regclass);
-
-
---
--- Name: plan_check_run id; Type: DEFAULT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.plan_check_run ALTER COLUMN id SET DEFAULT nextval('public.plan_check_run_id_seq'::regclass);
-
-
---
--- Name: principal id; Type: DEFAULT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.principal ALTER COLUMN id SET DEFAULT nextval('public.principal_id_seq'::regclass);
-
-
---
--- Name: project_webhook id; Type: DEFAULT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.project_webhook ALTER COLUMN id SET DEFAULT nextval('public.project_webhook_id_seq'::regclass);
-
-
---
--- Name: query_history id; Type: DEFAULT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.query_history ALTER COLUMN id SET DEFAULT nextval('public.query_history_id_seq'::regclass);
-
-
---
--- Name: revision id; Type: DEFAULT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.revision ALTER COLUMN id SET DEFAULT nextval('public.revision_id_seq'::regclass);
-
-
---
--- Name: sync_history id; Type: DEFAULT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.sync_history ALTER COLUMN id SET DEFAULT nextval('public.sync_history_id_seq'::regclass);
-
-
---
--- Name: task id; Type: DEFAULT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.task ALTER COLUMN id SET DEFAULT nextval('public.task_id_seq'::regclass);
-
-
---
--- Name: task_run id; Type: DEFAULT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.task_run ALTER COLUMN id SET DEFAULT nextval('public.task_run_id_seq'::regclass);
-
-
---
--- Name: worksheet id; Type: DEFAULT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.worksheet ALTER COLUMN id SET DEFAULT nextval('public.worksheet_id_seq'::regclass);
-
-
---
--- Name: worksheet_organizer id; Type: DEFAULT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.worksheet_organizer ALTER COLUMN id SET DEFAULT nextval('public.worksheet_organizer_id_seq'::regclass);
-
-
---
--- Data for Name: access_grant; Type: TABLE DATA; Schema: public; Owner: -
---
-
-
-
---
--- Data for Name: audit_log; Type: TABLE DATA; Schema: public; Owner: -
---
-
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (101, '2025-05-26 06:48:06.307193+00', '{"method": "/bytebase.v1.UserService/CreateUser", "parent": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "request": "{\"user\":{\"email\":\"[email protected]\", \"title\":\"Demo\", \"userType\":\"USER\"}}", "response": "{\"name\":\"users/101\", \"email\":\"[email protected]\", \"title\":\"Demo\", \"userType\":\"USER\"}", "severity": "INFO", "requestMetadata": {"callerIp": "[::1]:56517", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (193, '2026-03-10 08:27:36.110711+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.AuthService/Login", "parent": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "latency": "0.104769541s", "request": "{\"email\":\"[email protected]\", \"web\":true}", "resource": "[email protected]", "response": "{\"user\":{\"name\":\"users/[email protected]\", \"email\":\"[email protected]\", \"title\":\"Demo\"}}", "severity": "INFO", "requestMetadata": {"callerIp": "[::1]:57270", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (112, '2025-05-26 07:27:50.339726+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.OrgPolicyService/UpdatePolicy", "parent": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "request": "{\"policy\":{\"name\":\"environments/prod/policies/tag\", \"type\":\"TAG\", \"tagPolicy\":{\"tags\":{\"bb.tag.review_config\":\"reviewConfigs/sql-review-sample-policy\"}}}, \"updateMask\":\"payload\", \"allowMissing\":true}", "response": "{\"name\":\"environments/prod/policies/tag\", \"type\":\"TAG\", \"tagPolicy\":{\"tags\":{\"bb.tag.review_config\":\"reviewConfigs/sql-review-sample-policy\"}}, \"enforce\":true, \"resourceType\":\"ENVIRONMENT\"}", "severity": "INFO", "requestMetadata": {"callerIp": "[::1]:59178", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (102, '2025-05-26 06:48:06.450846+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.AuthService/Login", "parent": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "request": "{\"email\":\"[email protected]\", \"web\":true}", "resource": "[email protected]", "response": "{\"user\":{\"name\":\"users/101\", \"email\":\"[email protected]\", \"title\":\"Demo\", \"userType\":\"USER\"}}", "severity": "INFO", "requestMetadata": {"callerIp": "[::1]:56753", "callerSuppliedUserAgent": "grpc-go/1.71.0"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (103, '2025-05-26 06:48:45.01432+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.SettingService/UpdateSetting", "parent": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "request": "{\"setting\":{\"name\":\"settings/bb.workspace.profile\", \"value\":{\"workspaceProfileSettingValue\":{\"databaseChangeMode\":\"PIPELINE\"}}}, \"allowMissing\":true, \"updateMask\":\"value.workspaceProfileSettingValue.databaseChangeMode\"}", "resource": "settings/bb.workspace.profile", "response": "{\"name\":\"settings/bb.workspace.profile\", \"value\":{\"workspaceProfileSettingValue\":{\"databaseChangeMode\":\"PIPELINE\"}}}", "severity": "INFO", "serviceData": {"name": "settings/bb.workspace.profile", "@type": "type.googleapis.com/bytebase.v1.Setting", "value": {"workspaceProfileSettingValue": {}}}, "requestMetadata": {"callerIp": "[::1]:56516", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (113, '2025-05-26 07:27:50.339901+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.OrgPolicyService/UpdatePolicy", "parent": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "request": "{\"policy\":{\"name\":\"environments/test/policies/tag\", \"type\":\"TAG\", \"tagPolicy\":{\"tags\":{\"bb.tag.review_config\":\"reviewConfigs/sql-review-sample-policy\"}}}, \"updateMask\":\"payload\", \"allowMissing\":true}", "response": "{\"name\":\"environments/test/policies/tag\", \"type\":\"TAG\", \"tagPolicy\":{\"tags\":{\"bb.tag.review_config\":\"reviewConfigs/sql-review-sample-policy\"}}, \"enforce\":true, \"resourceType\":\"ENVIRONMENT\"}", "severity": "INFO", "requestMetadata": {"callerIp": "[::1]:59172", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (104, '2025-05-26 06:51:21.254849+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.SettingService/UpdateSetting", "parent": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "request": "{\"setting\":{\"name\":\"settings/bb.workspace.profile\", \"value\":{\"workspaceProfileSettingValue\":{\"externalUrl\":\"https://demo.bytebase.com\", \"databaseChangeMode\":\"PIPELINE\"}}}, \"allowMissing\":true, \"updateMask\":\"value.workspaceProfileSettingValue.externalUrl\"}", "resource": "settings/bb.workspace.profile", "response": "{\"name\":\"settings/bb.workspace.profile\", \"value\":{\"workspaceProfileSettingValue\":{\"externalUrl\":\"https://demo.bytebase.com\", \"databaseChangeMode\":\"PIPELINE\"}}}", "severity": "INFO", "serviceData": {"name": "settings/bb.workspace.profile", "@type": "type.googleapis.com/bytebase.v1.Setting", "value": {"workspaceProfileSettingValue": {"databaseChangeMode": "PIPELINE"}}}, "requestMetadata": {"callerIp": "[::1]:56515", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (105, '2025-05-26 07:15:33.833558+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.UserService/CreateUser", "parent": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "request": "{\"user\":{\"name\":\"users/0\", \"email\":\"[email protected]\", \"title\":\"Dev1\", \"userType\":\"USER\"}}", "resource": "users/0", "response": "{\"name\":\"users/102\", \"email\":\"[email protected]\", \"title\":\"Dev1\", \"userType\":\"USER\"}", "severity": "INFO", "requestMetadata": {"callerIp": "[::1]:58583", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (106, '2025-05-26 07:15:33.845475+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.WorkspaceService/SetIamPolicy", "parent": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "request": "{\"resource\":\"workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48\", \"policy\":{\"bindings\":[{\"role\":\"roles/workspaceMember\", \"members\":[\"allUsers\", \"user:[email protected]\"], \"condition\":{}}, {\"role\":\"roles/workspaceAdmin\", \"members\":[\"user:[email protected]\"], \"condition\":{}}], \"etag\":\"1748242086302\"}, \"etag\":\"1748242086302\"}", "resource": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "response": "{\"bindings\":[{\"role\":\"roles/workspaceMember\", \"members\":[\"allUsers\", \"user:[email protected]\"], \"condition\":{}}, {\"role\":\"roles/workspaceAdmin\", \"members\":[\"user:[email protected]\"], \"condition\":{}}], \"etag\":\"1748243733843\"}", "severity": "INFO", "requestMetadata": {"callerIp": "[::1]:58583", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (107, '2025-05-26 07:16:05.086374+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.UserService/CreateUser", "parent": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "request": "{\"user\":{\"name\":\"users/0\", \"email\":\"[email protected]\", \"title\":\"dba1\", \"userType\":\"USER\"}}", "resource": "users/0", "response": "{\"name\":\"users/103\", \"email\":\"[email protected]\", \"title\":\"dba1\", \"userType\":\"USER\"}", "severity": "INFO", "requestMetadata": {"callerIp": "[::1]:58583", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (108, '2025-05-26 07:16:05.093675+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.WorkspaceService/SetIamPolicy", "parent": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "request": "{\"resource\":\"workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48\", \"policy\":{\"bindings\":[{\"role\":\"roles/workspaceMember\", \"members\":[\"allUsers\", \"user:[email protected]\"], \"condition\":{}}, {\"role\":\"roles/workspaceAdmin\", \"members\":[\"user:[email protected]\"], \"condition\":{}}, {\"role\":\"roles/workspaceDBA\", \"members\":[\"user:[email protected]\"]}], \"etag\":\"1748243733843\"}, \"etag\":\"1748243733843\"}", "resource": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "response": "{\"bindings\":[{\"role\":\"roles/workspaceMember\", \"members\":[\"allUsers\", \"user:[email protected]\"], \"condition\":{}}, {\"role\":\"roles/workspaceAdmin\", \"members\":[\"user:[email protected]\"], \"condition\":{}}, {\"role\":\"roles/workspaceDBA\", \"members\":[\"user:[email protected]\"], \"condition\":{}}], \"etag\":\"1748243765092\"}", "severity": "INFO", "requestMetadata": {"callerIp": "[::1]:58583", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (109, '2025-05-26 07:16:33.694524+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.UserService/CreateUser", "parent": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "request": "{\"user\":{\"name\":\"users/0\", \"email\":\"[email protected]\", \"title\":\"API user\", \"userType\":\"SERVICE_ACCOUNT\"}}", "resource": "users/0", "response": "{\"name\":\"users/104\", \"email\":\"[email protected]\", \"title\":\"API user\", \"userType\":\"SERVICE_ACCOUNT\"}", "severity": "INFO", "requestMetadata": {"callerIp": "[::1]:58813", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (110, '2025-05-26 07:16:33.700462+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.WorkspaceService/SetIamPolicy", "parent": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "request": "{\"resource\":\"workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48\", \"policy\":{\"bindings\":[{\"role\":\"roles/workspaceMember\", \"members\":[\"allUsers\", \"user:[email protected]\"], \"condition\":{}}, {\"role\":\"roles/workspaceAdmin\", \"members\":[\"user:[email protected]\", \"user:[email protected]\"], \"condition\":{}}, {\"role\":\"roles/workspaceDBA\", \"members\":[\"user:[email protected]\"], \"condition\":{}}], \"etag\":\"1748243765092\"}, \"etag\":\"1748243765092\"}", "resource": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "response": "{\"bindings\":[{\"role\":\"roles/workspaceMember\", \"members\":[\"allUsers\", \"user:[email protected]\"], \"condition\":{}}, {\"role\":\"roles/workspaceAdmin\", \"members\":[\"user:[email protected]\", \"user:[email protected]\"], \"condition\":{}}, {\"role\":\"roles/workspaceDBA\", \"members\":[\"user:[email protected]\"], \"condition\":{}}], \"etag\":\"1748243793699\"}", "severity": "INFO", "requestMetadata": {"callerIp": "[::1]:58813", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (111, '2025-05-26 07:24:34.037938+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.RoleService/UpdateRole", "parent": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "request": "{\"role\":{\"name\":\"roles/qa-custom-role\", \"title\":\"QA\", \"description\":\"Custom-defined QA role\", \"permissions\":[\"bb.databases.get\", \"bb.databases.getSchema\", \"bb.databases.list\", \"bb.issueComments.create\", \"bb.issues.get\", \"bb.issues.list\", \"bb.planCheckRuns.list\", \"bb.planCheckRuns.run\", \"bb.plans.get\", \"bb.plans.list\", \"bb.projects.get\", \"bb.projects.getIamPolicy\", \"bb.rollouts.get\", \"bb.taskRuns.list\"]}, \"updateMask\":\"title,description,permissions\", \"allowMissing\":true}", "response": "{\"name\":\"roles/qa-custom-role\", \"title\":\"QA\", \"description\":\"Custom-defined QA role\", \"permissions\":[\"bb.databases.get\", \"bb.databases.getSchema\", \"bb.databases.list\", \"bb.issueComments.create\", \"bb.issues.get\", \"bb.issues.list\", \"bb.planCheckRuns.list\", \"bb.planCheckRuns.run\", \"bb.plans.get\", \"bb.plans.list\", \"bb.projects.get\", \"bb.projects.getIamPolicy\", \"bb.rollouts.get\", \"bb.taskRuns.list\"], \"type\":\"CUSTOM\"}", "severity": "INFO", "requestMetadata": {"callerIp": "[::1]:59178", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (114, '2025-05-26 07:38:07.205352+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.RiskService/CreateRisk", "parent": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "request": "{\"risk\":{\"source\":\"DDL\", \"title\":\" ALTER column in production environment is high risk\", \"level\":300, \"active\":true, \"condition\":{\"expression\":\"environment_id == \\\"prod\\\" && sql_type == \\\"ALTER_TABLE\\\"\"}}}", "response": "{\"name\":\"risks/101\", \"source\":\"DDL\", \"title\":\" ALTER column in production environment is high risk\", \"level\":300, \"active\":true, \"condition\":{\"expression\":\"environment_id == \\\"prod\\\" && sql_type == \\\"ALTER_TABLE\\\"\"}}", "severity": "INFO", "requestMetadata": {"callerIp": "[::1]:59172", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (115, '2025-05-26 07:38:48.901692+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.RiskService/CreateRisk", "parent": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "request": "{\"risk\":{\"source\":\"DDL\", \"title\":\"CREATE TABLE in production environment is moderate risk\", \"level\":300, \"active\":true, \"condition\":{\"expression\":\"environment_id == \\\"prod\\\" && sql_type == \\\"CREATE_TABLE\\\"\"}}}", "response": "{\"name\":\"risks/102\", \"source\":\"DDL\", \"title\":\"CREATE TABLE in production environment is moderate risk\", \"level\":300, \"active\":true, \"condition\":{\"expression\":\"environment_id == \\\"prod\\\" && sql_type == \\\"CREATE_TABLE\\\"\"}}", "severity": "INFO", "requestMetadata": {"callerIp": "[::1]:59172", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (116, '2025-05-26 07:39:45.588851+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.RiskService/CreateRisk", "parent": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "request": "{\"risk\":{\"source\":\"DML\", \"title\":\"Updated or deleted rows exceeds 100 in prod is high risk\", \"level\":300, \"active\":true, \"condition\":{\"expression\":\"environment_id == \\\"prod\\\" && affected_rows > 100 && sql_type in [\\\"UPDATE\\\", \\\"DELETE\\\"]\"}}}", "response": "{\"name\":\"risks/103\", \"source\":\"DML\", \"title\":\"Updated or deleted rows exceeds 100 in prod is high risk\", \"level\":300, \"active\":true, \"condition\":{\"expression\":\"environment_id == \\\"prod\\\" && affected_rows > 100 && sql_type in [\\\"UPDATE\\\", \\\"DELETE\\\"]\"}}", "severity": "INFO", "requestMetadata": {"callerIp": "[::1]:59172", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (117, '2025-05-26 07:40:00.03158+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.SettingService/UpdateSetting", "parent": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "request": "{\"setting\":{\"name\":\"settings/bb.workspace.approval\", \"value\":{\"workspaceApprovalSettingValue\":{\"rules\":[{\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/projectOwner\"}]}, {\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceDBA\"}]}]}, \"title\":\"Project Owner -> Workspace DBA\", \"description\":\"The system defines the approval process, first the project Owner approves, then the DBA approves.\", \"creator\":\"users/[email protected]\"}, \"condition\":{\"expression\":\"source == \\\"DML\\\" && level == 300\"}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/projectOwner\"}]}]}, \"title\":\"Project Owner\", \"description\":\"The system defines the approval process and only needs the project Owner to approve it.\", \"creator\":\"users/[email protected]\"}, \"condition\":{}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceDBA\"}]}]}, \"title\":\"Workspace DBA\", \"description\":\"The system defines the approval process and only needs DBA approval.\", \"creator\":\"users/[email protected]\"}, \"condition\":{}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceAdmin\"}]}]}, \"title\":\"Workspace Admin\", \"description\":\"The system defines the approval process and only needs Administrator approval.\", \"creator\":\"users/[email protected]\"}, \"condition\":{}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/projectOwner\"}]}, {\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceDBA\"}]}, {\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceAdmin\"}]}]}, \"title\":\"Project Owner -> Workspace DBA -> Workspace Admin\", \"description\":\"The system defines the approval process, first the project Owner approves, then the DBA approves, and finally the Administrator approves.\", \"creator\":\"users/[email protected]\"}, \"condition\":{}}]}}}, \"allowMissing\":true}", "resource": "settings/bb.workspace.approval", "response": "{\"name\":\"settings/bb.workspace.approval\", \"value\":{\"workspaceApprovalSettingValue\":{\"rules\":[{\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/projectOwner\"}]}, {\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceDBA\"}]}]}, \"title\":\"Project Owner -> Workspace DBA\", \"description\":\"The system defines the approval process, first the project Owner approves, then the DBA approves.\", \"creator\":\"users/[email protected]\"}, \"condition\":{\"expression\":\"source == \\\"DML\\\" && level == 300\"}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/projectOwner\"}]}]}, \"title\":\"Project Owner\", \"description\":\"The system defines the approval process and only needs the project Owner to approve it.\", \"creator\":\"users/[email protected]\"}, \"condition\":{}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceDBA\"}]}]}, \"title\":\"Workspace DBA\", \"description\":\"The system defines the approval process and only needs DBA approval.\", \"creator\":\"users/[email protected]\"}, \"condition\":{}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceAdmin\"}]}]}, \"title\":\"Workspace Admin\", \"description\":\"The system defines the approval process and only needs Administrator approval.\", \"creator\":\"users/[email protected]\"}, \"condition\":{}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/projectOwner\"}]}, {\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceDBA\"}]}, {\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceAdmin\"}]}]}, \"title\":\"Project Owner -> Workspace DBA -> Workspace Admin\", \"description\":\"The system defines the approval process, first the project Owner approves, then the DBA approves, and finally the Administrator approves.\", \"creator\":\"users/[email protected]\"}, \"condition\":{}}]}}}", "severity": "INFO", "serviceData": {"name": "settings/bb.workspace.approval", "@type": "type.googleapis.com/bytebase.v1.Setting", "value": {"workspaceApprovalSettingValue": {}}}, "requestMetadata": {"callerIp": "[::1]:60530", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (118, '2025-05-26 07:40:07.663554+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.SettingService/UpdateSetting", "parent": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "request": "{\"setting\":{\"name\":\"settings/bb.workspace.approval\", \"value\":{\"workspaceApprovalSettingValue\":{\"rules\":[{\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/projectOwner\"}]}, {\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceDBA\"}]}]}, \"title\":\"Project Owner -> Workspace DBA\", \"description\":\"The system defines the approval process, first the project Owner approves, then the DBA approves.\", \"creator\":\"users/[email protected]\"}, \"condition\":{\"expression\":\"source == \\\"DML\\\" && level == 300\"}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/projectOwner\"}]}]}, \"title\":\"Project Owner\", \"description\":\"The system defines the approval process and only needs the project Owner to approve it.\", \"creator\":\"users/[email protected]\"}, \"condition\":{\"expression\":\"source == \\\"DML\\\" && level == 0\"}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceDBA\"}]}]}, \"title\":\"Workspace DBA\", \"description\":\"The system defines the approval process and only needs DBA approval.\", \"creator\":\"users/[email protected]\"}, \"condition\":{}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceAdmin\"}]}]}, \"title\":\"Workspace Admin\", \"description\":\"The system defines the approval process and only needs Administrator approval.\", \"creator\":\"users/[email protected]\"}, \"condition\":{}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/projectOwner\"}]}, {\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceDBA\"}]}, {\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceAdmin\"}]}]}, \"title\":\"Project Owner -> Workspace DBA -> Workspace Admin\", \"description\":\"The system defines the approval process, first the project Owner approves, then the DBA approves, and finally the Administrator approves.\", \"creator\":\"users/[email protected]\"}, \"condition\":{}}]}}}, \"allowMissing\":true}", "resource": "settings/bb.workspace.approval", "response": "{\"name\":\"settings/bb.workspace.approval\", \"value\":{\"workspaceApprovalSettingValue\":{\"rules\":[{\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/projectOwner\"}]}, {\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceDBA\"}]}]}, \"title\":\"Project Owner -> Workspace DBA\", \"description\":\"The system defines the approval process, first the project Owner approves, then the DBA approves.\", \"creator\":\"users/[email protected]\"}, \"condition\":{\"expression\":\"source == \\\"DML\\\" && level == 300\"}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/projectOwner\"}]}]}, \"title\":\"Project Owner\", \"description\":\"The system defines the approval process and only needs the project Owner to approve it.\", \"creator\":\"users/[email protected]\"}, \"condition\":{\"expression\":\"source == \\\"DML\\\" && level == 0\"}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceDBA\"}]}]}, \"title\":\"Workspace DBA\", \"description\":\"The system defines the approval process and only needs DBA approval.\", \"creator\":\"users/[email protected]\"}, \"condition\":{}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceAdmin\"}]}]}, \"title\":\"Workspace Admin\", \"description\":\"The system defines the approval process and only needs Administrator approval.\", \"creator\":\"users/[email protected]\"}, \"condition\":{}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/projectOwner\"}]}, {\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceDBA\"}]}, {\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceAdmin\"}]}]}, \"title\":\"Project Owner -> Workspace DBA -> Workspace Admin\", \"description\":\"The system defines the approval process, first the project Owner approves, then the DBA approves, and finally the Administrator approves.\", \"creator\":\"users/[email protected]\"}, \"condition\":{}}]}}}", "severity": "INFO", "serviceData": {"name": "settings/bb.workspace.approval", "@type": "type.googleapis.com/bytebase.v1.Setting", "value": {"workspaceApprovalSettingValue": {"rules": [{"template": {"flow": {"steps": [{"type": "ANY", "nodes": [{"role": "roles/projectOwner", "type": "ANY_IN_GROUP"}]}, {"type": "ANY", "nodes": [{"role": "roles/workspaceDBA", "type": "ANY_IN_GROUP"}]}]}, "title": "Project Owner -> Workspace DBA", "creator": "users/[email protected]", "description": "The system defines the approval process, first the project Owner approves, then the DBA approves."}, "condition": {"expression": "source == \"DML\" && level == 300"}}, {"template": {"flow": {"steps": [{"type": "ANY", "nodes": [{"role": "roles/projectOwner", "type": "ANY_IN_GROUP"}]}]}, "title": "Project Owner", "creator": "users/[email protected]", "description": "The system defines the approval process and only needs the project Owner to approve it."}, "condition": {}}, {"template": {"flow": {"steps": [{"type": "ANY", "nodes": [{"role": "roles/workspaceDBA", "type": "ANY_IN_GROUP"}]}]}, "title": "Workspace DBA", "creator": "users/[email protected]", "description": "The system defines the approval process and only needs DBA approval."}, "condition": {}}, {"template": {"flow": {"steps": [{"type": "ANY", "nodes": [{"role": "roles/workspaceAdmin", "type": "ANY_IN_GROUP"}]}]}, "title": "Workspace Admin", "creator": "users/[email protected]", "description": "The system defines the approval process and only needs Administrator approval."}, "condition": {}}, {"template": {"flow": {"steps": [{"type": "ANY", "nodes": [{"role": "roles/projectOwner", "type": "ANY_IN_GROUP"}]}, {"type": "ANY", "nodes": [{"role": "roles/workspaceDBA", "type": "ANY_IN_GROUP"}]}, {"type": "ANY", "nodes": [{"role": "roles/workspaceAdmin", "type": "ANY_IN_GROUP"}]}]}, "title": "Project Owner -> Workspace DBA -> Workspace Admin", "creator": "users/[email protected]", "description": "The system defines the approval process, first the project Owner approves, then the DBA approves, and finally the Administrator approves."}, "condition": {}}]}}}, "requestMetadata": {"callerIp": "[::1]:60530", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (119, '2025-05-26 07:40:43.115949+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.SettingService/UpdateSetting", "parent": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "request": "{\"setting\":{\"name\":\"settings/bb.workspace.approval\", \"value\":{\"workspaceApprovalSettingValue\":{\"rules\":[{\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/projectOwner\"}]}, {\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceDBA\"}]}]}, \"title\":\"Project Owner -> Workspace DBA\", \"description\":\"The system defines the approval process, first the project Owner approves, then the DBA approves.\", \"creator\":\"users/[email protected]\"}, \"condition\":{\"expression\":\"source == \\\"DML\\\" && level == 300 || source == \\\"DDL\\\" && level == 300\"}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/projectOwner\"}]}]}, \"title\":\"Project Owner\", \"description\":\"The system defines the approval process and only needs the project Owner to approve it.\", \"creator\":\"users/[email protected]\"}, \"condition\":{\"expression\":\"source == \\\"DML\\\" && level == 0\"}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceDBA\"}]}]}, \"title\":\"Workspace DBA\", \"description\":\"The system defines the approval process and only needs DBA approval.\", \"creator\":\"users/[email protected]\"}, \"condition\":{}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceAdmin\"}]}]}, \"title\":\"Workspace Admin\", \"description\":\"The system defines the approval process and only needs Administrator approval.\", \"creator\":\"users/[email protected]\"}, \"condition\":{}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/projectOwner\"}]}, {\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceDBA\"}]}, {\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceAdmin\"}]}]}, \"title\":\"Project Owner -> Workspace DBA -> Workspace Admin\", \"description\":\"The system defines the approval process, first the project Owner approves, then the DBA approves, and finally the Administrator approves.\", \"creator\":\"users/[email protected]\"}, \"condition\":{}}]}}}, \"allowMissing\":true}", "resource": "settings/bb.workspace.approval", "response": "{\"name\":\"settings/bb.workspace.approval\", \"value\":{\"workspaceApprovalSettingValue\":{\"rules\":[{\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/projectOwner\"}]}, {\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceDBA\"}]}]}, \"title\":\"Project Owner -> Workspace DBA\", \"description\":\"The system defines the approval process, first the project Owner approves, then the DBA approves.\", \"creator\":\"users/[email protected]\"}, \"condition\":{\"expression\":\"source == \\\"DML\\\" && level == 300 || source == \\\"DDL\\\" && level == 300\"}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/projectOwner\"}]}]}, \"title\":\"Project Owner\", \"description\":\"The system defines the approval process and only needs the project Owner to approve it.\", \"creator\":\"users/[email protected]\"}, \"condition\":{\"expression\":\"source == \\\"DML\\\" && level == 0\"}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceDBA\"}]}]}, \"title\":\"Workspace DBA\", \"description\":\"The system defines the approval process and only needs DBA approval.\", \"creator\":\"users/[email protected]\"}, \"condition\":{}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceAdmin\"}]}]}, \"title\":\"Workspace Admin\", \"description\":\"The system defines the approval process and only needs Administrator approval.\", \"creator\":\"users/[email protected]\"}, \"condition\":{}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/projectOwner\"}]}, {\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceDBA\"}]}, {\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceAdmin\"}]}]}, \"title\":\"Project Owner -> Workspace DBA -> Workspace Admin\", \"description\":\"The system defines the approval process, first the project Owner approves, then the DBA approves, and finally the Administrator approves.\", \"creator\":\"users/[email protected]\"}, \"condition\":{}}]}}}", "severity": "INFO", "serviceData": {"name": "settings/bb.workspace.approval", "@type": "type.googleapis.com/bytebase.v1.Setting", "value": {"workspaceApprovalSettingValue": {"rules": [{"template": {"flow": {"steps": [{"type": "ANY", "nodes": [{"role": "roles/projectOwner", "type": "ANY_IN_GROUP"}]}, {"type": "ANY", "nodes": [{"role": "roles/workspaceDBA", "type": "ANY_IN_GROUP"}]}]}, "title": "Project Owner -> Workspace DBA", "creator": "users/[email protected]", "description": "The system defines the approval process, first the project Owner approves, then the DBA approves."}, "condition": {"expression": "source == \"DML\" && level == 300"}}, {"template": {"flow": {"steps": [{"type": "ANY", "nodes": [{"role": "roles/projectOwner", "type": "ANY_IN_GROUP"}]}]}, "title": "Project Owner", "creator": "users/[email protected]", "description": "The system defines the approval process and only needs the project Owner to approve it."}, "condition": {"expression": "source == \"DML\" && level == 0"}}, {"template": {"flow": {"steps": [{"type": "ANY", "nodes": [{"role": "roles/workspaceDBA", "type": "ANY_IN_GROUP"}]}]}, "title": "Workspace DBA", "creator": "users/[email protected]", "description": "The system defines the approval process and only needs DBA approval."}, "condition": {}}, {"template": {"flow": {"steps": [{"type": "ANY", "nodes": [{"role": "roles/workspaceAdmin", "type": "ANY_IN_GROUP"}]}]}, "title": "Workspace Admin", "creator": "users/[email protected]", "description": "The system defines the approval process and only needs Administrator approval."}, "condition": {}}, {"template": {"flow": {"steps": [{"type": "ANY", "nodes": [{"role": "roles/projectOwner", "type": "ANY_IN_GROUP"}]}, {"type": "ANY", "nodes": [{"role": "roles/workspaceDBA", "type": "ANY_IN_GROUP"}]}, {"type": "ANY", "nodes": [{"role": "roles/workspaceAdmin", "type": "ANY_IN_GROUP"}]}]}, "title": "Project Owner -> Workspace DBA -> Workspace Admin", "creator": "users/[email protected]", "description": "The system defines the approval process, first the project Owner approves, then the DBA approves, and finally the Administrator approves."}, "condition": {}}]}}}, "requestMetadata": {"callerIp": "[::1]:60530", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (132, '2025-05-26 07:56:06.908019+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.InstanceService/CreateInstance", "parent": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "status": {"code": 3, "message": "invalid datasource ADMIN, error failed to connect to `user=bb database=postgres`: /tmp/.s.PGSQL.5432 (/tmp): dial error: dial unix /tmp/.s.PGSQL.5432: connect: no such file or directory"}, "request": "{\"instance\":{\"name\":\"instances/bytebase-meta\", \"state\":\"ACTIVE\", \"title\":\"bytebase-meta\", \"engine\":\"POSTGRES\", \"dataSources\":[{\"id\":\"35a64b4a-543f-4eac-ad32-b191a958c66d\", \"type\":\"ADMIN\", \"username\":\"bb\", \"host\":\"/tmp\", \"port\":\"5432\", \"authenticationType\":\"PASSWORD\"}], \"environment\":\"environments/prod\", \"activation\":true}, \"instanceId\":\"bytebase-meta\", \"validateOnly\":true}", "resource": "instances/bytebase-meta", "severity": "INFO", "requestMetadata": {"callerIp": "[::1]:61847", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (120, '2025-05-26 07:40:47.856611+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.SettingService/UpdateSetting", "parent": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "request": "{\"setting\":{\"name\":\"settings/bb.workspace.approval\", \"value\":{\"workspaceApprovalSettingValue\":{\"rules\":[{\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/projectOwner\"}]}, {\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceDBA\"}]}]}, \"title\":\"Project Owner -> Workspace DBA\", \"description\":\"The system defines the approval process, first the project Owner approves, then the DBA approves.\", \"creator\":\"users/[email protected]\"}, \"condition\":{\"expression\":\"source == \\\"DML\\\" && level == 300 || source == \\\"DDL\\\" && level == 300\"}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/projectOwner\"}]}]}, \"title\":\"Project Owner\", \"description\":\"The system defines the approval process and only needs the project Owner to approve it.\", \"creator\":\"users/[email protected]\"}, \"condition\":{\"expression\":\"source == \\\"DML\\\" && level == 0 || source == \\\"DDL\\\" && level == 200\"}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceDBA\"}]}]}, \"title\":\"Workspace DBA\", \"description\":\"The system defines the approval process and only needs DBA approval.\", \"creator\":\"users/[email protected]\"}, \"condition\":{}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceAdmin\"}]}]}, \"title\":\"Workspace Admin\", \"description\":\"The system defines the approval process and only needs Administrator approval.\", \"creator\":\"users/[email protected]\"}, \"condition\":{}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/projectOwner\"}]}, {\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceDBA\"}]}, {\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceAdmin\"}]}]}, \"title\":\"Project Owner -> Workspace DBA -> Workspace Admin\", \"description\":\"The system defines the approval process, first the project Owner approves, then the DBA approves, and finally the Administrator approves.\", \"creator\":\"users/[email protected]\"}, \"condition\":{}}]}}}, \"allowMissing\":true}", "resource": "settings/bb.workspace.approval", "response": "{\"name\":\"settings/bb.workspace.approval\", \"value\":{\"workspaceApprovalSettingValue\":{\"rules\":[{\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/projectOwner\"}]}, {\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceDBA\"}]}]}, \"title\":\"Project Owner -> Workspace DBA\", \"description\":\"The system defines the approval process, first the project Owner approves, then the DBA approves.\", \"creator\":\"users/[email protected]\"}, \"condition\":{\"expression\":\"source == \\\"DML\\\" && level == 300 || source == \\\"DDL\\\" && level == 300\"}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/projectOwner\"}]}]}, \"title\":\"Project Owner\", \"description\":\"The system defines the approval process and only needs the project Owner to approve it.\", \"creator\":\"users/[email protected]\"}, \"condition\":{\"expression\":\"source == \\\"DML\\\" && level == 0 || source == \\\"DDL\\\" && level == 200\"}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceDBA\"}]}]}, \"title\":\"Workspace DBA\", \"description\":\"The system defines the approval process and only needs DBA approval.\", \"creator\":\"users/[email protected]\"}, \"condition\":{}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceAdmin\"}]}]}, \"title\":\"Workspace Admin\", \"description\":\"The system defines the approval process and only needs Administrator approval.\", \"creator\":\"users/[email protected]\"}, \"condition\":{}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/projectOwner\"}]}, {\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceDBA\"}]}, {\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceAdmin\"}]}]}, \"title\":\"Project Owner -> Workspace DBA -> Workspace Admin\", \"description\":\"The system defines the approval process, first the project Owner approves, then the DBA approves, and finally the Administrator approves.\", \"creator\":\"users/[email protected]\"}, \"condition\":{}}]}}}", "severity": "INFO", "serviceData": {"name": "settings/bb.workspace.approval", "@type": "type.googleapis.com/bytebase.v1.Setting", "value": {"workspaceApprovalSettingValue": {"rules": [{"template": {"flow": {"steps": [{"type": "ANY", "nodes": [{"role": "roles/projectOwner", "type": "ANY_IN_GROUP"}]}, {"type": "ANY", "nodes": [{"role": "roles/workspaceDBA", "type": "ANY_IN_GROUP"}]}]}, "title": "Project Owner -> Workspace DBA", "creator": "users/[email protected]", "description": "The system defines the approval process, first the project Owner approves, then the DBA approves."}, "condition": {"expression": "source == \"DML\" && level == 300 || source == \"DDL\" && level == 300"}}, {"template": {"flow": {"steps": [{"type": "ANY", "nodes": [{"role": "roles/projectOwner", "type": "ANY_IN_GROUP"}]}]}, "title": "Project Owner", "creator": "users/[email protected]", "description": "The system defines the approval process and only needs the project Owner to approve it."}, "condition": {"expression": "source == \"DML\" && level == 0"}}, {"template": {"flow": {"steps": [{"type": "ANY", "nodes": [{"role": "roles/workspaceDBA", "type": "ANY_IN_GROUP"}]}]}, "title": "Workspace DBA", "creator": "users/[email protected]", "description": "The system defines the approval process and only needs DBA approval."}, "condition": {}}, {"template": {"flow": {"steps": [{"type": "ANY", "nodes": [{"role": "roles/workspaceAdmin", "type": "ANY_IN_GROUP"}]}]}, "title": "Workspace Admin", "creator": "users/[email protected]", "description": "The system defines the approval process and only needs Administrator approval."}, "condition": {}}, {"template": {"flow": {"steps": [{"type": "ANY", "nodes": [{"role": "roles/projectOwner", "type": "ANY_IN_GROUP"}]}, {"type": "ANY", "nodes": [{"role": "roles/workspaceDBA", "type": "ANY_IN_GROUP"}]}, {"type": "ANY", "nodes": [{"role": "roles/workspaceAdmin", "type": "ANY_IN_GROUP"}]}]}, "title": "Project Owner -> Workspace DBA -> Workspace Admin", "creator": "users/[email protected]", "description": "The system defines the approval process, first the project Owner approves, then the DBA approves, and finally the Administrator approves."}, "condition": {}}]}}}, "requestMetadata": {"callerIp": "[::1]:60530", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (127, '2025-05-26 07:48:20.879598+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.OrgPolicyService/UpdatePolicy", "parent": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "request": "{\"policy\":{\"name\":\"policies/masking_rule\", \"type\":\"MASKING_RULE\", \"maskingRulePolicy\":{\"rules\":[{\"id\":\"e0743172-c9c7-43f8-9923-9a3c06012cee\", \"condition\":{\"expression\":\"classification_level in [\\\"4\\\"]\"}, \"semanticType\":\"bb.default\"}]}, \"resourceType\":\"WORKSPACE\"}, \"updateMask\":\"payload\", \"allowMissing\":true}", "response": "{\"name\":\"policies/masking_rule\", \"type\":\"MASKING_RULE\", \"maskingRulePolicy\":{\"rules\":[{\"id\":\"e0743172-c9c7-43f8-9923-9a3c06012cee\", \"condition\":{\"expression\":\"classification_level in [\\\"4\\\"]\"}, \"semanticType\":\"bb.default\"}]}, \"enforce\":true, \"resourceType\":\"WORKSPACE\"}", "severity": "INFO", "requestMetadata": {"callerIp": "[::1]:61234", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (121, '2025-05-26 07:40:51.55467+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.SettingService/UpdateSetting", "parent": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "request": "{\"setting\":{\"name\":\"settings/bb.workspace.approval\", \"value\":{\"workspaceApprovalSettingValue\":{\"rules\":[{\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/projectOwner\"}]}, {\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceDBA\"}]}]}, \"title\":\"Project Owner -> Workspace DBA\", \"description\":\"The system defines the approval process, first the project Owner approves, then the DBA approves.\", \"creator\":\"users/[email protected]\"}, \"condition\":{\"expression\":\"source == \\\"DML\\\" && level == 300 || source == \\\"DDL\\\" && level == 300\"}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/projectOwner\"}]}]}, \"title\":\"Project Owner\", \"description\":\"The system defines the approval process and only needs the project Owner to approve it.\", \"creator\":\"users/[email protected]\"}, \"condition\":{\"expression\":\"source == \\\"DML\\\" && level == 0 || source == \\\"DDL\\\" && level == 200 || source == \\\"DDL\\\" &&\\nlevel == 0\"}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceDBA\"}]}]}, \"title\":\"Workspace DBA\", \"description\":\"The system defines the approval process and only needs DBA approval.\", \"creator\":\"users/[email protected]\"}, \"condition\":{}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceAdmin\"}]}]}, \"title\":\"Workspace Admin\", \"description\":\"The system defines the approval process and only needs Administrator approval.\", \"creator\":\"users/[email protected]\"}, \"condition\":{}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/projectOwner\"}]}, {\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceDBA\"}]}, {\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceAdmin\"}]}]}, \"title\":\"Project Owner -> Workspace DBA -> Workspace Admin\", \"description\":\"The system defines the approval process, first the project Owner approves, then the DBA approves, and finally the Administrator approves.\", \"creator\":\"users/[email protected]\"}, \"condition\":{}}]}}}, \"allowMissing\":true}", "resource": "settings/bb.workspace.approval", "response": "{\"name\":\"settings/bb.workspace.approval\", \"value\":{\"workspaceApprovalSettingValue\":{\"rules\":[{\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/projectOwner\"}]}, {\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceDBA\"}]}]}, \"title\":\"Project Owner -> Workspace DBA\", \"description\":\"The system defines the approval process, first the project Owner approves, then the DBA approves.\", \"creator\":\"users/[email protected]\"}, \"condition\":{\"expression\":\"source == \\\"DML\\\" && level == 300 || source == \\\"DDL\\\" && level == 300\"}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/projectOwner\"}]}]}, \"title\":\"Project Owner\", \"description\":\"The system defines the approval process and only needs the project Owner to approve it.\", \"creator\":\"users/[email protected]\"}, \"condition\":{\"expression\":\"source == \\\"DML\\\" && level == 0 || source == \\\"DDL\\\" && level == 200 || source == \\\"DDL\\\" &&\\nlevel == 0\"}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceDBA\"}]}]}, \"title\":\"Workspace DBA\", \"description\":\"The system defines the approval process and only needs DBA approval.\", \"creator\":\"users/[email protected]\"}, \"condition\":{}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceAdmin\"}]}]}, \"title\":\"Workspace Admin\", \"description\":\"The system defines the approval process and only needs Administrator approval.\", \"creator\":\"users/[email protected]\"}, \"condition\":{}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/projectOwner\"}]}, {\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceDBA\"}]}, {\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceAdmin\"}]}]}, \"title\":\"Project Owner -> Workspace DBA -> Workspace Admin\", \"description\":\"The system defines the approval process, first the project Owner approves, then the DBA approves, and finally the Administrator approves.\", \"creator\":\"users/[email protected]\"}, \"condition\":{}}]}}}", "severity": "INFO", "serviceData": {"name": "settings/bb.workspace.approval", "@type": "type.googleapis.com/bytebase.v1.Setting", "value": {"workspaceApprovalSettingValue": {"rules": [{"template": {"flow": {"steps": [{"type": "ANY", "nodes": [{"role": "roles/projectOwner", "type": "ANY_IN_GROUP"}]}, {"type": "ANY", "nodes": [{"role": "roles/workspaceDBA", "type": "ANY_IN_GROUP"}]}]}, "title": "Project Owner -> Workspace DBA", "creator": "users/[email protected]", "description": "The system defines the approval process, first the project Owner approves, then the DBA approves."}, "condition": {"expression": "source == \"DML\" && level == 300 || source == \"DDL\" && level == 300"}}, {"template": {"flow": {"steps": [{"type": "ANY", "nodes": [{"role": "roles/projectOwner", "type": "ANY_IN_GROUP"}]}]}, "title": "Project Owner", "creator": "users/[email protected]", "description": "The system defines the approval process and only needs the project Owner to approve it."}, "condition": {"expression": "source == \"DML\" && level == 0 || source == \"DDL\" && level == 200"}}, {"template": {"flow": {"steps": [{"type": "ANY", "nodes": [{"role": "roles/workspaceDBA", "type": "ANY_IN_GROUP"}]}]}, "title": "Workspace DBA", "creator": "users/[email protected]", "description": "The system defines the approval process and only needs DBA approval."}, "condition": {}}, {"template": {"flow": {"steps": [{"type": "ANY", "nodes": [{"role": "roles/workspaceAdmin", "type": "ANY_IN_GROUP"}]}]}, "title": "Workspace Admin", "creator": "users/[email protected]", "description": "The system defines the approval process and only needs Administrator approval."}, "condition": {}}, {"template": {"flow": {"steps": [{"type": "ANY", "nodes": [{"role": "roles/projectOwner", "type": "ANY_IN_GROUP"}]}, {"type": "ANY", "nodes": [{"role": "roles/workspaceDBA", "type": "ANY_IN_GROUP"}]}, {"type": "ANY", "nodes": [{"role": "roles/workspaceAdmin", "type": "ANY_IN_GROUP"}]}]}, "title": "Project Owner -> Workspace DBA -> Workspace Admin", "creator": "users/[email protected]", "description": "The system defines the approval process, first the project Owner approves, then the DBA approves, and finally the Administrator approves."}, "condition": {}}]}}}, "requestMetadata": {"callerIp": "[::1]:60530", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (122, '2025-05-26 07:40:53.534087+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.SettingService/UpdateSetting", "parent": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "request": "{\"setting\":{\"name\":\"settings/bb.workspace.approval\", \"value\":{\"workspaceApprovalSettingValue\":{\"rules\":[{\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/projectOwner\"}]}, {\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceDBA\"}]}]}, \"title\":\"Project Owner -> Workspace DBA\", \"description\":\"The system defines the approval process, first the project Owner approves, then the DBA approves.\", \"creator\":\"users/[email protected]\"}, \"condition\":{\"expression\":\"source == \\\"DML\\\" && level == 300 || source == \\\"DDL\\\" && level == 300\"}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/projectOwner\"}]}]}, \"title\":\"Project Owner\", \"description\":\"The system defines the approval process and only needs the project Owner to approve it.\", \"creator\":\"users/[email protected]\"}, \"condition\":{\"expression\":\"source == \\\"DML\\\" && level == 0 || source == \\\"DDL\\\" && level == 200 || source == \\\"DDL\\\" &&\\nlevel == 0 || source == \\\"DML\\\" && level == 200\"}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceDBA\"}]}]}, \"title\":\"Workspace DBA\", \"description\":\"The system defines the approval process and only needs DBA approval.\", \"creator\":\"users/[email protected]\"}, \"condition\":{}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceAdmin\"}]}]}, \"title\":\"Workspace Admin\", \"description\":\"The system defines the approval process and only needs Administrator approval.\", \"creator\":\"users/[email protected]\"}, \"condition\":{}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/projectOwner\"}]}, {\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceDBA\"}]}, {\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceAdmin\"}]}]}, \"title\":\"Project Owner -> Workspace DBA -> Workspace Admin\", \"description\":\"The system defines the approval process, first the project Owner approves, then the DBA approves, and finally the Administrator approves.\", \"creator\":\"users/[email protected]\"}, \"condition\":{}}]}}}, \"allowMissing\":true}", "resource": "settings/bb.workspace.approval", "response": "{\"name\":\"settings/bb.workspace.approval\", \"value\":{\"workspaceApprovalSettingValue\":{\"rules\":[{\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/projectOwner\"}]}, {\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceDBA\"}]}]}, \"title\":\"Project Owner -> Workspace DBA\", \"description\":\"The system defines the approval process, first the project Owner approves, then the DBA approves.\", \"creator\":\"users/[email protected]\"}, \"condition\":{\"expression\":\"source == \\\"DML\\\" && level == 300 || source == \\\"DDL\\\" && level == 300\"}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/projectOwner\"}]}]}, \"title\":\"Project Owner\", \"description\":\"The system defines the approval process and only needs the project Owner to approve it.\", \"creator\":\"users/[email protected]\"}, \"condition\":{\"expression\":\"source == \\\"DML\\\" && level == 0 || source == \\\"DDL\\\" && level == 200 || source == \\\"DDL\\\" &&\\nlevel == 0 || source == \\\"DML\\\" && level == 200\"}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceDBA\"}]}]}, \"title\":\"Workspace DBA\", \"description\":\"The system defines the approval process and only needs DBA approval.\", \"creator\":\"users/[email protected]\"}, \"condition\":{}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceAdmin\"}]}]}, \"title\":\"Workspace Admin\", \"description\":\"The system defines the approval process and only needs Administrator approval.\", \"creator\":\"users/[email protected]\"}, \"condition\":{}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/projectOwner\"}]}, {\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceDBA\"}]}, {\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceAdmin\"}]}]}, \"title\":\"Project Owner -> Workspace DBA -> Workspace Admin\", \"description\":\"The system defines the approval process, first the project Owner approves, then the DBA approves, and finally the Administrator approves.\", \"creator\":\"users/[email protected]\"}, \"condition\":{}}]}}}", "severity": "INFO", "serviceData": {"name": "settings/bb.workspace.approval", "@type": "type.googleapis.com/bytebase.v1.Setting", "value": {"workspaceApprovalSettingValue": {"rules": [{"template": {"flow": {"steps": [{"type": "ANY", "nodes": [{"role": "roles/projectOwner", "type": "ANY_IN_GROUP"}]}, {"type": "ANY", "nodes": [{"role": "roles/workspaceDBA", "type": "ANY_IN_GROUP"}]}]}, "title": "Project Owner -> Workspace DBA", "creator": "users/[email protected]", "description": "The system defines the approval process, first the project Owner approves, then the DBA approves."}, "condition": {"expression": "source == \"DML\" && level == 300 || source == \"DDL\" && level == 300"}}, {"template": {"flow": {"steps": [{"type": "ANY", "nodes": [{"role": "roles/projectOwner", "type": "ANY_IN_GROUP"}]}]}, "title": "Project Owner", "creator": "users/[email protected]", "description": "The system defines the approval process and only needs the project Owner to approve it."}, "condition": {"expression": "source == \"DML\" && level == 0 || source == \"DDL\" && level == 200 || source == \"DDL\" &&\nlevel == 0"}}, {"template": {"flow": {"steps": [{"type": "ANY", "nodes": [{"role": "roles/workspaceDBA", "type": "ANY_IN_GROUP"}]}]}, "title": "Workspace DBA", "creator": "users/[email protected]", "description": "The system defines the approval process and only needs DBA approval."}, "condition": {}}, {"template": {"flow": {"steps": [{"type": "ANY", "nodes": [{"role": "roles/workspaceAdmin", "type": "ANY_IN_GROUP"}]}]}, "title": "Workspace Admin", "creator": "users/[email protected]", "description": "The system defines the approval process and only needs Administrator approval."}, "condition": {}}, {"template": {"flow": {"steps": [{"type": "ANY", "nodes": [{"role": "roles/projectOwner", "type": "ANY_IN_GROUP"}]}, {"type": "ANY", "nodes": [{"role": "roles/workspaceDBA", "type": "ANY_IN_GROUP"}]}, {"type": "ANY", "nodes": [{"role": "roles/workspaceAdmin", "type": "ANY_IN_GROUP"}]}]}, "title": "Project Owner -> Workspace DBA -> Workspace Admin", "creator": "users/[email protected]", "description": "The system defines the approval process, first the project Owner approves, then the DBA approves, and finally the Administrator approves."}, "condition": {}}]}}}, "requestMetadata": {"callerIp": "[::1]:60530", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (123, '2025-05-26 07:41:12.810007+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.WorkspaceService/SetIamPolicy", "parent": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "request": "{\"resource\":\"workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48\", \"policy\":{\"bindings\":[{\"role\":\"roles/workspaceMember\", \"members\":[\"allUsers\", \"user:[email protected]\"], \"condition\":{}}, {\"role\":\"roles/workspaceAdmin\", \"members\":[\"user:[email protected]\", \"user:[email protected]\"], \"condition\":{}}, {\"role\":\"roles/workspaceDBA\", \"members\":[\"user:[email protected]\", \"user:[email protected]\"], \"condition\":{}}], \"etag\":\"1748243793699\"}, \"etag\":\"1748243793699\"}", "resource": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "response": "{\"bindings\":[{\"role\":\"roles/workspaceMember\", \"members\":[\"allUsers\", \"user:[email protected]\"], \"condition\":{}}, {\"role\":\"roles/workspaceAdmin\", \"members\":[\"user:[email protected]\", \"user:[email protected]\"], \"condition\":{}}, {\"role\":\"roles/workspaceDBA\", \"members\":[\"user:[email protected]\", \"user:[email protected]\"], \"condition\":{}}], \"etag\":\"1748245272807\"}", "severity": "INFO", "requestMetadata": {"callerIp": "[::1]:60530", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (124, '2025-05-26 07:44:16.159285+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.SettingService/UpdateSetting", "parent": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "request": "{\"setting\":{\"name\":\"settings/bb.workspace.data-classification\", \"value\":{\"dataClassificationSettingValue\":{\"configs\":[{\"id\":\"e5680e79-e84b-486e-8cb2-76c984c3fac9\", \"title\":\"Classification Example\", \"levels\":[{\"id\":\"1\", \"title\":\"Level 1\"}, {\"id\":\"2\", \"title\":\"Level 2\"}, {\"id\":\"3\", \"title\":\"Level 3\"}, {\"id\":\"4\", \"title\":\"Level 4\"}], \"classification\":{\"1\":{\"id\":\"1\", \"title\":\"Basic\"}, \"1-1\":{\"id\":\"1-1\", \"title\":\"Basic\", \"levelId\":\"1\"}, \"1-2\":{\"id\":\"1-2\", \"title\":\"Contact\", \"levelId\":\"2\"}, \"1-3\":{\"id\":\"1-3\", \"title\":\"Health\", \"levelId\":\"4\"}, \"2\":{\"id\":\"2\", \"title\":\"Relationship\"}, \"2-1\":{\"id\":\"2-1\", \"title\":\"Social\", \"levelId\":\"1\"}, \"2-2\":{\"id\":\"2-2\", \"title\":\"Business\", \"levelId\":\"3\"}}}]}}}, \"allowMissing\":true}", "resource": "settings/bb.workspace.data-classification", "response": "{\"name\":\"settings/bb.workspace.data-classification\", \"value\":{\"dataClassificationSettingValue\":{\"configs\":[{\"id\":\"e5680e79-e84b-486e-8cb2-76c984c3fac9\", \"title\":\"Classification Example\", \"levels\":[{\"id\":\"1\", \"title\":\"Level 1\"}, {\"id\":\"2\", \"title\":\"Level 2\"}, {\"id\":\"3\", \"title\":\"Level 3\"}, {\"id\":\"4\", \"title\":\"Level 4\"}], \"classification\":{\"1\":{\"id\":\"1\", \"title\":\"Basic\"}, \"1-1\":{\"id\":\"1-1\", \"title\":\"Basic\", \"levelId\":\"1\"}, \"1-2\":{\"id\":\"1-2\", \"title\":\"Contact\", \"levelId\":\"2\"}, \"1-3\":{\"id\":\"1-3\", \"title\":\"Health\", \"levelId\":\"4\"}, \"2\":{\"id\":\"2\", \"title\":\"Relationship\"}, \"2-1\":{\"id\":\"2-1\", \"title\":\"Social\", \"levelId\":\"1\"}, \"2-2\":{\"id\":\"2-2\", \"title\":\"Business\", \"levelId\":\"3\"}}}]}}}", "severity": "INFO", "serviceData": {"name": "settings/bb.workspace.data-classification", "@type": "type.googleapis.com/bytebase.v1.Setting", "value": {"dataClassificationSettingValue": {}}}, "requestMetadata": {"callerIp": "[::1]:60530", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (125, '2025-05-26 07:47:11.561832+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.SettingService/UpdateSetting", "parent": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "request": "{\"setting\":{\"name\":\"settings/bb.workspace.semantic-types\", \"value\":{\"semanticTypeSettingValue\":{\"types\":[{\"id\":\"bb.default\", \"title\":\"Default\", \"description\":\"Default type with full masking\"}]}}}, \"allowMissing\":true}", "resource": "settings/bb.workspace.semantic-types", "response": "{\"name\":\"settings/bb.workspace.semantic-types\", \"value\":{\"semanticTypeSettingValue\":{\"types\":[{\"id\":\"bb.default\", \"title\":\"Default\", \"description\":\"Default type with full masking\"}]}}}", "severity": "INFO", "requestMetadata": {"callerIp": "[::1]:61234", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (126, '2025-05-26 07:47:13.546539+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.SettingService/UpdateSetting", "parent": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "request": "{\"setting\":{\"name\":\"settings/bb.workspace.semantic-types\", \"value\":{\"semanticTypeSettingValue\":{\"types\":[{\"id\":\"bb.default\", \"title\":\"Default\", \"description\":\"Default type with full masking\"}, {\"id\":\"bb.default-partial\", \"title\":\"Default Partial\", \"description\":\"Default partial type with partial masking\"}]}}}, \"allowMissing\":true}", "resource": "settings/bb.workspace.semantic-types", "response": "{\"name\":\"settings/bb.workspace.semantic-types\", \"value\":{\"semanticTypeSettingValue\":{\"types\":[{\"id\":\"bb.default\", \"title\":\"Default\", \"description\":\"Default type with full masking\"}, {\"id\":\"bb.default-partial\", \"title\":\"Default Partial\", \"description\":\"Default partial type with partial masking\"}]}}}", "severity": "INFO", "serviceData": {"name": "settings/bb.workspace.semantic-types", "@type": "type.googleapis.com/bytebase.v1.Setting", "value": {"semanticTypeSettingValue": {"types": [{"id": "bb.default", "title": "Default", "description": "Default type with full masking"}]}}}, "requestMetadata": {"callerIp": "[::1]:61234", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (128, '2025-05-26 07:48:23.462873+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.OrgPolicyService/UpdatePolicy", "parent": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "request": "{\"policy\":{\"name\":\"policies/masking_rule\", \"type\":\"MASKING_RULE\", \"maskingRulePolicy\":{\"rules\":[{\"id\":\"1f3018bb-f4ea-4daa-b4b3-6e32bce0d22e\", \"condition\":{\"expression\":\"classification_level in [\\\"2\\\", \\\"3\\\"]\"}, \"semanticType\":\"bb.default-partial\"}, {\"id\":\"e0743172-c9c7-43f8-9923-9a3c06012cee\", \"condition\":{\"expression\":\"classification_level in [\\\"4\\\"]\"}, \"semanticType\":\"bb.default\"}]}, \"resourceType\":\"WORKSPACE\"}, \"updateMask\":\"payload\", \"allowMissing\":true}", "response": "{\"name\":\"policies/masking_rule\", \"type\":\"MASKING_RULE\", \"maskingRulePolicy\":{\"rules\":[{\"id\":\"1f3018bb-f4ea-4daa-b4b3-6e32bce0d22e\", \"condition\":{\"expression\":\"classification_level in [\\\"2\\\", \\\"3\\\"]\"}, \"semanticType\":\"bb.default-partial\"}, {\"id\":\"e0743172-c9c7-43f8-9923-9a3c06012cee\", \"condition\":{\"expression\":\"classification_level in [\\\"4\\\"]\"}, \"semanticType\":\"bb.default\"}]}, \"enforce\":true, \"resourceType\":\"WORKSPACE\"}", "severity": "INFO", "requestMetadata": {"callerIp": "[::1]:61234", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (129, '2025-05-26 07:49:51.250743+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.SettingService/UpdateSetting", "parent": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "request": "{\"setting\":{\"name\":\"settings/bb.workspace.watermark\", \"value\":{\"stringValue\":\"1\"}}, \"allowMissing\":true}", "resource": "settings/bb.workspace.watermark", "response": "{\"name\":\"settings/bb.workspace.watermark\", \"value\":{\"stringValue\":\"1\"}}", "severity": "INFO", "serviceData": {"name": "settings/bb.workspace.watermark", "@type": "type.googleapis.com/bytebase.v1.Setting", "value": {"stringValue": "0"}}, "requestMetadata": {"callerIp": "[::1]:61457", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (130, '2025-05-26 07:50:36.063194+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.SettingService/UpdateSetting", "parent": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "request": "{\"setting\":{\"name\":\"settings/bb.workspace.profile\", \"value\":{\"workspaceProfileSettingValue\":{\"externalUrl\":\"https://demo.bytebase.com\", \"domains\":[\"example.com\"], \"databaseChangeMode\":\"PIPELINE\"}}}, \"allowMissing\":true, \"updateMask\":\"value.workspaceProfileSettingValue.domains\"}", "resource": "settings/bb.workspace.profile", "response": "{\"name\":\"settings/bb.workspace.profile\", \"value\":{\"workspaceProfileSettingValue\":{\"externalUrl\":\"https://demo.bytebase.com\", \"domains\":[\"example.com\"], \"databaseChangeMode\":\"PIPELINE\"}}}", "severity": "INFO", "serviceData": {"name": "settings/bb.workspace.profile", "@type": "type.googleapis.com/bytebase.v1.Setting", "value": {"workspaceProfileSettingValue": {"externalUrl": "https://demo.bytebase.com", "databaseChangeMode": "PIPELINE"}}}, "requestMetadata": {"callerIp": "[::1]:61457", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (131, '2025-05-26 07:54:33.73121+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.ProjectService/SetIamPolicy", "parent": "projects/metadb", "request": "{\"resource\":\"projects/metadb\", \"policy\":{\"bindings\":[{\"role\":\"roles/projectOwner\", \"members\":[\"user:[email protected]\"], \"condition\":{}}, {\"role\":\"roles/sqlEditorUser\", \"members\":[\"user:[email protected]\", \"user:[email protected]\"], \"condition\":{\"title\":\"SQL Editor User All databases\"}}], \"etag\":\"1748246046446\"}, \"etag\":\"1748246046446\"}", "resource": "projects/metadb", "response": "{\"bindings\":[{\"role\":\"roles/projectOwner\", \"members\":[\"user:[email protected]\"], \"condition\":{}}, {\"role\":\"roles/sqlEditorUser\", \"members\":[\"user:[email protected]\", \"user:[email protected]\"], \"condition\":{\"title\":\"SQL Editor User All databases\"}}], \"etag\":\"1748246073728\"}", "severity": "INFO", "serviceData": {"@type": "type.googleapis.com/bytebase.v1.AuditData", "policyDelta": {"bindingDeltas": [{"role": "roles/sqlEditorUser", "action": "ADD", "member": "users/102", "condition": {"title": "SQL Editor User All databases"}}, {"role": "roles/sqlEditorUser", "action": "ADD", "member": "users/103", "condition": {"title": "SQL Editor User All databases"}}]}}, "requestMetadata": {"callerIp": "[::1]:61234", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (133, '2025-05-26 07:56:20.00543+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.InstanceService/CreateInstance", "parent": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "request": "{\"instance\":{\"name\":\"instances/bytebase-meta\", \"state\":\"ACTIVE\", \"title\":\"bytebase-meta\", \"engine\":\"POSTGRES\", \"dataSources\":[{\"id\":\"35a64b4a-543f-4eac-ad32-b191a958c66d\", \"type\":\"ADMIN\", \"username\":\"bb\", \"host\":\"/tmp\", \"port\":\"8082\", \"authenticationType\":\"PASSWORD\"}], \"environment\":\"environments/prod\", \"activation\":true}, \"instanceId\":\"bytebase-meta\", \"validateOnly\":true}", "resource": "instances/bytebase-meta", "response": "{\"name\":\"instances/bytebase-meta\", \"state\":\"ACTIVE\", \"title\":\"bytebase-meta\", \"engine\":\"POSTGRES\", \"dataSources\":[{\"id\":\"35a64b4a-543f-4eac-ad32-b191a958c66d\", \"type\":\"ADMIN\", \"username\":\"bb\", \"host\":\"/tmp\", \"port\":\"8082\", \"authenticationType\":\"PASSWORD\", \"redisType\":\"STANDALONE\"}], \"environment\":\"environments/prod\", \"activation\":true}", "severity": "INFO", "requestMetadata": {"callerIp": "[::1]:61847", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (134, '2025-05-26 07:56:43.29775+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.InstanceService/CreateInstance", "parent": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "request": "{\"instance\":{\"name\":\"instances/bytebase-meta\", \"state\":\"ACTIVE\", \"title\":\"bytebase-meta\", \"engine\":\"POSTGRES\", \"dataSources\":[{\"id\":\"35a64b4a-543f-4eac-ad32-b191a958c66d\", \"type\":\"ADMIN\", \"username\":\"bb\", \"host\":\"/tmp\", \"port\":\"8082\", \"authenticationType\":\"PASSWORD\"}], \"environment\":\"environments/prod\", \"activation\":true}, \"instanceId\":\"bytebase-meta\", \"validateOnly\":true}", "resource": "instances/bytebase-meta", "response": "{\"name\":\"instances/bytebase-meta\", \"state\":\"ACTIVE\", \"title\":\"bytebase-meta\", \"engine\":\"POSTGRES\", \"dataSources\":[{\"id\":\"35a64b4a-543f-4eac-ad32-b191a958c66d\", \"type\":\"ADMIN\", \"username\":\"bb\", \"host\":\"/tmp\", \"port\":\"8082\", \"authenticationType\":\"PASSWORD\", \"redisType\":\"STANDALONE\"}], \"environment\":\"environments/prod\", \"activation\":true}", "severity": "INFO", "requestMetadata": {"callerIp": "[::1]:61847", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (135, '2025-05-26 07:56:43.321404+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.InstanceService/CreateInstance", "parent": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "request": "{\"instance\":{\"name\":\"instances/bytebase-meta\", \"state\":\"ACTIVE\", \"title\":\"bytebase-meta\", \"engine\":\"POSTGRES\", \"dataSources\":[{\"id\":\"35a64b4a-543f-4eac-ad32-b191a958c66d\", \"type\":\"ADMIN\", \"username\":\"bb\", \"host\":\"/tmp\", \"port\":\"8082\", \"authenticationType\":\"PASSWORD\"}], \"environment\":\"environments/prod\", \"activation\":true}, \"instanceId\":\"bytebase-meta\"}", "resource": "instances/bytebase-meta", "response": "{\"name\":\"instances/bytebase-meta\", \"state\":\"ACTIVE\", \"title\":\"bytebase-meta\", \"engine\":\"POSTGRES\", \"engineVersion\":\"16.0.0\", \"dataSources\":[{\"id\":\"35a64b4a-543f-4eac-ad32-b191a958c66d\", \"type\":\"ADMIN\", \"username\":\"bb\", \"host\":\"/tmp\", \"port\":\"8082\", \"authenticationType\":\"PASSWORD\", \"redisType\":\"STANDALONE\"}], \"environment\":\"environments/prod\", \"activation\":true, \"roles\":[{\"name\":\"instances/bytebase-meta/roles/bb\", \"roleName\":\"bb\", \"attribute\":\"Superuser Create role Create DB Replication Bypass RLS+\"}]}", "severity": "INFO", "requestMetadata": {"callerIp": "[::1]:61847", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (136, '2025-05-26 07:56:59.903341+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.DatabaseService/BatchUpdateDatabases", "parent": "projects/default", "request": "{\"parent\":\"-\", \"requests\":[{\"database\":{\"name\":\"instances/bytebase-meta/databases/bb\", \"project\":\"projects/metadb\"}, \"updateMask\":\"project\"}]}", "resource": "-", "response": "{\"databases\":[{\"name\":\"instances/bytebase-meta/databases/bb\", \"state\":\"ACTIVE\", \"successfulSyncTime\":\"2025-05-26T07:56:53.177942Z\", \"project\":\"projects/metadb\", \"effectiveEnvironment\":\"environments/prod\", \"instanceResource\":{\"title\":\"bytebase-meta\", \"engine\":\"POSTGRES\", \"engineVersion\":\"16.0.0\", \"dataSources\":[{\"id\":\"35a64b4a-543f-4eac-ad32-b191a958c66d\", \"type\":\"ADMIN\", \"username\":\"bb\", \"host\":\"/tmp\", \"port\":\"8082\", \"authenticationType\":\"PASSWORD\", \"redisType\":\"STANDALONE\"}], \"activation\":true, \"name\":\"instances/bytebase-meta\", \"environment\":\"environments/prod\"}}]}", "severity": "INFO", "requestMetadata": {"callerIp": "[::1]:61847", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (137, '2025-05-26 07:56:59.903652+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.DatabaseService/BatchUpdateDatabases", "parent": "projects/metadb", "request": "{\"parent\":\"-\", \"requests\":[{\"database\":{\"name\":\"instances/bytebase-meta/databases/bb\", \"project\":\"projects/metadb\"}, \"updateMask\":\"project\"}]}", "resource": "-", "response": "{\"databases\":[{\"name\":\"instances/bytebase-meta/databases/bb\", \"state\":\"ACTIVE\", \"successfulSyncTime\":\"2025-05-26T07:56:53.177942Z\", \"project\":\"projects/metadb\", \"effectiveEnvironment\":\"environments/prod\", \"instanceResource\":{\"title\":\"bytebase-meta\", \"engine\":\"POSTGRES\", \"engineVersion\":\"16.0.0\", \"dataSources\":[{\"id\":\"35a64b4a-543f-4eac-ad32-b191a958c66d\", \"type\":\"ADMIN\", \"username\":\"bb\", \"host\":\"/tmp\", \"port\":\"8082\", \"authenticationType\":\"PASSWORD\", \"redisType\":\"STANDALONE\"}], \"activation\":true, \"name\":\"instances/bytebase-meta\", \"environment\":\"environments/prod\"}}]}", "severity": "INFO", "requestMetadata": {"callerIp": "[::1]:61847", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (138, '2025-05-26 07:57:47.352245+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.SQLService/Query", "parent": "projects/metadb", "request": "{\"name\":\"instances/bytebase-meta/databases/bb\", \"statement\":\"-- Fully completed issues by project\\nSELECT\\n project.resource_id,\\n count(*)\\nFROM\\n issue\\n LEFT JOIN project ON issue.project_id = project.id\\nWHERE\\n NOT EXISTS (\\n SELECT\\n 1\\n FROM\\n task,\\n task_run\\n WHERE\\n task.pipeline_id = issue.pipeline_id\\n AND task.id = task_run.task_id\\n AND task_run.status != ''DONE''\\n )\\n AND issue.status = ''DONE''\\nGROUP BY\\n project.resource_id;\", \"limit\":1000, \"dataSourceId\":\"35a64b4a-543f-4eac-ad32-b191a958c66d\", \"queryOption\":{\"redisRunCommandsOn\":\"SINGLE_NODE\"}}", "resource": "instances/bytebase-meta/databases/bb", "response": "{\"results\":[{\"error\":\"ERROR: column issue.project_id does not exist (SQLSTATE 42703)\", \"latency\":\"0.000508209s\", \"statement\":\"-- Fully completed issues by project\\nSELECT\\n project.resource_id,\\n count(*)\\nFROM\\n issue\\n LEFT JOIN project ON issue.project_id = project.id\\nWHERE\\n NOT EXISTS (\\n SELECT\\n 1\\n FROM\\n task,\\n task_run\\n WHERE\\n task.pipeline_id = issue.pipeline_id\\n AND task.id = task_run.task_id\\n AND task_run.status != ''DONE''\\n )\\n AND issue.status = ''DONE''\\nGROUP BY\\n project.resource_id;\", \"postgresError\":{\"severity\":\"ERROR\", \"code\":\"42703\", \"message\":\"column issue.project_id does not exist\", \"hint\":\"Perhaps you meant to reference the column \\\"issue.project\\\".\", \"position\":115, \"file\":\"parse_relation.c\", \"line\":3729, \"routine\":\"errorMissingColumn\"}, \"allowExport\":true}]}", "severity": "INFO", "requestMetadata": {"callerIp": "[::1]:61457", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (139, '2025-05-26 07:58:13.180421+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.SQLService/Query", "parent": "projects/metadb", "request": "{\"name\":\"instances/bytebase-meta/databases/bb\", \"statement\":\"-- Issues created by user\\nSELECT\\n issue.creator_id,\\n principal.email,\\n COUNT(issue.creator_id) AS amount\\nFROM\\n issue\\n INNER JOIN principal ON issue.creator_id = principal.id\\nGROUP BY\\n issue.creator_id,\\n principal.email\\nORDER BY\\n COUNT(issue.creator_id) DESC;\", \"limit\":1000, \"dataSourceId\":\"35a64b4a-543f-4eac-ad32-b191a958c66d\", \"queryOption\":{\"redisRunCommandsOn\":\"SINGLE_NODE\"}}", "resource": "instances/bytebase-meta/databases/bb", "response": "{\"results\":[{\"columnNames\":[\"creator_id\", \"email\", \"amount\"], \"columnTypeNames\":[\"INT4\", \"TEXT\", \"INT8\"], \"masked\":[false, false, false], \"sensitive\":[false, false, false], \"latency\":\"0.001358958s\", \"statement\":\"-- Issues created by user\\nSELECT\\n issue.creator_id,\\n principal.email,\\n COUNT(issue.creator_id) AS amount\\nFROM\\n issue\\n INNER JOIN principal ON issue.creator_id = principal.id\\nGROUP BY\\n issue.creator_id,\\n principal.email\\nORDER BY\\n COUNT(issue.creator_id) DESC;\", \"allowExport\":true}]}", "severity": "INFO", "requestMetadata": {"callerIp": "[::1]:61457", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (184, '2025-06-09 02:21:04.278663+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.DatabaseService/UpdateDatabase", "parent": "projects/hr", "request": "{\"database\":{\"name\":\"instances/prod-sample-instance/databases/hr_prod\",\"state\":\"ACTIVE\",\"successfulSyncTime\":\"2025-06-05T07:08:02.301195Z\",\"project\":\"projects/hr\",\"environment\":\"environments/prod\",\"effectiveEnvironment\":\"environments/prod\",\"instanceResource\":{\"title\":\"Prod Sample Instance\",\"engine\":\"POSTGRES\",\"engineVersion\":\"16.0.0\",\"dataSources\":[{\"id\":\"9af4f227-a55e-4e82-b7f5-c7193b5f405c\",\"type\":\"ADMIN\",\"username\":\"bbsample\",\"host\":\"/tmp\",\"port\":\"8084\",\"authenticationType\":\"PASSWORD\",\"redisType\":\"STANDALONE\"},{\"id\":\"e700ae12-173e-4f0d-8590-0414cf6a9405\",\"type\":\"READ_ONLY\",\"username\":\"bbsample\",\"host\":\"/tmp\",\"port\":\"8084\",\"authenticationType\":\"PASSWORD\",\"redisType\":\"STANDALONE\"}],\"activation\":true,\"name\":\"instances/prod-sample-instance\",\"environment\":\"environments/prod\"},\"backupAvailable\":true},\"updateMask\":\"drifted\"}", "resource": "instances/prod-sample-instance/databases/hr_prod", "response": "{\"name\":\"instances/prod-sample-instance/databases/hr_prod\",\"state\":\"ACTIVE\",\"successfulSyncTime\":\"2025-06-05T07:08:02.301195Z\",\"project\":\"projects/hr\",\"effectiveEnvironment\":\"environments/prod\",\"instanceResource\":{\"title\":\"Prod Sample Instance\",\"engine\":\"POSTGRES\",\"engineVersion\":\"16.0.0\",\"dataSources\":[{\"id\":\"9af4f227-a55e-4e82-b7f5-c7193b5f405c\",\"type\":\"ADMIN\",\"username\":\"bbsample\",\"host\":\"/tmp\",\"port\":\"8084\",\"authenticationType\":\"PASSWORD\",\"redisType\":\"STANDALONE\"},{\"id\":\"e700ae12-173e-4f0d-8590-0414cf6a9405\",\"type\":\"READ_ONLY\",\"username\":\"bbsample\",\"host\":\"/tmp\",\"port\":\"8084\",\"authenticationType\":\"PASSWORD\",\"redisType\":\"STANDALONE\"}],\"activation\":true,\"name\":\"instances/prod-sample-instance\",\"environment\":\"environments/prod\"},\"backupAvailable\":true}", "severity": "INFO", "requestMetadata": {"callerIp": "[::1]:56354", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (140, '2025-05-26 08:03:36.061032+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.InstanceService/CreateInstance", "parent": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "request": "{\"instance\":{\"name\":\"instances/test-sample-instance\", \"state\":\"ACTIVE\", \"title\":\"Test Sample Instance\", \"engine\":\"POSTGRES\", \"dataSources\":[{\"id\":\"a7f206f9-37c4-41ca-8b59-fcf4c6148105\", \"type\":\"ADMIN\", \"username\":\"bbsample\", \"host\":\"/tmp\", \"port\":\"8083\", \"authenticationType\":\"PASSWORD\"}], \"environment\":\"environments/test\", \"activation\":true}, \"instanceId\":\"test-sample-instance\", \"validateOnly\":true}", "resource": "instances/test-sample-instance", "response": "{\"name\":\"instances/test-sample-instance\", \"state\":\"ACTIVE\", \"title\":\"Test Sample Instance\", \"engine\":\"POSTGRES\", \"dataSources\":[{\"id\":\"a7f206f9-37c4-41ca-8b59-fcf4c6148105\", \"type\":\"ADMIN\", \"username\":\"bbsample\", \"host\":\"/tmp\", \"port\":\"8083\", \"authenticationType\":\"PASSWORD\", \"redisType\":\"STANDALONE\"}], \"environment\":\"environments/test\", \"activation\":true}", "severity": "INFO", "requestMetadata": {"callerIp": "[::1]:61457", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (141, '2025-05-26 08:03:43.346664+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.InstanceService/CreateInstance", "parent": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "request": "{\"instance\":{\"name\":\"instances/test-sample-instance\", \"state\":\"ACTIVE\", \"title\":\"Test Sample Instance\", \"engine\":\"POSTGRES\", \"dataSources\":[{\"id\":\"a7f206f9-37c4-41ca-8b59-fcf4c6148105\", \"type\":\"ADMIN\", \"username\":\"bbsample\", \"host\":\"/tmp\", \"port\":\"8083\", \"authenticationType\":\"PASSWORD\"}], \"environment\":\"environments/test\", \"activation\":true}, \"instanceId\":\"test-sample-instance\", \"validateOnly\":true}", "resource": "instances/test-sample-instance", "response": "{\"name\":\"instances/test-sample-instance\", \"state\":\"ACTIVE\", \"title\":\"Test Sample Instance\", \"engine\":\"POSTGRES\", \"dataSources\":[{\"id\":\"a7f206f9-37c4-41ca-8b59-fcf4c6148105\", \"type\":\"ADMIN\", \"username\":\"bbsample\", \"host\":\"/tmp\", \"port\":\"8083\", \"authenticationType\":\"PASSWORD\", \"redisType\":\"STANDALONE\"}], \"environment\":\"environments/test\", \"activation\":true}", "severity": "INFO", "requestMetadata": {"callerIp": "[::1]:61457", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (142, '2025-05-26 08:03:43.376894+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.InstanceService/CreateInstance", "parent": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "request": "{\"instance\":{\"name\":\"instances/test-sample-instance\", \"state\":\"ACTIVE\", \"title\":\"Test Sample Instance\", \"engine\":\"POSTGRES\", \"dataSources\":[{\"id\":\"a7f206f9-37c4-41ca-8b59-fcf4c6148105\", \"type\":\"ADMIN\", \"username\":\"bbsample\", \"host\":\"/tmp\", \"port\":\"8083\", \"authenticationType\":\"PASSWORD\"}], \"environment\":\"environments/test\", \"activation\":true}, \"instanceId\":\"test-sample-instance\"}", "resource": "instances/test-sample-instance", "response": "{\"name\":\"instances/test-sample-instance\", \"state\":\"ACTIVE\", \"title\":\"Test Sample Instance\", \"engine\":\"POSTGRES\", \"engineVersion\":\"16.0.0\", \"dataSources\":[{\"id\":\"a7f206f9-37c4-41ca-8b59-fcf4c6148105\", \"type\":\"ADMIN\", \"username\":\"bbsample\", \"host\":\"/tmp\", \"port\":\"8083\", \"authenticationType\":\"PASSWORD\", \"redisType\":\"STANDALONE\"}], \"environment\":\"environments/test\", \"activation\":true, \"roles\":[{\"name\":\"instances/test-sample-instance/roles/bbsample\", \"roleName\":\"bbsample\", \"attribute\":\"Superuser Create role Create DB Replication Bypass RLS+\"}]}", "severity": "INFO", "requestMetadata": {"callerIp": "[::1]:61457", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (143, '2025-05-26 08:04:29.881979+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.InstanceService/CreateInstance", "parent": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "request": "{\"instance\":{\"name\":\"instances/prod-sample-instance\", \"state\":\"ACTIVE\", \"title\":\"Prod Sample Instance\", \"engine\":\"POSTGRES\", \"dataSources\":[{\"id\":\"9af4f227-a55e-4e82-b7f5-c7193b5f405c\", \"type\":\"ADMIN\", \"username\":\"bbsample\", \"host\":\"/tmp\", \"port\":\"8084\", \"authenticationType\":\"PASSWORD\"}], \"environment\":\"environments/prod\", \"activation\":true}, \"instanceId\":\"prod-sample-instance\", \"validateOnly\":true}", "resource": "instances/prod-sample-instance", "response": "{\"name\":\"instances/prod-sample-instance\", \"state\":\"ACTIVE\", \"title\":\"Prod Sample Instance\", \"engine\":\"POSTGRES\", \"dataSources\":[{\"id\":\"9af4f227-a55e-4e82-b7f5-c7193b5f405c\", \"type\":\"ADMIN\", \"username\":\"bbsample\", \"host\":\"/tmp\", \"port\":\"8084\", \"authenticationType\":\"PASSWORD\", \"redisType\":\"STANDALONE\"}], \"environment\":\"environments/prod\", \"activation\":true}", "severity": "INFO", "requestMetadata": {"callerIp": "[::1]:61457", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (144, '2025-05-26 08:04:29.903741+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.InstanceService/CreateInstance", "parent": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "request": "{\"instance\":{\"name\":\"instances/prod-sample-instance\", \"state\":\"ACTIVE\", \"title\":\"Prod Sample Instance\", \"engine\":\"POSTGRES\", \"dataSources\":[{\"id\":\"9af4f227-a55e-4e82-b7f5-c7193b5f405c\", \"type\":\"ADMIN\", \"username\":\"bbsample\", \"host\":\"/tmp\", \"port\":\"8084\", \"authenticationType\":\"PASSWORD\"}], \"environment\":\"environments/prod\", \"activation\":true}, \"instanceId\":\"prod-sample-instance\"}", "resource": "instances/prod-sample-instance", "response": "{\"name\":\"instances/prod-sample-instance\", \"state\":\"ACTIVE\", \"title\":\"Prod Sample Instance\", \"engine\":\"POSTGRES\", \"engineVersion\":\"16.0.0\", \"dataSources\":[{\"id\":\"9af4f227-a55e-4e82-b7f5-c7193b5f405c\", \"type\":\"ADMIN\", \"username\":\"bbsample\", \"host\":\"/tmp\", \"port\":\"8084\", \"authenticationType\":\"PASSWORD\", \"redisType\":\"STANDALONE\"}], \"environment\":\"environments/prod\", \"activation\":true, \"roles\":[{\"name\":\"instances/prod-sample-instance/roles/bbsample\", \"roleName\":\"bbsample\", \"attribute\":\"Superuser Create role Create DB Replication Bypass RLS+\"}]}", "severity": "INFO", "requestMetadata": {"callerIp": "[::1]:61457", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (145, '2025-05-26 08:04:47.263883+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.InstanceService/AddDataSource", "parent": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "status": {"code": 3, "message": "invalid datasource READ_ONLY, error failed to connect to `user=bytebase_readonly database=postgres`: /tmp/.s.PGSQL.8084 (/tmp): server error: FATAL: role \"bytebase_readonly\" does not exist (SQLSTATE 28000)"}, "request": "{\"name\":\"instances/prod-sample-instance\", \"dataSource\":{\"id\":\"e700ae12-173e-4f0d-8590-0414cf6a9405\", \"type\":\"READ_ONLY\", \"username\":\"bytebase_readonly\", \"host\":\"/tmp\", \"port\":\"8084\", \"authenticationType\":\"PASSWORD\"}, \"validateOnly\":true}", "resource": "instances/prod-sample-instance", "severity": "INFO", "requestMetadata": {"callerIp": "[::1]:61457", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (146, '2025-05-26 08:04:55.369194+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.InstanceService/AddDataSource", "parent": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "request": "{\"name\":\"instances/prod-sample-instance\", \"dataSource\":{\"id\":\"e700ae12-173e-4f0d-8590-0414cf6a9405\", \"type\":\"READ_ONLY\", \"username\":\"bbsample\", \"host\":\"/tmp\", \"port\":\"8084\", \"authenticationType\":\"PASSWORD\"}, \"validateOnly\":true}", "resource": "instances/prod-sample-instance", "response": "{\"name\":\"instances/prod-sample-instance\", \"state\":\"ACTIVE\", \"title\":\"Prod Sample Instance\", \"engine\":\"POSTGRES\", \"engineVersion\":\"16.0.0\", \"dataSources\":[{\"id\":\"9af4f227-a55e-4e82-b7f5-c7193b5f405c\", \"type\":\"ADMIN\", \"username\":\"bbsample\", \"host\":\"/tmp\", \"port\":\"8084\", \"authenticationType\":\"PASSWORD\", \"redisType\":\"STANDALONE\"}], \"environment\":\"environments/prod\", \"activation\":true, \"roles\":[{\"name\":\"instances/prod-sample-instance/roles/bbsample\", \"roleName\":\"bbsample\", \"attribute\":\"Superuser Create role Create DB Replication Bypass RLS+\"}]}", "severity": "INFO", "requestMetadata": {"callerIp": "[::1]:61457", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (147, '2025-05-26 08:05:03.50721+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.InstanceService/AddDataSource", "parent": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "request": "{\"name\":\"instances/prod-sample-instance\", \"dataSource\":{\"id\":\"e700ae12-173e-4f0d-8590-0414cf6a9405\", \"type\":\"READ_ONLY\", \"username\":\"bbsample\", \"host\":\"/tmp\", \"port\":\"8084\", \"authenticationType\":\"PASSWORD\"}, \"validateOnly\":true}", "resource": "instances/prod-sample-instance", "response": "{\"name\":\"instances/prod-sample-instance\", \"state\":\"ACTIVE\", \"title\":\"Prod Sample Instance\", \"engine\":\"POSTGRES\", \"engineVersion\":\"16.0.0\", \"dataSources\":[{\"id\":\"9af4f227-a55e-4e82-b7f5-c7193b5f405c\", \"type\":\"ADMIN\", \"username\":\"bbsample\", \"host\":\"/tmp\", \"port\":\"8084\", \"authenticationType\":\"PASSWORD\", \"redisType\":\"STANDALONE\"}], \"environment\":\"environments/prod\", \"activation\":true, \"roles\":[{\"name\":\"instances/prod-sample-instance/roles/bbsample\", \"roleName\":\"bbsample\", \"attribute\":\"Superuser Create role Create DB Replication Bypass RLS+\"}]}", "severity": "INFO", "requestMetadata": {"callerIp": "[::1]:61457", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (148, '2025-05-26 08:05:03.519785+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.InstanceService/AddDataSource", "parent": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "request": "{\"name\":\"instances/prod-sample-instance\", \"dataSource\":{\"id\":\"e700ae12-173e-4f0d-8590-0414cf6a9405\", \"type\":\"READ_ONLY\", \"username\":\"bbsample\", \"host\":\"/tmp\", \"port\":\"8084\", \"authenticationType\":\"PASSWORD\"}}", "resource": "instances/prod-sample-instance", "response": "{\"name\":\"instances/prod-sample-instance\", \"state\":\"ACTIVE\", \"title\":\"Prod Sample Instance\", \"engine\":\"POSTGRES\", \"engineVersion\":\"16.0.0\", \"dataSources\":[{\"id\":\"9af4f227-a55e-4e82-b7f5-c7193b5f405c\", \"type\":\"ADMIN\", \"username\":\"bbsample\", \"host\":\"/tmp\", \"port\":\"8084\", \"authenticationType\":\"PASSWORD\", \"redisType\":\"STANDALONE\"}, {\"id\":\"e700ae12-173e-4f0d-8590-0414cf6a9405\", \"type\":\"READ_ONLY\", \"username\":\"bbsample\", \"host\":\"/tmp\", \"port\":\"8084\", \"authenticationType\":\"PASSWORD\", \"redisType\":\"STANDALONE\"}], \"environment\":\"environments/prod\", \"activation\":true, \"roles\":[{\"name\":\"instances/prod-sample-instance/roles/bbsample\", \"roleName\":\"bbsample\", \"attribute\":\"Superuser Create role Create DB Replication Bypass RLS+\"}]}", "severity": "INFO", "requestMetadata": {"callerIp": "[::1]:61457", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (149, '2025-05-26 08:05:18.005999+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.DatabaseService/BatchUpdateDatabases", "parent": "projects/hr", "request": "{\"parent\":\"-\", \"requests\":[{\"database\":{\"name\":\"instances/prod-sample-instance/databases/hr_prod\", \"project\":\"projects/hr\"}, \"updateMask\":\"project\"}]}", "resource": "-", "response": "{\"databases\":[{\"name\":\"instances/prod-sample-instance/databases/hr_prod\", \"state\":\"ACTIVE\", \"successfulSyncTime\":\"2025-05-26T08:04:33.186522Z\", \"project\":\"projects/hr\", \"effectiveEnvironment\":\"environments/prod\", \"instanceResource\":{\"title\":\"Prod Sample Instance\", \"engine\":\"POSTGRES\", \"engineVersion\":\"16.0.0\", \"dataSources\":[{\"id\":\"9af4f227-a55e-4e82-b7f5-c7193b5f405c\", \"type\":\"ADMIN\", \"username\":\"bbsample\", \"host\":\"/tmp\", \"port\":\"8084\", \"authenticationType\":\"PASSWORD\", \"redisType\":\"STANDALONE\"}, {\"id\":\"e700ae12-173e-4f0d-8590-0414cf6a9405\", \"type\":\"READ_ONLY\", \"username\":\"bbsample\", \"host\":\"/tmp\", \"port\":\"8084\", \"authenticationType\":\"PASSWORD\", \"redisType\":\"STANDALONE\"}], \"activation\":true, \"name\":\"instances/prod-sample-instance\", \"environment\":\"environments/prod\"}, \"backupAvailable\":true}]}", "severity": "INFO", "requestMetadata": {"callerIp": "[::1]:61457", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (150, '2025-05-26 08:05:18.00631+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.DatabaseService/BatchUpdateDatabases", "parent": "projects/default", "request": "{\"parent\":\"-\", \"requests\":[{\"database\":{\"name\":\"instances/prod-sample-instance/databases/hr_prod\", \"project\":\"projects/hr\"}, \"updateMask\":\"project\"}]}", "resource": "-", "response": "{\"databases\":[{\"name\":\"instances/prod-sample-instance/databases/hr_prod\", \"state\":\"ACTIVE\", \"successfulSyncTime\":\"2025-05-26T08:04:33.186522Z\", \"project\":\"projects/hr\", \"effectiveEnvironment\":\"environments/prod\", \"instanceResource\":{\"title\":\"Prod Sample Instance\", \"engine\":\"POSTGRES\", \"engineVersion\":\"16.0.0\", \"dataSources\":[{\"id\":\"9af4f227-a55e-4e82-b7f5-c7193b5f405c\", \"type\":\"ADMIN\", \"username\":\"bbsample\", \"host\":\"/tmp\", \"port\":\"8084\", \"authenticationType\":\"PASSWORD\", \"redisType\":\"STANDALONE\"}, {\"id\":\"e700ae12-173e-4f0d-8590-0414cf6a9405\", \"type\":\"READ_ONLY\", \"username\":\"bbsample\", \"host\":\"/tmp\", \"port\":\"8084\", \"authenticationType\":\"PASSWORD\", \"redisType\":\"STANDALONE\"}], \"activation\":true, \"name\":\"instances/prod-sample-instance\", \"environment\":\"environments/prod\"}, \"backupAvailable\":true}]}", "severity": "INFO", "requestMetadata": {"callerIp": "[::1]:61457", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (151, '2025-05-26 08:05:25.065384+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.DatabaseService/BatchUpdateDatabases", "parent": "projects/hr", "request": "{\"parent\":\"-\", \"requests\":[{\"database\":{\"name\":\"instances/test-sample-instance/databases/hr_test\", \"project\":\"projects/hr\"}, \"updateMask\":\"project\"}]}", "resource": "-", "response": "{\"databases\":[{\"name\":\"instances/test-sample-instance/databases/hr_test\", \"state\":\"ACTIVE\", \"successfulSyncTime\":\"2025-05-26T08:03:53.183103Z\", \"project\":\"projects/hr\", \"effectiveEnvironment\":\"environments/test\", \"instanceResource\":{\"title\":\"Test Sample Instance\", \"engine\":\"POSTGRES\", \"engineVersion\":\"16.0.0\", \"dataSources\":[{\"id\":\"a7f206f9-37c4-41ca-8b59-fcf4c6148105\", \"type\":\"ADMIN\", \"username\":\"bbsample\", \"host\":\"/tmp\", \"port\":\"8083\", \"authenticationType\":\"PASSWORD\", \"redisType\":\"STANDALONE\"}], \"activation\":true, \"name\":\"instances/test-sample-instance\", \"environment\":\"environments/test\"}, \"backupAvailable\":true}]}", "severity": "INFO", "requestMetadata": {"callerIp": "[::1]:61457", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (152, '2025-05-26 08:05:25.065664+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.DatabaseService/BatchUpdateDatabases", "parent": "projects/default", "request": "{\"parent\":\"-\", \"requests\":[{\"database\":{\"name\":\"instances/test-sample-instance/databases/hr_test\", \"project\":\"projects/hr\"}, \"updateMask\":\"project\"}]}", "resource": "-", "response": "{\"databases\":[{\"name\":\"instances/test-sample-instance/databases/hr_test\", \"state\":\"ACTIVE\", \"successfulSyncTime\":\"2025-05-26T08:03:53.183103Z\", \"project\":\"projects/hr\", \"effectiveEnvironment\":\"environments/test\", \"instanceResource\":{\"title\":\"Test Sample Instance\", \"engine\":\"POSTGRES\", \"engineVersion\":\"16.0.0\", \"dataSources\":[{\"id\":\"a7f206f9-37c4-41ca-8b59-fcf4c6148105\", \"type\":\"ADMIN\", \"username\":\"bbsample\", \"host\":\"/tmp\", \"port\":\"8083\", \"authenticationType\":\"PASSWORD\", \"redisType\":\"STANDALONE\"}], \"activation\":true, \"name\":\"instances/test-sample-instance\", \"environment\":\"environments/test\"}, \"backupAvailable\":true}]}", "severity": "INFO", "requestMetadata": {"callerIp": "[::1]:61457", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (153, '2025-05-26 08:07:29.78582+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.ProjectService/SetIamPolicy", "parent": "projects/hr", "request": "{\"resource\":\"projects/hr\", \"policy\":{\"bindings\":[{\"role\":\"roles/projectOwner\", \"members\":[\"user:[email protected]\"], \"condition\":{}}, {\"role\":\"roles/projectDeveloper\", \"members\":[\"user:[email protected]\"], \"condition\":{\"title\":\"Project Developer All databases\"}}], \"etag\":\"1748242124999\"}, \"etag\":\"1748242124999\"}", "resource": "projects/hr", "response": "{\"bindings\":[{\"role\":\"roles/projectOwner\", \"members\":[\"user:[email protected]\"], \"condition\":{}}, {\"role\":\"roles/projectDeveloper\", \"members\":[\"user:[email protected]\"], \"condition\":{\"title\":\"Project Developer All databases\"}}], \"etag\":\"1748246849784\"}", "severity": "INFO", "serviceData": {"@type": "type.googleapis.com/bytebase.v1.AuditData", "policyDelta": {"bindingDeltas": [{"role": "roles/projectDeveloper", "action": "ADD", "member": "users/102", "condition": {"title": "Project Developer All databases"}}]}}, "requestMetadata": {"callerIp": "[::1]:62678", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (154, '2025-05-26 08:08:54.155379+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.UserService/CreateUser", "parent": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "request": "{\"user\":{\"name\":\"users/0\", \"email\":\"[email protected]\", \"title\":\"QA1\", \"userType\":\"USER\"}}", "resource": "users/0", "response": "{\"name\":\"users/105\", \"email\":\"[email protected]\", \"title\":\"QA1\", \"userType\":\"USER\"}", "severity": "INFO", "requestMetadata": {"callerIp": "[::1]:62675", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (155, '2025-05-26 08:08:54.164132+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.WorkspaceService/SetIamPolicy", "parent": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "request": "{\"resource\":\"workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48\", \"policy\":{\"bindings\":[{\"role\":\"roles/workspaceMember\", \"members\":[\"allUsers\", \"user:[email protected]\", \"user:[email protected]\"], \"condition\":{}}, {\"role\":\"roles/workspaceAdmin\", \"members\":[\"user:[email protected]\", \"user:[email protected]\"], \"condition\":{}}, {\"role\":\"roles/workspaceDBA\", \"members\":[\"user:[email protected]\", \"user:[email protected]\"], \"condition\":{}}], \"etag\":\"1748245272807\"}, \"etag\":\"1748245272807\"}", "resource": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "response": "{\"bindings\":[{\"role\":\"roles/workspaceMember\", \"members\":[\"allUsers\", \"user:[email protected]\", \"user:[email protected]\"], \"condition\":{}}, {\"role\":\"roles/workspaceAdmin\", \"members\":[\"user:[email protected]\", \"user:[email protected]\"], \"condition\":{}}, {\"role\":\"roles/workspaceDBA\", \"members\":[\"user:[email protected]\", \"user:[email protected]\"], \"condition\":{}}], \"etag\":\"1748246934163\"}", "severity": "INFO", "requestMetadata": {"callerIp": "[::1]:62675", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (156, '2025-05-26 08:09:14.424273+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.UserService/CreateUser", "parent": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "request": "{\"user\":{\"name\":\"users/0\", \"email\":\"[email protected]\", \"title\":\"QA2\", \"userType\":\"USER\"}}", "resource": "users/0", "response": "{\"name\":\"users/106\", \"email\":\"[email protected]\", \"title\":\"QA2\", \"userType\":\"USER\"}", "severity": "INFO", "requestMetadata": {"callerIp": "[::1]:62675", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (157, '2025-05-26 08:09:14.43372+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.WorkspaceService/SetIamPolicy", "parent": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "request": "{\"resource\":\"workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48\", \"policy\":{\"bindings\":[{\"role\":\"roles/workspaceMember\", \"members\":[\"allUsers\", \"user:[email protected]\", \"user:[email protected]\", \"user:[email protected]\"], \"condition\":{}}, {\"role\":\"roles/workspaceAdmin\", \"members\":[\"user:[email protected]\", \"user:[email protected]\"], \"condition\":{}}, {\"role\":\"roles/workspaceDBA\", \"members\":[\"user:[email protected]\", \"user:[email protected]\"], \"condition\":{}}], \"etag\":\"1748246934163\"}, \"etag\":\"1748246934163\"}", "resource": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "response": "{\"bindings\":[{\"role\":\"roles/workspaceMember\", \"members\":[\"allUsers\", \"user:[email protected]\", \"user:[email protected]\", \"user:[email protected]\"], \"condition\":{}}, {\"role\":\"roles/workspaceAdmin\", \"members\":[\"user:[email protected]\", \"user:[email protected]\"], \"condition\":{}}, {\"role\":\"roles/workspaceDBA\", \"members\":[\"user:[email protected]\", \"user:[email protected]\"], \"condition\":{}}], \"etag\":\"1748246954432\"}", "severity": "INFO", "requestMetadata": {"callerIp": "[::1]:62675", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (158, '2025-05-26 08:09:47.440116+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.GroupService/CreateGroup", "parent": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "request": "{\"group\":{\"name\":\"groups/[email protected]\", \"title\":\"QA Group\", \"members\":[{\"member\":\"users/[email protected]\", \"role\":\"OWNER\"}, {\"member\":\"users/[email protected]\", \"role\":\"MEMBER\"}]}, \"groupEmail\":\"[email protected]\"}", "response": "{\"name\":\"groups/[email protected]\", \"title\":\"QA Group\", \"members\":[{\"member\":\"users/[email protected]\", \"role\":\"OWNER\"}, {\"member\":\"users/[email protected]\", \"role\":\"MEMBER\"}]}", "severity": "INFO", "requestMetadata": {"callerIp": "[::1]:62675", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (159, '2025-05-26 08:10:00.959856+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.WorkspaceService/SetIamPolicy", "parent": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "request": "{\"resource\":\"workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48\", \"policy\":{\"bindings\":[{\"role\":\"roles/workspaceMember\", \"members\":[\"allUsers\", \"user:[email protected]\", \"user:[email protected]\", \"user:[email protected]\", \"group:[email protected]\"], \"condition\":{}}, {\"role\":\"roles/workspaceAdmin\", \"members\":[\"user:[email protected]\", \"user:[email protected]\"], \"condition\":{}}, {\"role\":\"roles/workspaceDBA\", \"members\":[\"user:[email protected]\", \"user:[email protected]\"], \"condition\":{}}, {\"role\":\"roles/qa-custom-role\", \"members\":[\"group:[email protected]\"]}], \"etag\":\"1748246954432\"}, \"etag\":\"1748246954432\"}", "resource": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "response": "{\"bindings\":[{\"role\":\"roles/workspaceMember\", \"members\":[\"allUsers\", \"user:[email protected]\", \"user:[email protected]\", \"user:[email protected]\", \"group:[email protected]\"], \"condition\":{}}, {\"role\":\"roles/workspaceAdmin\", \"members\":[\"user:[email protected]\", \"user:[email protected]\"], \"condition\":{}}, {\"role\":\"roles/workspaceDBA\", \"members\":[\"user:[email protected]\", \"user:[email protected]\"], \"condition\":{}}, {\"role\":\"roles/qa-custom-role\", \"members\":[\"group:[email protected]\"], \"condition\":{}}], \"etag\":\"1748247000958\"}", "severity": "INFO", "requestMetadata": {"callerIp": "[::1]:62675", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (160, '2025-05-26 08:14:34.184265+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.SettingService/UpdateSetting", "parent": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "request": "{\"setting\":{\"name\":\"settings/bb.workspace.data-classification\", \"value\":{\"dataClassificationSettingValue\":{\"configs\":[{\"id\":\"e5680e79-e84b-486e-8cb2-76c984c3fac9\", \"title\":\"Classification Example\", \"levels\":[{\"id\":\"1\", \"title\":\"Level 1\"}, {\"id\":\"2\", \"title\":\"Level 2\"}, {\"id\":\"3\", \"title\":\"Level 3\"}, {\"id\":\"4\", \"title\":\"Level 4\"}], \"classification\":{\"1\":{\"id\":\"1\", \"title\":\"Basic\"}, \"1-1\":{\"id\":\"1-1\", \"title\":\"Basic\", \"levelId\":\"1\"}, \"1-2\":{\"id\":\"1-2\", \"title\":\"Contact\", \"levelId\":\"2\"}, \"1-3\":{\"id\":\"1-3\", \"title\":\"Health\", \"levelId\":\"4\"}, \"2\":{\"id\":\"2\", \"title\":\"Relationship\"}, \"2-1\":{\"id\":\"2-1\", \"title\":\"Social\", \"levelId\":\"1\"}, \"2-2\":{\"id\":\"2-2\", \"title\":\"Business\", \"levelId\":\"3\"}}, \"classificationFromConfig\":true}]}}}, \"allowMissing\":true}", "resource": "settings/bb.workspace.data-classification", "response": "{\"name\":\"settings/bb.workspace.data-classification\", \"value\":{\"dataClassificationSettingValue\":{\"configs\":[{\"id\":\"e5680e79-e84b-486e-8cb2-76c984c3fac9\", \"title\":\"Classification Example\", \"levels\":[{\"id\":\"1\", \"title\":\"Level 1\"}, {\"id\":\"2\", \"title\":\"Level 2\"}, {\"id\":\"3\", \"title\":\"Level 3\"}, {\"id\":\"4\", \"title\":\"Level 4\"}], \"classification\":{\"1\":{\"id\":\"1\", \"title\":\"Basic\"}, \"1-1\":{\"id\":\"1-1\", \"title\":\"Basic\", \"levelId\":\"1\"}, \"1-2\":{\"id\":\"1-2\", \"title\":\"Contact\", \"levelId\":\"2\"}, \"1-3\":{\"id\":\"1-3\", \"title\":\"Health\", \"levelId\":\"4\"}, \"2\":{\"id\":\"2\", \"title\":\"Relationship\"}, \"2-1\":{\"id\":\"2-1\", \"title\":\"Social\", \"levelId\":\"1\"}, \"2-2\":{\"id\":\"2-2\", \"title\":\"Business\", \"levelId\":\"3\"}}, \"classificationFromConfig\":true}]}}}", "severity": "INFO", "serviceData": {"name": "settings/bb.workspace.data-classification", "@type": "type.googleapis.com/bytebase.v1.Setting", "value": {"dataClassificationSettingValue": {"configs": [{"id": "e5680e79-e84b-486e-8cb2-76c984c3fac9", "title": "Classification Example", "levels": [{"id": "1", "title": "Level 1"}, {"id": "2", "title": "Level 2"}, {"id": "3", "title": "Level 3"}, {"id": "4", "title": "Level 4"}], "classification": {"1": {"id": "1", "title": "Basic"}, "2": {"id": "2", "title": "Relationship"}, "1-1": {"id": "1-1", "title": "Basic", "levelId": "1"}, "1-2": {"id": "1-2", "title": "Contact", "levelId": "2"}, "1-3": {"id": "1-3", "title": "Health", "levelId": "4"}, "2-1": {"id": "2-1", "title": "Social", "levelId": "1"}, "2-2": {"id": "2-2", "title": "Business", "levelId": "3"}}}]}}}, "requestMetadata": {"callerIp": "[::1]:63103", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (161, '2025-05-26 08:14:52.612657+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.DatabaseCatalogService/UpdateDatabaseCatalog", "parent": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "request": "{\"catalog\":{\"name\":\"instances/prod-sample-instance/databases/hr_prod/catalog\", \"schemas\":[{\"name\":\"public\", \"tables\":[{\"name\":\"employee\", \"columns\":{\"columns\":[{\"name\":\"first_name\", \"classification\":\"1-2\"}]}}]}]}}", "resource": "instances/prod-sample-instance/databases/hr_prod/catalog", "response": "{\"name\":\"instances/prod-sample-instance/databases/hr_prod/catalog\", \"schemas\":[{\"name\":\"public\", \"tables\":[{\"name\":\"employee\", \"columns\":{\"columns\":[{\"name\":\"first_name\", \"classification\":\"1-2\"}]}}]}]}", "severity": "INFO", "requestMetadata": {"callerIp": "[::1]:63103", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (162, '2025-05-26 08:14:55.969774+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.DatabaseCatalogService/UpdateDatabaseCatalog", "parent": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "request": "{\"catalog\":{\"name\":\"instances/prod-sample-instance/databases/hr_prod/catalog\", \"schemas\":[{\"name\":\"public\", \"tables\":[{\"name\":\"employee\", \"columns\":{\"columns\":[{\"name\":\"first_name\", \"classification\":\"1-2\"}, {\"name\":\"last_name\", \"classification\":\"1-2\"}]}}]}]}}", "resource": "instances/prod-sample-instance/databases/hr_prod/catalog", "response": "{\"name\":\"instances/prod-sample-instance/databases/hr_prod/catalog\", \"schemas\":[{\"name\":\"public\", \"tables\":[{\"name\":\"employee\", \"columns\":{\"columns\":[{\"name\":\"first_name\", \"classification\":\"1-2\"}, {\"name\":\"last_name\", \"classification\":\"1-2\"}]}}]}]}", "severity": "INFO", "requestMetadata": {"callerIp": "[::1]:63103", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (163, '2025-05-26 08:15:29.44377+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.DatabaseCatalogService/UpdateDatabaseCatalog", "parent": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "request": "{\"catalog\":{\"name\":\"instances/prod-sample-instance/databases/hr_prod/catalog\", \"schemas\":[{\"name\":\"public\", \"tables\":[{\"name\":\"employee\", \"columns\":{\"columns\":[{\"name\":\"first_name\", \"classification\":\"1-2\"}, {\"name\":\"last_name\", \"classification\":\"1-2\"}]}}, {\"name\":\"salary\", \"columns\":{\"columns\":[{\"name\":\"amount\", \"semanticType\":\"bb.default\"}]}}]}]}}", "resource": "instances/prod-sample-instance/databases/hr_prod/catalog", "response": "{\"name\":\"instances/prod-sample-instance/databases/hr_prod/catalog\", \"schemas\":[{\"name\":\"public\", \"tables\":[{\"name\":\"employee\", \"columns\":{\"columns\":[{\"name\":\"first_name\", \"classification\":\"1-2\"}, {\"name\":\"last_name\", \"classification\":\"1-2\"}]}}, {\"name\":\"salary\", \"columns\":{\"columns\":[{\"name\":\"amount\", \"semanticType\":\"bb.default\"}]}}]}]}", "severity": "INFO", "requestMetadata": {"callerIp": "[::1]:63103", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (164, '2025-05-26 08:15:44.970189+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.SQLService/Query", "parent": "projects/hr", "request": "{\"name\":\"instances/prod-sample-instance/databases/hr_prod\", \"statement\":\"SELECT * FROM salary;\", \"limit\":1000, \"dataSourceId\":\"e700ae12-173e-4f0d-8590-0414cf6a9405\", \"queryOption\":{\"redisRunCommandsOn\":\"SINGLE_NODE\"}}", "resource": "instances/prod-sample-instance/databases/hr_prod", "response": "{\"results\":[{\"columnNames\":[\"emp_no\", \"amount\", \"from_date\", \"to_date\"], \"columnTypeNames\":[\"INT4\", \"INT4\", \"DATE\", \"DATE\"], \"rowsCount\":\"1000\", \"masked\":[false, true, false, false], \"sensitive\":[false, true, false, false], \"latency\":\"0.003390584s\", \"statement\":\"WITH result AS (\\nSELECT * FROM salary\\n) SELECT * FROM result LIMIT 1000;\", \"allowExport\":true}]}", "severity": "INFO", "requestMetadata": {"callerIp": "[::1]:63103", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (165, '2025-05-26 08:15:49.543617+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.SQLService/Query", "parent": "projects/hr", "request": "{\"name\":\"instances/prod-sample-instance/databases/hr_prod\", \"statement\":\"SELECT * FROM employee\", \"limit\":1000, \"dataSourceId\":\"e700ae12-173e-4f0d-8590-0414cf6a9405\", \"queryOption\":{\"redisRunCommandsOn\":\"SINGLE_NODE\"}}", "resource": "instances/prod-sample-instance/databases/hr_prod", "response": "{\"results\":[{\"columnNames\":[\"emp_no\", \"birth_date\", \"first_name\", \"last_name\", \"gender\", \"hire_date\"], \"columnTypeNames\":[\"INT4\", \"DATE\", \"TEXT\", \"TEXT\", \"TEXT\", \"DATE\"], \"rowsCount\":\"1000\", \"masked\":[false, false, true, true, false, false], \"sensitive\":[false, false, true, true, false, false], \"latency\":\"0.005566459s\", \"statement\":\"WITH result AS (\\nSELECT * FROM employee\\n) SELECT * FROM result LIMIT 1000;\", \"allowExport\":true}]}", "severity": "INFO", "requestMetadata": {"callerIp": "[::1]:63110", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (166, '2025-05-26 08:23:40.127402+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.OrgPolicyService/UpdatePolicy", "parent": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "request": "{\"policy\":{\"name\":\"environments/prod/policies/data_source_query\", \"type\":\"DATA_SOURCE_QUERY\", \"dataSourceQueryPolicy\":{\"disallowDdl\":true, \"disallowDml\":true}}, \"updateMask\":\"payload\", \"allowMissing\":true}", "response": "{\"name\":\"environments/prod/policies/data_source_query\", \"type\":\"DATA_SOURCE_QUERY\", \"dataSourceQueryPolicy\":{\"disallowDdl\":true, \"disallowDml\":true}, \"enforce\":true, \"resourceType\":\"ENVIRONMENT\"}", "severity": "INFO", "requestMetadata": {"callerIp": "[::1]:63481", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (167, '2025-05-26 08:23:40.136557+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.OrgPolicyService/UpdatePolicy", "parent": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "request": "{\"policy\":{\"name\":\"environments/prod/policies/disable_copy_data\", \"type\":\"DISABLE_COPY_DATA\", \"disableCopyDataPolicy\":{\"active\":true}}, \"updateMask\":\"payload\", \"allowMissing\":true}", "response": "{\"name\":\"environments/prod/policies/disable_copy_data\", \"type\":\"DISABLE_COPY_DATA\", \"disableCopyDataPolicy\":{\"active\":true}, \"enforce\":true, \"resourceType\":\"ENVIRONMENT\"}", "severity": "INFO", "requestMetadata": {"callerIp": "[::1]:63481", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (168, '2025-05-26 08:23:44.737109+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.SettingService/UpdateSetting", "parent": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "request": "{\"setting\":{\"name\":\"settings/bb.workspace.environment\", \"value\":{\"environmentSetting\":{\"environments\":[{\"name\":\"environments/test\", \"id\":\"test\", \"title\":\"Test\"}, {\"name\":\"environments/prod\", \"id\":\"prod\", \"title\":\"Prod\", \"tags\":{\"protected\":\"protected\"}}]}}}, \"updateMask\":\"environmentSetting\"}", "resource": "settings/bb.workspace.environment", "response": "{\"name\":\"settings/bb.workspace.environment\", \"value\":{\"environmentSetting\":{\"environments\":[{\"name\":\"environments/test\", \"id\":\"test\", \"title\":\"Test\"}, {\"name\":\"environments/prod\", \"id\":\"prod\", \"title\":\"Prod\", \"tags\":{\"protected\":\"protected\"}}]}}}", "severity": "INFO", "serviceData": {"name": "settings/bb.workspace.environment", "@type": "type.googleapis.com/bytebase.v1.Setting", "value": {"environmentSetting": {"environments": [{"id": "test", "name": "environments/test", "title": "Test"}, {"id": "prod", "name": "environments/prod", "title": "Prod"}]}}}, "requestMetadata": {"callerIp": "[::1]:63481", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (169, '2025-05-26 08:26:15.25803+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.PlanService/CreatePlan", "parent": "projects/hr", "request": "{\"parent\":\"projects/hr\", \"plan\":{\"name\":\"projects/hr/plans/-102\", \"steps\":[{\"specs\":[{\"earliestAllowedTime\":\"2030-05-25T18:00:00Z\", \"id\":\"036e8f34-05e6-4916-ba58-45c6a452fc60\", \"changeDatabaseConfig\":{\"target\":\"instances/test-sample-instance/databases/hr_test\", \"sheet\":\"projects/hr/sheets/101\", \"type\":\"MIGRATE\"}}]}, {\"specs\":[{\"id\":\"ea634b72-91e0-48b5-9ab6-ecc8d9355ff8\", \"changeDatabaseConfig\":{\"target\":\"instances/prod-sample-instance/databases/hr_prod\", \"sheet\":\"projects/hr/sheets/101\", \"type\":\"MIGRATE\"}}]}]}}", "response": "{\"name\":\"projects/hr/plans/101\", \"steps\":[{\"specs\":[{\"earliestAllowedTime\":\"2030-05-25T18:00:00Z\", \"id\":\"036e8f34-05e6-4916-ba58-45c6a452fc60\", \"specReleaseSource\":{}, \"changeDatabaseConfig\":{\"target\":\"instances/test-sample-instance/databases/hr_test\", \"sheet\":\"projects/hr/sheets/101\", \"type\":\"MIGRATE\", \"preUpdateBackupDetail\":{}}}]}, {\"specs\":[{\"id\":\"ea634b72-91e0-48b5-9ab6-ecc8d9355ff8\", \"specReleaseSource\":{}, \"changeDatabaseConfig\":{\"target\":\"instances/prod-sample-instance/databases/hr_prod\", \"sheet\":\"projects/hr/sheets/101\", \"type\":\"MIGRATE\", \"preUpdateBackupDetail\":{}}}]}], \"creator\":\"users/[email protected]\", \"createTime\":\"2025-05-26T08:26:15.250094Z\", \"updateTime\":\"2025-05-26T08:26:15.250094Z\", \"releaseSource\":{}, \"deployment\":{\"environments\":[\"test\", \"prod\"]}}", "severity": "INFO", "requestMetadata": {"callerIp": "[::1]:63974", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (170, '2025-05-26 08:26:15.268137+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.IssueService/CreateIssue", "parent": "projects/hr", "request": "{\"parent\":\"projects/hr\", \"issue\":{\"name\":\"projects/hr/issues/-101\", \"title\":\"👉👉👉 [START HERE] Add email column to Employee table\", \"type\":\"DATABASE_CHANGE\", \"status\":\"OPEN\", \"creator\":\"users/[email protected]\", \"plan\":\"projects/hr/plans/101\", \"labels\":[\"3.6.2\", \"feature\"]}}", "response": "{\"name\":\"projects/hr/issues/101\", \"title\":\"👉👉👉 [START HERE] Add email column to Employee table\", \"type\":\"DATABASE_CHANGE\", \"status\":\"OPEN\", \"creator\":\"users/[email protected]\", \"createTime\":\"2025-05-26T08:26:15.266310Z\", \"updateTime\":\"2025-05-26T08:26:15.266310Z\", \"plan\":\"projects/hr/plans/101\", \"labels\":[\"3.6.2\", \"feature\"]}", "severity": "INFO", "requestMetadata": {"callerIp": "[::1]:63974", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (183, '2025-06-09 02:20:50.345446+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.RiskService/UpdateRisk", "parent": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "request": "{\"risk\":{\"name\":\"risks/102\",\"source\":\"DDL\",\"title\":\"CREATE TABLE in production environment is moderate risk\",\"level\":200,\"active\":true,\"condition\":{\"expression\":\"environment_id == \\\"prod\\\" && sql_type == \\\"CREATE_TABLE\\\"\"}},\"updateMask\":\"title,level,active,condition,source\"}", "resource": "risks/102", "response": "{\"name\":\"risks/102\",\"source\":\"DDL\",\"title\":\"CREATE TABLE in production environment is moderate risk\",\"level\":200,\"active\":true,\"condition\":{\"expression\":\"environment_id == \\\"prod\\\" && sql_type == \\\"CREATE_TABLE\\\"\"}}", "severity": "INFO", "requestMetadata": {"callerIp": "[::1]:56353", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (171, '2025-05-26 08:26:15.276663+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.RolloutService/CreateRollout", "parent": "projects/hr", "request": "{\"parent\":\"projects/hr\", \"rollout\":{\"plan\":\"projects/hr/plans/101\"}}", "response": "{\"name\":\"projects/hr/rollouts/101\", \"plan\":\"projects/hr/plans/101\", \"stages\":[{\"name\":\"projects/hr/rollouts/101/stages/101\", \"environment\":\"environments/test\", \"tasks\":[{\"name\":\"projects/hr/rollouts/101/stages/101/tasks/101\", \"specId\":\"036e8f34-05e6-4916-ba58-45c6a452fc60\", \"status\":\"NOT_STARTED\", \"type\":\"DATABASE_SCHEMA_UPDATE\", \"target\":\"instances/test-sample-instance/databases/hr_test\", \"databaseSchemaUpdate\":{\"sheet\":\"projects/hr/sheets/101\"}}]}, {\"name\":\"projects/hr/rollouts/101/stages/102\", \"environment\":\"environments/prod\", \"tasks\":[{\"name\":\"projects/hr/rollouts/101/stages/102/tasks/102\", \"specId\":\"ea634b72-91e0-48b5-9ab6-ecc8d9355ff8\", \"status\":\"NOT_STARTED\", \"type\":\"DATABASE_SCHEMA_UPDATE\", \"target\":\"instances/prod-sample-instance/databases/hr_prod\", \"databaseSchemaUpdate\":{\"sheet\":\"projects/hr/sheets/101\"}}]}], \"creator\":\"users/[email protected]\", \"createTime\":\"2025-05-26T08:26:15.272294Z\", \"issue\":\"projects/hr/issues/101\"}", "severity": "INFO", "requestMetadata": {"callerIp": "[::1]:63974", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (172, '2025-05-26 08:27:15.379272+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.DatabaseService/UpdateDatabase", "parent": "projects/hr", "request": "{\"database\":{\"name\":\"instances/prod-sample-instance/databases/hr_prod\", \"state\":\"ACTIVE\", \"successfulSyncTime\":\"2025-05-26T08:04:33.186522Z\", \"project\":\"projects/hr\", \"environment\":\"environments/prod\", \"effectiveEnvironment\":\"environments/prod\", \"instanceResource\":{\"title\":\"Prod Sample Instance\", \"engine\":\"POSTGRES\", \"engineVersion\":\"16.0.0\", \"dataSources\":[{\"id\":\"9af4f227-a55e-4e82-b7f5-c7193b5f405c\", \"type\":\"ADMIN\", \"username\":\"bbsample\", \"host\":\"/tmp\", \"port\":\"8084\", \"authenticationType\":\"PASSWORD\", \"redisType\":\"STANDALONE\"}, {\"id\":\"e700ae12-173e-4f0d-8590-0414cf6a9405\", \"type\":\"READ_ONLY\", \"username\":\"bbsample\", \"host\":\"/tmp\", \"port\":\"8084\", \"authenticationType\":\"PASSWORD\", \"redisType\":\"STANDALONE\"}], \"activation\":true, \"name\":\"instances/prod-sample-instance\", \"environment\":\"environments/prod\"}, \"backupAvailable\":true}, \"updateMask\":\"drifted\"}", "resource": "instances/prod-sample-instance/databases/hr_prod", "response": "{\"name\":\"instances/prod-sample-instance/databases/hr_prod\", \"state\":\"ACTIVE\", \"successfulSyncTime\":\"2025-05-26T08:04:33.186522Z\", \"project\":\"projects/hr\", \"effectiveEnvironment\":\"environments/prod\", \"instanceResource\":{\"title\":\"Prod Sample Instance\", \"engine\":\"POSTGRES\", \"engineVersion\":\"16.0.0\", \"dataSources\":[{\"id\":\"9af4f227-a55e-4e82-b7f5-c7193b5f405c\", \"type\":\"ADMIN\", \"username\":\"bbsample\", \"host\":\"/tmp\", \"port\":\"8084\", \"authenticationType\":\"PASSWORD\", \"redisType\":\"STANDALONE\"}, {\"id\":\"e700ae12-173e-4f0d-8590-0414cf6a9405\", \"type\":\"READ_ONLY\", \"username\":\"bbsample\", \"host\":\"/tmp\", \"port\":\"8084\", \"authenticationType\":\"PASSWORD\", \"redisType\":\"STANDALONE\"}], \"activation\":true, \"name\":\"instances/prod-sample-instance\", \"environment\":\"environments/prod\"}, \"backupAvailable\":true}", "severity": "INFO", "requestMetadata": {"callerIp": "[::1]:63974", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (173, '2025-05-26 08:27:35.2587+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.DatabaseService/UpdateDatabase", "parent": "projects/hr", "request": "{\"database\":{\"name\":\"instances/test-sample-instance/databases/hr_test\", \"state\":\"ACTIVE\", \"successfulSyncTime\":\"2025-05-26T08:03:53.183103Z\", \"project\":\"projects/hr\", \"environment\":\"environments/test\", \"effectiveEnvironment\":\"environments/test\", \"instanceResource\":{\"title\":\"Test Sample Instance\", \"engine\":\"POSTGRES\", \"engineVersion\":\"16.0.0\", \"dataSources\":[{\"id\":\"a7f206f9-37c4-41ca-8b59-fcf4c6148105\", \"type\":\"ADMIN\", \"username\":\"bbsample\", \"host\":\"/tmp\", \"port\":\"8083\", \"authenticationType\":\"PASSWORD\", \"redisType\":\"STANDALONE\"}], \"activation\":true, \"name\":\"instances/test-sample-instance\", \"environment\":\"environments/test\"}, \"backupAvailable\":true}, \"updateMask\":\"drifted\"}", "resource": "instances/test-sample-instance/databases/hr_test", "response": "{\"name\":\"instances/test-sample-instance/databases/hr_test\", \"state\":\"ACTIVE\", \"successfulSyncTime\":\"2025-05-26T08:03:53.183103Z\", \"project\":\"projects/hr\", \"effectiveEnvironment\":\"environments/test\", \"instanceResource\":{\"title\":\"Test Sample Instance\", \"engine\":\"POSTGRES\", \"engineVersion\":\"16.0.0\", \"dataSources\":[{\"id\":\"a7f206f9-37c4-41ca-8b59-fcf4c6148105\", \"type\":\"ADMIN\", \"username\":\"bbsample\", \"host\":\"/tmp\", \"port\":\"8083\", \"authenticationType\":\"PASSWORD\", \"redisType\":\"STANDALONE\"}], \"activation\":true, \"name\":\"instances/test-sample-instance\", \"environment\":\"environments/test\"}, \"backupAvailable\":true}", "severity": "INFO", "requestMetadata": {"callerIp": "[::1]:63859", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (174, '2025-05-26 08:31:19.335918+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.SQLService/Query", "parent": "projects/metadb", "request": "{\"name\":\"instances/bytebase-meta/databases/bb\", \"statement\":\"-- Issues created by user\\nSELECT\\n issue.creator_id,\\n principal.email,\\n COUNT(issue.creator_id) AS amount\\nFROM\\n issue\\n INNER JOIN principal ON issue.creator_id = principal.id\\nGROUP BY\\n issue.creator_id,\\n principal.email\\nORDER BY\\n COUNT(issue.creator_id) DESC;\", \"limit\":1000, \"dataSourceId\":\"35a64b4a-543f-4eac-ad32-b191a958c66d\", \"queryOption\":{\"redisRunCommandsOn\":\"SINGLE_NODE\"}}", "resource": "instances/bytebase-meta/databases/bb", "response": "{\"results\":[{\"columnNames\":[\"creator_id\", \"email\", \"amount\"], \"columnTypeNames\":[\"INT4\", \"TEXT\", \"INT8\"], \"rowsCount\":\"1\", \"masked\":[false, false, false], \"sensitive\":[false, false, false], \"latency\":\"0.001571042s\", \"statement\":\"-- Issues created by user\\nSELECT\\n issue.creator_id,\\n principal.email,\\n COUNT(issue.creator_id) AS amount\\nFROM\\n issue\\n INNER JOIN principal ON issue.creator_id = principal.id\\nGROUP BY\\n issue.creator_id,\\n principal.email\\nORDER BY\\n COUNT(issue.creator_id) DESC;\", \"allowExport\":true}]}", "severity": "INFO", "requestMetadata": {"callerIp": "[::1]:64314", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (175, '2025-05-26 08:47:09.084937+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.OrgPolicyService/UpdatePolicy", "parent": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "request": "{\"policy\":{\"name\":\"environments/test/policies/tag\", \"type\":\"TAG\", \"tagPolicy\":{\"tags\":{\"bb.tag.review_config\":\"reviewConfigs/sql-review-sample-policy\"}}}, \"updateMask\":\"payload\", \"allowMissing\":true}", "response": "{\"name\":\"environments/test/policies/tag\", \"type\":\"TAG\", \"tagPolicy\":{\"tags\":{\"bb.tag.review_config\":\"reviewConfigs/sql-review-sample-policy\"}}, \"enforce\":true, \"resourceType\":\"ENVIRONMENT\"}", "severity": "INFO", "requestMetadata": {"callerIp": "[::1]:49782", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (176, '2025-05-26 08:47:09.084988+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.OrgPolicyService/UpdatePolicy", "parent": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "request": "{\"policy\":{\"name\":\"environments/prod/policies/tag\", \"type\":\"TAG\", \"tagPolicy\":{\"tags\":{\"bb.tag.review_config\":\"reviewConfigs/sql-review-sample-policy\"}}}, \"updateMask\":\"payload\", \"allowMissing\":true}", "response": "{\"name\":\"environments/prod/policies/tag\", \"type\":\"TAG\", \"tagPolicy\":{\"tags\":{\"bb.tag.review_config\":\"reviewConfigs/sql-review-sample-policy\"}}, \"enforce\":true, \"resourceType\":\"ENVIRONMENT\"}", "severity": "INFO", "requestMetadata": {"callerIp": "[::1]:49799", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (177, '2025-05-26 08:47:41.77037+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.SettingService/UpdateSetting", "parent": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "request": "{\"setting\":{\"name\":\"settings/bb.workspace.approval\", \"value\":{\"workspaceApprovalSettingValue\":{\"rules\":[{\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/projectOwner\"}]}, {\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceDBA\"}]}]}, \"title\":\"Project Owner -> Workspace DBA\", \"description\":\"The system defines the approval process, first the project Owner approves, then the DBA approves.\", \"creator\":\"users/[email protected]\"}, \"condition\":{\"expression\":\"source == \\\"DML\\\" && level == 300 || source == \\\"DDL\\\" && level == 300\"}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/projectOwner\"}]}]}, \"title\":\"Project Owner\", \"description\":\"The system defines the approval process and only needs the project Owner to approve it.\", \"creator\":\"users/[email protected]\"}, \"condition\":{\"expression\":\"source == \\\"DML\\\" && level == 0 || source == \\\"DDL\\\" && level == 200 || source == \\\"DDL\\\" &&\\nlevel == 0 || source == \\\"DML\\\" && level == 200 || source == \\\"DATA_EXPORT\\\" &&\\nlevel == 0\"}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceDBA\"}]}]}, \"title\":\"Workspace DBA\", \"description\":\"The system defines the approval process and only needs DBA approval.\", \"creator\":\"users/[email protected]\"}, \"condition\":{}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceAdmin\"}]}]}, \"title\":\"Workspace Admin\", \"description\":\"The system defines the approval process and only needs Administrator approval.\", \"creator\":\"users/[email protected]\"}, \"condition\":{}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/projectOwner\"}]}, {\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceDBA\"}]}, {\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceAdmin\"}]}]}, \"title\":\"Project Owner -> Workspace DBA -> Workspace Admin\", \"description\":\"The system defines the approval process, first the project Owner approves, then the DBA approves, and finally the Administrator approves.\", \"creator\":\"users/[email protected]\"}, \"condition\":{}}]}}}, \"allowMissing\":true}", "resource": "settings/bb.workspace.approval", "response": "{\"name\":\"settings/bb.workspace.approval\", \"value\":{\"workspaceApprovalSettingValue\":{\"rules\":[{\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/projectOwner\"}]}, {\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceDBA\"}]}]}, \"title\":\"Project Owner -> Workspace DBA\", \"description\":\"The system defines the approval process, first the project Owner approves, then the DBA approves.\", \"creator\":\"users/[email protected]\"}, \"condition\":{\"expression\":\"source == \\\"DML\\\" && level == 300 || source == \\\"DDL\\\" && level == 300\"}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/projectOwner\"}]}]}, \"title\":\"Project Owner\", \"description\":\"The system defines the approval process and only needs the project Owner to approve it.\", \"creator\":\"users/[email protected]\"}, \"condition\":{\"expression\":\"source == \\\"DML\\\" && level == 0 || source == \\\"DDL\\\" && level == 200 || source == \\\"DDL\\\" &&\\nlevel == 0 || source == \\\"DML\\\" && level == 200 || source == \\\"DATA_EXPORT\\\" &&\\nlevel == 0\"}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceDBA\"}]}]}, \"title\":\"Workspace DBA\", \"description\":\"The system defines the approval process and only needs DBA approval.\", \"creator\":\"users/[email protected]\"}, \"condition\":{}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceAdmin\"}]}]}, \"title\":\"Workspace Admin\", \"description\":\"The system defines the approval process and only needs Administrator approval.\", \"creator\":\"users/[email protected]\"}, \"condition\":{}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/projectOwner\"}]}, {\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceDBA\"}]}, {\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceAdmin\"}]}]}, \"title\":\"Project Owner -> Workspace DBA -> Workspace Admin\", \"description\":\"The system defines the approval process, first the project Owner approves, then the DBA approves, and finally the Administrator approves.\", \"creator\":\"users/[email protected]\"}, \"condition\":{}}]}}}", "severity": "INFO", "serviceData": {"name": "settings/bb.workspace.approval", "@type": "type.googleapis.com/bytebase.v1.Setting", "value": {"workspaceApprovalSettingValue": {"rules": [{"template": {"flow": {"steps": [{"type": "ANY", "nodes": [{"role": "roles/projectOwner", "type": "ANY_IN_GROUP"}]}, {"type": "ANY", "nodes": [{"role": "roles/workspaceDBA", "type": "ANY_IN_GROUP"}]}]}, "title": "Project Owner -> Workspace DBA", "creator": "users/[email protected]", "description": "The system defines the approval process, first the project Owner approves, then the DBA approves."}, "condition": {"expression": "source == \"DML\" && level == 300 || source == \"DDL\" && level == 300"}}, {"template": {"flow": {"steps": [{"type": "ANY", "nodes": [{"role": "roles/projectOwner", "type": "ANY_IN_GROUP"}]}]}, "title": "Project Owner", "creator": "users/[email protected]", "description": "The system defines the approval process and only needs the project Owner to approve it."}, "condition": {"expression": "source == \"DML\" && level == 0 || source == \"DDL\" && level == 200 || source == \"DDL\" &&\nlevel == 0 || source == \"DML\" && level == 200"}}, {"template": {"flow": {"steps": [{"type": "ANY", "nodes": [{"role": "roles/workspaceDBA", "type": "ANY_IN_GROUP"}]}]}, "title": "Workspace DBA", "creator": "users/[email protected]", "description": "The system defines the approval process and only needs DBA approval."}, "condition": {}}, {"template": {"flow": {"steps": [{"type": "ANY", "nodes": [{"role": "roles/workspaceAdmin", "type": "ANY_IN_GROUP"}]}]}, "title": "Workspace Admin", "creator": "users/[email protected]", "description": "The system defines the approval process and only needs Administrator approval."}, "condition": {}}, {"template": {"flow": {"steps": [{"type": "ANY", "nodes": [{"role": "roles/projectOwner", "type": "ANY_IN_GROUP"}]}, {"type": "ANY", "nodes": [{"role": "roles/workspaceDBA", "type": "ANY_IN_GROUP"}]}, {"type": "ANY", "nodes": [{"role": "roles/workspaceAdmin", "type": "ANY_IN_GROUP"}]}]}, "title": "Project Owner -> Workspace DBA -> Workspace Admin", "creator": "users/[email protected]", "description": "The system defines the approval process, first the project Owner approves, then the DBA approves, and finally the Administrator approves."}, "condition": {}}]}}}, "requestMetadata": {"callerIp": "[::1]:49799", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (178, '2025-05-26 08:47:45.801694+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.SettingService/UpdateSetting", "parent": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "request": "{\"setting\":{\"name\":\"settings/bb.workspace.approval\", \"value\":{\"workspaceApprovalSettingValue\":{\"rules\":[{\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/projectOwner\"}]}, {\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceDBA\"}]}]}, \"title\":\"Project Owner -> Workspace DBA\", \"description\":\"The system defines the approval process, first the project Owner approves, then the DBA approves.\", \"creator\":\"users/[email protected]\"}, \"condition\":{\"expression\":\"source == \\\"DML\\\" && level == 300 || source == \\\"DDL\\\" && level == 300\"}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/projectOwner\"}]}]}, \"title\":\"Project Owner\", \"description\":\"The system defines the approval process and only needs the project Owner to approve it.\", \"creator\":\"users/[email protected]\"}, \"condition\":{\"expression\":\"source == \\\"DML\\\" && level == 0 || source == \\\"DDL\\\" && level == 200 || source == \\\"DDL\\\" &&\\nlevel == 0 || source == \\\"DML\\\" && level == 200 || source == \\\"DATA_EXPORT\\\" &&\\nlevel == 0 || source == \\\"REQUEST_QUERY\\\" && level == 0\"}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceDBA\"}]}]}, \"title\":\"Workspace DBA\", \"description\":\"The system defines the approval process and only needs DBA approval.\", \"creator\":\"users/[email protected]\"}, \"condition\":{}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceAdmin\"}]}]}, \"title\":\"Workspace Admin\", \"description\":\"The system defines the approval process and only needs Administrator approval.\", \"creator\":\"users/[email protected]\"}, \"condition\":{}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/projectOwner\"}]}, {\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceDBA\"}]}, {\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceAdmin\"}]}]}, \"title\":\"Project Owner -> Workspace DBA -> Workspace Admin\", \"description\":\"The system defines the approval process, first the project Owner approves, then the DBA approves, and finally the Administrator approves.\", \"creator\":\"users/[email protected]\"}, \"condition\":{}}]}}}, \"allowMissing\":true}", "resource": "settings/bb.workspace.approval", "response": "{\"name\":\"settings/bb.workspace.approval\", \"value\":{\"workspaceApprovalSettingValue\":{\"rules\":[{\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/projectOwner\"}]}, {\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceDBA\"}]}]}, \"title\":\"Project Owner -> Workspace DBA\", \"description\":\"The system defines the approval process, first the project Owner approves, then the DBA approves.\", \"creator\":\"users/[email protected]\"}, \"condition\":{\"expression\":\"source == \\\"DML\\\" && level == 300 || source == \\\"DDL\\\" && level == 300\"}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/projectOwner\"}]}]}, \"title\":\"Project Owner\", \"description\":\"The system defines the approval process and only needs the project Owner to approve it.\", \"creator\":\"users/[email protected]\"}, \"condition\":{\"expression\":\"source == \\\"DML\\\" && level == 0 || source == \\\"DDL\\\" && level == 200 || source == \\\"DDL\\\" &&\\nlevel == 0 || source == \\\"DML\\\" && level == 200 || source == \\\"DATA_EXPORT\\\" &&\\nlevel == 0 || source == \\\"REQUEST_QUERY\\\" && level == 0\"}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceDBA\"}]}]}, \"title\":\"Workspace DBA\", \"description\":\"The system defines the approval process and only needs DBA approval.\", \"creator\":\"users/[email protected]\"}, \"condition\":{}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceAdmin\"}]}]}, \"title\":\"Workspace Admin\", \"description\":\"The system defines the approval process and only needs Administrator approval.\", \"creator\":\"users/[email protected]\"}, \"condition\":{}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/projectOwner\"}]}, {\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceDBA\"}]}, {\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceAdmin\"}]}]}, \"title\":\"Project Owner -> Workspace DBA -> Workspace Admin\", \"description\":\"The system defines the approval process, first the project Owner approves, then the DBA approves, and finally the Administrator approves.\", \"creator\":\"users/[email protected]\"}, \"condition\":{}}]}}}", "severity": "INFO", "serviceData": {"name": "settings/bb.workspace.approval", "@type": "type.googleapis.com/bytebase.v1.Setting", "value": {"workspaceApprovalSettingValue": {"rules": [{"template": {"flow": {"steps": [{"type": "ANY", "nodes": [{"role": "roles/projectOwner", "type": "ANY_IN_GROUP"}]}, {"type": "ANY", "nodes": [{"role": "roles/workspaceDBA", "type": "ANY_IN_GROUP"}]}]}, "title": "Project Owner -> Workspace DBA", "creator": "users/[email protected]", "description": "The system defines the approval process, first the project Owner approves, then the DBA approves."}, "condition": {"expression": "source == \"DML\" && level == 300 || source == \"DDL\" && level == 300"}}, {"template": {"flow": {"steps": [{"type": "ANY", "nodes": [{"role": "roles/projectOwner", "type": "ANY_IN_GROUP"}]}]}, "title": "Project Owner", "creator": "users/[email protected]", "description": "The system defines the approval process and only needs the project Owner to approve it."}, "condition": {"expression": "source == \"DML\" && level == 0 || source == \"DDL\" && level == 200 || source == \"DDL\" &&\nlevel == 0 || source == \"DML\" && level == 200 || source == \"DATA_EXPORT\" &&\nlevel == 0"}}, {"template": {"flow": {"steps": [{"type": "ANY", "nodes": [{"role": "roles/workspaceDBA", "type": "ANY_IN_GROUP"}]}]}, "title": "Workspace DBA", "creator": "users/[email protected]", "description": "The system defines the approval process and only needs DBA approval."}, "condition": {}}, {"template": {"flow": {"steps": [{"type": "ANY", "nodes": [{"role": "roles/workspaceAdmin", "type": "ANY_IN_GROUP"}]}]}, "title": "Workspace Admin", "creator": "users/[email protected]", "description": "The system defines the approval process and only needs Administrator approval."}, "condition": {}}, {"template": {"flow": {"steps": [{"type": "ANY", "nodes": [{"role": "roles/projectOwner", "type": "ANY_IN_GROUP"}]}, {"type": "ANY", "nodes": [{"role": "roles/workspaceDBA", "type": "ANY_IN_GROUP"}]}, {"type": "ANY", "nodes": [{"role": "roles/workspaceAdmin", "type": "ANY_IN_GROUP"}]}]}, "title": "Project Owner -> Workspace DBA -> Workspace Admin", "creator": "users/[email protected]", "description": "The system defines the approval process, first the project Owner approves, then the DBA approves, and finally the Administrator approves."}, "condition": {}}]}}}, "requestMetadata": {"callerIp": "[::1]:49799", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (179, '2025-05-26 08:47:49.174483+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.SettingService/UpdateSetting", "parent": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "request": "{\"setting\":{\"name\":\"settings/bb.workspace.approval\", \"value\":{\"workspaceApprovalSettingValue\":{\"rules\":[{\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/projectOwner\"}]}, {\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceDBA\"}]}]}, \"title\":\"Project Owner -> Workspace DBA\", \"description\":\"The system defines the approval process, first the project Owner approves, then the DBA approves.\", \"creator\":\"users/[email protected]\"}, \"condition\":{\"expression\":\"source == \\\"DML\\\" && level == 300 || source == \\\"DDL\\\" && level == 300\"}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/projectOwner\"}]}]}, \"title\":\"Project Owner\", \"description\":\"The system defines the approval process and only needs the project Owner to approve it.\", \"creator\":\"users/[email protected]\"}, \"condition\":{\"expression\":\"source == \\\"DML\\\" && level == 0 || source == \\\"DDL\\\" && level == 200 || source == \\\"DDL\\\" &&\\nlevel == 0 || source == \\\"DML\\\" && level == 200 || source == \\\"DATA_EXPORT\\\" &&\\nlevel == 0 || source == \\\"REQUEST_QUERY\\\" && level == 0 || source == \\\"REQUEST_EXPORT\\\" &&\\nlevel == 0\"}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceDBA\"}]}]}, \"title\":\"Workspace DBA\", \"description\":\"The system defines the approval process and only needs DBA approval.\", \"creator\":\"users/[email protected]\"}, \"condition\":{}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceAdmin\"}]}]}, \"title\":\"Workspace Admin\", \"description\":\"The system defines the approval process and only needs Administrator approval.\", \"creator\":\"users/[email protected]\"}, \"condition\":{}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/projectOwner\"}]}, {\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceDBA\"}]}, {\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceAdmin\"}]}]}, \"title\":\"Project Owner -> Workspace DBA -> Workspace Admin\", \"description\":\"The system defines the approval process, first the project Owner approves, then the DBA approves, and finally the Administrator approves.\", \"creator\":\"users/[email protected]\"}, \"condition\":{}}]}}}, \"allowMissing\":true}", "resource": "settings/bb.workspace.approval", "response": "{\"name\":\"settings/bb.workspace.approval\", \"value\":{\"workspaceApprovalSettingValue\":{\"rules\":[{\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/projectOwner\"}]}, {\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceDBA\"}]}]}, \"title\":\"Project Owner -> Workspace DBA\", \"description\":\"The system defines the approval process, first the project Owner approves, then the DBA approves.\", \"creator\":\"users/[email protected]\"}, \"condition\":{\"expression\":\"source == \\\"DML\\\" && level == 300 || source == \\\"DDL\\\" && level == 300\"}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/projectOwner\"}]}]}, \"title\":\"Project Owner\", \"description\":\"The system defines the approval process and only needs the project Owner to approve it.\", \"creator\":\"users/[email protected]\"}, \"condition\":{\"expression\":\"source == \\\"DML\\\" && level == 0 || source == \\\"DDL\\\" && level == 200 || source == \\\"DDL\\\" &&\\nlevel == 0 || source == \\\"DML\\\" && level == 200 || source == \\\"DATA_EXPORT\\\" &&\\nlevel == 0 || source == \\\"REQUEST_QUERY\\\" && level == 0 || source == \\\"REQUEST_EXPORT\\\" &&\\nlevel == 0\"}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceDBA\"}]}]}, \"title\":\"Workspace DBA\", \"description\":\"The system defines the approval process and only needs DBA approval.\", \"creator\":\"users/[email protected]\"}, \"condition\":{}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceAdmin\"}]}]}, \"title\":\"Workspace Admin\", \"description\":\"The system defines the approval process and only needs Administrator approval.\", \"creator\":\"users/[email protected]\"}, \"condition\":{}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/projectOwner\"}]}, {\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceDBA\"}]}, {\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceAdmin\"}]}]}, \"title\":\"Project Owner -> Workspace DBA -> Workspace Admin\", \"description\":\"The system defines the approval process, first the project Owner approves, then the DBA approves, and finally the Administrator approves.\", \"creator\":\"users/[email protected]\"}, \"condition\":{}}]}}}", "severity": "INFO", "serviceData": {"name": "settings/bb.workspace.approval", "@type": "type.googleapis.com/bytebase.v1.Setting", "value": {"workspaceApprovalSettingValue": {"rules": [{"template": {"flow": {"steps": [{"type": "ANY", "nodes": [{"role": "roles/projectOwner", "type": "ANY_IN_GROUP"}]}, {"type": "ANY", "nodes": [{"role": "roles/workspaceDBA", "type": "ANY_IN_GROUP"}]}]}, "title": "Project Owner -> Workspace DBA", "creator": "users/[email protected]", "description": "The system defines the approval process, first the project Owner approves, then the DBA approves."}, "condition": {"expression": "source == \"DML\" && level == 300 || source == \"DDL\" && level == 300"}}, {"template": {"flow": {"steps": [{"type": "ANY", "nodes": [{"role": "roles/projectOwner", "type": "ANY_IN_GROUP"}]}]}, "title": "Project Owner", "creator": "users/[email protected]", "description": "The system defines the approval process and only needs the project Owner to approve it."}, "condition": {"expression": "source == \"DML\" && level == 0 || source == \"DDL\" && level == 200 || source == \"DDL\" &&\nlevel == 0 || source == \"DML\" && level == 200 || source == \"DATA_EXPORT\" &&\nlevel == 0 || source == \"REQUEST_QUERY\" && level == 0"}}, {"template": {"flow": {"steps": [{"type": "ANY", "nodes": [{"role": "roles/workspaceDBA", "type": "ANY_IN_GROUP"}]}]}, "title": "Workspace DBA", "creator": "users/[email protected]", "description": "The system defines the approval process and only needs DBA approval."}, "condition": {}}, {"template": {"flow": {"steps": [{"type": "ANY", "nodes": [{"role": "roles/workspaceAdmin", "type": "ANY_IN_GROUP"}]}]}, "title": "Workspace Admin", "creator": "users/[email protected]", "description": "The system defines the approval process and only needs Administrator approval."}, "condition": {}}, {"template": {"flow": {"steps": [{"type": "ANY", "nodes": [{"role": "roles/projectOwner", "type": "ANY_IN_GROUP"}]}, {"type": "ANY", "nodes": [{"role": "roles/workspaceDBA", "type": "ANY_IN_GROUP"}]}, {"type": "ANY", "nodes": [{"role": "roles/workspaceAdmin", "type": "ANY_IN_GROUP"}]}]}, "title": "Project Owner -> Workspace DBA -> Workspace Admin", "creator": "users/[email protected]", "description": "The system defines the approval process, first the project Owner approves, then the DBA approves, and finally the Administrator approves."}, "condition": {}}]}}}, "requestMetadata": {"callerIp": "[::1]:49799", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (180, '2025-05-26 08:48:05.008683+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.SettingService/UpdateSetting", "parent": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "request": "{\"setting\":{\"name\":\"settings/bb.workspace.approval\", \"value\":{\"workspaceApprovalSettingValue\":{\"rules\":[{\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/projectOwner\"}]}, {\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceDBA\"}]}]}, \"title\":\"Project Owner -> Workspace DBA\", \"description\":\"The system defines the approval process, first the project Owner approves, then the DBA approves.\", \"creator\":\"users/[email protected]\"}, \"condition\":{\"expression\":\"source == \\\"DML\\\" && level == 300 || source == \\\"DDL\\\" && level == 300\"}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/projectOwner\"}]}]}, \"title\":\"Project Owner\", \"description\":\"The system defines the approval process and only needs the project Owner to approve it.\", \"creator\":\"users/[email protected]\"}, \"condition\":{\"expression\":\"source == \\\"DML\\\" && level == 0 || source == \\\"DDL\\\" && level == 200 || source == \\\"DDL\\\" &&\\nlevel == 0 || source == \\\"DML\\\" && level == 200 || source == \\\"DATA_EXPORT\\\" &&\\nlevel == 0 || source == \\\"REQUEST_QUERY\\\" && level == 0 || source == \\\"REQUEST_EXPORT\\\" &&\\nlevel == 0 || source == \\\"CREATE_DATABASE\\\" && level == 0\"}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceDBA\"}]}]}, \"title\":\"Workspace DBA\", \"description\":\"The system defines the approval process and only needs DBA approval.\", \"creator\":\"users/[email protected]\"}, \"condition\":{}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceAdmin\"}]}]}, \"title\":\"Workspace Admin\", \"description\":\"The system defines the approval process and only needs Administrator approval.\", \"creator\":\"users/[email protected]\"}, \"condition\":{}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/projectOwner\"}]}, {\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceDBA\"}]}, {\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceAdmin\"}]}]}, \"title\":\"Project Owner -> Workspace DBA -> Workspace Admin\", \"description\":\"The system defines the approval process, first the project Owner approves, then the DBA approves, and finally the Administrator approves.\", \"creator\":\"users/[email protected]\"}, \"condition\":{}}]}}}, \"allowMissing\":true}", "resource": "settings/bb.workspace.approval", "response": "{\"name\":\"settings/bb.workspace.approval\", \"value\":{\"workspaceApprovalSettingValue\":{\"rules\":[{\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/projectOwner\"}]}, {\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceDBA\"}]}]}, \"title\":\"Project Owner -> Workspace DBA\", \"description\":\"The system defines the approval process, first the project Owner approves, then the DBA approves.\", \"creator\":\"users/[email protected]\"}, \"condition\":{\"expression\":\"source == \\\"DML\\\" && level == 300 || source == \\\"DDL\\\" && level == 300\"}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/projectOwner\"}]}]}, \"title\":\"Project Owner\", \"description\":\"The system defines the approval process and only needs the project Owner to approve it.\", \"creator\":\"users/[email protected]\"}, \"condition\":{\"expression\":\"source == \\\"DML\\\" && level == 0 || source == \\\"DDL\\\" && level == 200 || source == \\\"DDL\\\" &&\\nlevel == 0 || source == \\\"DML\\\" && level == 200 || source == \\\"DATA_EXPORT\\\" &&\\nlevel == 0 || source == \\\"REQUEST_QUERY\\\" && level == 0 || source == \\\"REQUEST_EXPORT\\\" &&\\nlevel == 0 || source == \\\"CREATE_DATABASE\\\" && level == 0\"}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceDBA\"}]}]}, \"title\":\"Workspace DBA\", \"description\":\"The system defines the approval process and only needs DBA approval.\", \"creator\":\"users/[email protected]\"}, \"condition\":{}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceAdmin\"}]}]}, \"title\":\"Workspace Admin\", \"description\":\"The system defines the approval process and only needs Administrator approval.\", \"creator\":\"users/[email protected]\"}, \"condition\":{}}, {\"template\":{\"flow\":{\"steps\":[{\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/projectOwner\"}]}, {\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceDBA\"}]}, {\"type\":\"ANY\", \"nodes\":[{\"type\":\"ANY_IN_GROUP\", \"role\":\"roles/workspaceAdmin\"}]}]}, \"title\":\"Project Owner -> Workspace DBA -> Workspace Admin\", \"description\":\"The system defines the approval process, first the project Owner approves, then the DBA approves, and finally the Administrator approves.\", \"creator\":\"users/[email protected]\"}, \"condition\":{}}]}}}", "severity": "INFO", "serviceData": {"name": "settings/bb.workspace.approval", "@type": "type.googleapis.com/bytebase.v1.Setting", "value": {"workspaceApprovalSettingValue": {"rules": [{"template": {"flow": {"steps": [{"type": "ANY", "nodes": [{"role": "roles/projectOwner", "type": "ANY_IN_GROUP"}]}, {"type": "ANY", "nodes": [{"role": "roles/workspaceDBA", "type": "ANY_IN_GROUP"}]}]}, "title": "Project Owner -> Workspace DBA", "creator": "users/[email protected]", "description": "The system defines the approval process, first the project Owner approves, then the DBA approves."}, "condition": {"expression": "source == \"DML\" && level == 300 || source == \"DDL\" && level == 300"}}, {"template": {"flow": {"steps": [{"type": "ANY", "nodes": [{"role": "roles/projectOwner", "type": "ANY_IN_GROUP"}]}]}, "title": "Project Owner", "creator": "users/[email protected]", "description": "The system defines the approval process and only needs the project Owner to approve it."}, "condition": {"expression": "source == \"DML\" && level == 0 || source == \"DDL\" && level == 200 || source == \"DDL\" &&\nlevel == 0 || source == \"DML\" && level == 200 || source == \"DATA_EXPORT\" &&\nlevel == 0 || source == \"REQUEST_QUERY\" && level == 0 || source == \"REQUEST_EXPORT\" &&\nlevel == 0"}}, {"template": {"flow": {"steps": [{"type": "ANY", "nodes": [{"role": "roles/workspaceDBA", "type": "ANY_IN_GROUP"}]}]}, "title": "Workspace DBA", "creator": "users/[email protected]", "description": "The system defines the approval process and only needs DBA approval."}, "condition": {}}, {"template": {"flow": {"steps": [{"type": "ANY", "nodes": [{"role": "roles/workspaceAdmin", "type": "ANY_IN_GROUP"}]}]}, "title": "Workspace Admin", "creator": "users/[email protected]", "description": "The system defines the approval process and only needs Administrator approval."}, "condition": {}}, {"template": {"flow": {"steps": [{"type": "ANY", "nodes": [{"role": "roles/projectOwner", "type": "ANY_IN_GROUP"}]}, {"type": "ANY", "nodes": [{"role": "roles/workspaceDBA", "type": "ANY_IN_GROUP"}]}, {"type": "ANY", "nodes": [{"role": "roles/workspaceAdmin", "type": "ANY_IN_GROUP"}]}]}, "title": "Project Owner -> Workspace DBA -> Workspace Admin", "creator": "users/[email protected]", "description": "The system defines the approval process, first the project Owner approves, then the DBA approves, and finally the Administrator approves."}, "condition": {}}]}}}, "requestMetadata": {"callerIp": "[::1]:49799", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (181, '2025-06-05 07:04:57.22349+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.AuthService/Login", "parent": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "request": "{\"email\":\"[email protected]\", \"web\":true}", "resource": "[email protected]", "response": "{\"user\":{\"name\":\"users/101\", \"email\":\"[email protected]\", \"title\":\"Demo\", \"userType\":\"USER\"}}", "severity": "INFO", "requestMetadata": {"callerIp": "[::1]:58691", "callerSuppliedUserAgent": "grpc-go/1.72.2"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (182, '2025-06-09 02:20:35.270694+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.AuthService/Login", "parent": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "request": "{\"email\":\"[email protected]\",\"web\":true}", "resource": "[email protected]", "response": "{\"user\":{\"name\":\"users/101\",\"email\":\"[email protected]\",\"title\":\"Demo\",\"userType\":\"USER\"}}", "severity": "INFO", "requestMetadata": {"callerIp": "[::1]:56360", "callerSuppliedUserAgent": "grpc-go/1.72.2"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (185, '2025-06-09 02:21:07.597633+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.DatabaseService/UpdateDatabase", "parent": "projects/hr", "request": "{\"database\":{\"name\":\"instances/test-sample-instance/databases/hr_test\",\"state\":\"ACTIVE\",\"successfulSyncTime\":\"2025-06-05T07:08:02.306591Z\",\"project\":\"projects/hr\",\"environment\":\"environments/test\",\"effectiveEnvironment\":\"environments/test\",\"instanceResource\":{\"title\":\"Test Sample Instance\",\"engine\":\"POSTGRES\",\"engineVersion\":\"16.0.0\",\"dataSources\":[{\"id\":\"a7f206f9-37c4-41ca-8b59-fcf4c6148105\",\"type\":\"ADMIN\",\"username\":\"bbsample\",\"host\":\"/tmp\",\"port\":\"8083\",\"authenticationType\":\"PASSWORD\",\"redisType\":\"STANDALONE\"}],\"activation\":true,\"name\":\"instances/test-sample-instance\",\"environment\":\"environments/test\"},\"backupAvailable\":true},\"updateMask\":\"drifted\"}", "resource": "instances/test-sample-instance/databases/hr_test", "response": "{\"name\":\"instances/test-sample-instance/databases/hr_test\",\"state\":\"ACTIVE\",\"successfulSyncTime\":\"2025-06-05T07:08:02.306591Z\",\"project\":\"projects/hr\",\"effectiveEnvironment\":\"environments/test\",\"instanceResource\":{\"title\":\"Test Sample Instance\",\"engine\":\"POSTGRES\",\"engineVersion\":\"16.0.0\",\"dataSources\":[{\"id\":\"a7f206f9-37c4-41ca-8b59-fcf4c6148105\",\"type\":\"ADMIN\",\"username\":\"bbsample\",\"host\":\"/tmp\",\"port\":\"8083\",\"authenticationType\":\"PASSWORD\",\"redisType\":\"STANDALONE\"}],\"activation\":true,\"name\":\"instances/test-sample-instance\",\"environment\":\"environments/test\"},\"backupAvailable\":true}", "severity": "INFO", "requestMetadata": {"callerIp": "[::1]:56353", "callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (186, '2025-09-09 03:25:51.338104+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.AuthService/Login", "parent": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "latency": "0.092258458s", "request": "{\"email\":\"[email protected]\",\"web\":true}", "resource": "[email protected]", "response": "{\"user\":{\"name\":\"users/101\",\"email\":\"[email protected]\",\"title\":\"Demo\",\"userType\":\"USER\"}}", "severity": "INFO", "requestMetadata": {"callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (187, '2025-09-09 03:27:04.928131+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.DatabaseService/UpdateDatabase", "parent": "projects/hr", "latency": "0.045281250s", "request": "{\"database\":{\"name\":\"instances/prod-sample-instance/databases/hr_prod\",\"state\":\"ACTIVE\",\"successfulSyncTime\":\"2025-06-05T07:08:02.301195Z\",\"project\":\"projects/hr\",\"environment\":\"environments/prod\",\"effectiveEnvironment\":\"environments/prod\",\"instanceResource\":{\"title\":\"Prod Sample Instance\",\"engine\":\"POSTGRES\",\"engineVersion\":\"16.0.0\",\"dataSources\":[{\"id\":\"9af4f227-a55e-4e82-b7f5-c7193b5f405c\",\"type\":\"ADMIN\",\"username\":\"bbsample\",\"host\":\"/tmp\",\"port\":\"8084\",\"authenticationType\":\"PASSWORD\",\"redisType\":\"STANDALONE\"},{\"id\":\"e700ae12-173e-4f0d-8590-0414cf6a9405\",\"type\":\"READ_ONLY\",\"username\":\"bbsample\",\"host\":\"/tmp\",\"port\":\"8084\",\"authenticationType\":\"PASSWORD\",\"redisType\":\"STANDALONE\"}],\"activation\":true,\"name\":\"instances/prod-sample-instance\",\"environment\":\"environments/prod\"},\"backupAvailable\":true},\"updateMask\":\"drifted\"}", "resource": "instances/prod-sample-instance/databases/hr_prod", "response": "{\"name\":\"instances/prod-sample-instance/databases/hr_prod\",\"state\":\"ACTIVE\",\"successfulSyncTime\":\"2025-09-09T03:27:04.921330Z\",\"project\":\"projects/hr\",\"effectiveEnvironment\":\"environments/prod\",\"instanceResource\":{\"title\":\"Prod Sample Instance\",\"engine\":\"POSTGRES\",\"engineVersion\":\"16.0.0\",\"dataSources\":[{\"id\":\"9af4f227-a55e-4e82-b7f5-c7193b5f405c\",\"type\":\"ADMIN\",\"username\":\"bbsample\",\"host\":\"/tmp\",\"port\":\"8084\",\"authenticationType\":\"PASSWORD\",\"redisType\":\"STANDALONE\"},{\"id\":\"e700ae12-173e-4f0d-8590-0414cf6a9405\",\"type\":\"READ_ONLY\",\"username\":\"bbsample\",\"host\":\"/tmp\",\"port\":\"8084\",\"authenticationType\":\"PASSWORD\",\"redisType\":\"STANDALONE\"}],\"activation\":true,\"name\":\"instances/prod-sample-instance\",\"environment\":\"environments/prod\"},\"backupAvailable\":true}", "severity": "INFO", "requestMetadata": {"callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (188, '2025-09-09 03:27:11.850022+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.DatabaseService/UpdateDatabase", "parent": "projects/hr", "latency": "0.049809208s", "request": "{\"database\":{\"name\":\"instances/test-sample-instance/databases/hr_test\",\"state\":\"ACTIVE\",\"successfulSyncTime\":\"2025-06-05T07:08:02.306591Z\",\"project\":\"projects/hr\",\"environment\":\"environments/test\",\"effectiveEnvironment\":\"environments/test\",\"instanceResource\":{\"title\":\"Test Sample Instance\",\"engine\":\"POSTGRES\",\"engineVersion\":\"16.0.0\",\"dataSources\":[{\"id\":\"a7f206f9-37c4-41ca-8b59-fcf4c6148105\",\"type\":\"ADMIN\",\"username\":\"bbsample\",\"host\":\"/tmp\",\"port\":\"8083\",\"authenticationType\":\"PASSWORD\",\"redisType\":\"STANDALONE\"}],\"activation\":true,\"name\":\"instances/test-sample-instance\",\"environment\":\"environments/test\"},\"backupAvailable\":true},\"updateMask\":\"drifted\"}", "resource": "instances/test-sample-instance/databases/hr_test", "response": "{\"name\":\"instances/test-sample-instance/databases/hr_test\",\"state\":\"ACTIVE\",\"successfulSyncTime\":\"2025-09-09T03:27:11.843520Z\",\"project\":\"projects/hr\",\"effectiveEnvironment\":\"environments/test\",\"instanceResource\":{\"title\":\"Test Sample Instance\",\"engine\":\"POSTGRES\",\"engineVersion\":\"16.0.0\",\"dataSources\":[{\"id\":\"a7f206f9-37c4-41ca-8b59-fcf4c6148105\",\"type\":\"ADMIN\",\"username\":\"bbsample\",\"host\":\"/tmp\",\"port\":\"8083\",\"authenticationType\":\"PASSWORD\",\"redisType\":\"STANDALONE\"}],\"activation\":true,\"name\":\"instances/test-sample-instance\",\"environment\":\"environments/test\"},\"backupAvailable\":true}", "severity": "INFO", "requestMetadata": {"callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (189, '2025-10-10 07:13:53.406615+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.AuthService/Login", "parent": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "latency": "0.078084416s", "request": "{\"email\":\"[email protected]\",\"web\":true}", "resource": "[email protected]", "response": "{\"user\":{\"name\":\"users/101\",\"email\":\"[email protected]\",\"title\":\"Demo\",\"userType\":\"USER\"}}", "severity": "INFO", "requestMetadata": {"callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36 Edg/141.0.0.0"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (190, '2025-10-10 07:15:40.836602+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.DatabaseService/UpdateDatabase", "parent": "projects/hr", "latency": "0.029922417s", "request": "{\"database\":{\"name\":\"instances/prod-sample-instance/databases/hr_prod\",\"state\":\"ACTIVE\",\"successfulSyncTime\":\"2025-10-10T07:14:57.127856Z\",\"project\":\"projects/hr\",\"environment\":\"environments/prod\",\"effectiveEnvironment\":\"environments/prod\",\"instanceResource\":{\"title\":\"Prod Sample Instance\",\"engine\":\"POSTGRES\",\"engineVersion\":\"16.0.0\",\"dataSources\":[{\"id\":\"9af4f227-a55e-4e82-b7f5-c7193b5f405c\",\"type\":\"ADMIN\",\"username\":\"bbsample\",\"host\":\"/tmp\",\"port\":\"8084\",\"authenticationType\":\"PASSWORD\",\"redisType\":\"STANDALONE\"},{\"id\":\"e700ae12-173e-4f0d-8590-0414cf6a9405\",\"type\":\"READ_ONLY\",\"username\":\"bbsample\",\"host\":\"/tmp\",\"port\":\"8084\",\"authenticationType\":\"PASSWORD\",\"redisType\":\"STANDALONE\"}],\"activation\":true,\"name\":\"instances/prod-sample-instance\",\"environment\":\"environments/prod\"},\"backupAvailable\":true},\"updateMask\":\"drifted\"}", "resource": "instances/prod-sample-instance/databases/hr_prod", "response": "{\"name\":\"instances/prod-sample-instance/databases/hr_prod\",\"state\":\"ACTIVE\",\"successfulSyncTime\":\"2025-10-10T07:15:40.832105Z\",\"project\":\"projects/hr\",\"effectiveEnvironment\":\"environments/prod\",\"instanceResource\":{\"title\":\"Prod Sample Instance\",\"engine\":\"POSTGRES\",\"engineVersion\":\"16.0.0\",\"dataSources\":[{\"id\":\"9af4f227-a55e-4e82-b7f5-c7193b5f405c\",\"type\":\"ADMIN\",\"username\":\"bbsample\",\"host\":\"/tmp\",\"port\":\"8084\",\"authenticationType\":\"PASSWORD\",\"redisType\":\"STANDALONE\"},{\"id\":\"e700ae12-173e-4f0d-8590-0414cf6a9405\",\"type\":\"READ_ONLY\",\"username\":\"bbsample\",\"host\":\"/tmp\",\"port\":\"8084\",\"authenticationType\":\"PASSWORD\",\"redisType\":\"STANDALONE\"}],\"activation\":true,\"name\":\"instances/prod-sample-instance\",\"environment\":\"environments/prod\"},\"backupAvailable\":true}", "severity": "INFO", "requestMetadata": {"callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36 Edg/141.0.0.0"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (191, '2025-10-10 07:15:45.142666+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.DatabaseService/UpdateDatabase", "parent": "projects/hr", "latency": "0.037116417s", "request": "{\"database\":{\"name\":\"instances/test-sample-instance/databases/hr_test\",\"state\":\"ACTIVE\",\"successfulSyncTime\":\"2025-10-10T07:14:57.127853Z\",\"project\":\"projects/hr\",\"environment\":\"environments/test\",\"effectiveEnvironment\":\"environments/test\",\"instanceResource\":{\"title\":\"Test Sample Instance\",\"engine\":\"POSTGRES\",\"engineVersion\":\"16.0.0\",\"dataSources\":[{\"id\":\"a7f206f9-37c4-41ca-8b59-fcf4c6148105\",\"type\":\"ADMIN\",\"username\":\"bbsample\",\"host\":\"/tmp\",\"port\":\"8083\",\"authenticationType\":\"PASSWORD\",\"redisType\":\"STANDALONE\"}],\"activation\":true,\"name\":\"instances/test-sample-instance\",\"environment\":\"environments/test\"},\"backupAvailable\":true},\"updateMask\":\"drifted\"}", "resource": "instances/test-sample-instance/databases/hr_test", "response": "{\"name\":\"instances/test-sample-instance/databases/hr_test\",\"state\":\"ACTIVE\",\"successfulSyncTime\":\"2025-10-10T07:15:45.139052Z\",\"project\":\"projects/hr\",\"effectiveEnvironment\":\"environments/test\",\"instanceResource\":{\"title\":\"Test Sample Instance\",\"engine\":\"POSTGRES\",\"engineVersion\":\"16.0.0\",\"dataSources\":[{\"id\":\"a7f206f9-37c4-41ca-8b59-fcf4c6148105\",\"type\":\"ADMIN\",\"username\":\"bbsample\",\"host\":\"/tmp\",\"port\":\"8083\",\"authenticationType\":\"PASSWORD\",\"redisType\":\"STANDALONE\"}],\"activation\":true,\"name\":\"instances/test-sample-instance\",\"environment\":\"environments/test\"},\"backupAvailable\":true}", "severity": "INFO", "requestMetadata": {"callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36 Edg/141.0.0.0"}}') ON CONFLICT DO NOTHING;
-INSERT INTO public.audit_log (id, created_at, payload) VALUES (192, '2025-10-13 22:55:22.871747+00', '{"user": "users/[email protected]", "method": "/bytebase.v1.AuthService/Login", "parent": "workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48", "latency": "0.092679833s", "request": "{\"email\":\"[email protected]\",\"web\":true}", "resource": "[email protected]", "response": "{\"user\":{\"name\":\"users/101\",\"email\":\"[email protected]\",\"title\":\"Demo\",\"userType\":\"USER\"}}", "severity": "INFO", "requestMetadata": {"callerSuppliedUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36"}}') ON CONFLICT DO NOTHING;
-
-
---
--- Data for Name: changelog; Type: TABLE DATA; Schema: public; Owner: -
---
-
-INSERT INTO public.changelog (id, created_at, instance, db_name, status, sync_history_id, payload) VALUES (101, '2025-05-26 08:27:15.376781+00', 'prod-sample-instance', 'hr_prod', 'DONE', 101, '{"type": "BASELINE", "gitCommit": "unknown"}') ON CONFLICT DO NOTHING;
-INSERT INTO public.changelog (id, created_at, instance, db_name, status, sync_history_id, payload) VALUES (102, '2025-05-26 08:27:35.257981+00', 'test-sample-instance', 'hr_test', 'DONE', 102, '{"type": "BASELINE", "gitCommit": "unknown"}') ON CONFLICT DO NOTHING;
-INSERT INTO public.changelog (id, created_at, instance, db_name, status, sync_history_id, payload) VALUES (103, '2025-06-09 02:21:04.276704+00', 'prod-sample-instance', 'hr_prod', 'DONE', 103, '{"type": "BASELINE", "gitCommit": "unknown"}') ON CONFLICT DO NOTHING;
-INSERT INTO public.changelog (id, created_at, instance, db_name, status, sync_history_id, payload) VALUES (104, '2025-06-09 02:21:07.596692+00', 'test-sample-instance', 'hr_test', 'DONE', 104, '{"type": "BASELINE", "gitCommit": "unknown"}') ON CONFLICT DO NOTHING;
-INSERT INTO public.changelog (id, created_at, instance, db_name, status, sync_history_id, payload) VALUES (105, '2025-09-09 03:27:04.925923+00', 'prod-sample-instance', 'hr_prod', 'DONE', 105, '{"type": "BASELINE", "gitCommit": "unknown"}') ON CONFLICT DO NOTHING;
-INSERT INTO public.changelog (id, created_at, instance, db_name, status, sync_history_id, payload) VALUES (106, '2025-09-09 03:27:11.848726+00', 'test-sample-instance', 'hr_test', 'DONE', 106, '{"type": "BASELINE", "gitCommit": "unknown"}') ON CONFLICT DO NOTHING;
-INSERT INTO public.changelog (id, created_at, instance, db_name, status, sync_history_id, payload) VALUES (107, '2025-10-10 07:15:40.835471+00', 'prod-sample-instance', 'hr_prod', 'DONE', 107, '{"type": "BASELINE", "gitCommit": "unknown"}') ON CONFLICT DO NOTHING;
-INSERT INTO public.changelog (id, created_at, instance, db_name, status, sync_history_id, payload) VALUES (108, '2025-10-10 07:15:45.142133+00', 'test-sample-instance', 'hr_test', 'DONE', 108, '{"type": "BASELINE", "gitCommit": "unknown"}') ON CONFLICT DO NOTHING;
-
-
---
--- Data for Name: db; Type: TABLE DATA; Schema: public; Owner: -
---
-
-INSERT INTO public.db (deleted, project, instance, name, environment, metadata) VALUES (false, 'default', 'prod-sample-instance', 'postgres', NULL, '{"lastSyncTime": "2025-06-05T07:08:02.311361Z"}') ON CONFLICT DO NOTHING;
-INSERT INTO public.db (deleted, project, instance, name, environment, metadata) VALUES (false, 'metadb', 'bytebase-meta', 'bb', NULL, '{"lastSyncTime": "2025-06-05T07:08:02.312662Z"}') ON CONFLICT DO NOTHING;
-INSERT INTO public.db (deleted, project, instance, name, environment, metadata) VALUES (false, 'default', 'test-sample-instance', 'postgres', NULL, '{"lastSyncTime": "2025-06-05T07:08:02.313191Z"}') ON CONFLICT DO NOTHING;
-INSERT INTO public.db (deleted, project, instance, name, environment, metadata) VALUES (false, 'default', 'bytebase-meta', 'postgres', NULL, '{"lastSyncTime": "2025-06-05T07:08:02.316233Z"}') ON CONFLICT DO NOTHING;
-INSERT INTO public.db (deleted, project, instance, name, environment, metadata) VALUES (false, 'hr', 'prod-sample-instance', 'hr_prod', NULL, '{"lastSyncTime": "2025-10-10T07:15:40.832105Z", "backupAvailable": true}') ON CONFLICT DO NOTHING;
-INSERT INTO public.db (deleted, project, instance, name, environment, metadata) VALUES (false, 'hr', 'test-sample-instance', 'hr_test', NULL, '{"lastSyncTime": "2025-10-10T07:15:45.139052Z", "backupAvailable": true}') ON CONFLICT DO NOTHING;
-
-
---
--- Data for Name: db_group; Type: TABLE DATA; Schema: public; Owner: -
---
-
-
-
---
--- Data for Name: db_schema; Type: TABLE DATA; Schema: public; Owner: -
---
-
-INSERT INTO public.db_schema (instance, db_name, metadata, raw_dump, config) VALUES ('bytebase-meta', 'bb', '{"name":"bb","schemas":[{"name":"public","tables":[{"name":"audit_log","columns":[{"name":"id","position":1,"default":"nextval(''public.audit_log_id_seq''::regclass)","type":"bigint"},{"name":"created_at","position":2,"default":"now()","type":"timestamp with time zone"},{"name":"payload","position":3,"default":"''{}''::jsonb","type":"jsonb"}],"indexes":[{"name":"audit_log_pkey","expressions":["id"],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX audit_log_pkey ON public.audit_log USING btree (id);","isConstraint":true},{"name":"idx_audit_log_created_at","expressions":["created_at"],"type":"btree","definition":"CREATE INDEX idx_audit_log_created_at ON public.audit_log USING btree (created_at);"},{"name":"idx_audit_log_payload_method","expressions":["payload ->> ''method''::text"],"type":"btree","definition":"CREATE INDEX idx_audit_log_payload_method ON public.audit_log USING btree (((payload ->> ''method''::text)));"},{"name":"idx_audit_log_payload_parent","expressions":["payload ->> ''parent''::text"],"type":"btree","definition":"CREATE INDEX idx_audit_log_payload_parent ON public.audit_log USING btree (((payload ->> ''parent''::text)));"},{"name":"idx_audit_log_payload_resource","expressions":["payload ->> ''resource''::text"],"type":"btree","definition":"CREATE INDEX idx_audit_log_payload_resource ON public.audit_log USING btree (((payload ->> ''resource''::text)));"},{"name":"idx_audit_log_payload_user","expressions":["payload ->> ''user''::text"],"type":"btree","definition":"CREATE INDEX idx_audit_log_payload_user ON public.audit_log USING btree (((payload ->> ''user''::text)));"}],"rowCount":"81","dataSize":"139264","indexSize":"98304","owner":"bb"},{"name":"changelist","columns":[{"name":"id","position":1,"default":"nextval(''public.changelist_id_seq''::regclass)","type":"integer"},{"name":"creator_id","position":2,"type":"integer"},{"name":"updated_at","position":3,"default":"now()","type":"timestamp with time zone"},{"name":"project","position":4,"type":"text"},{"name":"name","position":5,"type":"text"},{"name":"payload","position":6,"default":"''{}''::jsonb","type":"jsonb"}],"indexes":[{"name":"changelist_pkey","expressions":["id"],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX changelist_pkey ON public.changelist USING btree (id);","isConstraint":true},{"name":"idx_changelist_project_name","expressions":["project","name"],"type":"btree","unique":true,"definition":"CREATE UNIQUE INDEX idx_changelist_project_name ON public.changelist USING btree (project, name);"}],"dataSize":"8192","indexSize":"16384","foreignKeys":[{"name":"changelist_creator_id_fkey","columns":["creator_id"],"referencedSchema":"public","referencedTable":"principal","referencedColumns":["id"],"onDelete":"NO ACTION","onUpdate":"NO ACTION","matchType":"SIMPLE"},{"name":"changelist_project_fkey","columns":["project"],"referencedSchema":"public","referencedTable":"project","referencedColumns":["resource_id"],"onDelete":"NO ACTION","onUpdate":"NO ACTION","matchType":"SIMPLE"}],"owner":"bb"},{"name":"changelog","columns":[{"name":"id","position":1,"default":"nextval(''public.changelog_id_seq''::regclass)","type":"bigint"},{"name":"created_at","position":2,"default":"now()","type":"timestamp with time zone"},{"name":"instance","position":3,"type":"text"},{"name":"db_name","position":4,"type":"text"},{"name":"status","position":5,"type":"text"},{"name":"prev_sync_history_id","position":6,"nullable":true,"type":"bigint"},{"name":"sync_history_id","position":7,"nullable":true,"type":"bigint"},{"name":"payload","position":8,"default":"''{}''::jsonb","type":"jsonb"}],"indexes":[{"name":"changelog_pkey","expressions":["id"],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX changelog_pkey ON public.changelog USING btree (id);","isConstraint":true},{"name":"idx_changelog_instance_db_name","expressions":["instance","db_name"],"type":"btree","definition":"CREATE INDEX idx_changelog_instance_db_name ON public.changelog USING btree (instance, db_name);"}],"rowCount":"2","dataSize":"16384","indexSize":"32768","foreignKeys":[{"name":"changelog_instance_db_name_fkey","columns":["instance","db_name"],"referencedSchema":"public","referencedTable":"db","referencedColumns":["instance","name"],"onDelete":"NO ACTION","onUpdate":"NO ACTION","matchType":"SIMPLE"},{"name":"changelog_prev_sync_history_id_fkey","columns":["prev_sync_history_id"],"referencedSchema":"public","referencedTable":"sync_history","referencedColumns":["id"],"onDelete":"NO ACTION","onUpdate":"NO ACTION","matchType":"SIMPLE"},{"name":"changelog_sync_history_id_fkey","columns":["sync_history_id"],"referencedSchema":"public","referencedTable":"sync_history","referencedColumns":["id"],"onDelete":"NO ACTION","onUpdate":"NO ACTION","matchType":"SIMPLE"}],"checkConstraints":[{"name":"changelog_status_check","expression":"(status = ANY (ARRAY[''PENDING''::text, ''DONE''::text, ''FAILED''::text]))"}],"owner":"bb"},{"name":"data_source","columns":[{"name":"id","position":1,"default":"nextval(''public.data_source_id_seq''::regclass)","type":"integer"},{"name":"instance","position":2,"type":"text"},{"name":"options","position":3,"default":"''{}''::jsonb","type":"jsonb"}],"indexes":[{"name":"data_source_pkey","expressions":["id"],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX data_source_pkey ON public.data_source USING btree (id);","isConstraint":true}],"dataSize":"8192","indexSize":"8192","foreignKeys":[{"name":"data_source_instance_fkey","columns":["instance"],"referencedSchema":"public","referencedTable":"instance","referencedColumns":["resource_id"],"onDelete":"NO ACTION","onUpdate":"NO ACTION","matchType":"SIMPLE"}],"owner":"bb"},{"name":"db","columns":[{"name":"id","position":1,"default":"nextval(''public.db_id_seq''::regclass)","type":"integer"},{"name":"deleted","position":2,"default":"false","type":"boolean"},{"name":"project","position":3,"type":"text"},{"name":"instance","position":4,"type":"text"},{"name":"name","position":5,"type":"text"},{"name":"environment","position":6,"nullable":true,"type":"text"},{"name":"metadata","position":7,"default":"''{}''::jsonb","type":"jsonb"}],"indexes":[{"name":"db_pkey","expressions":["id"],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX db_pkey ON public.db USING btree (id);","isConstraint":true},{"name":"idx_db_project","expressions":["project"],"type":"btree","definition":"CREATE INDEX idx_db_project ON public.db USING btree (project);"},{"name":"idx_db_unique_instance_name","expressions":["instance","name"],"type":"btree","unique":true,"definition":"CREATE UNIQUE INDEX idx_db_unique_instance_name ON public.db USING btree (instance, name);"}],"rowCount":"6","dataSize":"16384","indexSize":"49152","foreignKeys":[{"name":"db_instance_fkey","columns":["instance"],"referencedSchema":"public","referencedTable":"instance","referencedColumns":["resource_id"],"onDelete":"NO ACTION","onUpdate":"NO ACTION","matchType":"SIMPLE"},{"name":"db_project_fkey","columns":["project"],"referencedSchema":"public","referencedTable":"project","referencedColumns":["resource_id"],"onDelete":"NO ACTION","onUpdate":"NO ACTION","matchType":"SIMPLE"}],"owner":"bb"},{"name":"db_group","columns":[{"name":"id","position":1,"default":"nextval(''public.db_group_id_seq''::regclass)","type":"bigint"},{"name":"project","position":2,"type":"text"},{"name":"resource_id","position":3,"type":"text"},{"name":"placeholder","position":4,"default":"''''::text","type":"text"},{"name":"expression","position":5,"default":"''{}''::jsonb","type":"jsonb"},{"name":"payload","position":6,"default":"''{}''::jsonb","type":"jsonb"}],"indexes":[{"name":"db_group_pkey","expressions":["id"],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX db_group_pkey ON public.db_group USING btree (id);","isConstraint":true},{"name":"idx_db_group_unique_project_placeholder","expressions":["project","placeholder"],"type":"btree","unique":true,"definition":"CREATE UNIQUE INDEX idx_db_group_unique_project_placeholder ON public.db_group USING btree (project, placeholder);"},{"name":"idx_db_group_unique_project_resource_id","expressions":["project","resource_id"],"type":"btree","unique":true,"definition":"CREATE UNIQUE INDEX idx_db_group_unique_project_resource_id ON public.db_group USING btree (project, resource_id);"}],"dataSize":"8192","indexSize":"24576","foreignKeys":[{"name":"db_group_project_fkey","columns":["project"],"referencedSchema":"public","referencedTable":"project","referencedColumns":["resource_id"],"onDelete":"NO ACTION","onUpdate":"NO ACTION","matchType":"SIMPLE"}],"owner":"bb"},{"name":"db_schema","columns":[{"name":"id","position":1,"default":"nextval(''public.db_schema_id_seq''::regclass)","type":"integer"},{"name":"instance","position":2,"type":"text"},{"name":"db_name","position":3,"type":"text"},{"name":"metadata","position":4,"default":"''{}''::json","type":"json"},{"name":"raw_dump","position":5,"default":"''''::text","type":"text"},{"name":"config","position":6,"default":"''{}''::jsonb","type":"jsonb"}],"indexes":[{"name":"db_schema_pkey","expressions":["id"],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX db_schema_pkey ON public.db_schema USING btree (id);","isConstraint":true},{"name":"idx_db_schema_unique_instance_db_name","expressions":["instance","db_name"],"type":"btree","unique":true,"definition":"CREATE UNIQUE INDEX idx_db_schema_unique_instance_db_name ON public.db_schema USING btree (instance, db_name);"}],"rowCount":"6","dataSize":"73728","indexSize":"32768","foreignKeys":[{"name":"db_schema_instance_db_name_fkey","columns":["instance","db_name"],"referencedSchema":"public","referencedTable":"db","referencedColumns":["instance","name"],"onDelete":"NO ACTION","onUpdate":"NO ACTION","matchType":"SIMPLE"}],"owner":"bb"},{"name":"export_archive","columns":[{"name":"id","position":1,"default":"nextval(''public.export_archive_id_seq''::regclass)","type":"integer"},{"name":"created_at","position":2,"default":"now()","type":"timestamp with time zone"},{"name":"bytes","position":3,"nullable":true,"type":"bytea"},{"name":"payload","position":4,"default":"''{}''::jsonb","type":"jsonb"}],"indexes":[{"name":"export_archive_pkey","expressions":["id"],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX export_archive_pkey ON public.export_archive USING btree (id);","isConstraint":true}],"dataSize":"8192","indexSize":"8192","owner":"bb"},{"name":"idp","columns":[{"name":"id","position":1,"default":"nextval(''public.idp_id_seq''::regclass)","type":"integer"},{"name":"resource_id","position":2,"type":"text"},{"name":"name","position":3,"type":"text"},{"name":"domain","position":4,"type":"text"},{"name":"type","position":5,"type":"text"},{"name":"config","position":6,"default":"''{}''::jsonb","type":"jsonb"}],"indexes":[{"name":"idp_pkey","expressions":["id"],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX idp_pkey ON public.idp USING btree (id);","isConstraint":true},{"name":"idx_idp_unique_resource_id","expressions":["resource_id"],"type":"btree","unique":true,"definition":"CREATE UNIQUE INDEX idx_idp_unique_resource_id ON public.idp USING btree (resource_id);"}],"dataSize":"8192","indexSize":"16384","checkConstraints":[{"name":"idp_type_check","expression":"(type = ANY (ARRAY[''OAUTH2''::text, ''OIDC''::text, ''LDAP''::text]))"}],"owner":"bb"},{"name":"instance","columns":[{"name":"id","position":1,"default":"nextval(''public.instance_id_seq''::regclass)","type":"integer"},{"name":"deleted","position":2,"default":"false","type":"boolean"},{"name":"environment","position":3,"nullable":true,"type":"text"},{"name":"resource_id","position":4,"type":"text"},{"name":"metadata","position":5,"default":"''{}''::jsonb","type":"jsonb"}],"indexes":[{"name":"idx_instance_unique_resource_id","expressions":["resource_id"],"type":"btree","unique":true,"definition":"CREATE UNIQUE INDEX idx_instance_unique_resource_id ON public.instance USING btree (resource_id);"},{"name":"instance_pkey","expressions":["id"],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX instance_pkey ON public.instance USING btree (id);","isConstraint":true}],"rowCount":"3","dataSize":"16384","indexSize":"32768","owner":"bb"},{"name":"instance_change_history","columns":[{"name":"id","position":1,"default":"nextval(''public.instance_change_history_id_seq''::regclass)","type":"bigint"},{"name":"version","position":2,"type":"text"}],"indexes":[{"name":"idx_instance_change_history_unique_version","expressions":["version"],"type":"btree","unique":true,"definition":"CREATE UNIQUE INDEX idx_instance_change_history_unique_version ON public.instance_change_history USING btree (version);"},{"name":"instance_change_history_pkey","expressions":["id"],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX instance_change_history_pkey ON public.instance_change_history USING btree (id);","isConstraint":true}],"rowCount":"1","dataSize":"16384","indexSize":"32768","owner":"bb"},{"name":"issue","columns":[{"name":"id","position":1,"default":"nextval(''public.issue_id_seq''::regclass)","type":"integer"},{"name":"creator_id","position":2,"type":"integer"},{"name":"created_at","position":3,"default":"now()","type":"timestamp with time zone"},{"name":"updated_at","position":4,"default":"now()","type":"timestamp with time zone"},{"name":"project","position":5,"type":"text"},{"name":"plan_id","position":6,"nullable":true,"type":"bigint"},{"name":"pipeline_id","position":7,"nullable":true,"type":"integer"},{"name":"name","position":8,"type":"text"},{"name":"status","position":9,"type":"text"},{"name":"type","position":10,"type":"text"},{"name":"description","position":11,"default":"''''::text","type":"text"},{"name":"payload","position":12,"default":"''{}''::jsonb","type":"jsonb"},{"name":"ts_vector","position":13,"nullable":true,"type":"tsvector"}],"indexes":[{"name":"idx_issue_creator_id","expressions":["creator_id"],"type":"btree","definition":"CREATE INDEX idx_issue_creator_id ON public.issue USING btree (creator_id);"},{"name":"idx_issue_pipeline_id","expressions":["pipeline_id"],"type":"btree","definition":"CREATE INDEX idx_issue_pipeline_id ON public.issue USING btree (pipeline_id);"},{"name":"idx_issue_plan_id","expressions":["plan_id"],"type":"btree","definition":"CREATE INDEX idx_issue_plan_id ON public.issue USING btree (plan_id);"},{"name":"idx_issue_project","expressions":["project"],"type":"btree","definition":"CREATE INDEX idx_issue_project ON public.issue USING btree (project);"},{"name":"idx_issue_ts_vector","expressions":["ts_vector"],"type":"gin","definition":"CREATE INDEX idx_issue_ts_vector ON public.issue USING gin (ts_vector);"},{"name":"issue_pkey","expressions":["id"],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX issue_pkey ON public.issue USING btree (id);","isConstraint":true}],"rowCount":"1","dataSize":"16384","indexSize":"98304","foreignKeys":[{"name":"issue_creator_id_fkey","columns":["creator_id"],"referencedSchema":"public","referencedTable":"principal","referencedColumns":["id"],"onDelete":"NO ACTION","onUpdate":"NO ACTION","matchType":"SIMPLE"},{"name":"issue_pipeline_id_fkey","columns":["pipeline_id"],"referencedSchema":"public","referencedTable":"pipeline","referencedColumns":["id"],"onDelete":"NO ACTION","onUpdate":"NO ACTION","matchType":"SIMPLE"},{"name":"issue_plan_id_fkey","columns":["plan_id"],"referencedSchema":"public","referencedTable":"plan","referencedColumns":["id"],"onDelete":"NO ACTION","onUpdate":"NO ACTION","matchType":"SIMPLE"},{"name":"issue_project_fkey","columns":["project"],"referencedSchema":"public","referencedTable":"project","referencedColumns":["resource_id"],"onDelete":"NO ACTION","onUpdate":"NO ACTION","matchType":"SIMPLE"}],"checkConstraints":[{"name":"issue_status_check","expression":"(status = ANY (ARRAY[''OPEN''::text, ''DONE''::text, ''CANCELED''::text]))"}],"owner":"bb"},{"name":"issue_comment","columns":[{"name":"id","position":1,"default":"nextval(''public.issue_comment_id_seq''::regclass)","type":"bigint"},{"name":"creator_id","position":2,"type":"integer"},{"name":"created_at","position":3,"default":"now()","type":"timestamp with time zone"},{"name":"updated_at","position":4,"default":"now()","type":"timestamp with time zone"},{"name":"issue_id","position":5,"type":"integer"},{"name":"payload","position":6,"default":"''{}''::jsonb","type":"jsonb"}],"indexes":[{"name":"idx_issue_comment_issue_id","expressions":["issue_id"],"type":"btree","definition":"CREATE INDEX idx_issue_comment_issue_id ON public.issue_comment USING btree (issue_id);"},{"name":"issue_comment_pkey","expressions":["id"],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX issue_comment_pkey ON public.issue_comment USING btree (id);","isConstraint":true}],"dataSize":"8192","indexSize":"16384","foreignKeys":[{"name":"issue_comment_creator_id_fkey","columns":["creator_id"],"referencedSchema":"public","referencedTable":"principal","referencedColumns":["id"],"onDelete":"NO ACTION","onUpdate":"NO ACTION","matchType":"SIMPLE"},{"name":"issue_comment_issue_id_fkey","columns":["issue_id"],"referencedSchema":"public","referencedTable":"issue","referencedColumns":["id"],"onDelete":"NO ACTION","onUpdate":"NO ACTION","matchType":"SIMPLE"}],"owner":"bb"},{"name":"issue_subscriber","columns":[{"name":"issue_id","position":1,"type":"integer"},{"name":"subscriber_id","position":2,"type":"integer"}],"indexes":[{"name":"idx_issue_subscriber_subscriber_id","expressions":["subscriber_id"],"type":"btree","definition":"CREATE INDEX idx_issue_subscriber_subscriber_id ON public.issue_subscriber USING btree (subscriber_id);"},{"name":"issue_subscriber_pkey","expressions":["issue_id","subscriber_id"],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX issue_subscriber_pkey ON public.issue_subscriber USING btree (issue_id, subscriber_id);","isConstraint":true}],"indexSize":"16384","foreignKeys":[{"name":"issue_subscriber_issue_id_fkey","columns":["issue_id"],"referencedSchema":"public","referencedTable":"issue","referencedColumns":["id"],"onDelete":"NO ACTION","onUpdate":"NO ACTION","matchType":"SIMPLE"},{"name":"issue_subscriber_subscriber_id_fkey","columns":["subscriber_id"],"referencedSchema":"public","referencedTable":"principal","referencedColumns":["id"],"onDelete":"NO ACTION","onUpdate":"NO ACTION","matchType":"SIMPLE"}],"owner":"bb"},{"name":"pipeline","columns":[{"name":"id","position":1,"default":"nextval(''public.pipeline_id_seq''::regclass)","type":"integer"},{"name":"creator_id","position":2,"type":"integer"},{"name":"created_at","position":3,"default":"now()","type":"timestamp with time zone"},{"name":"project","position":4,"type":"text"},{"name":"name","position":5,"type":"text"}],"indexes":[{"name":"pipeline_pkey","expressions":["id"],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX pipeline_pkey ON public.pipeline USING btree (id);","isConstraint":true}],"rowCount":"1","dataSize":"16384","indexSize":"16384","foreignKeys":[{"name":"pipeline_creator_id_fkey","columns":["creator_id"],"referencedSchema":"public","referencedTable":"principal","referencedColumns":["id"],"onDelete":"NO ACTION","onUpdate":"NO ACTION","matchType":"SIMPLE"},{"name":"pipeline_project_fkey","columns":["project"],"referencedSchema":"public","referencedTable":"project","referencedColumns":["resource_id"],"onDelete":"NO ACTION","onUpdate":"NO ACTION","matchType":"SIMPLE"}],"owner":"bb"},{"name":"plan","columns":[{"name":"id","position":1,"default":"nextval(''public.plan_id_seq''::regclass)","type":"bigint"},{"name":"creator_id","position":2,"type":"integer"},{"name":"created_at","position":3,"default":"now()","type":"timestamp with time zone"},{"name":"updated_at","position":4,"default":"now()","type":"timestamp with time zone"},{"name":"project","position":5,"type":"text"},{"name":"pipeline_id","position":6,"nullable":true,"type":"integer"},{"name":"name","position":7,"type":"text"},{"name":"description","position":8,"type":"text"},{"name":"config","position":9,"default":"''{}''::jsonb","type":"jsonb"}],"indexes":[{"name":"idx_plan_pipeline_id","expressions":["pipeline_id"],"type":"btree","definition":"CREATE INDEX idx_plan_pipeline_id ON public.plan USING btree (pipeline_id);"},{"name":"idx_plan_project","expressions":["project"],"type":"btree","definition":"CREATE INDEX idx_plan_project ON public.plan USING btree (project);"},{"name":"plan_pkey","expressions":["id"],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX plan_pkey ON public.plan USING btree (id);","isConstraint":true}],"rowCount":"1","dataSize":"16384","indexSize":"49152","foreignKeys":[{"name":"plan_creator_id_fkey","columns":["creator_id"],"referencedSchema":"public","referencedTable":"principal","referencedColumns":["id"],"onDelete":"NO ACTION","onUpdate":"NO ACTION","matchType":"SIMPLE"},{"name":"plan_pipeline_id_fkey","columns":["pipeline_id"],"referencedSchema":"public","referencedTable":"pipeline","referencedColumns":["id"],"onDelete":"NO ACTION","onUpdate":"NO ACTION","matchType":"SIMPLE"},{"name":"plan_project_fkey","columns":["project"],"referencedSchema":"public","referencedTable":"project","referencedColumns":["resource_id"],"onDelete":"NO ACTION","onUpdate":"NO ACTION","matchType":"SIMPLE"}],"owner":"bb"},{"name":"plan_check_run","columns":[{"name":"id","position":1,"default":"nextval(''public.plan_check_run_id_seq''::regclass)","type":"integer"},{"name":"created_at","position":2,"default":"now()","type":"timestamp with time zone"},{"name":"updated_at","position":3,"default":"now()","type":"timestamp with time zone"},{"name":"plan_id","position":4,"type":"bigint"},{"name":"status","position":5,"type":"text"},{"name":"type","position":6,"type":"text"},{"name":"config","position":7,"default":"''{}''::jsonb","type":"jsonb"},{"name":"result","position":8,"default":"''{}''::jsonb","type":"jsonb"},{"name":"payload","position":9,"default":"''{}''::jsonb","type":"jsonb"}],"indexes":[{"name":"idx_plan_check_run_plan_id","expressions":["plan_id"],"type":"btree","definition":"CREATE INDEX idx_plan_check_run_plan_id ON public.plan_check_run USING btree (plan_id);"},{"name":"plan_check_run_pkey","expressions":["id"],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX plan_check_run_pkey ON public.plan_check_run USING btree (id);","isConstraint":true}],"rowCount":"6","dataSize":"16384","indexSize":"32768","foreignKeys":[{"name":"plan_check_run_plan_id_fkey","columns":["plan_id"],"referencedSchema":"public","referencedTable":"plan","referencedColumns":["id"],"onDelete":"NO ACTION","onUpdate":"NO ACTION","matchType":"SIMPLE"}],"checkConstraints":[{"name":"plan_check_run_status_check","expression":"(status = ANY (ARRAY[''RUNNING''::text, ''DONE''::text, ''FAILED''::text, ''CANCELED''::text]))"},{"name":"plan_check_run_type_check","expression":"(type ~~ ''bb.plan-check.%''::text)"}],"owner":"bb"},{"name":"policy","columns":[{"name":"id","position":1,"default":"nextval(''public.policy_id_seq''::regclass)","type":"integer"},{"name":"enforce","position":2,"default":"true","type":"boolean"},{"name":"updated_at","position":3,"default":"now()","type":"timestamp with time zone"},{"name":"resource_type","position":4,"type":"text"},{"name":"resource","position":5,"type":"text"},{"name":"type","position":6,"type":"text"},{"name":"payload","position":7,"default":"''{}''::jsonb","type":"jsonb"},{"name":"inherit_from_parent","position":8,"default":"true","type":"boolean"}],"indexes":[{"name":"idx_policy_unique_resource_type_resource_type","expressions":["resource_type","resource","type"],"type":"btree","unique":true,"definition":"CREATE UNIQUE INDEX idx_policy_unique_resource_type_resource_type ON public.policy USING btree (resource_type, resource, type);"},{"name":"policy_pkey","expressions":["id"],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX policy_pkey ON public.policy USING btree (id);","isConstraint":true}],"rowCount":"8","dataSize":"16384","indexSize":"32768","checkConstraints":[{"name":"policy_resource_type_check","expression":"(resource_type = ANY (ARRAY[''WORKSPACE''::text, ''ENVIRONMENT''::text, ''PROJECT''::text, ''INSTANCE''::text]))"}],"owner":"bb"},{"name":"principal","columns":[{"name":"id","position":1,"default":"nextval(''public.principal_id_seq''::regclass)","type":"integer"},{"name":"deleted","position":2,"default":"false","type":"boolean"},{"name":"created_at","position":3,"default":"now()","type":"timestamp with time zone"},{"name":"type","position":4,"type":"text"},{"name":"name","position":5,"type":"text"},{"name":"email","position":6,"type":"text"},{"name":"password_hash","position":7,"type":"text"},{"name":"phone","position":8,"default":"''''::text","type":"text"},{"name":"mfa_config","position":9,"default":"''{}''::jsonb","type":"jsonb"},{"name":"profile","position":10,"default":"''{}''::jsonb","type":"jsonb"}],"indexes":[{"name":"principal_pkey","expressions":["id"],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX principal_pkey ON public.principal USING btree (id);","isConstraint":true}],"rowCount":"7","dataSize":"16384","indexSize":"16384","checkConstraints":[{"name":"principal_type_check","expression":"(type = ANY (ARRAY[''END_USER''::text, ''SYSTEM_BOT''::text, ''SERVICE_ACCOUNT''::text]))"}],"owner":"bb"},{"name":"project","columns":[{"name":"id","position":1,"default":"nextval(''public.project_id_seq''::regclass)","type":"integer"},{"name":"deleted","position":2,"default":"false","type":"boolean"},{"name":"name","position":3,"type":"text"},{"name":"resource_id","position":4,"type":"text"},{"name":"data_classification_config_id","position":5,"default":"''''::text","type":"text"},{"name":"setting","position":6,"default":"''{}''::jsonb","type":"jsonb"}],"indexes":[{"name":"idx_project_unique_resource_id","expressions":["resource_id"],"type":"btree","unique":true,"definition":"CREATE UNIQUE INDEX idx_project_unique_resource_id ON public.project USING btree (resource_id);"},{"name":"project_pkey","expressions":["id"],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX project_pkey ON public.project USING btree (id);","isConstraint":true}],"rowCount":"3","dataSize":"16384","indexSize":"32768","owner":"bb"},{"name":"project_webhook","columns":[{"name":"id","position":1,"default":"nextval(''public.project_webhook_id_seq''::regclass)","type":"integer"},{"name":"project","position":2,"type":"text"},{"name":"type","position":3,"type":"text"},{"name":"name","position":4,"type":"text"},{"name":"url","position":5,"type":"text"},{"name":"event_list","position":6,"type":"_text"},{"name":"payload","position":7,"default":"''{}''::jsonb","type":"jsonb"}],"indexes":[{"name":"idx_project_webhook_project","expressions":["project"],"type":"btree","definition":"CREATE INDEX idx_project_webhook_project ON public.project_webhook USING btree (project);"},{"name":"project_webhook_pkey","expressions":["id"],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX project_webhook_pkey ON public.project_webhook USING btree (id);","isConstraint":true}],"dataSize":"8192","indexSize":"16384","foreignKeys":[{"name":"project_webhook_project_fkey","columns":["project"],"referencedSchema":"public","referencedTable":"project","referencedColumns":["resource_id"],"onDelete":"NO ACTION","onUpdate":"NO ACTION","matchType":"SIMPLE"}],"checkConstraints":[{"name":"project_webhook_type_check","expression":"(type ~~ ''bb.plugin.webhook.%''::text)"}],"owner":"bb"},{"name":"query_history","columns":[{"name":"id","position":1,"default":"nextval(''public.query_history_id_seq''::regclass)","type":"bigint"},{"name":"creator_id","position":2,"type":"integer"},{"name":"created_at","position":3,"default":"now()","type":"timestamp with time zone"},{"name":"project_id","position":4,"type":"text"},{"name":"database","position":5,"type":"text"},{"name":"statement","position":6,"type":"text"},{"name":"type","position":7,"type":"text"},{"name":"payload","position":8,"default":"''{}''::jsonb","type":"jsonb"}],"indexes":[{"name":"idx_query_history_creator_id_created_at_project_id","expressions":["creator_id","created_at","project_id"],"type":"btree","definition":"CREATE INDEX idx_query_history_creator_id_created_at_project_id ON public.query_history USING btree (creator_id, created_at, project_id DESC);"},{"name":"query_history_pkey","expressions":["id"],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX query_history_pkey ON public.query_history USING btree (id);","isConstraint":true}],"rowCount":"5","dataSize":"16384","indexSize":"32768","foreignKeys":[{"name":"query_history_creator_id_fkey","columns":["creator_id"],"referencedSchema":"public","referencedTable":"principal","referencedColumns":["id"],"onDelete":"NO ACTION","onUpdate":"NO ACTION","matchType":"SIMPLE"}],"owner":"bb"},{"name":"release","columns":[{"name":"id","position":1,"default":"nextval(''public.release_id_seq''::regclass)","type":"bigint"},{"name":"deleted","position":2,"default":"false","type":"boolean"},{"name":"project","position":3,"type":"text"},{"name":"creator_id","position":4,"type":"integer"},{"name":"created_at","position":5,"default":"now()","type":"timestamp with time zone"},{"name":"payload","position":6,"default":"''{}''::jsonb","type":"jsonb"}],"indexes":[{"name":"idx_release_project","expressions":["project"],"type":"btree","definition":"CREATE INDEX idx_release_project ON public.release USING btree (project);"},{"name":"release_pkey","expressions":["id"],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX release_pkey ON public.release USING btree (id);","isConstraint":true}],"dataSize":"8192","indexSize":"16384","foreignKeys":[{"name":"release_creator_id_fkey","columns":["creator_id"],"referencedSchema":"public","referencedTable":"principal","referencedColumns":["id"],"onDelete":"NO ACTION","onUpdate":"NO ACTION","matchType":"SIMPLE"},{"name":"release_project_fkey","columns":["project"],"referencedSchema":"public","referencedTable":"project","referencedColumns":["resource_id"],"onDelete":"NO ACTION","onUpdate":"NO ACTION","matchType":"SIMPLE"}],"owner":"bb"},{"name":"review_config","columns":[{"name":"id","position":1,"type":"text"},{"name":"enabled","position":2,"default":"true","type":"boolean"},{"name":"name","position":3,"type":"text"},{"name":"payload","position":4,"default":"''{}''::jsonb","type":"jsonb"}],"indexes":[{"name":"review_config_pkey","expressions":["id"],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX review_config_pkey ON public.review_config USING btree (id);","isConstraint":true}],"rowCount":"1","dataSize":"16384","indexSize":"16384","owner":"bb"},{"name":"revision","columns":[{"name":"id","position":1,"default":"nextval(''public.revision_id_seq''::regclass)","type":"bigint"},{"name":"instance","position":2,"type":"text"},{"name":"db_name","position":3,"type":"text"},{"name":"created_at","position":4,"default":"now()","type":"timestamp with time zone"},{"name":"deleter_id","position":5,"nullable":true,"type":"integer"},{"name":"deleted_at","position":6,"nullable":true,"type":"timestamp with time zone"},{"name":"version","position":7,"type":"text"},{"name":"payload","position":8,"default":"''{}''::jsonb","type":"jsonb"}],"indexes":[{"name":"idx_revision_instance_db_name_version","expressions":["instance","db_name","version"],"type":"btree","definition":"CREATE INDEX idx_revision_instance_db_name_version ON public.revision USING btree (instance, db_name, version);"},{"name":"idx_revision_unique_instance_db_name_version_deleted_at_null","expressions":["instance","db_name","version"],"type":"btree","unique":true,"definition":"CREATE UNIQUE INDEX idx_revision_unique_instance_db_name_version_deleted_at_null ON public.revision USING btree (instance, db_name, version) WHERE (deleted_at IS NULL);"},{"name":"revision_pkey","expressions":["id"],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX revision_pkey ON public.revision USING btree (id);","isConstraint":true}],"dataSize":"8192","indexSize":"24576","foreignKeys":[{"name":"revision_deleter_id_fkey","columns":["deleter_id"],"referencedSchema":"public","referencedTable":"principal","referencedColumns":["id"],"onDelete":"NO ACTION","onUpdate":"NO ACTION","matchType":"SIMPLE"},{"name":"revision_instance_db_name_fkey","columns":["instance","db_name"],"referencedSchema":"public","referencedTable":"db","referencedColumns":["instance","name"],"onDelete":"NO ACTION","onUpdate":"NO ACTION","matchType":"SIMPLE"}],"owner":"bb"},{"name":"risk","columns":[{"name":"id","position":1,"default":"nextval(''public.risk_id_seq''::regclass)","type":"bigint"},{"name":"source","position":2,"type":"text"},{"name":"level","position":3,"type":"bigint"},{"name":"name","position":4,"type":"text"},{"name":"active","position":5,"type":"boolean"},{"name":"expression","position":6,"type":"jsonb"}],"indexes":[{"name":"risk_pkey","expressions":["id"],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX risk_pkey ON public.risk USING btree (id);","isConstraint":true}],"rowCount":"3","dataSize":"16384","indexSize":"16384","checkConstraints":[{"name":"risk_source_check","expression":"(source ~~ ''bb.risk.%''::text)"}],"owner":"bb"},{"name":"role","columns":[{"name":"id","position":1,"default":"nextval(''public.role_id_seq''::regclass)","type":"bigint"},{"name":"resource_id","position":2,"type":"text"},{"name":"name","position":3,"type":"text"},{"name":"description","position":4,"type":"text"},{"name":"permissions","position":5,"default":"''{}''::jsonb","type":"jsonb"},{"name":"payload","position":6,"default":"''{}''::jsonb","type":"jsonb"}],"indexes":[{"name":"idx_role_unique_resource_id","expressions":["resource_id"],"type":"btree","unique":true,"definition":"CREATE UNIQUE INDEX idx_role_unique_resource_id ON public.role USING btree (resource_id);"},{"name":"role_pkey","expressions":["id"],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX role_pkey ON public.role USING btree (id);","isConstraint":true}],"rowCount":"1","dataSize":"16384","indexSize":"32768","owner":"bb"},{"name":"setting","columns":[{"name":"id","position":1,"default":"nextval(''public.setting_id_seq''::regclass)","type":"integer"},{"name":"name","position":2,"type":"text"},{"name":"value","position":3,"type":"text"}],"indexes":[{"name":"idx_setting_unique_name","expressions":["name"],"type":"btree","unique":true,"definition":"CREATE UNIQUE INDEX idx_setting_unique_name ON public.setting USING btree (name);"},{"name":"setting_pkey","expressions":["id"],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX setting_pkey ON public.setting USING btree (id);","isConstraint":true}],"rowCount":"14","dataSize":"49152","indexSize":"32768","owner":"bb"},{"name":"sheet","columns":[{"name":"id","position":1,"default":"nextval(''public.sheet_id_seq''::regclass)","type":"integer"},{"name":"creator_id","position":2,"type":"integer"},{"name":"created_at","position":3,"default":"now()","type":"timestamp with time zone"},{"name":"project","position":4,"type":"text"},{"name":"name","position":5,"type":"text"},{"name":"sha256","position":6,"type":"bytea"},{"name":"payload","position":7,"default":"''{}''::jsonb","type":"jsonb"}],"indexes":[{"name":"idx_sheet_project","expressions":["project"],"type":"btree","definition":"CREATE INDEX idx_sheet_project ON public.sheet USING btree (project);"},{"name":"sheet_pkey","expressions":["id"],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX sheet_pkey ON public.sheet USING btree (id);","isConstraint":true}],"rowCount":"1","dataSize":"16384","indexSize":"32768","foreignKeys":[{"name":"sheet_creator_id_fkey","columns":["creator_id"],"referencedSchema":"public","referencedTable":"principal","referencedColumns":["id"],"onDelete":"NO ACTION","onUpdate":"NO ACTION","matchType":"SIMPLE"},{"name":"sheet_project_fkey","columns":["project"],"referencedSchema":"public","referencedTable":"project","referencedColumns":["resource_id"],"onDelete":"NO ACTION","onUpdate":"NO ACTION","matchType":"SIMPLE"}],"owner":"bb"},{"name":"sheet_blob","columns":[{"name":"sha256","position":1,"type":"bytea"},{"name":"content","position":2,"type":"text"}],"indexes":[{"name":"sheet_blob_pkey","expressions":["sha256"],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX sheet_blob_pkey ON public.sheet_blob USING btree (sha256);","isConstraint":true}],"rowCount":"1","dataSize":"16384","indexSize":"16384","owner":"bb"},{"name":"sync_history","columns":[{"name":"id","position":1,"default":"nextval(''public.sync_history_id_seq''::regclass)","type":"bigint"},{"name":"created_at","position":2,"default":"now()","type":"timestamp with time zone"},{"name":"instance","position":3,"type":"text"},{"name":"db_name","position":4,"type":"text"},{"name":"metadata","position":5,"default":"''{}''::json","type":"json"},{"name":"raw_dump","position":6,"default":"''''::text","type":"text"}],"indexes":[{"name":"idx_sync_history_instance_db_name_created_at","expressions":["instance","db_name","created_at"],"type":"btree","definition":"CREATE INDEX idx_sync_history_instance_db_name_created_at ON public.sync_history USING btree (instance, db_name, created_at);"},{"name":"sync_history_pkey","expressions":["id"],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX sync_history_pkey ON public.sync_history USING btree (id);","isConstraint":true}],"rowCount":"2","dataSize":"32768","indexSize":"32768","foreignKeys":[{"name":"sync_history_instance_db_name_fkey","columns":["instance","db_name"],"referencedSchema":"public","referencedTable":"db","referencedColumns":["instance","name"],"onDelete":"NO ACTION","onUpdate":"NO ACTION","matchType":"SIMPLE"}],"owner":"bb"},{"name":"task","columns":[{"name":"id","position":1,"default":"nextval(''public.task_id_seq''::regclass)","type":"integer"},{"name":"pipeline_id","position":2,"type":"integer"},{"name":"instance","position":4,"type":"text"},{"name":"db_name","position":5,"nullable":true,"type":"text"},{"name":"type","position":6,"type":"text"},{"name":"payload","position":7,"default":"''{}''::jsonb","type":"jsonb"},{"name":"environment","position":9,"nullable":true,"type":"text"}],"indexes":[{"name":"idx_task_pipeline_id_environment","expressions":["pipeline_id","environment"],"type":"btree","definition":"CREATE INDEX idx_task_pipeline_id_environment ON public.task USING btree (pipeline_id, environment);"},{"name":"task_pkey","expressions":["id"],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX task_pkey ON public.task USING btree (id);","isConstraint":true}],"rowCount":"2","dataSize":"16384","indexSize":"32768","foreignKeys":[{"name":"task_instance_fkey","columns":["instance"],"referencedSchema":"public","referencedTable":"instance","referencedColumns":["resource_id"],"onDelete":"NO ACTION","onUpdate":"NO ACTION","matchType":"SIMPLE"},{"name":"task_pipeline_id_fkey","columns":["pipeline_id"],"referencedSchema":"public","referencedTable":"pipeline","referencedColumns":["id"],"onDelete":"NO ACTION","onUpdate":"NO ACTION","matchType":"SIMPLE"}],"owner":"bb"},{"name":"task_run","columns":[{"name":"id","position":1,"default":"nextval(''public.task_run_id_seq''::regclass)","type":"integer"},{"name":"creator_id","position":2,"type":"integer"},{"name":"created_at","position":3,"default":"now()","type":"timestamp with time zone"},{"name":"updated_at","position":4,"default":"now()","type":"timestamp with time zone"},{"name":"task_id","position":5,"type":"integer"},{"name":"sheet_id","position":6,"nullable":true,"type":"integer"},{"name":"attempt","position":7,"type":"integer"},{"name":"status","position":8,"type":"text"},{"name":"started_at","position":9,"nullable":true,"type":"timestamp with time zone"},{"name":"code","position":10,"default":"0","type":"integer"},{"name":"result","position":11,"default":"''{}''::jsonb","type":"jsonb"},{"name":"run_at","position":12,"nullable":true,"type":"timestamp with time zone"}],"indexes":[{"name":"idx_task_run_task_id","expressions":["task_id"],"type":"btree","definition":"CREATE INDEX idx_task_run_task_id ON public.task_run USING btree (task_id);"},{"name":"task_run_pkey","expressions":["id"],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX task_run_pkey ON public.task_run USING btree (id);","isConstraint":true},{"name":"uk_task_run_task_id_attempt","expressions":["task_id","attempt"],"type":"btree","unique":true,"definition":"CREATE UNIQUE INDEX uk_task_run_task_id_attempt ON public.task_run USING btree (task_id, attempt);"}],"dataSize":"8192","indexSize":"24576","foreignKeys":[{"name":"task_run_creator_id_fkey","columns":["creator_id"],"referencedSchema":"public","referencedTable":"principal","referencedColumns":["id"],"onDelete":"NO ACTION","onUpdate":"NO ACTION","matchType":"SIMPLE"},{"name":"task_run_sheet_id_fkey","columns":["sheet_id"],"referencedSchema":"public","referencedTable":"sheet","referencedColumns":["id"],"onDelete":"NO ACTION","onUpdate":"NO ACTION","matchType":"SIMPLE"},{"name":"task_run_task_id_fkey","columns":["task_id"],"referencedSchema":"public","referencedTable":"task","referencedColumns":["id"],"onDelete":"NO ACTION","onUpdate":"NO ACTION","matchType":"SIMPLE"}],"checkConstraints":[{"name":"task_run_status_check","expression":"(status = ANY (ARRAY[''PENDING''::text, ''RUNNING''::text, ''DONE''::text, ''FAILED''::text, ''CANCELED''::text]))"}],"owner":"bb"},{"name":"task_run_log","columns":[{"name":"id","position":1,"default":"nextval(''public.task_run_log_id_seq''::regclass)","type":"bigint"},{"name":"task_run_id","position":2,"type":"integer"},{"name":"created_at","position":3,"default":"now()","type":"timestamp with time zone"},{"name":"payload","position":4,"default":"''{}''::jsonb","type":"jsonb"}],"indexes":[{"name":"idx_task_run_log_task_run_id","expressions":["task_run_id"],"type":"btree","definition":"CREATE INDEX idx_task_run_log_task_run_id ON public.task_run_log USING btree (task_run_id);"},{"name":"task_run_log_pkey","expressions":["id"],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX task_run_log_pkey ON public.task_run_log USING btree (id);","isConstraint":true}],"dataSize":"8192","indexSize":"16384","foreignKeys":[{"name":"task_run_log_task_run_id_fkey","columns":["task_run_id"],"referencedSchema":"public","referencedTable":"task_run","referencedColumns":["id"],"onDelete":"NO ACTION","onUpdate":"NO ACTION","matchType":"SIMPLE"}],"owner":"bb"},{"name":"user_group","columns":[{"name":"email","position":1,"type":"text"},{"name":"name","position":2,"type":"text"},{"name":"description","position":3,"default":"''''::text","type":"text"},{"name":"payload","position":4,"default":"''{}''::jsonb","type":"jsonb"}],"indexes":[{"name":"user_group_pkey","expressions":["email"],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX user_group_pkey ON public.user_group USING btree (email);","isConstraint":true}],"rowCount":"1","dataSize":"16384","indexSize":"16384","owner":"bb"},{"name":"worksheet","columns":[{"name":"id","position":1,"default":"nextval(''public.worksheet_id_seq''::regclass)","type":"integer"},{"name":"creator_id","position":2,"type":"integer"},{"name":"created_at","position":3,"default":"now()","type":"timestamp with time zone"},{"name":"updated_at","position":4,"default":"now()","type":"timestamp with time zone"},{"name":"project","position":5,"type":"text"},{"name":"instance","position":6,"nullable":true,"type":"text"},{"name":"db_name","position":7,"nullable":true,"type":"text"},{"name":"name","position":8,"type":"text"},{"name":"statement","position":9,"type":"text"},{"name":"visibility","position":10,"type":"text"},{"name":"payload","position":11,"default":"''{}''::jsonb","type":"jsonb"}],"indexes":[{"name":"idx_worksheet_creator_id_project","expressions":["creator_id","project"],"type":"btree","definition":"CREATE INDEX idx_worksheet_creator_id_project ON public.worksheet USING btree (creator_id, project);"},{"name":"worksheet_pkey","expressions":["id"],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX worksheet_pkey ON public.worksheet USING btree (id);","isConstraint":true}],"rowCount":"1","dataSize":"16384","indexSize":"32768","foreignKeys":[{"name":"worksheet_creator_id_fkey","columns":["creator_id"],"referencedSchema":"public","referencedTable":"principal","referencedColumns":["id"],"onDelete":"NO ACTION","onUpdate":"NO ACTION","matchType":"SIMPLE"},{"name":"worksheet_project_fkey","columns":["project"],"referencedSchema":"public","referencedTable":"project","referencedColumns":["resource_id"],"onDelete":"NO ACTION","onUpdate":"NO ACTION","matchType":"SIMPLE"}],"owner":"bb"},{"name":"worksheet_organizer","columns":[{"name":"id","position":1,"default":"nextval(''public.worksheet_organizer_id_seq''::regclass)","type":"integer"},{"name":"worksheet_id","position":2,"type":"integer"},{"name":"principal_id","position":3,"type":"integer"},{"name":"starred","position":4,"default":"false","type":"boolean"}],"indexes":[{"name":"idx_worksheet_organizer_principal_id","expressions":["principal_id"],"type":"btree","definition":"CREATE INDEX idx_worksheet_organizer_principal_id ON public.worksheet_organizer USING btree (principal_id);"},{"name":"idx_worksheet_organizer_unique_sheet_id_principal_id","expressions":["worksheet_id","principal_id"],"type":"btree","unique":true,"definition":"CREATE UNIQUE INDEX idx_worksheet_organizer_unique_sheet_id_principal_id ON public.worksheet_organizer USING btree (worksheet_id, principal_id);"},{"name":"worksheet_organizer_pkey","expressions":["id"],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX worksheet_organizer_pkey ON public.worksheet_organizer USING btree (id);","isConstraint":true}],"indexSize":"24576","foreignKeys":[{"name":"worksheet_organizer_principal_id_fkey","columns":["principal_id"],"referencedSchema":"public","referencedTable":"principal","referencedColumns":["id"],"onDelete":"NO ACTION","onUpdate":"NO ACTION","matchType":"SIMPLE"},{"name":"worksheet_organizer_worksheet_id_fkey","columns":["worksheet_id"],"referencedSchema":"public","referencedTable":"worksheet","referencedColumns":["id"],"onDelete":"CASCADE","onUpdate":"NO ACTION","matchType":"SIMPLE"}],"owner":"bb"}],"sequences":[{"name":"audit_log_id_seq","dataType":"bigint","start":"1","minValue":"1","maxValue":"9223372036854775807","increment":"1","cacheSize":"1","lastValue":"181","ownerTable":"audit_log","ownerColumn":"id"},{"name":"changelist_id_seq","dataType":"integer","start":"1","minValue":"1","maxValue":"2147483647","increment":"1","cacheSize":"1","ownerTable":"changelist","ownerColumn":"id"},{"name":"changelog_id_seq","dataType":"bigint","start":"1","minValue":"1","maxValue":"9223372036854775807","increment":"1","cacheSize":"1","lastValue":"102","ownerTable":"changelog","ownerColumn":"id"},{"name":"data_source_id_seq","dataType":"integer","start":"1","minValue":"1","maxValue":"2147483647","increment":"1","cacheSize":"1","ownerTable":"data_source","ownerColumn":"id"},{"name":"db_group_id_seq","dataType":"bigint","start":"1","minValue":"1","maxValue":"9223372036854775807","increment":"1","cacheSize":"1","ownerTable":"db_group","ownerColumn":"id"},{"name":"db_id_seq","dataType":"integer","start":"1","minValue":"1","maxValue":"2147483647","increment":"1","cacheSize":"1","lastValue":"106","ownerTable":"db","ownerColumn":"id"},{"name":"db_schema_id_seq","dataType":"integer","start":"1","minValue":"1","maxValue":"2147483647","increment":"1","cacheSize":"1","lastValue":"108","ownerTable":"db_schema","ownerColumn":"id"},{"name":"export_archive_id_seq","dataType":"integer","start":"1","minValue":"1","maxValue":"2147483647","increment":"1","cacheSize":"1","ownerTable":"export_archive","ownerColumn":"id"},{"name":"idp_id_seq","dataType":"integer","start":"1","minValue":"1","maxValue":"2147483647","increment":"1","cacheSize":"1","ownerTable":"idp","ownerColumn":"id"},{"name":"instance_change_history_id_seq","dataType":"bigint","start":"1","minValue":"1","maxValue":"9223372036854775807","increment":"1","cacheSize":"1","lastValue":"123","ownerTable":"instance_change_history","ownerColumn":"id"},{"name":"instance_id_seq","dataType":"integer","start":"1","minValue":"1","maxValue":"2147483647","increment":"1","cacheSize":"1","lastValue":"103","ownerTable":"instance","ownerColumn":"id"},{"name":"issue_comment_id_seq","dataType":"bigint","start":"1","minValue":"1","maxValue":"9223372036854775807","increment":"1","cacheSize":"1","ownerTable":"issue_comment","ownerColumn":"id"},{"name":"issue_id_seq","dataType":"integer","start":"1","minValue":"1","maxValue":"2147483647","increment":"1","cacheSize":"1","lastValue":"101","ownerTable":"issue","ownerColumn":"id"},{"name":"pipeline_id_seq","dataType":"integer","start":"1","minValue":"1","maxValue":"2147483647","increment":"1","cacheSize":"1","lastValue":"101","ownerTable":"pipeline","ownerColumn":"id"},{"name":"plan_check_run_id_seq","dataType":"integer","start":"1","minValue":"1","maxValue":"2147483647","increment":"1","cacheSize":"1","lastValue":"106","ownerTable":"plan_check_run","ownerColumn":"id"},{"name":"plan_id_seq","dataType":"bigint","start":"1","minValue":"1","maxValue":"9223372036854775807","increment":"1","cacheSize":"1","lastValue":"101","ownerTable":"plan","ownerColumn":"id"},{"name":"policy_id_seq","dataType":"integer","start":"1","minValue":"1","maxValue":"2147483647","increment":"1","cacheSize":"1","lastValue":"111","ownerTable":"policy","ownerColumn":"id"},{"name":"principal_id_seq","dataType":"integer","start":"1","minValue":"1","maxValue":"2147483647","increment":"1","cacheSize":"1","lastValue":"106","ownerTable":"principal","ownerColumn":"id"},{"name":"project_id_seq","dataType":"integer","start":"1","minValue":"1","maxValue":"2147483647","increment":"1","cacheSize":"1","lastValue":"102","ownerTable":"project","ownerColumn":"id"},{"name":"project_webhook_id_seq","dataType":"integer","start":"1","minValue":"1","maxValue":"2147483647","increment":"1","cacheSize":"1","ownerTable":"project_webhook","ownerColumn":"id"},{"name":"query_history_id_seq","dataType":"bigint","start":"1","minValue":"1","maxValue":"9223372036854775807","increment":"1","cacheSize":"1","lastValue":"105","ownerTable":"query_history","ownerColumn":"id"},{"name":"release_id_seq","dataType":"bigint","start":"1","minValue":"1","maxValue":"9223372036854775807","increment":"1","cacheSize":"1","ownerTable":"release","ownerColumn":"id"},{"name":"revision_id_seq","dataType":"bigint","start":"1","minValue":"1","maxValue":"9223372036854775807","increment":"1","cacheSize":"1","ownerTable":"revision","ownerColumn":"id"},{"name":"risk_id_seq","dataType":"bigint","start":"1","minValue":"1","maxValue":"9223372036854775807","increment":"1","cacheSize":"1","lastValue":"103","ownerTable":"risk","ownerColumn":"id"},{"name":"role_id_seq","dataType":"bigint","start":"1","minValue":"1","maxValue":"9223372036854775807","increment":"1","cacheSize":"1","lastValue":"101","ownerTable":"role","ownerColumn":"id"},{"name":"setting_id_seq","dataType":"integer","start":"1","minValue":"1","maxValue":"2147483647","increment":"1","cacheSize":"1","lastValue":"139","ownerTable":"setting","ownerColumn":"id"},{"name":"sheet_id_seq","dataType":"integer","start":"1","minValue":"1","maxValue":"2147483647","increment":"1","cacheSize":"1","lastValue":"101","ownerTable":"sheet","ownerColumn":"id"},{"name":"sync_history_id_seq","dataType":"bigint","start":"1","minValue":"1","maxValue":"9223372036854775807","increment":"1","cacheSize":"1","lastValue":"102","ownerTable":"sync_history","ownerColumn":"id"},{"name":"task_id_seq","dataType":"integer","start":"1","minValue":"1","maxValue":"2147483647","increment":"1","cacheSize":"1","lastValue":"102","ownerTable":"task","ownerColumn":"id"},{"name":"task_run_id_seq","dataType":"integer","start":"1","minValue":"1","maxValue":"2147483647","increment":"1","cacheSize":"1","ownerTable":"task_run","ownerColumn":"id"},{"name":"task_run_log_id_seq","dataType":"bigint","start":"1","minValue":"1","maxValue":"9223372036854775807","increment":"1","cacheSize":"1","ownerTable":"task_run_log","ownerColumn":"id"},{"name":"worksheet_id_seq","dataType":"integer","start":"1","minValue":"1","maxValue":"2147483647","increment":"1","cacheSize":"1","lastValue":"101","ownerTable":"worksheet","ownerColumn":"id"},{"name":"worksheet_organizer_id_seq","dataType":"integer","start":"1","minValue":"1","maxValue":"2147483647","increment":"1","cacheSize":"1","ownerTable":"worksheet_organizer","ownerColumn":"id"}],"owner":"pg_database_owner"}],"characterSet":"UTF8","collation":"en_US.UTF-8","owner":"bb","searchPath":"\"$user\", public"}', '
-SET statement_timeout = 0;
-SET lock_timeout = 0;
-SET idle_in_transaction_session_timeout = 0;
-SET client_encoding = ''UTF8'';
-SET standard_conforming_strings = on;
-SELECT pg_catalog.set_config(''search_path'', '''', false);
-SET check_function_bodies = false;
-SET xmloption = content;
-SET client_min_messages = warning;
-SET row_security = off;
-
-SET default_tablespace = '''';
-
-CREATE SEQUENCE "public"."audit_log_id_seq"
- AS bigint
- START WITH 1
- INCREMENT BY 1
- MINVALUE 1
- MAXVALUE 9223372036854775807
- NO CYCLE;
-
-CREATE TABLE "public"."audit_log" (
- "id" bigint DEFAULT nextval(''public.audit_log_id_seq''::regclass) NOT NULL,
- "created_at" timestamp with time zone DEFAULT now() NOT NULL,
- "payload" jsonb DEFAULT ''{}''::jsonb NOT NULL
-);
-
-ALTER SEQUENCE "public"."audit_log_id_seq" OWNED BY "public"."audit_log"."id";
-
-ALTER TABLE ONLY "public"."audit_log" ADD CONSTRAINT "audit_log_pkey" PRIMARY KEY ("id");
-
-CREATE INDEX "idx_audit_log_created_at" ON ONLY "public"."audit_log" ("created_at");
-
-CREATE INDEX "idx_audit_log_payload_method" ON ONLY "public"."audit_log" ((payload ->> ''method''::text));
-
-CREATE INDEX "idx_audit_log_payload_parent" ON ONLY "public"."audit_log" ((payload ->> ''parent''::text));
-
-CREATE INDEX "idx_audit_log_payload_resource" ON ONLY "public"."audit_log" ((payload ->> ''resource''::text));
-
-CREATE INDEX "idx_audit_log_payload_user" ON ONLY "public"."audit_log" ((payload ->> ''user''::text));
-
-CREATE SEQUENCE "public"."changelist_id_seq"
- AS integer
- START WITH 1
- INCREMENT BY 1
- MINVALUE 1
- MAXVALUE 2147483647
- NO CYCLE;
-
-CREATE TABLE "public"."changelist" (
- "id" integer DEFAULT nextval(''public.changelist_id_seq''::regclass) NOT NULL,
- "creator_id" integer NOT NULL,
- "updated_at" timestamp with time zone DEFAULT now() NOT NULL,
- "project" text NOT NULL,
- "name" text NOT NULL,
- "payload" jsonb DEFAULT ''{}''::jsonb NOT NULL
-);
-
-ALTER SEQUENCE "public"."changelist_id_seq" OWNED BY "public"."changelist"."id";
-
-ALTER TABLE ONLY "public"."changelist" ADD CONSTRAINT "changelist_pkey" PRIMARY KEY ("id");
-
-CREATE UNIQUE INDEX "idx_changelist_project_name" ON ONLY "public"."changelist" ("project", "name");
-
-CREATE SEQUENCE "public"."changelog_id_seq"
- AS bigint
- START WITH 1
- INCREMENT BY 1
- MINVALUE 1
- MAXVALUE 9223372036854775807
- NO CYCLE;
-
-CREATE TABLE "public"."changelog" (
- "id" bigint DEFAULT nextval(''public.changelog_id_seq''::regclass) NOT NULL,
- "created_at" timestamp with time zone DEFAULT now() NOT NULL,
- "instance" text NOT NULL,
- "db_name" text NOT NULL,
- "status" text NOT NULL,
- "prev_sync_history_id" bigint,
- "sync_history_id" bigint,
- "payload" jsonb DEFAULT ''{}''::jsonb NOT NULL,
- CONSTRAINT "changelog_status_check" CHECK (status = ANY (ARRAY[''PENDING''::text, ''DONE''::text, ''FAILED''::text]))
-);
-
-ALTER SEQUENCE "public"."changelog_id_seq" OWNED BY "public"."changelog"."id";
-
-ALTER TABLE ONLY "public"."changelog" ADD CONSTRAINT "changelog_pkey" PRIMARY KEY ("id");
-
-CREATE INDEX "idx_changelog_instance_db_name" ON ONLY "public"."changelog" ("instance", "db_name");
-
-CREATE SEQUENCE "public"."data_source_id_seq"
- AS integer
- START WITH 1
- INCREMENT BY 1
- MINVALUE 1
- MAXVALUE 2147483647
- NO CYCLE;
-
-CREATE TABLE "public"."data_source" (
- "id" integer DEFAULT nextval(''public.data_source_id_seq''::regclass) NOT NULL,
- "instance" text NOT NULL,
- "options" jsonb DEFAULT ''{}''::jsonb NOT NULL
-);
-
-ALTER SEQUENCE "public"."data_source_id_seq" OWNED BY "public"."data_source"."id";
-
-ALTER TABLE ONLY "public"."data_source" ADD CONSTRAINT "data_source_pkey" PRIMARY KEY ("id");
-
-CREATE SEQUENCE "public"."db_id_seq"
- AS integer
- START WITH 1
- INCREMENT BY 1
- MINVALUE 1
- MAXVALUE 2147483647
- NO CYCLE;
-
-CREATE TABLE "public"."db" (
- "id" integer DEFAULT nextval(''public.db_id_seq''::regclass) NOT NULL,
- "deleted" boolean DEFAULT false NOT NULL,
- "project" text NOT NULL,
- "instance" text NOT NULL,
- "name" text NOT NULL,
- "environment" text,
- "metadata" jsonb DEFAULT ''{}''::jsonb NOT NULL
-);
-
-ALTER SEQUENCE "public"."db_id_seq" OWNED BY "public"."db"."id";
-
-ALTER TABLE ONLY "public"."db" ADD CONSTRAINT "db_pkey" PRIMARY KEY ("id");
-
-CREATE INDEX "idx_db_project" ON ONLY "public"."db" ("project");
-
-CREATE UNIQUE INDEX "idx_db_unique_instance_name" ON ONLY "public"."db" ("instance", "name");
-
-CREATE SEQUENCE "public"."db_group_id_seq"
- AS bigint
- START WITH 1
- INCREMENT BY 1
- MINVALUE 1
- MAXVALUE 9223372036854775807
- NO CYCLE;
-
-CREATE TABLE "public"."db_group" (
- "id" bigint DEFAULT nextval(''public.db_group_id_seq''::regclass) NOT NULL,
- "project" text NOT NULL,
- "resource_id" text NOT NULL,
- "placeholder" text DEFAULT ''''::text NOT NULL,
- "expression" jsonb DEFAULT ''{}''::jsonb NOT NULL,
- "payload" jsonb DEFAULT ''{}''::jsonb NOT NULL
-);
-
-ALTER SEQUENCE "public"."db_group_id_seq" OWNED BY "public"."db_group"."id";
-
-ALTER TABLE ONLY "public"."db_group" ADD CONSTRAINT "db_group_pkey" PRIMARY KEY ("id");
-
-CREATE UNIQUE INDEX "idx_db_group_unique_project_placeholder" ON ONLY "public"."db_group" ("project", "placeholder");
-
-CREATE UNIQUE INDEX "idx_db_group_unique_project_resource_id" ON ONLY "public"."db_group" ("project", "resource_id");
-
-CREATE SEQUENCE "public"."db_schema_id_seq"
- AS integer
- START WITH 1
- INCREMENT BY 1
- MINVALUE 1
- MAXVALUE 2147483647
- NO CYCLE;
-
-CREATE TABLE "public"."db_schema" (
- "id" integer DEFAULT nextval(''public.db_schema_id_seq''::regclass) NOT NULL,
- "instance" text NOT NULL,
- "db_name" text NOT NULL,
- "metadata" json DEFAULT ''{}''::json NOT NULL,
- "raw_dump" text DEFAULT ''''::text NOT NULL,
- "config" jsonb DEFAULT ''{}''::jsonb NOT NULL
-);
-
-ALTER SEQUENCE "public"."db_schema_id_seq" OWNED BY "public"."db_schema"."id";
-
-ALTER TABLE ONLY "public"."db_schema" ADD CONSTRAINT "db_schema_pkey" PRIMARY KEY ("id");
-
-CREATE UNIQUE INDEX "idx_db_schema_unique_instance_db_name" ON ONLY "public"."db_schema" ("instance", "db_name");
-
-CREATE SEQUENCE "public"."export_archive_id_seq"
- AS integer
- START WITH 1
- INCREMENT BY 1
- MINVALUE 1
- MAXVALUE 2147483647
- NO CYCLE;
-
-CREATE TABLE "public"."export_archive" (
- "id" integer DEFAULT nextval(''public.export_archive_id_seq''::regclass) NOT NULL,
- "created_at" timestamp with time zone DEFAULT now() NOT NULL,
- "bytes" bytea,
- "payload" jsonb DEFAULT ''{}''::jsonb NOT NULL
-);
-
-ALTER SEQUENCE "public"."export_archive_id_seq" OWNED BY "public"."export_archive"."id";
-
-ALTER TABLE ONLY "public"."export_archive" ADD CONSTRAINT "export_archive_pkey" PRIMARY KEY ("id");
-
-CREATE SEQUENCE "public"."idp_id_seq"
- AS integer
- START WITH 1
- INCREMENT BY 1
- MINVALUE 1
- MAXVALUE 2147483647
- NO CYCLE;
-
-CREATE TABLE "public"."idp" (
- "id" integer DEFAULT nextval(''public.idp_id_seq''::regclass) NOT NULL,
- "resource_id" text NOT NULL,
- "name" text NOT NULL,
- "domain" text NOT NULL,
- "type" text NOT NULL,
- "config" jsonb DEFAULT ''{}''::jsonb NOT NULL,
- CONSTRAINT "idp_type_check" CHECK (type = ANY (ARRAY[''OAUTH2''::text, ''OIDC''::text, ''LDAP''::text]))
-);
-
-ALTER SEQUENCE "public"."idp_id_seq" OWNED BY "public"."idp"."id";
-
-ALTER TABLE ONLY "public"."idp" ADD CONSTRAINT "idp_pkey" PRIMARY KEY ("id");
-
-CREATE UNIQUE INDEX "idx_idp_unique_resource_id" ON ONLY "public"."idp" ("resource_id");
-
-CREATE SEQUENCE "public"."instance_id_seq"
- AS integer
- START WITH 1
- INCREMENT BY 1
- MINVALUE 1
- MAXVALUE 2147483647
- NO CYCLE;
-
-CREATE TABLE "public"."instance" (
- "id" integer DEFAULT nextval(''public.instance_id_seq''::regclass) NOT NULL,
- "deleted" boolean DEFAULT false NOT NULL,
- "environment" text,
- "resource_id" text NOT NULL,
- "metadata" jsonb DEFAULT ''{}''::jsonb NOT NULL
-);
-
-ALTER SEQUENCE "public"."instance_id_seq" OWNED BY "public"."instance"."id";
-
-ALTER TABLE ONLY "public"."instance" ADD CONSTRAINT "instance_pkey" PRIMARY KEY ("id");
-
-CREATE UNIQUE INDEX "idx_instance_unique_resource_id" ON ONLY "public"."instance" ("resource_id");
-
-CREATE SEQUENCE "public"."instance_change_history_id_seq"
- AS bigint
- START WITH 1
- INCREMENT BY 1
- MINVALUE 1
- MAXVALUE 9223372036854775807
- NO CYCLE;
-
-CREATE TABLE "public"."instance_change_history" (
- "id" bigint DEFAULT nextval(''public.instance_change_history_id_seq''::regclass) NOT NULL,
- "version" text NOT NULL
-);
-
-ALTER SEQUENCE "public"."instance_change_history_id_seq" OWNED BY "public"."instance_change_history"."id";
-
-ALTER TABLE ONLY "public"."instance_change_history" ADD CONSTRAINT "instance_change_history_pkey" PRIMARY KEY ("id");
-
-CREATE UNIQUE INDEX "idx_instance_change_history_unique_version" ON ONLY "public"."instance_change_history" ("version");
-
-CREATE SEQUENCE "public"."issue_id_seq"
- AS integer
- START WITH 1
- INCREMENT BY 1
- MINVALUE 1
- MAXVALUE 2147483647
- NO CYCLE;
-
-CREATE TABLE "public"."issue" (
- "id" integer DEFAULT nextval(''public.issue_id_seq''::regclass) NOT NULL,
- "creator_id" integer NOT NULL,
- "created_at" timestamp with time zone DEFAULT now() NOT NULL,
- "updated_at" timestamp with time zone DEFAULT now() NOT NULL,
- "project" text NOT NULL,
- "plan_id" bigint,
- "pipeline_id" integer,
- "name" text NOT NULL,
- "status" text NOT NULL,
- "type" text NOT NULL,
- "description" text DEFAULT ''''::text NOT NULL,
- "payload" jsonb DEFAULT ''{}''::jsonb NOT NULL,
- "ts_vector" tsvector,
- CONSTRAINT "issue_status_check" CHECK (status = ANY (ARRAY[''OPEN''::text, ''DONE''::text, ''CANCELED''::text]))
-);
-
-ALTER SEQUENCE "public"."issue_id_seq" OWNED BY "public"."issue"."id";
-
-ALTER TABLE ONLY "public"."issue" ADD CONSTRAINT "issue_pkey" PRIMARY KEY ("id");
-
-CREATE INDEX "idx_issue_creator_id" ON ONLY "public"."issue" ("creator_id");
-
-CREATE INDEX "idx_issue_pipeline_id" ON ONLY "public"."issue" ("pipeline_id");
-
-CREATE INDEX "idx_issue_plan_id" ON ONLY "public"."issue" ("plan_id");
-
-CREATE INDEX "idx_issue_project" ON ONLY "public"."issue" ("project");
-
-CREATE INDEX "idx_issue_ts_vector" ON ONLY "public"."issue" ("ts_vector");
-
-CREATE SEQUENCE "public"."issue_comment_id_seq"
- AS bigint
- START WITH 1
- INCREMENT BY 1
- MINVALUE 1
- MAXVALUE 9223372036854775807
- NO CYCLE;
-
-CREATE TABLE "public"."issue_comment" (
- "id" bigint DEFAULT nextval(''public.issue_comment_id_seq''::regclass) NOT NULL,
- "creator_id" integer NOT NULL,
- "created_at" timestamp with time zone DEFAULT now() NOT NULL,
- "updated_at" timestamp with time zone DEFAULT now() NOT NULL,
- "issue_id" integer NOT NULL,
- "payload" jsonb DEFAULT ''{}''::jsonb NOT NULL
-);
-
-ALTER SEQUENCE "public"."issue_comment_id_seq" OWNED BY "public"."issue_comment"."id";
-
-ALTER TABLE ONLY "public"."issue_comment" ADD CONSTRAINT "issue_comment_pkey" PRIMARY KEY ("id");
-
-CREATE INDEX "idx_issue_comment_issue_id" ON ONLY "public"."issue_comment" ("issue_id");
-
-CREATE TABLE "public"."issue_subscriber" (
- "issue_id" integer NOT NULL,
- "subscriber_id" integer NOT NULL
-);
-
-ALTER TABLE ONLY "public"."issue_subscriber" ADD CONSTRAINT "issue_subscriber_pkey" PRIMARY KEY ("issue_id", "subscriber_id");
-
-CREATE INDEX "idx_issue_subscriber_subscriber_id" ON ONLY "public"."issue_subscriber" ("subscriber_id");
-
-CREATE SEQUENCE "public"."pipeline_id_seq"
- AS integer
- START WITH 1
- INCREMENT BY 1
- MINVALUE 1
- MAXVALUE 2147483647
- NO CYCLE;
-
-CREATE TABLE "public"."pipeline" (
- "id" integer DEFAULT nextval(''public.pipeline_id_seq''::regclass) NOT NULL,
- "creator_id" integer NOT NULL,
- "created_at" timestamp with time zone DEFAULT now() NOT NULL,
- "project" text NOT NULL,
- "name" text NOT NULL
-);
-
-ALTER SEQUENCE "public"."pipeline_id_seq" OWNED BY "public"."pipeline"."id";
-
-ALTER TABLE ONLY "public"."pipeline" ADD CONSTRAINT "pipeline_pkey" PRIMARY KEY ("id");
-
-CREATE SEQUENCE "public"."plan_id_seq"
- AS bigint
- START WITH 1
- INCREMENT BY 1
- MINVALUE 1
- MAXVALUE 9223372036854775807
- NO CYCLE;
-
-CREATE TABLE "public"."plan" (
- "id" bigint DEFAULT nextval(''public.plan_id_seq''::regclass) NOT NULL,
- "creator_id" integer NOT NULL,
- "created_at" timestamp with time zone DEFAULT now() NOT NULL,
- "updated_at" timestamp with time zone DEFAULT now() NOT NULL,
- "project" text NOT NULL,
- "pipeline_id" integer,
- "name" text NOT NULL,
- "description" text NOT NULL,
- "config" jsonb DEFAULT ''{}''::jsonb NOT NULL
-);
-
-ALTER SEQUENCE "public"."plan_id_seq" OWNED BY "public"."plan"."id";
-
-ALTER TABLE ONLY "public"."plan" ADD CONSTRAINT "plan_pkey" PRIMARY KEY ("id");
-
-CREATE INDEX "idx_plan_pipeline_id" ON ONLY "public"."plan" ("pipeline_id");
-
-CREATE INDEX "idx_plan_project" ON ONLY "public"."plan" ("project");
-
-CREATE SEQUENCE "public"."plan_check_run_id_seq"
- AS integer
- START WITH 1
- INCREMENT BY 1
- MINVALUE 1
- MAXVALUE 2147483647
- NO CYCLE;
-
-CREATE TABLE "public"."plan_check_run" (
- "id" integer DEFAULT nextval(''public.plan_check_run_id_seq''::regclass) NOT NULL,
- "created_at" timestamp with time zone DEFAULT now() NOT NULL,
- "updated_at" timestamp with time zone DEFAULT now() NOT NULL,
- "plan_id" bigint NOT NULL,
- "status" text NOT NULL,
- "type" text NOT NULL,
- "config" jsonb DEFAULT ''{}''::jsonb NOT NULL,
- "result" jsonb DEFAULT ''{}''::jsonb NOT NULL,
- "payload" jsonb DEFAULT ''{}''::jsonb NOT NULL,
- CONSTRAINT "plan_check_run_status_check" CHECK (status = ANY (ARRAY[''RUNNING''::text, ''DONE''::text, ''FAILED''::text, ''CANCELED''::text])),
- CONSTRAINT "plan_check_run_type_check" CHECK (type ~~ ''bb.plan-check.%''::text)
-);
-
-ALTER SEQUENCE "public"."plan_check_run_id_seq" OWNED BY "public"."plan_check_run"."id";
-
-ALTER TABLE ONLY "public"."plan_check_run" ADD CONSTRAINT "plan_check_run_pkey" PRIMARY KEY ("id");
-
-CREATE INDEX "idx_plan_check_run_plan_id" ON ONLY "public"."plan_check_run" ("plan_id");
-
-CREATE SEQUENCE "public"."policy_id_seq"
- AS integer
- START WITH 1
- INCREMENT BY 1
- MINVALUE 1
- MAXVALUE 2147483647
- NO CYCLE;
-
-CREATE TABLE "public"."policy" (
- "id" integer DEFAULT nextval(''public.policy_id_seq''::regclass) NOT NULL,
- "enforce" boolean DEFAULT true NOT NULL,
- "updated_at" timestamp with time zone DEFAULT now() NOT NULL,
- "resource_type" text NOT NULL,
- "resource" text NOT NULL,
- "type" text NOT NULL,
- "payload" jsonb DEFAULT ''{}''::jsonb NOT NULL,
- "inherit_from_parent" boolean DEFAULT true NOT NULL,
- CONSTRAINT "policy_resource_type_check" CHECK (resource_type = ANY (ARRAY[''WORKSPACE''::text, ''ENVIRONMENT''::text, ''PROJECT''::text, ''INSTANCE''::text]))
-);
-
-ALTER SEQUENCE "public"."policy_id_seq" OWNED BY "public"."policy"."id";
-
-ALTER TABLE ONLY "public"."policy" ADD CONSTRAINT "policy_pkey" PRIMARY KEY ("id");
-
-CREATE UNIQUE INDEX "idx_policy_unique_resource_type_resource_type" ON ONLY "public"."policy" ("resource_type", "resource", "type");
-
-CREATE SEQUENCE "public"."principal_id_seq"
- AS integer
- START WITH 1
- INCREMENT BY 1
- MINVALUE 1
- MAXVALUE 2147483647
- NO CYCLE;
-
-CREATE TABLE "public"."principal" (
- "id" integer DEFAULT nextval(''public.principal_id_seq''::regclass) NOT NULL,
- "deleted" boolean DEFAULT false NOT NULL,
- "created_at" timestamp with time zone DEFAULT now() NOT NULL,
- "type" text NOT NULL,
- "name" text NOT NULL,
- "email" text NOT NULL,
- "password_hash" text NOT NULL,
- "phone" text DEFAULT ''''::text NOT NULL,
- "mfa_config" jsonb DEFAULT ''{}''::jsonb NOT NULL,
- "profile" jsonb DEFAULT ''{}''::jsonb NOT NULL,
- CONSTRAINT "principal_type_check" CHECK (type = ANY (ARRAY[''END_USER''::text, ''SYSTEM_BOT''::text, ''SERVICE_ACCOUNT''::text]))
-);
-
-ALTER SEQUENCE "public"."principal_id_seq" OWNED BY "public"."principal"."id";
-
-ALTER TABLE ONLY "public"."principal" ADD CONSTRAINT "principal_pkey" PRIMARY KEY ("id");
-
-CREATE SEQUENCE "public"."project_id_seq"
- AS integer
- START WITH 1
- INCREMENT BY 1
- MINVALUE 1
- MAXVALUE 2147483647
- NO CYCLE;
-
-CREATE TABLE "public"."project" (
- "id" integer DEFAULT nextval(''public.project_id_seq''::regclass) NOT NULL,
- "deleted" boolean DEFAULT false NOT NULL,
- "name" text NOT NULL,
- "resource_id" text NOT NULL,
- "data_classification_config_id" text DEFAULT ''''::text NOT NULL,
- "setting" jsonb DEFAULT ''{}''::jsonb NOT NULL
-);
-
-ALTER SEQUENCE "public"."project_id_seq" OWNED BY "public"."project"."id";
-
-ALTER TABLE ONLY "public"."project" ADD CONSTRAINT "project_pkey" PRIMARY KEY ("id");
-
-CREATE UNIQUE INDEX "idx_project_unique_resource_id" ON ONLY "public"."project" ("resource_id");
-
-CREATE SEQUENCE "public"."project_webhook_id_seq"
- AS integer
- START WITH 1
- INCREMENT BY 1
- MINVALUE 1
- MAXVALUE 2147483647
- NO CYCLE;
-
-CREATE TABLE "public"."project_webhook" (
- "id" integer DEFAULT nextval(''public.project_webhook_id_seq''::regclass) NOT NULL,
- "project" text NOT NULL,
- "type" text NOT NULL,
- "name" text NOT NULL,
- "url" text NOT NULL,
- "event_list" _text NOT NULL,
- "payload" jsonb DEFAULT ''{}''::jsonb NOT NULL,
- CONSTRAINT "project_webhook_type_check" CHECK (type ~~ ''bb.plugin.webhook.%''::text)
-);
-
-ALTER SEQUENCE "public"."project_webhook_id_seq" OWNED BY "public"."project_webhook"."id";
-
-ALTER TABLE ONLY "public"."project_webhook" ADD CONSTRAINT "project_webhook_pkey" PRIMARY KEY ("id");
-
-CREATE INDEX "idx_project_webhook_project" ON ONLY "public"."project_webhook" ("project");
-
-CREATE SEQUENCE "public"."query_history_id_seq"
- AS bigint
- START WITH 1
- INCREMENT BY 1
- MINVALUE 1
- MAXVALUE 9223372036854775807
- NO CYCLE;
-
-CREATE TABLE "public"."query_history" (
- "id" bigint DEFAULT nextval(''public.query_history_id_seq''::regclass) NOT NULL,
- "creator_id" integer NOT NULL,
- "created_at" timestamp with time zone DEFAULT now() NOT NULL,
- "project_id" text NOT NULL,
- "database" text NOT NULL,
- "statement" text NOT NULL,
- "type" text NOT NULL,
- "payload" jsonb DEFAULT ''{}''::jsonb NOT NULL
-);
-
-ALTER SEQUENCE "public"."query_history_id_seq" OWNED BY "public"."query_history"."id";
-
-ALTER TABLE ONLY "public"."query_history" ADD CONSTRAINT "query_history_pkey" PRIMARY KEY ("id");
-
-CREATE INDEX "idx_query_history_creator_id_created_at_project_id" ON ONLY "public"."query_history" ("creator_id", "created_at", "project_id" DESC);
-
-CREATE SEQUENCE "public"."release_id_seq"
- AS bigint
- START WITH 1
- INCREMENT BY 1
- MINVALUE 1
- MAXVALUE 9223372036854775807
- NO CYCLE;
-
-CREATE TABLE "public"."release" (
- "id" bigint DEFAULT nextval(''public.release_id_seq''::regclass) NOT NULL,
- "deleted" boolean DEFAULT false NOT NULL,
- "project" text NOT NULL,
- "creator_id" integer NOT NULL,
- "created_at" timestamp with time zone DEFAULT now() NOT NULL,
- "payload" jsonb DEFAULT ''{}''::jsonb NOT NULL
-);
-
-ALTER SEQUENCE "public"."release_id_seq" OWNED BY "public"."release"."id";
-
-ALTER TABLE ONLY "public"."release" ADD CONSTRAINT "release_pkey" PRIMARY KEY ("id");
-
-CREATE INDEX "idx_release_project" ON ONLY "public"."release" ("project");
-
-CREATE TABLE "public"."review_config" (
- "id" text NOT NULL,
- "enabled" boolean DEFAULT true NOT NULL,
- "name" text NOT NULL,
- "payload" jsonb DEFAULT ''{}''::jsonb NOT NULL
-);
-
-ALTER TABLE ONLY "public"."review_config" ADD CONSTRAINT "review_config_pkey" PRIMARY KEY ("id");
-
-CREATE SEQUENCE "public"."revision_id_seq"
- AS bigint
- START WITH 1
- INCREMENT BY 1
- MINVALUE 1
- MAXVALUE 9223372036854775807
- NO CYCLE;
-
-CREATE TABLE "public"."revision" (
- "id" bigint DEFAULT nextval(''public.revision_id_seq''::regclass) NOT NULL,
- "instance" text NOT NULL,
- "db_name" text NOT NULL,
- "created_at" timestamp with time zone DEFAULT now() NOT NULL,
- "deleter_id" integer,
- "deleted_at" timestamp with time zone,
- "version" text NOT NULL,
- "payload" jsonb DEFAULT ''{}''::jsonb NOT NULL
-);
-
-ALTER SEQUENCE "public"."revision_id_seq" OWNED BY "public"."revision"."id";
-
-ALTER TABLE ONLY "public"."revision" ADD CONSTRAINT "revision_pkey" PRIMARY KEY ("id");
-
-CREATE INDEX "idx_revision_instance_db_name_version" ON ONLY "public"."revision" ("instance", "db_name", "version");
-
-CREATE UNIQUE INDEX "idx_revision_unique_instance_db_name_version_deleted_at_null" ON ONLY "public"."revision" ("instance", "db_name", "version");
-
-CREATE SEQUENCE "public"."risk_id_seq"
- AS bigint
- START WITH 1
- INCREMENT BY 1
- MINVALUE 1
- MAXVALUE 9223372036854775807
- NO CYCLE;
-
-CREATE TABLE "public"."risk" (
- "id" bigint DEFAULT nextval(''public.risk_id_seq''::regclass) NOT NULL,
- "source" text NOT NULL,
- "level" bigint NOT NULL,
- "name" text NOT NULL,
- "active" boolean NOT NULL,
- "expression" jsonb NOT NULL,
- CONSTRAINT "risk_source_check" CHECK (source ~~ ''bb.risk.%''::text)
-);
-
-ALTER SEQUENCE "public"."risk_id_seq" OWNED BY "public"."risk"."id";
-
-ALTER TABLE ONLY "public"."risk" ADD CONSTRAINT "risk_pkey" PRIMARY KEY ("id");
-
-CREATE SEQUENCE "public"."role_id_seq"
- AS bigint
- START WITH 1
- INCREMENT BY 1
- MINVALUE 1
- MAXVALUE 9223372036854775807
- NO CYCLE;
-
-CREATE TABLE "public"."role" (
- "id" bigint DEFAULT nextval(''public.role_id_seq''::regclass) NOT NULL,
- "resource_id" text NOT NULL,
- "name" text NOT NULL,
- "description" text NOT NULL,
- "permissions" jsonb DEFAULT ''{}''::jsonb NOT NULL,
- "payload" jsonb DEFAULT ''{}''::jsonb NOT NULL
-);
-
-ALTER SEQUENCE "public"."role_id_seq" OWNED BY "public"."role"."id";
-
-ALTER TABLE ONLY "public"."role" ADD CONSTRAINT "role_pkey" PRIMARY KEY ("id");
-
-CREATE UNIQUE INDEX "idx_role_unique_resource_id" ON ONLY "public"."role" ("resource_id");
-
-CREATE SEQUENCE "public"."setting_id_seq"
- AS integer
- START WITH 1
- INCREMENT BY 1
- MINVALUE 1
- MAXVALUE 2147483647
- NO CYCLE;
-
-CREATE TABLE "public"."setting" (
- "id" integer DEFAULT nextval(''public.setting_id_seq''::regclass) NOT NULL,
- "name" text NOT NULL,
- "value" text NOT NULL
-);
-
-ALTER SEQUENCE "public"."setting_id_seq" OWNED BY "public"."setting"."id";
-
-ALTER TABLE ONLY "public"."setting" ADD CONSTRAINT "setting_pkey" PRIMARY KEY ("id");
-
-CREATE UNIQUE INDEX "idx_setting_unique_name" ON ONLY "public"."setting" ("name");
-
-CREATE SEQUENCE "public"."sheet_id_seq"
- AS integer
- START WITH 1
- INCREMENT BY 1
- MINVALUE 1
- MAXVALUE 2147483647
- NO CYCLE;
-
-CREATE TABLE "public"."sheet" (
- "id" integer DEFAULT nextval(''public.sheet_id_seq''::regclass) NOT NULL,
- "creator_id" integer NOT NULL,
- "created_at" timestamp with time zone DEFAULT now() NOT NULL,
- "project" text NOT NULL,
- "name" text NOT NULL,
- "sha256" bytea NOT NULL,
- "payload" jsonb DEFAULT ''{}''::jsonb NOT NULL
-);
-
-ALTER SEQUENCE "public"."sheet_id_seq" OWNED BY "public"."sheet"."id";
-
-ALTER TABLE ONLY "public"."sheet" ADD CONSTRAINT "sheet_pkey" PRIMARY KEY ("id");
-
-CREATE INDEX "idx_sheet_project" ON ONLY "public"."sheet" ("project");
-
-CREATE TABLE "public"."sheet_blob" (
- "sha256" bytea NOT NULL,
- "content" text NOT NULL
-);
-
-ALTER TABLE ONLY "public"."sheet_blob" ADD CONSTRAINT "sheet_blob_pkey" PRIMARY KEY ("sha256");
-
-CREATE SEQUENCE "public"."sync_history_id_seq"
- AS bigint
- START WITH 1
- INCREMENT BY 1
- MINVALUE 1
- MAXVALUE 9223372036854775807
- NO CYCLE;
-
-CREATE TABLE "public"."sync_history" (
- "id" bigint DEFAULT nextval(''public.sync_history_id_seq''::regclass) NOT NULL,
- "created_at" timestamp with time zone DEFAULT now() NOT NULL,
- "instance" text NOT NULL,
- "db_name" text NOT NULL,
- "metadata" json DEFAULT ''{}''::json NOT NULL,
- "raw_dump" text DEFAULT ''''::text NOT NULL
-);
-
-ALTER SEQUENCE "public"."sync_history_id_seq" OWNED BY "public"."sync_history"."id";
-
-ALTER TABLE ONLY "public"."sync_history" ADD CONSTRAINT "sync_history_pkey" PRIMARY KEY ("id");
-
-CREATE INDEX "idx_sync_history_instance_db_name_created_at" ON ONLY "public"."sync_history" ("instance", "db_name", "created_at");
-
-CREATE SEQUENCE "public"."task_id_seq"
- AS integer
- START WITH 1
- INCREMENT BY 1
- MINVALUE 1
- MAXVALUE 2147483647
- NO CYCLE;
-
-CREATE TABLE "public"."task" (
- "id" integer DEFAULT nextval(''public.task_id_seq''::regclass) NOT NULL,
- "pipeline_id" integer NOT NULL,
- "instance" text NOT NULL,
- "db_name" text,
- "type" text NOT NULL,
- "payload" jsonb DEFAULT ''{}''::jsonb NOT NULL,
- "environment" text
-);
-
-ALTER SEQUENCE "public"."task_id_seq" OWNED BY "public"."task"."id";
-
-ALTER TABLE ONLY "public"."task" ADD CONSTRAINT "task_pkey" PRIMARY KEY ("id");
-
-CREATE INDEX "idx_task_pipeline_id_environment" ON ONLY "public"."task" ("pipeline_id", "environment");
-
-CREATE SEQUENCE "public"."task_run_id_seq"
- AS integer
- START WITH 1
- INCREMENT BY 1
- MINVALUE 1
- MAXVALUE 2147483647
- NO CYCLE;
-
-CREATE TABLE "public"."task_run" (
- "id" integer DEFAULT nextval(''public.task_run_id_seq''::regclass) NOT NULL,
- "creator_id" integer NOT NULL,
- "created_at" timestamp with time zone DEFAULT now() NOT NULL,
- "updated_at" timestamp with time zone DEFAULT now() NOT NULL,
- "task_id" integer NOT NULL,
- "sheet_id" integer,
- "attempt" integer NOT NULL,
- "status" text NOT NULL,
- "started_at" timestamp with time zone,
- "code" integer DEFAULT 0 NOT NULL,
- "result" jsonb DEFAULT ''{}''::jsonb NOT NULL,
- "run_at" timestamp with time zone,
- CONSTRAINT "task_run_status_check" CHECK (status = ANY (ARRAY[''PENDING''::text, ''RUNNING''::text, ''DONE''::text, ''FAILED''::text, ''CANCELED''::text]))
-);
-
-ALTER SEQUENCE "public"."task_run_id_seq" OWNED BY "public"."task_run"."id";
-
-ALTER TABLE ONLY "public"."task_run" ADD CONSTRAINT "task_run_pkey" PRIMARY KEY ("id");
-
-CREATE INDEX "idx_task_run_task_id" ON ONLY "public"."task_run" ("task_id");
-
-CREATE UNIQUE INDEX "uk_task_run_task_id_attempt" ON ONLY "public"."task_run" ("task_id", "attempt");
-
-CREATE SEQUENCE "public"."task_run_log_id_seq"
- AS bigint
- START WITH 1
- INCREMENT BY 1
- MINVALUE 1
- MAXVALUE 9223372036854775807
- NO CYCLE;
-
-CREATE TABLE "public"."task_run_log" (
- "id" bigint DEFAULT nextval(''public.task_run_log_id_seq''::regclass) NOT NULL,
- "task_run_id" integer NOT NULL,
- "created_at" timestamp with time zone DEFAULT now() NOT NULL,
- "payload" jsonb DEFAULT ''{}''::jsonb NOT NULL
-);
-
-ALTER SEQUENCE "public"."task_run_log_id_seq" OWNED BY "public"."task_run_log"."id";
-
-ALTER TABLE ONLY "public"."task_run_log" ADD CONSTRAINT "task_run_log_pkey" PRIMARY KEY ("id");
-
-CREATE INDEX "idx_task_run_log_task_run_id" ON ONLY "public"."task_run_log" ("task_run_id");
-
-CREATE TABLE "public"."user_group" (
- "email" text NOT NULL,
- "name" text NOT NULL,
- "description" text DEFAULT ''''::text NOT NULL,
- "payload" jsonb DEFAULT ''{}''::jsonb NOT NULL
-);
-
-ALTER TABLE ONLY "public"."user_group" ADD CONSTRAINT "user_group_pkey" PRIMARY KEY ("email");
-
-CREATE SEQUENCE "public"."worksheet_id_seq"
- AS integer
- START WITH 1
- INCREMENT BY 1
- MINVALUE 1
- MAXVALUE 2147483647
- NO CYCLE;
-
-CREATE TABLE "public"."worksheet" (
- "id" integer DEFAULT nextval(''public.worksheet_id_seq''::regclass) NOT NULL,
- "creator_id" integer NOT NULL,
- "created_at" timestamp with time zone DEFAULT now() NOT NULL,
- "updated_at" timestamp with time zone DEFAULT now() NOT NULL,
- "project" text NOT NULL,
- "instance" text,
- "db_name" text,
- "name" text NOT NULL,
- "statement" text NOT NULL,
- "visibility" text NOT NULL,
- "payload" jsonb DEFAULT ''{}''::jsonb NOT NULL
-);
-
-ALTER SEQUENCE "public"."worksheet_id_seq" OWNED BY "public"."worksheet"."id";
-
-ALTER TABLE ONLY "public"."worksheet" ADD CONSTRAINT "worksheet_pkey" PRIMARY KEY ("id");
-
-CREATE INDEX "idx_worksheet_creator_id_project" ON ONLY "public"."worksheet" ("creator_id", "project");
-
-CREATE SEQUENCE "public"."worksheet_organizer_id_seq"
- AS integer
- START WITH 1
- INCREMENT BY 1
- MINVALUE 1
- MAXVALUE 2147483647
- NO CYCLE;
-
-CREATE TABLE "public"."worksheet_organizer" (
- "id" integer DEFAULT nextval(''public.worksheet_organizer_id_seq''::regclass) NOT NULL,
- "worksheet_id" integer NOT NULL,
- "principal_id" integer NOT NULL,
- "starred" boolean DEFAULT false NOT NULL
-);
-
-ALTER SEQUENCE "public"."worksheet_organizer_id_seq" OWNED BY "public"."worksheet_organizer"."id";
-
-ALTER TABLE ONLY "public"."worksheet_organizer" ADD CONSTRAINT "worksheet_organizer_pkey" PRIMARY KEY ("id");
-
-CREATE INDEX "idx_worksheet_organizer_principal_id" ON ONLY "public"."worksheet_organizer" ("principal_id");
-
-CREATE UNIQUE INDEX "idx_worksheet_organizer_unique_sheet_id_principal_id" ON ONLY "public"."worksheet_organizer" ("worksheet_id", "principal_id");
-
-ALTER TABLE "public"."changelist"
- ADD CONSTRAINT "changelist_creator_id_fkey" FOREIGN KEY ("creator_id")
- REFERENCES "public"."principal" ("id");
-
-ALTER TABLE "public"."changelist"
- ADD CONSTRAINT "changelist_project_fkey" FOREIGN KEY ("project")
- REFERENCES "public"."project" ("resource_id");
-
-ALTER TABLE "public"."changelog"
- ADD CONSTRAINT "changelog_instance_db_name_fkey" FOREIGN KEY ("instance", "db_name")
- REFERENCES "public"."db" ("instance", "name");
-
-ALTER TABLE "public"."changelog"
- ADD CONSTRAINT "changelog_prev_sync_history_id_fkey" FOREIGN KEY ("prev_sync_history_id")
- REFERENCES "public"."sync_history" ("id");
-
-ALTER TABLE "public"."changelog"
- ADD CONSTRAINT "changelog_sync_history_id_fkey" FOREIGN KEY ("sync_history_id")
- REFERENCES "public"."sync_history" ("id");
-
-ALTER TABLE "public"."data_source"
- ADD CONSTRAINT "data_source_instance_fkey" FOREIGN KEY ("instance")
- REFERENCES "public"."instance" ("resource_id");
-
-ALTER TABLE "public"."db"
- ADD CONSTRAINT "db_instance_fkey" FOREIGN KEY ("instance")
- REFERENCES "public"."instance" ("resource_id");
-
-ALTER TABLE "public"."db"
- ADD CONSTRAINT "db_project_fkey" FOREIGN KEY ("project")
- REFERENCES "public"."project" ("resource_id");
-
-ALTER TABLE "public"."db_group"
- ADD CONSTRAINT "db_group_project_fkey" FOREIGN KEY ("project")
- REFERENCES "public"."project" ("resource_id");
-
-ALTER TABLE "public"."db_schema"
- ADD CONSTRAINT "db_schema_instance_db_name_fkey" FOREIGN KEY ("instance", "db_name")
- REFERENCES "public"."db" ("instance", "name");
-
-ALTER TABLE "public"."issue"
- ADD CONSTRAINT "issue_creator_id_fkey" FOREIGN KEY ("creator_id")
- REFERENCES "public"."principal" ("id");
-
-ALTER TABLE "public"."issue"
- ADD CONSTRAINT "issue_pipeline_id_fkey" FOREIGN KEY ("pipeline_id")
- REFERENCES "public"."pipeline" ("id");
-
-ALTER TABLE "public"."issue"
- ADD CONSTRAINT "issue_plan_id_fkey" FOREIGN KEY ("plan_id")
- REFERENCES "public"."plan" ("id");
-
-ALTER TABLE "public"."issue"
- ADD CONSTRAINT "issue_project_fkey" FOREIGN KEY ("project")
- REFERENCES "public"."project" ("resource_id");
-
-ALTER TABLE "public"."issue_comment"
- ADD CONSTRAINT "issue_comment_creator_id_fkey" FOREIGN KEY ("creator_id")
- REFERENCES "public"."principal" ("id");
-
-ALTER TABLE "public"."issue_comment"
- ADD CONSTRAINT "issue_comment_issue_id_fkey" FOREIGN KEY ("issue_id")
- REFERENCES "public"."issue" ("id");
-
-ALTER TABLE "public"."issue_subscriber"
- ADD CONSTRAINT "issue_subscriber_issue_id_fkey" FOREIGN KEY ("issue_id")
- REFERENCES "public"."issue" ("id");
-
-ALTER TABLE "public"."issue_subscriber"
- ADD CONSTRAINT "issue_subscriber_subscriber_id_fkey" FOREIGN KEY ("subscriber_id")
- REFERENCES "public"."principal" ("id");
-
-ALTER TABLE "public"."pipeline"
- ADD CONSTRAINT "pipeline_creator_id_fkey" FOREIGN KEY ("creator_id")
- REFERENCES "public"."principal" ("id");
-
-ALTER TABLE "public"."pipeline"
- ADD CONSTRAINT "pipeline_project_fkey" FOREIGN KEY ("project")
- REFERENCES "public"."project" ("resource_id");
-
-ALTER TABLE "public"."plan"
- ADD CONSTRAINT "plan_creator_id_fkey" FOREIGN KEY ("creator_id")
- REFERENCES "public"."principal" ("id");
-
-ALTER TABLE "public"."plan"
- ADD CONSTRAINT "plan_pipeline_id_fkey" FOREIGN KEY ("pipeline_id")
- REFERENCES "public"."pipeline" ("id");
-
-ALTER TABLE "public"."plan"
- ADD CONSTRAINT "plan_project_fkey" FOREIGN KEY ("project")
- REFERENCES "public"."project" ("resource_id");
-
-ALTER TABLE "public"."plan_check_run"
- ADD CONSTRAINT "plan_check_run_plan_id_fkey" FOREIGN KEY ("plan_id")
- REFERENCES "public"."plan" ("id");
-
-ALTER TABLE "public"."project_webhook"
- ADD CONSTRAINT "project_webhook_project_fkey" FOREIGN KEY ("project")
- REFERENCES "public"."project" ("resource_id");
-
-ALTER TABLE "public"."query_history"
- ADD CONSTRAINT "query_history_creator_id_fkey" FOREIGN KEY ("creator_id")
- REFERENCES "public"."principal" ("id");
-
-ALTER TABLE "public"."release"
- ADD CONSTRAINT "release_creator_id_fkey" FOREIGN KEY ("creator_id")
- REFERENCES "public"."principal" ("id");
-
-ALTER TABLE "public"."release"
- ADD CONSTRAINT "release_project_fkey" FOREIGN KEY ("project")
- REFERENCES "public"."project" ("resource_id");
-
-ALTER TABLE "public"."revision"
- ADD CONSTRAINT "revision_deleter_id_fkey" FOREIGN KEY ("deleter_id")
- REFERENCES "public"."principal" ("id");
-
-ALTER TABLE "public"."revision"
- ADD CONSTRAINT "revision_instance_db_name_fkey" FOREIGN KEY ("instance", "db_name")
- REFERENCES "public"."db" ("instance", "name");
-
-ALTER TABLE "public"."sheet"
- ADD CONSTRAINT "sheet_creator_id_fkey" FOREIGN KEY ("creator_id")
- REFERENCES "public"."principal" ("id");
-
-ALTER TABLE "public"."sheet"
- ADD CONSTRAINT "sheet_project_fkey" FOREIGN KEY ("project")
- REFERENCES "public"."project" ("resource_id");
-
-ALTER TABLE "public"."sync_history"
- ADD CONSTRAINT "sync_history_instance_db_name_fkey" FOREIGN KEY ("instance", "db_name")
- REFERENCES "public"."db" ("instance", "name");
-
-ALTER TABLE "public"."task"
- ADD CONSTRAINT "task_instance_fkey" FOREIGN KEY ("instance")
- REFERENCES "public"."instance" ("resource_id");
-
-ALTER TABLE "public"."task"
- ADD CONSTRAINT "task_pipeline_id_fkey" FOREIGN KEY ("pipeline_id")
- REFERENCES "public"."pipeline" ("id");
-
-ALTER TABLE "public"."task_run"
- ADD CONSTRAINT "task_run_creator_id_fkey" FOREIGN KEY ("creator_id")
- REFERENCES "public"."principal" ("id");
-
-ALTER TABLE "public"."task_run"
- ADD CONSTRAINT "task_run_sheet_id_fkey" FOREIGN KEY ("sheet_id")
- REFERENCES "public"."sheet" ("id");
-
-ALTER TABLE "public"."task_run"
- ADD CONSTRAINT "task_run_task_id_fkey" FOREIGN KEY ("task_id")
- REFERENCES "public"."task" ("id");
-
-ALTER TABLE "public"."task_run_log"
- ADD CONSTRAINT "task_run_log_task_run_id_fkey" FOREIGN KEY ("task_run_id")
- REFERENCES "public"."task_run" ("id");
-
-ALTER TABLE "public"."worksheet"
- ADD CONSTRAINT "worksheet_creator_id_fkey" FOREIGN KEY ("creator_id")
- REFERENCES "public"."principal" ("id");
-
-ALTER TABLE "public"."worksheet"
- ADD CONSTRAINT "worksheet_project_fkey" FOREIGN KEY ("project")
- REFERENCES "public"."project" ("resource_id");
-
-ALTER TABLE "public"."worksheet_organizer"
- ADD CONSTRAINT "worksheet_organizer_principal_id_fkey" FOREIGN KEY ("principal_id")
- REFERENCES "public"."principal" ("id");
-
-ALTER TABLE "public"."worksheet_organizer"
- ADD CONSTRAINT "worksheet_organizer_worksheet_id_fkey" FOREIGN KEY ("worksheet_id")
- REFERENCES "public"."worksheet" ("id");
-
-', '{}') ON CONFLICT DO NOTHING;
-INSERT INTO public.db_schema (instance, db_name, metadata, raw_dump, config) VALUES ('bytebase-meta', 'postgres', '{"name":"postgres", "schemas":[{"name":"public", "owner":"pg_database_owner"}], "characterSet":"UTF8", "collation":"en_US.UTF-8", "owner":"bb", "searchPath":"\"$user\", public"}', '
-SET statement_timeout = 0;
-SET lock_timeout = 0;
-SET idle_in_transaction_session_timeout = 0;
-SET client_encoding = ''UTF8'';
-SET standard_conforming_strings = on;
-SELECT pg_catalog.set_config(''search_path'', '''', false);
-SET check_function_bodies = false;
-SET xmloption = content;
-SET client_min_messages = warning;
-SET row_security = off;
-
-SET default_tablespace = '''';
-
-', '{}') ON CONFLICT DO NOTHING;
-INSERT INTO public.db_schema (instance, db_name, metadata, raw_dump, config) VALUES ('prod-sample-instance', 'postgres', '{"name":"postgres", "schemas":[{"name":"public", "owner":"pg_database_owner"}], "characterSet":"UTF8", "collation":"en_US.UTF-8", "owner":"bbsample", "searchPath":"\"$user\", public"}', '
-SET statement_timeout = 0;
-SET lock_timeout = 0;
-SET idle_in_transaction_session_timeout = 0;
-SET client_encoding = ''UTF8'';
-SET standard_conforming_strings = on;
-SELECT pg_catalog.set_config(''search_path'', '''', false);
-SET check_function_bodies = false;
-SET xmloption = content;
-SET client_min_messages = warning;
-SET row_security = off;
-
-SET default_tablespace = '''';
-
-', '{}') ON CONFLICT DO NOTHING;
-INSERT INTO public.db_schema (instance, db_name, metadata, raw_dump, config) VALUES ('test-sample-instance', 'postgres', '{"name":"postgres", "schemas":[{"name":"public", "owner":"pg_database_owner"}], "characterSet":"UTF8", "collation":"en_US.UTF-8", "owner":"bbsample", "searchPath":"\"$user\", public"}', '
-SET statement_timeout = 0;
-SET lock_timeout = 0;
-SET idle_in_transaction_session_timeout = 0;
-SET client_encoding = ''UTF8'';
-SET standard_conforming_strings = on;
-SELECT pg_catalog.set_config(''search_path'', '''', false);
-SET check_function_bodies = false;
-SET xmloption = content;
-SET client_min_messages = warning;
-SET row_security = off;
-
-SET default_tablespace = '''';
-
-', '{}') ON CONFLICT DO NOTHING;
-INSERT INTO public.db_schema (instance, db_name, metadata, raw_dump, config) VALUES ('prod-sample-instance', 'hr_prod', '{"name":"hr_prod","schemas":[{"name":"bbdataarchive","owner":"bbsample"},{"name":"public","tables":[{"name":"audit","columns":[{"name":"id","position":1,"default":"nextval(''public.audit_id_seq''::regclass)","type":"integer"},{"name":"operation","position":2,"type":"text"},{"name":"query","position":3,"nullable":true,"type":"text"},{"name":"user_name","position":4,"type":"text"},{"name":"changed_at","position":5,"default":"CURRENT_TIMESTAMP","nullable":true,"type":"timestamp(6) with time zone"}],"indexes":[{"name":"audit_pkey","expressions":["id"],"descending":[false],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX audit_pkey ON public.audit USING btree (id);","isConstraint":true,"opclassNames":["int4_ops"],"opclassDefaults":[true]},{"name":"idx_audit_changed_at","expressions":["changed_at"],"descending":[false],"type":"btree","definition":"CREATE INDEX idx_audit_changed_at ON public.audit USING btree (changed_at);","opclassNames":["timestamptz_ops"],"opclassDefaults":[true]},{"name":"idx_audit_operation","expressions":["operation"],"descending":[false],"type":"btree","definition":"CREATE INDEX idx_audit_operation ON public.audit USING btree (operation);","opclassNames":["text_ops"],"opclassDefaults":[true]},{"name":"idx_audit_username","expressions":["user_name"],"descending":[false],"type":"btree","definition":"CREATE INDEX idx_audit_username ON public.audit USING btree (user_name);","opclassNames":["text_ops"],"opclassDefaults":[true]}],"dataSize":"8192","indexSize":"32768","owner":"bbsample"},{"name":"department","columns":[{"name":"dept_no","position":1,"type":"text"},{"name":"dept_name","position":2,"type":"text"}],"indexes":[{"name":"department_dept_name_key","expressions":["dept_name"],"descending":[false],"type":"btree","unique":true,"definition":"CREATE UNIQUE INDEX department_dept_name_key ON public.department USING btree (dept_name);","isConstraint":true,"opclassNames":["text_ops"],"opclassDefaults":[true]},{"name":"department_pkey","expressions":["dept_no"],"descending":[false],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX department_pkey ON public.department USING btree (dept_no);","isConstraint":true,"opclassNames":["text_ops"],"opclassDefaults":[true]}],"dataSize":"16384","indexSize":"32768","owner":"bbsample"},{"name":"dept_emp","columns":[{"name":"emp_no","position":1,"type":"integer"},{"name":"dept_no","position":2,"type":"text"},{"name":"from_date","position":3,"type":"date"},{"name":"to_date","position":4,"type":"date"}],"indexes":[{"name":"dept_emp_pkey","expressions":["emp_no","dept_no"],"descending":[false,false],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX dept_emp_pkey ON public.dept_emp USING btree (emp_no, dept_no);","isConstraint":true,"opclassNames":["int4_ops","text_ops"],"opclassDefaults":[true,true]}],"rowCount":"1103","dataSize":"106496","indexSize":"57344","foreignKeys":[{"name":"dept_emp_dept_no_fkey","columns":["dept_no"],"referencedSchema":"public","referencedTable":"department","referencedColumns":["dept_no"],"onDelete":"CASCADE","onUpdate":"NO ACTION","matchType":"SIMPLE"},{"name":"dept_emp_emp_no_fkey","columns":["emp_no"],"referencedSchema":"public","referencedTable":"employee","referencedColumns":["emp_no"],"onDelete":"CASCADE","onUpdate":"NO ACTION","matchType":"SIMPLE"}],"owner":"bbsample"},{"name":"dept_manager","columns":[{"name":"emp_no","position":1,"type":"integer"},{"name":"dept_no","position":2,"type":"text"},{"name":"from_date","position":3,"type":"date"},{"name":"to_date","position":4,"type":"date"}],"indexes":[{"name":"dept_manager_pkey","expressions":["emp_no","dept_no"],"descending":[false,false],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX dept_manager_pkey ON public.dept_manager USING btree (emp_no, dept_no);","isConstraint":true,"opclassNames":["int4_ops","text_ops"],"opclassDefaults":[true,true]}],"dataSize":"16384","indexSize":"16384","foreignKeys":[{"name":"dept_manager_dept_no_fkey","columns":["dept_no"],"referencedSchema":"public","referencedTable":"department","referencedColumns":["dept_no"],"onDelete":"CASCADE","onUpdate":"NO ACTION","matchType":"SIMPLE"},{"name":"dept_manager_emp_no_fkey","columns":["emp_no"],"referencedSchema":"public","referencedTable":"employee","referencedColumns":["emp_no"],"onDelete":"CASCADE","onUpdate":"NO ACTION","matchType":"SIMPLE"}],"owner":"bbsample"},{"name":"employee","columns":[{"name":"emp_no","position":1,"default":"nextval(''public.employee_emp_no_seq''::regclass)","type":"integer"},{"name":"birth_date","position":2,"type":"date"},{"name":"first_name","position":3,"type":"text"},{"name":"last_name","position":4,"type":"text"},{"name":"gender","position":5,"type":"text"},{"name":"hire_date","position":6,"type":"date"}],"indexes":[{"name":"employee_pkey","expressions":["emp_no"],"descending":[false],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX employee_pkey ON public.employee USING btree (emp_no);","isConstraint":true,"opclassNames":["int4_ops"],"opclassDefaults":[true]},{"name":"idx_employee_hire_date","expressions":["hire_date"],"descending":[false],"type":"btree","definition":"CREATE INDEX idx_employee_hire_date ON public.employee USING btree (hire_date);","opclassNames":["date_ops"],"opclassDefaults":[true]}],"rowCount":"1000","dataSize":"98304","indexSize":"98304","checkConstraints":[{"name":"employee_gender_check","expression":"(gender = ANY (ARRAY[''M''::text, ''F''::text]))"}],"owner":"bbsample"},{"name":"salary","columns":[{"name":"emp_no","position":1,"type":"integer"},{"name":"amount","position":2,"type":"integer"},{"name":"from_date","position":3,"type":"date"},{"name":"to_date","position":4,"type":"date"}],"indexes":[{"name":"idx_salary_amount","expressions":["amount"],"descending":[false],"type":"btree","definition":"CREATE INDEX idx_salary_amount ON public.salary USING btree (amount);","opclassNames":["int4_ops"],"opclassDefaults":[true]},{"name":"salary_pkey","expressions":["emp_no","from_date"],"descending":[false,false],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX salary_pkey ON public.salary USING btree (emp_no, from_date);","isConstraint":true,"opclassNames":["int4_ops","date_ops"],"opclassDefaults":[true,true]}],"rowCount":"9488","dataSize":"458752","indexSize":"548864","foreignKeys":[{"name":"salary_emp_no_fkey","columns":["emp_no"],"referencedSchema":"public","referencedTable":"employee","referencedColumns":["emp_no"],"onDelete":"CASCADE","onUpdate":"NO ACTION","matchType":"SIMPLE"}],"owner":"bbsample","triggers":[{"name":"salary_log_trigger","body":"CREATE TRIGGER salary_log_trigger AFTER DELETE OR UPDATE ON public.salary FOR EACH ROW EXECUTE FUNCTION public.log_dml_operations()"}]},{"name":"title","columns":[{"name":"emp_no","position":1,"type":"integer"},{"name":"title","position":2,"type":"text"},{"name":"from_date","position":3,"type":"date"},{"name":"to_date","position":4,"nullable":true,"type":"date"}],"indexes":[{"name":"title_pkey","expressions":["emp_no","title","from_date"],"descending":[false,false,false],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX title_pkey ON public.title USING btree (emp_no, title, from_date);","isConstraint":true,"opclassNames":["int4_ops","text_ops","date_ops"],"opclassDefaults":[true,true,true]}],"rowCount":"1470","dataSize":"131072","indexSize":"73728","foreignKeys":[{"name":"title_emp_no_fkey","columns":["emp_no"],"referencedSchema":"public","referencedTable":"employee","referencedColumns":["emp_no"],"onDelete":"CASCADE","onUpdate":"NO ACTION","matchType":"SIMPLE"}],"owner":"bbsample"}],"views":[{"name":"current_dept_emp","definition":" SELECT l.emp_no,\n d.dept_no,\n l.from_date,\n l.to_date\n FROM (public.dept_emp d\n JOIN public.dept_emp_latest_date l ON (((d.emp_no = l.emp_no) AND (d.from_date = l.from_date) AND (l.to_date = d.to_date))));","dependencyColumns":[{"schema":"public","table":"dept_emp","column":"dept_no"},{"schema":"public","table":"dept_emp","column":"emp_no"},{"schema":"public","table":"dept_emp","column":"from_date"},{"schema":"public","table":"dept_emp","column":"to_date"},{"schema":"public","table":"dept_emp_latest_date","column":"emp_no"},{"schema":"public","table":"dept_emp_latest_date","column":"from_date"},{"schema":"public","table":"dept_emp_latest_date","column":"to_date"}],"columns":[{"name":"emp_no","position":1,"nullable":true,"type":"integer"},{"name":"dept_no","position":2,"nullable":true,"type":"text"},{"name":"from_date","position":3,"nullable":true,"type":"date"},{"name":"to_date","position":4,"nullable":true,"type":"date"}]},{"name":"dept_emp_latest_date","definition":" SELECT emp_no,\n max(from_date) AS from_date,\n max(to_date) AS to_date\n FROM public.dept_emp\n GROUP BY emp_no;","dependencyColumns":[{"schema":"public","table":"dept_emp","column":"emp_no"},{"schema":"public","table":"dept_emp","column":"from_date"},{"schema":"public","table":"dept_emp","column":"to_date"}],"columns":[{"name":"emp_no","position":1,"nullable":true,"type":"integer"},{"name":"from_date","position":2,"nullable":true,"type":"date"},{"name":"to_date","position":3,"nullable":true,"type":"date"}]}],"functions":[{"name":"log_dml_operations","definition":"CREATE OR REPLACE FUNCTION public.log_dml_operations()\n RETURNS trigger\n LANGUAGE plpgsql\nAS $function$\nBEGIN\n IF (TG_OP = ''INSERT'') THEN\n INSERT INTO audit (operation, query, user_name)\n VALUES (''INSERT'', current_query(), current_user);\n RETURN NEW;\n ELSIF (TG_OP = ''UPDATE'') THEN\n INSERT INTO audit (operation, query, user_name)\n VALUES (''UPDATE'', current_query(), current_user);\n RETURN NEW;\n ELSIF (TG_OP = ''DELETE'') THEN\n INSERT INTO audit (operation, query, user_name)\n VALUES (''DELETE'', current_query(), current_user);\n RETURN OLD;\n END IF;\n RETURN NULL;\nEND;\n$function$\n","signature":"log_dml_operations()"}],"sequences":[{"name":"audit_id_seq","dataType":"integer","start":"1","minValue":"1","maxValue":"2147483647","increment":"1","cacheSize":"1","ownerTable":"audit","ownerColumn":"id"},{"name":"employee_emp_no_seq","dataType":"integer","start":"1","minValue":"1","maxValue":"2147483647","increment":"1","cacheSize":"1","ownerTable":"employee","ownerColumn":"emp_no"}],"owner":"pg_database_owner","comment":"standard public schema"}],"characterSet":"UTF8","collation":"en_US.UTF-8","owner":"bbsample","searchPath":"\"$user\", public"}', '
-SET statement_timeout = 0;
-SET lock_timeout = 0;
-SET idle_in_transaction_session_timeout = 0;
-SET client_encoding = ''UTF8'';
-SET standard_conforming_strings = on;
-SELECT pg_catalog.set_config(''search_path'', '''', false);
-SET check_function_bodies = false;
-SET xmloption = content;
-SET client_min_messages = warning;
-SET row_security = off;
-
-CREATE SEQUENCE "public"."audit_id_seq"
- AS integer
- START WITH 1
- INCREMENT BY 1
- MINVALUE 1
- MAXVALUE 2147483647
- NO CYCLE;
-
-CREATE SEQUENCE "public"."employee_emp_no_seq"
- AS integer
- START WITH 1
- INCREMENT BY 1
- MINVALUE 1
- MAXVALUE 2147483647
- NO CYCLE;
-
-SET default_tablespace = '''';
-
-CREATE TABLE "public"."audit" (
- "id" integer DEFAULT nextval(''public.audit_id_seq''::regclass) NOT NULL,
- "operation" text NOT NULL,
- "query" text,
- "user_name" text NOT NULL,
- "changed_at" timestamp(6) with time zone DEFAULT CURRENT_TIMESTAMP
-);
-
-ALTER SEQUENCE "public"."audit_id_seq" OWNED BY "public"."audit"."id";
-
-ALTER TABLE ONLY "public"."audit" ADD CONSTRAINT "audit_pkey" PRIMARY KEY (id);
-
-CREATE INDEX "idx_audit_changed_at" ON ONLY "public"."audit" (changed_at);
-
-CREATE INDEX "idx_audit_operation" ON ONLY "public"."audit" (operation);
-
-CREATE INDEX "idx_audit_username" ON ONLY "public"."audit" (user_name);
-
-CREATE TABLE "public"."department" (
- "dept_no" text NOT NULL,
- "dept_name" text NOT NULL
-);
-
-ALTER TABLE ONLY "public"."department" ADD CONSTRAINT "department_pkey" PRIMARY KEY (dept_no);
-
-ALTER TABLE ONLY "public"."department" ADD CONSTRAINT "department_dept_name_key" UNIQUE (dept_name);
-
-CREATE TABLE "public"."dept_emp" (
- "emp_no" integer NOT NULL,
- "dept_no" text NOT NULL,
- "from_date" date NOT NULL,
- "to_date" date NOT NULL
-);
-
-ALTER TABLE ONLY "public"."dept_emp" ADD CONSTRAINT "dept_emp_pkey" PRIMARY KEY (emp_no, dept_no);
-
-CREATE TABLE "public"."dept_manager" (
- "emp_no" integer NOT NULL,
- "dept_no" text NOT NULL,
- "from_date" date NOT NULL,
- "to_date" date NOT NULL
-);
-
-ALTER TABLE ONLY "public"."dept_manager" ADD CONSTRAINT "dept_manager_pkey" PRIMARY KEY (emp_no, dept_no);
-
-CREATE TABLE "public"."employee" (
- "emp_no" integer DEFAULT nextval(''public.employee_emp_no_seq''::regclass) NOT NULL,
- "birth_date" date NOT NULL,
- "first_name" text NOT NULL,
- "last_name" text NOT NULL,
- "gender" text NOT NULL,
- "hire_date" date NOT NULL,
- CONSTRAINT "employee_gender_check" CHECK (gender = ANY (ARRAY[''M''::text, ''F''::text]))
-);
-
-ALTER SEQUENCE "public"."employee_emp_no_seq" OWNED BY "public"."employee"."emp_no";
-
-ALTER TABLE ONLY "public"."employee" ADD CONSTRAINT "employee_pkey" PRIMARY KEY (emp_no);
-
-CREATE INDEX "idx_employee_hire_date" ON ONLY "public"."employee" (hire_date);
-
-CREATE OR REPLACE FUNCTION public.log_dml_operations()
- RETURNS trigger
- LANGUAGE plpgsql
-AS $function$
-BEGIN
- IF (TG_OP = ''INSERT'') THEN
- INSERT INTO audit (operation, query, user_name)
- VALUES (''INSERT'', current_query(), current_user);
- RETURN NEW;
- ELSIF (TG_OP = ''UPDATE'') THEN
- INSERT INTO audit (operation, query, user_name)
- VALUES (''UPDATE'', current_query(), current_user);
- RETURN NEW;
- ELSIF (TG_OP = ''DELETE'') THEN
- INSERT INTO audit (operation, query, user_name)
- VALUES (''DELETE'', current_query(), current_user);
- RETURN OLD;
- END IF;
- RETURN NULL;
-END;
-$function$
-;
-
-CREATE TABLE "public"."salary" (
- "emp_no" integer NOT NULL,
- "amount" integer NOT NULL,
- "from_date" date NOT NULL,
- "to_date" date NOT NULL
-);
-
-ALTER TABLE ONLY "public"."salary" ADD CONSTRAINT "salary_pkey" PRIMARY KEY (emp_no, from_date);
-
-CREATE INDEX "idx_salary_amount" ON ONLY "public"."salary" (amount);
-
-CREATE TABLE "public"."title" (
- "emp_no" integer NOT NULL,
- "title" text NOT NULL,
- "from_date" date NOT NULL,
- "to_date" date
-);
-
-ALTER TABLE ONLY "public"."title" ADD CONSTRAINT "title_pkey" PRIMARY KEY (emp_no, title, from_date);
-
-CREATE VIEW "public"."dept_emp_latest_date" AS
- SELECT emp_no,
- max(from_date) AS from_date,
- max(to_date) AS to_date
- FROM public.dept_emp
- GROUP BY emp_no;
-
-CREATE VIEW "public"."current_dept_emp" AS
- SELECT l.emp_no,
- d.dept_no,
- l.from_date,
- l.to_date
- FROM (public.dept_emp d
- JOIN public.dept_emp_latest_date l ON (((d.emp_no = l.emp_no) AND (d.from_date = l.from_date) AND (l.to_date = d.to_date))));
-
-CREATE TRIGGER salary_log_trigger AFTER DELETE OR UPDATE ON public.salary FOR EACH ROW EXECUTE FUNCTION public.log_dml_operations();
-
-ALTER TABLE "public"."dept_emp"
- ADD CONSTRAINT "dept_emp_dept_no_fkey" FOREIGN KEY ("dept_no")
- REFERENCES "public"."department" ("dept_no")
- ON DELETE CASCADE;
-
-ALTER TABLE "public"."dept_emp"
- ADD CONSTRAINT "dept_emp_emp_no_fkey" FOREIGN KEY ("emp_no")
- REFERENCES "public"."employee" ("emp_no")
- ON DELETE CASCADE;
-
-ALTER TABLE "public"."dept_manager"
- ADD CONSTRAINT "dept_manager_dept_no_fkey" FOREIGN KEY ("dept_no")
- REFERENCES "public"."department" ("dept_no")
- ON DELETE CASCADE;
-
-ALTER TABLE "public"."dept_manager"
- ADD CONSTRAINT "dept_manager_emp_no_fkey" FOREIGN KEY ("emp_no")
- REFERENCES "public"."employee" ("emp_no")
- ON DELETE CASCADE;
-
-ALTER TABLE "public"."salary"
- ADD CONSTRAINT "salary_emp_no_fkey" FOREIGN KEY ("emp_no")
- REFERENCES "public"."employee" ("emp_no")
- ON DELETE CASCADE;
-
-ALTER TABLE "public"."title"
- ADD CONSTRAINT "title_emp_no_fkey" FOREIGN KEY ("emp_no")
- REFERENCES "public"."employee" ("emp_no")
- ON DELETE CASCADE;
-
-', '{"schemas": [{"name": "public", "tables": [{"name": "salary", "columns": [{"name": "to_date"}, {"name": "amount", "semanticType": "bb.default"}, {"name": "emp_no"}, {"name": "from_date"}]}, {"name": "employee", "columns": [{"name": "last_name", "classification": "1-2"}, {"name": "emp_no"}, {"name": "birth_date"}, {"name": "gender"}, {"name": "hire_date"}, {"name": "first_name", "classification": "1-2"}]}]}]}') ON CONFLICT DO NOTHING;
-INSERT INTO public.db_schema (instance, db_name, metadata, raw_dump, config) VALUES ('test-sample-instance', 'hr_test', '{"name":"hr_test","schemas":[{"name":"bbdataarchive","owner":"bbsample"},{"name":"public","tables":[{"name":"audit","columns":[{"name":"id","position":1,"default":"nextval(''public.audit_id_seq''::regclass)","type":"integer"},{"name":"operation","position":2,"type":"text"},{"name":"query","position":3,"nullable":true,"type":"text"},{"name":"user_name","position":4,"type":"text"},{"name":"changed_at","position":5,"default":"CURRENT_TIMESTAMP","nullable":true,"type":"timestamp(6) with time zone"}],"indexes":[{"name":"audit_pkey","expressions":["id"],"descending":[false],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX audit_pkey ON public.audit USING btree (id);","isConstraint":true,"opclassNames":["int4_ops"],"opclassDefaults":[true]},{"name":"idx_audit_changed_at","expressions":["changed_at"],"descending":[false],"type":"btree","definition":"CREATE INDEX idx_audit_changed_at ON public.audit USING btree (changed_at);","opclassNames":["timestamptz_ops"],"opclassDefaults":[true]},{"name":"idx_audit_operation","expressions":["operation"],"descending":[false],"type":"btree","definition":"CREATE INDEX idx_audit_operation ON public.audit USING btree (operation);","opclassNames":["text_ops"],"opclassDefaults":[true]},{"name":"idx_audit_username","expressions":["user_name"],"descending":[false],"type":"btree","definition":"CREATE INDEX idx_audit_username ON public.audit USING btree (user_name);","opclassNames":["text_ops"],"opclassDefaults":[true]}],"dataSize":"8192","indexSize":"32768","owner":"bbsample"},{"name":"department","columns":[{"name":"dept_no","position":1,"type":"text"},{"name":"dept_name","position":2,"type":"text"}],"indexes":[{"name":"department_dept_name_key","expressions":["dept_name"],"descending":[false],"type":"btree","unique":true,"definition":"CREATE UNIQUE INDEX department_dept_name_key ON public.department USING btree (dept_name);","isConstraint":true,"opclassNames":["text_ops"],"opclassDefaults":[true]},{"name":"department_pkey","expressions":["dept_no"],"descending":[false],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX department_pkey ON public.department USING btree (dept_no);","isConstraint":true,"opclassNames":["text_ops"],"opclassDefaults":[true]}],"dataSize":"16384","indexSize":"32768","owner":"bbsample"},{"name":"dept_emp","columns":[{"name":"emp_no","position":1,"type":"integer"},{"name":"dept_no","position":2,"type":"text"},{"name":"from_date","position":3,"type":"date"},{"name":"to_date","position":4,"type":"date"}],"indexes":[{"name":"dept_emp_pkey","expressions":["emp_no","dept_no"],"descending":[false,false],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX dept_emp_pkey ON public.dept_emp USING btree (emp_no, dept_no);","isConstraint":true,"opclassNames":["int4_ops","text_ops"],"opclassDefaults":[true,true]}],"rowCount":"1103","dataSize":"106496","indexSize":"57344","foreignKeys":[{"name":"dept_emp_dept_no_fkey","columns":["dept_no"],"referencedSchema":"public","referencedTable":"department","referencedColumns":["dept_no"],"onDelete":"CASCADE","onUpdate":"NO ACTION","matchType":"SIMPLE"},{"name":"dept_emp_emp_no_fkey","columns":["emp_no"],"referencedSchema":"public","referencedTable":"employee","referencedColumns":["emp_no"],"onDelete":"CASCADE","onUpdate":"NO ACTION","matchType":"SIMPLE"}],"owner":"bbsample"},{"name":"dept_manager","columns":[{"name":"emp_no","position":1,"type":"integer"},{"name":"dept_no","position":2,"type":"text"},{"name":"from_date","position":3,"type":"date"},{"name":"to_date","position":4,"type":"date"}],"indexes":[{"name":"dept_manager_pkey","expressions":["emp_no","dept_no"],"descending":[false,false],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX dept_manager_pkey ON public.dept_manager USING btree (emp_no, dept_no);","isConstraint":true,"opclassNames":["int4_ops","text_ops"],"opclassDefaults":[true,true]}],"dataSize":"16384","indexSize":"16384","foreignKeys":[{"name":"dept_manager_dept_no_fkey","columns":["dept_no"],"referencedSchema":"public","referencedTable":"department","referencedColumns":["dept_no"],"onDelete":"CASCADE","onUpdate":"NO ACTION","matchType":"SIMPLE"},{"name":"dept_manager_emp_no_fkey","columns":["emp_no"],"referencedSchema":"public","referencedTable":"employee","referencedColumns":["emp_no"],"onDelete":"CASCADE","onUpdate":"NO ACTION","matchType":"SIMPLE"}],"owner":"bbsample"},{"name":"employee","columns":[{"name":"emp_no","position":1,"default":"nextval(''public.employee_emp_no_seq''::regclass)","type":"integer"},{"name":"birth_date","position":2,"type":"date"},{"name":"first_name","position":3,"type":"text"},{"name":"last_name","position":4,"type":"text"},{"name":"gender","position":5,"type":"text"},{"name":"hire_date","position":6,"type":"date"}],"indexes":[{"name":"employee_pkey","expressions":["emp_no"],"descending":[false],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX employee_pkey ON public.employee USING btree (emp_no);","isConstraint":true,"opclassNames":["int4_ops"],"opclassDefaults":[true]},{"name":"idx_employee_hire_date","expressions":["hire_date"],"descending":[false],"type":"btree","definition":"CREATE INDEX idx_employee_hire_date ON public.employee USING btree (hire_date);","opclassNames":["date_ops"],"opclassDefaults":[true]}],"rowCount":"1000","dataSize":"98304","indexSize":"98304","checkConstraints":[{"name":"employee_gender_check","expression":"(gender = ANY (ARRAY[''M''::text, ''F''::text]))"}],"owner":"bbsample"},{"name":"salary","columns":[{"name":"emp_no","position":1,"type":"integer"},{"name":"amount","position":2,"type":"integer"},{"name":"from_date","position":3,"type":"date"},{"name":"to_date","position":4,"type":"date"}],"indexes":[{"name":"idx_salary_amount","expressions":["amount"],"descending":[false],"type":"btree","definition":"CREATE INDEX idx_salary_amount ON public.salary USING btree (amount);","opclassNames":["int4_ops"],"opclassDefaults":[true]},{"name":"salary_pkey","expressions":["emp_no","from_date"],"descending":[false,false],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX salary_pkey ON public.salary USING btree (emp_no, from_date);","isConstraint":true,"opclassNames":["int4_ops","date_ops"],"opclassDefaults":[true,true]}],"rowCount":"9488","dataSize":"458752","indexSize":"548864","foreignKeys":[{"name":"salary_emp_no_fkey","columns":["emp_no"],"referencedSchema":"public","referencedTable":"employee","referencedColumns":["emp_no"],"onDelete":"CASCADE","onUpdate":"NO ACTION","matchType":"SIMPLE"}],"owner":"bbsample","triggers":[{"name":"salary_log_trigger","body":"CREATE TRIGGER salary_log_trigger AFTER DELETE OR UPDATE ON public.salary FOR EACH ROW EXECUTE FUNCTION public.log_dml_operations()"}]},{"name":"title","columns":[{"name":"emp_no","position":1,"type":"integer"},{"name":"title","position":2,"type":"text"},{"name":"from_date","position":3,"type":"date"},{"name":"to_date","position":4,"nullable":true,"type":"date"}],"indexes":[{"name":"title_pkey","expressions":["emp_no","title","from_date"],"descending":[false,false,false],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX title_pkey ON public.title USING btree (emp_no, title, from_date);","isConstraint":true,"opclassNames":["int4_ops","text_ops","date_ops"],"opclassDefaults":[true,true,true]}],"rowCount":"1470","dataSize":"131072","indexSize":"73728","foreignKeys":[{"name":"title_emp_no_fkey","columns":["emp_no"],"referencedSchema":"public","referencedTable":"employee","referencedColumns":["emp_no"],"onDelete":"CASCADE","onUpdate":"NO ACTION","matchType":"SIMPLE"}],"owner":"bbsample"}],"views":[{"name":"current_dept_emp","definition":" SELECT l.emp_no,\n d.dept_no,\n l.from_date,\n l.to_date\n FROM (public.dept_emp d\n JOIN public.dept_emp_latest_date l ON (((d.emp_no = l.emp_no) AND (d.from_date = l.from_date) AND (l.to_date = d.to_date))));","dependencyColumns":[{"schema":"public","table":"dept_emp","column":"dept_no"},{"schema":"public","table":"dept_emp","column":"emp_no"},{"schema":"public","table":"dept_emp","column":"from_date"},{"schema":"public","table":"dept_emp","column":"to_date"},{"schema":"public","table":"dept_emp_latest_date","column":"emp_no"},{"schema":"public","table":"dept_emp_latest_date","column":"from_date"},{"schema":"public","table":"dept_emp_latest_date","column":"to_date"}],"columns":[{"name":"emp_no","position":1,"nullable":true,"type":"integer"},{"name":"dept_no","position":2,"nullable":true,"type":"text"},{"name":"from_date","position":3,"nullable":true,"type":"date"},{"name":"to_date","position":4,"nullable":true,"type":"date"}]},{"name":"dept_emp_latest_date","definition":" SELECT emp_no,\n max(from_date) AS from_date,\n max(to_date) AS to_date\n FROM public.dept_emp\n GROUP BY emp_no;","dependencyColumns":[{"schema":"public","table":"dept_emp","column":"emp_no"},{"schema":"public","table":"dept_emp","column":"from_date"},{"schema":"public","table":"dept_emp","column":"to_date"}],"columns":[{"name":"emp_no","position":1,"nullable":true,"type":"integer"},{"name":"from_date","position":2,"nullable":true,"type":"date"},{"name":"to_date","position":3,"nullable":true,"type":"date"}]}],"functions":[{"name":"log_dml_operations","definition":"CREATE OR REPLACE FUNCTION public.log_dml_operations()\n RETURNS trigger\n LANGUAGE plpgsql\nAS $function$\nBEGIN\n IF (TG_OP = ''INSERT'') THEN\n INSERT INTO audit (operation, query, user_name)\n VALUES (''INSERT'', current_query(), current_user);\n RETURN NEW;\n ELSIF (TG_OP = ''UPDATE'') THEN\n INSERT INTO audit (operation, query, user_name)\n VALUES (''UPDATE'', current_query(), current_user);\n RETURN NEW;\n ELSIF (TG_OP = ''DELETE'') THEN\n INSERT INTO audit (operation, query, user_name)\n VALUES (''DELETE'', current_query(), current_user);\n RETURN OLD;\n END IF;\n RETURN NULL;\nEND;\n$function$\n","signature":"log_dml_operations()"}],"sequences":[{"name":"audit_id_seq","dataType":"integer","start":"1","minValue":"1","maxValue":"2147483647","increment":"1","cacheSize":"1","ownerTable":"audit","ownerColumn":"id"},{"name":"employee_emp_no_seq","dataType":"integer","start":"1","minValue":"1","maxValue":"2147483647","increment":"1","cacheSize":"1","ownerTable":"employee","ownerColumn":"emp_no"}],"owner":"pg_database_owner","comment":"standard public schema"}],"characterSet":"UTF8","collation":"en_US.UTF-8","owner":"bbsample","searchPath":"\"$user\", public"}', '
-SET statement_timeout = 0;
-SET lock_timeout = 0;
-SET idle_in_transaction_session_timeout = 0;
-SET client_encoding = ''UTF8'';
-SET standard_conforming_strings = on;
-SELECT pg_catalog.set_config(''search_path'', '''', false);
-SET check_function_bodies = false;
-SET xmloption = content;
-SET client_min_messages = warning;
-SET row_security = off;
-
-CREATE SEQUENCE "public"."audit_id_seq"
- AS integer
- START WITH 1
- INCREMENT BY 1
- MINVALUE 1
- MAXVALUE 2147483647
- NO CYCLE;
-
-CREATE SEQUENCE "public"."employee_emp_no_seq"
- AS integer
- START WITH 1
- INCREMENT BY 1
- MINVALUE 1
- MAXVALUE 2147483647
- NO CYCLE;
-
-SET default_tablespace = '''';
-
-CREATE TABLE "public"."audit" (
- "id" integer DEFAULT nextval(''public.audit_id_seq''::regclass) NOT NULL,
- "operation" text NOT NULL,
- "query" text,
- "user_name" text NOT NULL,
- "changed_at" timestamp(6) with time zone DEFAULT CURRENT_TIMESTAMP
-);
-
-ALTER SEQUENCE "public"."audit_id_seq" OWNED BY "public"."audit"."id";
-
-ALTER TABLE ONLY "public"."audit" ADD CONSTRAINT "audit_pkey" PRIMARY KEY (id);
-
-CREATE INDEX "idx_audit_changed_at" ON ONLY "public"."audit" (changed_at);
-
-CREATE INDEX "idx_audit_operation" ON ONLY "public"."audit" (operation);
-
-CREATE INDEX "idx_audit_username" ON ONLY "public"."audit" (user_name);
-
-CREATE TABLE "public"."department" (
- "dept_no" text NOT NULL,
- "dept_name" text NOT NULL
-);
-
-ALTER TABLE ONLY "public"."department" ADD CONSTRAINT "department_pkey" PRIMARY KEY (dept_no);
-
-ALTER TABLE ONLY "public"."department" ADD CONSTRAINT "department_dept_name_key" UNIQUE (dept_name);
-
-CREATE TABLE "public"."dept_emp" (
- "emp_no" integer NOT NULL,
- "dept_no" text NOT NULL,
- "from_date" date NOT NULL,
- "to_date" date NOT NULL
-);
-
-ALTER TABLE ONLY "public"."dept_emp" ADD CONSTRAINT "dept_emp_pkey" PRIMARY KEY (emp_no, dept_no);
-
-CREATE TABLE "public"."dept_manager" (
- "emp_no" integer NOT NULL,
- "dept_no" text NOT NULL,
- "from_date" date NOT NULL,
- "to_date" date NOT NULL
-);
-
-ALTER TABLE ONLY "public"."dept_manager" ADD CONSTRAINT "dept_manager_pkey" PRIMARY KEY (emp_no, dept_no);
-
-CREATE TABLE "public"."employee" (
- "emp_no" integer DEFAULT nextval(''public.employee_emp_no_seq''::regclass) NOT NULL,
- "birth_date" date NOT NULL,
- "first_name" text NOT NULL,
- "last_name" text NOT NULL,
- "gender" text NOT NULL,
- "hire_date" date NOT NULL,
- CONSTRAINT "employee_gender_check" CHECK (gender = ANY (ARRAY[''M''::text, ''F''::text]))
-);
-
-ALTER SEQUENCE "public"."employee_emp_no_seq" OWNED BY "public"."employee"."emp_no";
-
-ALTER TABLE ONLY "public"."employee" ADD CONSTRAINT "employee_pkey" PRIMARY KEY (emp_no);
-
-CREATE INDEX "idx_employee_hire_date" ON ONLY "public"."employee" (hire_date);
-
-CREATE OR REPLACE FUNCTION public.log_dml_operations()
- RETURNS trigger
- LANGUAGE plpgsql
-AS $function$
-BEGIN
- IF (TG_OP = ''INSERT'') THEN
- INSERT INTO audit (operation, query, user_name)
- VALUES (''INSERT'', current_query(), current_user);
- RETURN NEW;
- ELSIF (TG_OP = ''UPDATE'') THEN
- INSERT INTO audit (operation, query, user_name)
- VALUES (''UPDATE'', current_query(), current_user);
- RETURN NEW;
- ELSIF (TG_OP = ''DELETE'') THEN
- INSERT INTO audit (operation, query, user_name)
- VALUES (''DELETE'', current_query(), current_user);
- RETURN OLD;
- END IF;
- RETURN NULL;
-END;
-$function$
-;
-
-CREATE TABLE "public"."salary" (
- "emp_no" integer NOT NULL,
- "amount" integer NOT NULL,
- "from_date" date NOT NULL,
- "to_date" date NOT NULL
-);
-
-ALTER TABLE ONLY "public"."salary" ADD CONSTRAINT "salary_pkey" PRIMARY KEY (emp_no, from_date);
-
-CREATE INDEX "idx_salary_amount" ON ONLY "public"."salary" (amount);
-
-CREATE TABLE "public"."title" (
- "emp_no" integer NOT NULL,
- "title" text NOT NULL,
- "from_date" date NOT NULL,
- "to_date" date
-);
-
-ALTER TABLE ONLY "public"."title" ADD CONSTRAINT "title_pkey" PRIMARY KEY (emp_no, title, from_date);
-
-CREATE VIEW "public"."dept_emp_latest_date" AS
- SELECT emp_no,
- max(from_date) AS from_date,
- max(to_date) AS to_date
- FROM public.dept_emp
- GROUP BY emp_no;
-
-CREATE VIEW "public"."current_dept_emp" AS
- SELECT l.emp_no,
- d.dept_no,
- l.from_date,
- l.to_date
- FROM (public.dept_emp d
- JOIN public.dept_emp_latest_date l ON (((d.emp_no = l.emp_no) AND (d.from_date = l.from_date) AND (l.to_date = d.to_date))));
-
-CREATE TRIGGER salary_log_trigger AFTER DELETE OR UPDATE ON public.salary FOR EACH ROW EXECUTE FUNCTION public.log_dml_operations();
-
-ALTER TABLE "public"."dept_emp"
- ADD CONSTRAINT "dept_emp_dept_no_fkey" FOREIGN KEY ("dept_no")
- REFERENCES "public"."department" ("dept_no")
- ON DELETE CASCADE;
-
-ALTER TABLE "public"."dept_emp"
- ADD CONSTRAINT "dept_emp_emp_no_fkey" FOREIGN KEY ("emp_no")
- REFERENCES "public"."employee" ("emp_no")
- ON DELETE CASCADE;
-
-ALTER TABLE "public"."dept_manager"
- ADD CONSTRAINT "dept_manager_dept_no_fkey" FOREIGN KEY ("dept_no")
- REFERENCES "public"."department" ("dept_no")
- ON DELETE CASCADE;
-
-ALTER TABLE "public"."dept_manager"
- ADD CONSTRAINT "dept_manager_emp_no_fkey" FOREIGN KEY ("emp_no")
- REFERENCES "public"."employee" ("emp_no")
- ON DELETE CASCADE;
-
-ALTER TABLE "public"."salary"
- ADD CONSTRAINT "salary_emp_no_fkey" FOREIGN KEY ("emp_no")
- REFERENCES "public"."employee" ("emp_no")
- ON DELETE CASCADE;
-
-ALTER TABLE "public"."title"
- ADD CONSTRAINT "title_emp_no_fkey" FOREIGN KEY ("emp_no")
- REFERENCES "public"."employee" ("emp_no")
- ON DELETE CASCADE;
-
-', '{}') ON CONFLICT DO NOTHING;
-
-
---
--- Data for Name: export_archive; Type: TABLE DATA; Schema: public; Owner: -
---
-
-
-
---
--- Data for Name: idp; Type: TABLE DATA; Schema: public; Owner: -
---
-
-
-
---
--- Data for Name: instance; Type: TABLE DATA; Schema: public; Owner: -
---
-
-INSERT INTO public.instance (deleted, environment, resource_id, metadata) VALUES (false, 'prod', 'bytebase-meta', '{"roles": [{"name": "bb", "attribute": "Superuser Create role Create DB Replication Bypass RLS+"}], "title": "bytebase-meta", "engine": "POSTGRES", "version": "16.0.0", "activation": true, "dataSources": [{"id": "35a64b4a-543f-4eac-ad32-b191a958c66d", "host": "/tmp", "port": "8082", "type": "ADMIN", "username": "bb", "authenticationType": "PASSWORD"}], "lastSyncTime": "2025-06-05T07:07:57.638515Z"}') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance (deleted, environment, resource_id, metadata) VALUES (false, 'prod', 'prod-sample-instance', '{"roles": [{"name": "bbsample", "attribute": "Superuser Create role Create DB Replication Bypass RLS+"}], "title": "Prod Sample Instance", "engine": "POSTGRES", "version": "16.0.0", "activation": true, "dataSources": [{"id": "9af4f227-a55e-4e82-b7f5-c7193b5f405c", "host": "/tmp", "port": "8084", "type": "ADMIN", "username": "bbsample", "authenticationType": "PASSWORD"}, {"id": "e700ae12-173e-4f0d-8590-0414cf6a9405", "host": "/tmp", "port": "8084", "type": "READ_ONLY", "username": "bbsample", "authenticationType": "PASSWORD"}], "lastSyncTime": "2025-06-05T07:07:57.649471Z"}') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance (deleted, environment, resource_id, metadata) VALUES (false, 'test', 'test-sample-instance', '{"roles": [{"name": "bbsample", "attribute": "Superuser Create role Create DB Replication Bypass RLS+"}], "title": "Test Sample Instance", "engine": "POSTGRES", "version": "16.0.0", "activation": true, "dataSources": [{"id": "a7f206f9-37c4-41ca-8b59-fcf4c6148105", "host": "/tmp", "port": "8083", "type": "ADMIN", "username": "bbsample", "authenticationType": "PASSWORD"}], "lastSyncTime": "2025-06-05T07:07:57.659121Z"}') ON CONFLICT DO NOTHING;
-
-
---
--- Data for Name: instance_change_history; Type: TABLE DATA; Schema: public; Owner: -
---
-
-INSERT INTO public.instance_change_history (id, version) VALUES (101, '3.6.5') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (102, '3.7.0') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (103, '3.7.1') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (104, '3.7.2') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (105, '3.7.3') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (106, '3.7.4') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (107, '3.7.5') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (108, '3.7.6') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (109, '3.7.7') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (110, '3.7.8') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (111, '3.7.9') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (112, '3.7.10') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (113, '3.7.11') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (114, '3.7.12') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (115, '3.7.13') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (116, '3.7.14') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (117, '3.7.15') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (118, '3.7.16') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (119, '3.7.17') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (120, '3.7.18') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (121, '3.7.19') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (122, '3.7.20') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (123, '3.7.21') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (124, '3.7.22') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (125, '3.7.23') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (126, '3.7.24') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (127, '3.7.25') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (128, '3.7.26') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (129, '3.7.27') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (130, '3.8.0') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (131, '3.8.1') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (132, '3.8.2') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (133, '3.8.3') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (134, '3.8.4') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (135, '3.9.0') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (136, '3.9.1') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (137, '3.9.2') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (138, '3.9.3') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (139, '3.9.4') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (140, '3.9.5') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (141, '3.9.6') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (142, '3.9.7') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (143, '3.9.8') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (144, '3.9.9') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (145, '3.9.10') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (146, '3.10.0') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (147, '3.10.1') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (148, '3.10.2') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (149, '3.10.3') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (150, '3.10.4') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (151, '3.10.5') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (152, '3.10.6') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (153, '3.10.7') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (154, '3.10.8') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (155, '3.11.0') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (156, '3.11.1') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (157, '3.11.2') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (158, '3.11.3') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (159, '3.11.4') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (160, '3.11.5') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (161, '3.11.6') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (162, '3.11.7') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (163, '3.11.8') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (164, '3.11.9') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (165, '3.11.10') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (166, '3.11.11') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (167, '3.11.12') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (168, '3.11.13') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (169, '3.11.14') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (170, '3.11.15') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (171, '3.11.16') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (172, '3.11.17') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (173, '3.11.18') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (174, '3.11.19') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (175, '3.11.20') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (176, '3.11.21') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (177, '3.12.0') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (178, '3.12.1') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (179, '3.12.2') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (180, '3.12.3') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (181, '3.12.4') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (182, '3.12.5') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (183, '3.13.0') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (184, '3.13.1') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (185, '3.13.2') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (186, '3.13.3') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (187, '3.13.4') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (188, '3.13.5') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (189, '3.13.6') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (190, '3.13.7') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (191, '3.13.8') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (192, '3.13.9') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (193, '3.13.10') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (194, '3.13.11') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (195, '3.13.12') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (196, '3.13.13') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (197, '3.13.14') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (198, '3.13.15') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (199, '3.13.16') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (200, '3.13.17') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (201, '3.13.18') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (202, '3.13.19') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (203, '3.13.20') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (204, '3.13.21') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (205, '3.13.22') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (206, '3.13.23') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (207, '3.13.24') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (208, '3.13.25') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (209, '3.13.26') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (210, '3.13.27') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (211, '3.13.28') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (212, '3.13.29') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (213, '3.13.30') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (214, '3.13.31') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (215, '3.14.0') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (216, '3.14.1') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (217, '3.14.2') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (218, '3.14.3') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (219, '3.14.4') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (220, '3.14.5') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (221, '3.14.6') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (222, '3.14.7') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (223, '3.14.8') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (224, '3.14.9') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (225, '3.14.10') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (226, '3.14.11') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (227, '3.14.12') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (228, '3.14.13') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (229, '3.14.14') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (230, '3.14.15') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (231, '3.14.16') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (232, '3.14.17') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (233, '3.14.18') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (234, '3.14.19') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (235, '3.14.20') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (236, '3.14.21') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (237, '3.14.22') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (238, '3.14.23') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (239, '3.14.24') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (240, '3.14.25') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (241, '3.14.26') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (242, '3.14.27') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (243, '3.14.28') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (244, '3.14.29') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (245, '3.14.30') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (246, '3.14.31') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (247, '3.14.32') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (248, '3.14.33') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (249, '3.14.34') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (250, '3.15.0') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (251, '3.15.1') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (252, '3.15.2') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (253, '3.15.3') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (254, '3.15.4') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (255, '3.15.5') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (256, '3.15.6') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (257, '3.15.7') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (258, '3.15.8') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (259, '3.15.9') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (260, '3.15.10') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (261, '3.15.11') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (262, '3.16.0') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (263, '3.16.1') ON CONFLICT DO NOTHING;
-INSERT INTO public.instance_change_history (id, version) VALUES (264, '3.16.2') ON CONFLICT DO NOTHING;
-
-
---
--- Data for Name: issue; Type: TABLE DATA; Schema: public; Owner: -
---
-
-INSERT INTO public.issue (id, created_at, updated_at, project, plan_id, name, status, type, description, payload, ts_vector, creator) VALUES (101, '2025-05-26 08:26:15.26631+00', '2025-05-26 08:26:16.121796+00', 'hr', 101, '👉👉👉 [START HERE] Add email column to Employee table', 'OPEN', 'DATABASE_CHANGE', '', '{"labels": ["3.6.2", "feature"], "approval": {"riskLevel": "HIGH", "approvalTemplate": {"id": "bb.project-owner-workspace-dba", "flow": {"roles": ["roles/projectOwner", "roles/workspaceDBA"]}, "title": "Project Owner -> Workspace DBA", "description": "The system defines the approval process, first the project Owner approves, then the DBA approves."}, "approvalFindingDone": true}}', '''add'':3 ''column'':5 ''email'':4 ''employee'':7 ''here'':2 ''start'':1 ''table'':8 ''to'':6', '[email protected]') ON CONFLICT DO NOTHING;
-
-
---
--- Data for Name: issue_comment; Type: TABLE DATA; Schema: public; Owner: -
---
-
-
-
---
--- Data for Name: oauth2_authorization_code; Type: TABLE DATA; Schema: public; Owner: -
---
-
-
-
---
--- Data for Name: oauth2_client; Type: TABLE DATA; Schema: public; Owner: -
---
-
-
-
---
--- Data for Name: oauth2_refresh_token; Type: TABLE DATA; Schema: public; Owner: -
---
-
-
-
---
--- Data for Name: plan; Type: TABLE DATA; Schema: public; Owner: -
---
-
-INSERT INTO public.plan (id, created_at, updated_at, project, name, description, config, deleted, creator) VALUES (101, '2025-05-26 08:26:15.250094+00', '2025-05-26 08:26:15.250094+00', 'hr', '👉👉👉 [START HERE] Add email column to Employee table', '', '{"specs": [{"id": "036e8f34-05e6-4916-ba58-45c6a452fc60", "changeDatabaseConfig": {"type": "MIGRATE", "targets": ["instances/prod-sample-instance/databases/hr_prod", "instances/test-sample-instance/databases/hr_test"], "migrateType": "DDL", "sheetSha256": "dc3cbdad177e12396a1be4e31c959f7b0fdf03193c21bcfa113da7fa23109222"}}], "hasRollout": false}', false, '[email protected]') ON CONFLICT DO NOTHING;
-
-
---
--- Data for Name: plan_check_run; Type: TABLE DATA; Schema: public; Owner: -
---
-
-
-
---
--- Data for Name: plan_webhook_delivery; Type: TABLE DATA; Schema: public; Owner: -
---
-
-
-
---
--- Data for Name: policy; Type: TABLE DATA; Schema: public; Owner: -
---
-
-INSERT INTO public.policy (enforce, updated_at, resource_type, resource, type, payload, inherit_from_parent) VALUES (true, '2025-05-26 08:47:09.079713+00', 'ENVIRONMENT', 'environments/test', 'TAG', '{"tags": {"bb.tag.review_config": "reviewConfigs/sql-review-sample-policy"}}', false) ON CONFLICT DO NOTHING;
-INSERT INTO public.policy (enforce, updated_at, resource_type, resource, type, payload, inherit_from_parent) VALUES (true, '2025-05-26 08:47:09.079724+00', 'ENVIRONMENT', 'environments/prod', 'TAG', '{"tags": {"bb.tag.review_config": "reviewConfigs/sql-review-sample-policy"}}', false) ON CONFLICT DO NOTHING;
-INSERT INTO public.policy (enforce, updated_at, resource_type, resource, type, payload, inherit_from_parent) VALUES (true, '2025-10-13 22:54:21.894178+00', 'ENVIRONMENT', 'environments/test', 'ROLLOUT', '{}', true) ON CONFLICT DO NOTHING;
-INSERT INTO public.policy (enforce, updated_at, resource_type, resource, type, payload, inherit_from_parent) VALUES (true, '2025-10-13 22:54:21.894178+00', 'ENVIRONMENT', 'environments/prod', 'ROLLOUT', '{}', true) ON CONFLICT DO NOTHING;
-INSERT INTO public.policy (enforce, updated_at, resource_type, resource, type, payload, inherit_from_parent) VALUES (true, '2026-03-10 08:21:23.909985+00', 'ENVIRONMENT', 'environments/prod', 'QUERY_DATA', '{"disallowDdl": true, "disallowDml": true, "disableCopyData": true, "adminDataSourceRestriction": "RESTRICTION_UNSPECIFIED."}', false) ON CONFLICT DO NOTHING;
-INSERT INTO public.policy (enforce, updated_at, resource_type, resource, type, payload, inherit_from_parent) VALUES (true, '2025-05-26 08:07:29.784956+00', 'PROJECT', 'projects/hr', 'IAM', '{"bindings": [{"role": "roles/projectOwner", "members": ["users/[email protected]"], "condition": {}}, {"role": "roles/projectDeveloper", "members": ["users/[email protected]"], "condition": {"title": "Project Developer All databases"}}]}', false) ON CONFLICT DO NOTHING;
-INSERT INTO public.policy (enforce, updated_at, resource_type, resource, type, payload, inherit_from_parent) VALUES (true, '2025-05-26 07:54:33.728664+00', 'PROJECT', 'projects/metadb', 'IAM', '{"bindings": [{"role": "roles/projectOwner", "members": ["users/[email protected]"], "condition": {}}, {"role": "roles/sqlEditorReadUser", "members": ["users/[email protected]", "users/[email protected]"], "condition": {"title": "SQL Editor User All databases"}}, {"role": "roles/sqlEditorUser", "members": ["users/[email protected]", "users/[email protected]"], "condition": {"expression": "resource.environment_id in [\"test\"]"}}]}', false) ON CONFLICT DO NOTHING;
-INSERT INTO public.policy (enforce, updated_at, resource_type, resource, type, payload, inherit_from_parent) VALUES (true, '2025-05-26 07:48:23.461198+00', 'WORKSPACE', 'workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48', 'MASKING_RULE', '{"rules": [{"id": "1f3018bb-f4ea-4daa-b4b3-6e32bce0d22e", "condition": {"expression": "resource.classification_level in [\"2\", \"3\"]"}, "semanticType": "bb.default-partial"}, {"id": "e0743172-c9c7-43f8-9923-9a3c06012cee", "condition": {"expression": "resource.classification_level in [\"4\"]"}, "semanticType": "bb.default"}]}', false) ON CONFLICT DO NOTHING;
-INSERT INTO public.policy (enforce, updated_at, resource_type, resource, type, payload, inherit_from_parent) VALUES (true, '2025-09-09 03:16:27.935445+00', 'WORKSPACE', 'workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48', 'QUERY_DATA', '{"disableExport": false, "maximumResultRows": -1}', true) ON CONFLICT DO NOTHING;
-INSERT INTO public.policy (enforce, updated_at, resource_type, resource, type, payload, inherit_from_parent) VALUES (true, '2025-05-26 08:10:00.958154+00', 'WORKSPACE', 'workspaces/a6b014b9-d0d4-4974-9be6-53ec61ea5f48', 'IAM', '{"bindings": [{"role": "roles/workspaceMember", "members": ["allUsers", "users/[email protected]", "users/[email protected]", "users/[email protected]", "groups/[email protected]"], "condition": {}}, {"role": "roles/workspaceAdmin", "members": ["users/[email protected]", "serviceAccounts/[email protected]"], "condition": {}}, {"role": "roles/workspaceDBA", "members": ["users/[email protected]", "users/[email protected]"], "condition": {}}, {"role": "roles/qa-custom-role", "members": ["groups/[email protected]"], "condition": {}}]}', false) ON CONFLICT DO NOTHING;
-
-
---
--- Data for Name: principal; Type: TABLE DATA; Schema: public; Owner: -
---
-
-INSERT INTO public.principal (id, deleted, created_at, name, email, password_hash, phone, mfa_config, profile) VALUES (102, false, '2025-05-26 07:15:33.831094+00', 'Dev1', '[email protected]', '$2a$10$KPcwy0hDaEWKqNBvDhr1eORTibMOiMlkVIk5NAuvkxkqx.HVdESsO', '', '{}', '{}') ON CONFLICT DO NOTHING;
-INSERT INTO public.principal (id, deleted, created_at, name, email, password_hash, phone, mfa_config, profile) VALUES (103, false, '2025-05-26 07:16:05.084865+00', 'dba1', '[email protected]', '$2a$10$6N6Cf2mFthj.GHvIHYwySei5xdNdnJDgsvt.5ez7TRsiFrtQXVM82', '', '{}', '{}') ON CONFLICT DO NOTHING;
-INSERT INTO public.principal (id, deleted, created_at, name, email, password_hash, phone, mfa_config, profile) VALUES (105, false, '2025-05-26 08:08:54.153568+00', 'QA1', '[email protected]', '$2a$10$ItgVGF7yA68QAlDPPykM.eDTXVYTVXdpqilNcVNGutI0XUExq2nZG', '', '{}', '{}') ON CONFLICT DO NOTHING;
-INSERT INTO public.principal (id, deleted, created_at, name, email, password_hash, phone, mfa_config, profile) VALUES (106, false, '2025-05-26 08:09:14.423135+00', 'QA2', '[email protected]', '$2a$10$rUSSIn7pKKuRfBjrz1xdJud3kIY79zymiIuu4k8ufza7EO5Phqi76', '', '{}', '{}') ON CONFLICT DO NOTHING;
-INSERT INTO public.principal (id, deleted, created_at, name, email, password_hash, phone, mfa_config, profile) VALUES (101, false, '2025-05-26 06:48:06.299115+00', 'Demo', '[email protected]', '$2a$10$rounVehKcCdUp3ykPl.K6.ebxXWOLxtcFEmDBHNQFcHK/pGTDUREy', '', '{}', '{"lastLoginTime": "2026-03-10T08:27:36.107766Z"}') ON CONFLICT DO NOTHING;
-
-
---
--- Data for Name: project; Type: TABLE DATA; Schema: public; Owner: -
---
-
-INSERT INTO public.project (deleted, name, resource_id, setting) VALUES (false, 'Bytebase MetaDB', 'metadb', '{"allowRequestRole": true, "autoResolveIssue": true, "enforceIssueTitle": true, "allowModifyStatement": true, "dataClassificationConfigId": "e5680e79-e84b-486e-8cb2-76c984c3fac9"}') ON CONFLICT DO NOTHING;
-INSERT INTO public.project (deleted, name, resource_id, setting) VALUES (false, 'Default', 'default', '{"allowRequestRole": true, "enforceIssueTitle": true, "dataClassificationConfigId": "e5680e79-e84b-486e-8cb2-76c984c3fac9"}') ON CONFLICT DO NOTHING;
-INSERT INTO public.project (deleted, name, resource_id, setting) VALUES (false, 'HR Project', 'hr', '{"issueLabels": [{"color": "#4f46e5", "value": "3.6.2"}, {"color": "#E54646", "value": "bug"}, {"color": "#63E546", "value": "feature"}], "allowRequestRole": true, "autoResolveIssue": true, "allowSelfApproval": true, "enforceIssueTitle": true, "allowModifyStatement": true, "dataClassificationConfigId": "e5680e79-e84b-486e-8cb2-76c984c3fac9"}') ON CONFLICT DO NOTHING;
-
-
---
--- Data for Name: project_webhook; Type: TABLE DATA; Schema: public; Owner: -
---
-
-
-
---
--- Data for Name: query_history; Type: TABLE DATA; Schema: public; Owner: -
---
-
-INSERT INTO public.query_history (id, created_at, project_id, database, statement, type, payload, creator) VALUES (101, '2025-05-26 07:57:47.34796+00', 'metadb', 'instances/bytebase-meta/databases/bb', '-- Fully completed issues by project
-SELECT
- project.resource_id,
- count(*)
-FROM
- issue
- LEFT JOIN project ON issue.project_id = project.id
-WHERE
- NOT EXISTS (
- SELECT
- 1
- FROM
- task,
- task_run
- WHERE
- task.pipeline_id = issue.pipeline_id
- AND task.id = task_run.task_id
- AND task_run.status != ''DONE''
- )
- AND issue.status = ''DONE''
-GROUP BY
- project.resource_id;', 'QUERY', '{"duration": "0.000827625s"}', '[email protected]') ON CONFLICT DO NOTHING;
-INSERT INTO public.query_history (id, created_at, project_id, database, statement, type, payload, creator) VALUES (102, '2025-05-26 07:58:13.178283+00', 'metadb', 'instances/bytebase-meta/databases/bb', '-- Issues created by user
-SELECT
- issue.creator_id,
- principal.email,
- COUNT(issue.creator_id) AS amount
-FROM
- issue
- INNER JOIN principal ON issue.creator_id = principal.id
-GROUP BY
- issue.creator_id,
- principal.email
-ORDER BY
- COUNT(issue.creator_id) DESC;', 'QUERY', '{"duration": "0.001645875s"}', '[email protected]') ON CONFLICT DO NOTHING;
-INSERT INTO public.query_history (id, created_at, project_id, database, statement, type, payload, creator) VALUES (103, '2025-05-26 08:15:44.969221+00', 'hr', 'instances/prod-sample-instance/databases/hr_prod', 'SELECT * FROM salary;', 'QUERY', '{"duration": "0.003704s"}', '[email protected]') ON CONFLICT DO NOTHING;
-INSERT INTO public.query_history (id, created_at, project_id, database, statement, type, payload, creator) VALUES (104, '2025-05-26 08:15:49.542826+00', 'hr', 'instances/prod-sample-instance/databases/hr_prod', 'SELECT * FROM employee', 'QUERY', '{"duration": "0.005847792s"}', '[email protected]') ON CONFLICT DO NOTHING;
-INSERT INTO public.query_history (id, created_at, project_id, database, statement, type, payload, creator) VALUES (105, '2025-05-26 08:31:19.334518+00', 'metadb', 'instances/bytebase-meta/databases/bb', '-- Issues created by user
-SELECT
- issue.creator_id,
- principal.email,
- COUNT(issue.creator_id) AS amount
-FROM
- issue
- INNER JOIN principal ON issue.creator_id = principal.id
-GROUP BY
- issue.creator_id,
- principal.email
-ORDER BY
- COUNT(issue.creator_id) DESC;', 'QUERY', '{"duration": "0.001888209s"}', '[email protected]') ON CONFLICT DO NOTHING;
-
-
---
--- Data for Name: release; Type: TABLE DATA; Schema: public; Owner: -
---
-
-
-
---
--- Data for Name: replica_heartbeat; Type: TABLE DATA; Schema: public; Owner: -
---
-
-INSERT INTO public.replica_heartbeat (replica_id, last_heartbeat) VALUES ('bae1426c-717f-457f-8ccd-7b99b717b855', '2026-03-10 15:45:49.640487+00') ON CONFLICT DO NOTHING;
-
-
---
--- Data for Name: review_config; Type: TABLE DATA; Schema: public; Owner: -
---
-
-INSERT INTO public.review_config (id, enabled, name, payload) VALUES ('sql-review-sample-policy', true, 'SQL Review Sample Policy', '{"sqlReviewRules": [{"type": "DATABASE_DROP_EMPTY_DATABASE", "level": "ERROR", "engine": "MYSQL"}, {"type": "TABLE_DROP_NAMING_CONVENTION", "level": "ERROR", "engine": "MYSQL", "namingPayload": {"format": "_del$"}}, {"type": "COLUMN_NO_NULL", "level": "WARNING", "engine": "MYSQL"}, {"type": "STATEMENT_AFFECTED_ROW_LIMIT", "level": "WARNING", "engine": "MYSQL", "numberPayload": {"number": 100}}, {"type": "DATABASE_DROP_EMPTY_DATABASE", "level": "ERROR", "engine": "TIDB"}, {"type": "TABLE_DROP_NAMING_CONVENTION", "level": "ERROR", "engine": "TIDB", "namingPayload": {"format": "_del$"}}, {"type": "COLUMN_NO_NULL", "level": "WARNING", "engine": "TIDB"}, {"type": "DATABASE_DROP_EMPTY_DATABASE", "level": "ERROR", "engine": "OCEANBASE"}, {"type": "TABLE_DROP_NAMING_CONVENTION", "level": "ERROR", "engine": "OCEANBASE", "namingPayload": {"format": "_del$"}}, {"type": "COLUMN_NO_NULL", "level": "WARNING", "engine": "OCEANBASE"}, {"type": "DATABASE_DROP_EMPTY_DATABASE", "level": "ERROR", "engine": "MARIADB"}, {"type": "TABLE_DROP_NAMING_CONVENTION", "level": "ERROR", "engine": "MARIADB", "namingPayload": {"format": "_del$"}}, {"type": "COLUMN_NO_NULL", "level": "WARNING", "engine": "MARIADB"}, {"type": "TABLE_DROP_NAMING_CONVENTION", "level": "ERROR", "engine": "POSTGRES", "namingPayload": {"format": "_del$"}}, {"type": "COLUMN_NO_NULL", "level": "WARNING", "engine": "POSTGRES"}, {"type": "STATEMENT_MAXIMUM_LIMIT_VALUE", "level": "WARNING", "engine": "POSTGRES", "numberPayload": {"number": 100}}, {"type": "STATEMENT_AFFECTED_ROW_LIMIT", "level": "WARNING", "engine": "POSTGRES", "numberPayload": {"number": 100}}, {"type": "TABLE_DROP_NAMING_CONVENTION", "level": "ERROR", "engine": "SNOWFLAKE", "namingPayload": {"format": "_del$"}}, {"type": "COLUMN_NO_NULL", "level": "WARNING", "engine": "SNOWFLAKE"}, {"type": "TABLE_DROP_NAMING_CONVENTION", "level": "ERROR", "engine": "MSSQL", "namingPayload": {"format": "_del$"}}, {"type": "COLUMN_NO_NULL", "level": "WARNING", "engine": "MSSQL"}, {"type": "COLUMN_NO_NULL", "level": "WARNING", "engine": "ORACLE"}]}') ON CONFLICT DO NOTHING;
-
-
---
--- Data for Name: revision; Type: TABLE DATA; Schema: public; Owner: -
---
-
-
-
---
--- Data for Name: role; Type: TABLE DATA; Schema: public; Owner: -
---
-
-INSERT INTO public.role (resource_id, name, description, permissions, payload) VALUES ('qa-custom-role', 'QA', 'Custom-defined QA role', '{"permissions": ["bb.databaseGroups.get", "bb.databaseGroups.list", "bb.databases.get", "bb.databases.getSchema", "bb.databases.list", "bb.issueComments.create", "bb.issues.get", "bb.issues.list", "bb.planCheckRuns.get", "bb.planCheckRuns.run", "bb.plans.get", "bb.plans.list", "bb.projects.get", "bb.projects.getIamPolicy", "bb.rollouts.get", "bb.taskRuns.list"]}', '{}') ON CONFLICT DO NOTHING;
-
-
---
--- Data for Name: service_account; Type: TABLE DATA; Schema: public; Owner: -
---
-
-INSERT INTO public.service_account (deleted, created_at, name, email, service_key_hash, project) VALUES (false, '2025-05-26 07:16:33.693169+00', 'API user', '[email protected]', '$2a$10$dm2.6B6YYbSDoKRDAmph2O4amsa4RDSiHjWpO2JfosO8ceP5vErj2', NULL) ON CONFLICT DO NOTHING;
-
-
---
--- Data for Name: setting; Type: TABLE DATA; Schema: public; Owner: -
---
-
-INSERT INTO public.setting (name, value) VALUES ('ENVIRONMENT', '{"environments": [{"id": "test", "title": "Test"}, {"id": "prod", "tags": {"protected": "protected"}, "title": "Prod"}]}') ON CONFLICT DO NOTHING;
-INSERT INTO public.setting (name, value) VALUES ('SEMANTIC_TYPES', '{"types": [{"id": "bb.default", "title": "Default", "description": "Default type with full masking"}, {"id": "bb.default-partial", "title": "Default Partial", "description": "Default partial type with partial masking"}]}') ON CONFLICT DO NOTHING;
-INSERT INTO public.setting (name, value) VALUES ('DATA_CLASSIFICATION', '{"configs": [{"id": "e5680e79-e84b-486e-8cb2-76c984c3fac9", "title": "Classification Example", "levels": [{"id": "1", "title": "Level 1"}, {"id": "2", "title": "Level 2"}, {"id": "3", "title": "Level 3"}, {"id": "4", "title": "Level 4"}], "classification": {"1": {"id": "1", "title": "Basic"}, "2": {"id": "2", "title": "Relationship"}, "1-1": {"id": "1-1", "title": "Basic", "levelId": "1"}, "1-2": {"id": "1-2", "title": "Contact", "levelId": "2"}, "1-3": {"id": "1-3", "title": "Health", "levelId": "4"}, "2-1": {"id": "2-1", "title": "Social", "levelId": "1"}, "2-2": {"id": "2-2", "title": "Business", "levelId": "3"}}, "classificationFromConfig": true}]}') ON CONFLICT DO NOTHING;
-INSERT INTO public.setting (name, value) VALUES ('APP_IM', '{"settings": []}') ON CONFLICT DO NOTHING;
-INSERT INTO public.setting (name, value) VALUES ('WORKSPACE_APPROVAL', '{"rules": [{"source": "CHANGE_DATABASE", "template": {"id": "bb.project-owner-workspace-dba", "flow": {"roles": ["roles/projectOwner", "roles/workspaceDBA"]}, "title": " ALTER column in production environment is high risk (DDL)", "description": "The system defines the approval process, first the project Owner approves, then the DBA approves."}, "condition": {"expression": "(resource.environment_id == \"prod\" && statement.sql_type == \"ALTER_TABLE\") && !(statement.sql_type in [\"DELETE\", \"INSERT\", \"UPDATE\"])"}}, {"source": "CHANGE_DATABASE", "template": {"id": "bb.project-owner", "flow": {"roles": ["roles/projectOwner"]}, "title": "CREATE TABLE in production environment is moderate risk (DDL)", "description": "The system defines the approval process and only needs the project Owner to approve it."}, "condition": {"expression": "(resource.environment_id == \"prod\" && statement.sql_type == \"CREATE_TABLE\") && !(statement.sql_type in [\"DELETE\", \"INSERT\", \"UPDATE\"])"}}, {"source": "CHANGE_DATABASE", "template": {"id": "bb.project-owner", "flow": {"roles": ["roles/projectOwner"]}, "title": "Fallback rule (DDL)", "description": "The system defines the approval process and only needs the project Owner to approve it."}, "condition": {"expression": "!(statement.sql_type in [\"DELETE\", \"INSERT\", \"UPDATE\"])"}}, {"source": "CHANGE_DATABASE", "template": {"id": "bb.project-owner-workspace-dba", "flow": {"roles": ["roles/projectOwner", "roles/workspaceDBA"]}, "title": "Updated or deleted rows exceeds 100 in prod is high risk (DML)", "description": "The system defines the approval process, first the project Owner approves, then the DBA approves."}, "condition": {"expression": "(resource.environment_id == \"prod\" && statement.affected_rows > 100 && statement.sql_type in [\"UPDATE\", \"DELETE\"]) && statement.sql_type in [\"DELETE\", \"INSERT\", \"UPDATE\"]"}}, {"source": "CHANGE_DATABASE", "template": {"id": "bb.project-owner", "flow": {"roles": ["roles/projectOwner"]}, "title": "Fallback rule (DML)", "description": "The system defines the approval process and only needs the project Owner to approve it."}, "condition": {"expression": "statement.sql_type in [\"DELETE\", \"INSERT\", \"UPDATE\"]"}}]}') ON CONFLICT DO NOTHING;
-INSERT INTO public.setting (name, value) VALUES ('SYSTEM', '{"license": "eyJhbGciOiJSUzI1NiIsImtpZCI6InYxIiwidHlwIjoiSldUIn0.eyJpbnN0YW5jZUNvdW50Ijo5OTksInRyaWFsaW5nIjpmYWxzZSwicGxhbiI6IkVOVEVSUFJJU0UiLCJvcmdOYW1lIjoiYmIiLCJhdWQiOiJiYi5saWNlbnNlIiwiZXhwIjo3OTc0OTc5MjAwLCJpYXQiOjE2NjM2Njc1NjEsImlzcyI6ImJ5dGViYXNlIiwic3ViIjoiMDAwMDEwMDAuIn0.JjYCMeAAMB9FlVeDFLdN3jvFcqtPsbEzaIm1YEDhUrfekthCbIOeX_DB2Bg2OUji3HSX5uDvG9AkK4Gtrc4gLMPI3D5mk3L-6wUKZ0L4REztS47LT4oxVhpqPQayYa9lKJB1YoHaqeMV4Z5FXeOXwuACoELznlwpT6pXo9xXm_I6QwQiO7-zD83XOTO4PRjByc-q3GKQu_64zJMIKiCW0I8a3GvrdSnO7jUuYU1KPmCuk0ZRq3I91m29LTo478BMST59HqCLj1GGuCKtR3SL_376XsZfUUM0iSAur5scg99zNGWRj-sUo05wbAadYx6V6TKaWrBUi_8_0RnJyP5gbA", "authSecret": "l71IPJkuT7aTj7McDY3MSJ9BVqBAt2NQ", "workspaceId": "a6b014b9-d0d4-4974-9be6-53ec61ea5f48"}') ON CONFLICT DO NOTHING;
-INSERT INTO public.setting (name, value) VALUES ('WORKSPACE_PROFILE', '{"domains": ["example.com"], "watermark": true, "externalUrl": "https://demo.bytebase.com", "sqlResultSize": 104857600, "databaseChangeMode": "PIPELINE", "directorySyncToken": "3nnNo4tmEFH9FFyTACCfzGhyZUb4QsUC", "passwordRestriction": {"minLength": 8}, "enableMetricCollection": true}') ON CONFLICT DO NOTHING;
-
-
---
--- Data for Name: sheet_blob; Type: TABLE DATA; Schema: public; Owner: -
---
-
-INSERT INTO public.sheet_blob (sha256, content) VALUES ('\xdc3cbdad177e12396a1be4e31c959f7b0fdf03193c21bcfa113da7fa23109222', 'ALTER TABLE employee ADD COLUMN IF NOT EXISTS email TEXT DEFAULT '''';') ON CONFLICT DO NOTHING;
-
-
---
--- Data for Name: sync_history; Type: TABLE DATA; Schema: public; Owner: -
---
-
-INSERT INTO public.sync_history (id, created_at, instance, db_name, metadata, raw_dump) VALUES (101, '2025-05-26 08:27:15.374695+00', 'prod-sample-instance', 'hr_prod', '{"name":"hr_prod", "schemas":[{"name":"bbdataarchive", "owner":"bbsample"}, {"name":"public", "tables":[{"name":"audit", "columns":[{"name":"id", "position":1, "defaultExpression":"nextval(''public.audit_id_seq''::regclass)", "type":"integer"}, {"name":"operation", "position":2, "type":"text"}, {"name":"query", "position":3, "nullable":true, "type":"text"}, {"name":"user_name", "position":4, "type":"text"}, {"name":"changed_at", "position":5, "defaultExpression":"CURRENT_TIMESTAMP", "nullable":true, "type":"timestamp with time zone"}], "indexes":[{"name":"audit_pkey", "expressions":["id"], "type":"btree", "unique":true, "primary":true, "definition":"CREATE UNIQUE INDEX audit_pkey ON public.audit USING btree (id);", "isConstraint":true}, {"name":"idx_audit_changed_at", "expressions":["changed_at"], "type":"btree", "definition":"CREATE INDEX idx_audit_changed_at ON public.audit USING btree (changed_at);"}, {"name":"idx_audit_operation", "expressions":["operation"], "type":"btree", "definition":"CREATE INDEX idx_audit_operation ON public.audit USING btree (operation);"}, {"name":"idx_audit_username", "expressions":["user_name"], "type":"btree", "definition":"CREATE INDEX idx_audit_username ON public.audit USING btree (user_name);"}], "dataSize":"8192", "indexSize":"32768", "owner":"bbsample"}, {"name":"department", "columns":[{"name":"dept_no", "position":1, "type":"text"}, {"name":"dept_name", "position":2, "type":"text"}], "indexes":[{"name":"department_dept_name_key", "expressions":["dept_name"], "type":"btree", "unique":true, "definition":"CREATE UNIQUE INDEX department_dept_name_key ON public.department USING btree (dept_name);", "isConstraint":true}, {"name":"department_pkey", "expressions":["dept_no"], "type":"btree", "unique":true, "primary":true, "definition":"CREATE UNIQUE INDEX department_pkey ON public.department USING btree (dept_no);", "isConstraint":true}], "dataSize":"16384", "indexSize":"32768", "owner":"bbsample"}, {"name":"dept_emp", "columns":[{"name":"emp_no", "position":1, "type":"integer"}, {"name":"dept_no", "position":2, "type":"text"}, {"name":"from_date", "position":3, "type":"date"}, {"name":"to_date", "position":4, "type":"date"}], "indexes":[{"name":"dept_emp_pkey", "expressions":["emp_no", "dept_no"], "type":"btree", "unique":true, "primary":true, "definition":"CREATE UNIQUE INDEX dept_emp_pkey ON public.dept_emp USING btree (emp_no, dept_no);", "isConstraint":true}], "rowCount":"1103", "dataSize":"106496", "indexSize":"57344", "foreignKeys":[{"name":"dept_emp_dept_no_fkey", "columns":["dept_no"], "referencedSchema":"public", "referencedTable":"department", "referencedColumns":["dept_no"], "onDelete":"CASCADE", "onUpdate":"NO ACTION", "matchType":"SIMPLE"}, {"name":"dept_emp_emp_no_fkey", "columns":["emp_no"], "referencedSchema":"public", "referencedTable":"employee", "referencedColumns":["emp_no"], "onDelete":"CASCADE", "onUpdate":"NO ACTION", "matchType":"SIMPLE"}], "owner":"bbsample"}, {"name":"dept_manager", "columns":[{"name":"emp_no", "position":1, "type":"integer"}, {"name":"dept_no", "position":2, "type":"text"}, {"name":"from_date", "position":3, "type":"date"}, {"name":"to_date", "position":4, "type":"date"}], "indexes":[{"name":"dept_manager_pkey", "expressions":["emp_no", "dept_no"], "type":"btree", "unique":true, "primary":true, "definition":"CREATE UNIQUE INDEX dept_manager_pkey ON public.dept_manager USING btree (emp_no, dept_no);", "isConstraint":true}], "dataSize":"16384", "indexSize":"16384", "foreignKeys":[{"name":"dept_manager_dept_no_fkey", "columns":["dept_no"], "referencedSchema":"public", "referencedTable":"department", "referencedColumns":["dept_no"], "onDelete":"CASCADE", "onUpdate":"NO ACTION", "matchType":"SIMPLE"}, {"name":"dept_manager_emp_no_fkey", "columns":["emp_no"], "referencedSchema":"public", "referencedTable":"employee", "referencedColumns":["emp_no"], "onDelete":"CASCADE", "onUpdate":"NO ACTION", "matchType":"SIMPLE"}], "owner":"bbsample"}, {"name":"employee", "columns":[{"name":"emp_no", "position":1, "defaultExpression":"nextval(''public.employee_emp_no_seq''::regclass)", "type":"integer"}, {"name":"birth_date", "position":2, "type":"date"}, {"name":"first_name", "position":3, "type":"text"}, {"name":"last_name", "position":4, "type":"text"}, {"name":"gender", "position":5, "type":"text"}, {"name":"hire_date", "position":6, "type":"date"}], "indexes":[{"name":"employee_pkey", "expressions":["emp_no"], "type":"btree", "unique":true, "primary":true, "definition":"CREATE UNIQUE INDEX employee_pkey ON public.employee USING btree (emp_no);", "isConstraint":true}, {"name":"idx_employee_hire_date", "expressions":["hire_date"], "type":"btree", "definition":"CREATE INDEX idx_employee_hire_date ON public.employee USING btree (hire_date);"}], "rowCount":"1000", "dataSize":"98304", "indexSize":"98304", "owner":"bbsample"}, {"name":"salary", "columns":[{"name":"emp_no", "position":1, "type":"integer"}, {"name":"amount", "position":2, "type":"integer"}, {"name":"from_date", "position":3, "type":"date"}, {"name":"to_date", "position":4, "type":"date"}], "indexes":[{"name":"idx_salary_amount", "expressions":["amount"], "type":"btree", "definition":"CREATE INDEX idx_salary_amount ON public.salary USING btree (amount);"}, {"name":"salary_pkey", "expressions":["emp_no", "from_date"], "type":"btree", "unique":true, "primary":true, "definition":"CREATE UNIQUE INDEX salary_pkey ON public.salary USING btree (emp_no, from_date);", "isConstraint":true}], "rowCount":"9488", "dataSize":"458752", "indexSize":"548864", "foreignKeys":[{"name":"salary_emp_no_fkey", "columns":["emp_no"], "referencedSchema":"public", "referencedTable":"employee", "referencedColumns":["emp_no"], "onDelete":"CASCADE", "onUpdate":"NO ACTION", "matchType":"SIMPLE"}], "owner":"bbsample", "triggers":[{"name":"salary_log_trigger", "body":"CREATE TRIGGER salary_log_trigger AFTER DELETE OR UPDATE ON public.salary FOR EACH ROW EXECUTE FUNCTION public.log_dml_operations()"}]}, {"name":"title", "columns":[{"name":"emp_no", "position":1, "type":"integer"}, {"name":"title", "position":2, "type":"text"}, {"name":"from_date", "position":3, "type":"date"}, {"name":"to_date", "position":4, "nullable":true, "type":"date"}], "indexes":[{"name":"title_pkey", "expressions":["emp_no", "title", "from_date"], "type":"btree", "unique":true, "primary":true, "definition":"CREATE UNIQUE INDEX title_pkey ON public.title USING btree (emp_no, title, from_date);", "isConstraint":true}], "rowCount":"1470", "dataSize":"131072", "indexSize":"73728", "foreignKeys":[{"name":"title_emp_no_fkey", "columns":["emp_no"], "referencedSchema":"public", "referencedTable":"employee", "referencedColumns":["emp_no"], "onDelete":"CASCADE", "onUpdate":"NO ACTION", "matchType":"SIMPLE"}], "owner":"bbsample"}], "views":[{"name":"current_dept_emp", "definition":" SELECT l.emp_no,\n d.dept_no,\n l.from_date,\n l.to_date\n FROM (public.dept_emp d\n JOIN public.dept_emp_latest_date l ON (((d.emp_no = l.emp_no) AND (d.from_date = l.from_date) AND (l.to_date = d.to_date))));", "dependencyColumns":[{"schema":"public", "table":"dept_emp", "column":"dept_no"}, {"schema":"public", "table":"dept_emp", "column":"emp_no"}, {"schema":"public", "table":"dept_emp", "column":"from_date"}, {"schema":"public", "table":"dept_emp", "column":"to_date"}, {"schema":"public", "table":"dept_emp_latest_date", "column":"emp_no"}, {"schema":"public", "table":"dept_emp_latest_date", "column":"from_date"}, {"schema":"public", "table":"dept_emp_latest_date", "column":"to_date"}], "columns":[{"name":"emp_no", "position":1, "nullable":true, "type":"integer"}, {"name":"dept_no", "position":2, "nullable":true, "type":"text"}, {"name":"from_date", "position":3, "nullable":true, "type":"date"}, {"name":"to_date", "position":4, "nullable":true, "type":"date"}]}, {"name":"dept_emp_latest_date", "definition":" SELECT emp_no,\n max(from_date) AS from_date,\n max(to_date) AS to_date\n FROM public.dept_emp\n GROUP BY emp_no;", "dependencyColumns":[{"schema":"public", "table":"dept_emp", "column":"emp_no"}, {"schema":"public", "table":"dept_emp", "column":"from_date"}, {"schema":"public", "table":"dept_emp", "column":"to_date"}], "columns":[{"name":"emp_no", "position":1, "nullable":true, "type":"integer"}, {"name":"from_date", "position":2, "nullable":true, "type":"date"}, {"name":"to_date", "position":3, "nullable":true, "type":"date"}]}], "functions":[{"name":"log_dml_operations", "definition":"CREATE OR REPLACE FUNCTION public.log_dml_operations()\n RETURNS trigger\n LANGUAGE plpgsql\nAS $function$\nBEGIN\n IF (TG_OP = ''INSERT'') THEN\n INSERT INTO audit (operation, query, user_name)\n VALUES (''INSERT'', current_query(), current_user);\n RETURN NEW;\n ELSIF (TG_OP = ''UPDATE'') THEN\n INSERT INTO audit (operation, query, user_name)\n VALUES (''UPDATE'', current_query(), current_user);\n RETURN NEW;\n ELSIF (TG_OP = ''DELETE'') THEN\n INSERT INTO audit (operation, query, user_name)\n VALUES (''DELETE'', current_query(), current_user);\n RETURN OLD;\n END IF;\n RETURN NULL;\nEND;\n$function$\n", "signature":"log_dml_operations()"}], "sequences":[{"name":"audit_id_seq", "dataType":"integer", "start":"1", "minValue":"1", "maxValue":"2147483647", "increment":"1", "cacheSize":"1", "ownerTable":"audit", "ownerColumn":"id"}, {"name":"employee_emp_no_seq", "dataType":"integer", "start":"1", "minValue":"1", "maxValue":"2147483647", "increment":"1", "cacheSize":"1", "ownerTable":"employee", "ownerColumn":"emp_no"}], "owner":"pg_database_owner"}], "characterSet":"UTF8", "collation":"en_US.UTF-8", "owner":"bbsample"}', '
-SET statement_timeout = 0;
-SET lock_timeout = 0;
-SET idle_in_transaction_session_timeout = 0;
-SET client_encoding = ''UTF8'';
-SET standard_conforming_strings = on;
-SELECT pg_catalog.set_config(''search_path'', '''', false);
-SET check_function_bodies = false;
-SET xmloption = content;
-SET client_min_messages = warning;
-SET row_security = off;
-
-SET default_tablespace = '''';
-
-CREATE SEQUENCE "public"."audit_id_seq"
- AS integer
- START WITH 1
- INCREMENT BY 1
- MINVALUE 1
- MAXVALUE 2147483647
- NO CYCLE;
-
-CREATE TABLE "public"."audit" (
- "id" integer DEFAULT nextval(''public.audit_id_seq''::regclass) NOT NULL,
- "operation" text NOT NULL,
- "query" text,
- "user_name" text NOT NULL,
- "changed_at" timestamp with time zone DEFAULT CURRENT_TIMESTAMP
-);
-
-ALTER SEQUENCE "public"."audit_id_seq" OWNED BY "public"."audit"."id";
-
-ALTER TABLE ONLY "public"."audit" ADD CONSTRAINT "audit_pkey" PRIMARY KEY ("id");
-
-CREATE INDEX "idx_audit_changed_at" ON ONLY "public"."audit" ("changed_at");
-
-CREATE INDEX "idx_audit_operation" ON ONLY "public"."audit" ("operation");
-
-CREATE INDEX "idx_audit_username" ON ONLY "public"."audit" ("user_name");
-
-CREATE TABLE "public"."department" (
- "dept_no" text NOT NULL,
- "dept_name" text NOT NULL
-);
-
-ALTER TABLE ONLY "public"."department" ADD CONSTRAINT "department_pkey" PRIMARY KEY ("dept_no");
-
-ALTER TABLE ONLY "public"."department" ADD CONSTRAINT "department_dept_name_key" UNIQUE ("dept_name");
-
-CREATE TABLE "public"."dept_emp" (
- "emp_no" integer NOT NULL,
- "dept_no" text NOT NULL,
- "from_date" date NOT NULL,
- "to_date" date NOT NULL
-);
-
-ALTER TABLE ONLY "public"."dept_emp" ADD CONSTRAINT "dept_emp_pkey" PRIMARY KEY ("emp_no", "dept_no");
-
-CREATE TABLE "public"."dept_manager" (
- "emp_no" integer NOT NULL,
- "dept_no" text NOT NULL,
- "from_date" date NOT NULL,
- "to_date" date NOT NULL
-);
-
-ALTER TABLE ONLY "public"."dept_manager" ADD CONSTRAINT "dept_manager_pkey" PRIMARY KEY ("emp_no", "dept_no");
-
-CREATE SEQUENCE "public"."employee_emp_no_seq"
- AS integer
- START WITH 1
- INCREMENT BY 1
- MINVALUE 1
- MAXVALUE 2147483647
- NO CYCLE;
-
-CREATE TABLE "public"."employee" (
- "emp_no" integer DEFAULT nextval(''public.employee_emp_no_seq''::regclass) NOT NULL,
- "birth_date" date NOT NULL,
- "first_name" text NOT NULL,
- "last_name" text NOT NULL,
- "gender" text NOT NULL,
- "hire_date" date NOT NULL
-);
-
-ALTER SEQUENCE "public"."employee_emp_no_seq" OWNED BY "public"."employee"."emp_no";
-
-ALTER TABLE ONLY "public"."employee" ADD CONSTRAINT "employee_pkey" PRIMARY KEY ("emp_no");
-
-CREATE INDEX "idx_employee_hire_date" ON ONLY "public"."employee" ("hire_date");
-
-CREATE OR REPLACE FUNCTION public.log_dml_operations()
- RETURNS trigger
- LANGUAGE plpgsql
-AS $function$
-BEGIN
- IF (TG_OP = ''INSERT'') THEN
- INSERT INTO audit (operation, query, user_name)
- VALUES (''INSERT'', current_query(), current_user);
- RETURN NEW;
- ELSIF (TG_OP = ''UPDATE'') THEN
- INSERT INTO audit (operation, query, user_name)
- VALUES (''UPDATE'', current_query(), current_user);
- RETURN NEW;
- ELSIF (TG_OP = ''DELETE'') THEN
- INSERT INTO audit (operation, query, user_name)
- VALUES (''DELETE'', current_query(), current_user);
- RETURN OLD;
- END IF;
- RETURN NULL;
-END;
-$function$
-;
-
-CREATE TABLE "public"."salary" (
- "emp_no" integer NOT NULL,
- "amount" integer NOT NULL,
- "from_date" date NOT NULL,
- "to_date" date NOT NULL
-);
-
-ALTER TABLE ONLY "public"."salary" ADD CONSTRAINT "salary_pkey" PRIMARY KEY ("emp_no", "from_date");
-
-CREATE INDEX "idx_salary_amount" ON ONLY "public"."salary" ("amount");
-
-CREATE TABLE "public"."title" (
- "emp_no" integer NOT NULL,
- "title" text NOT NULL,
- "from_date" date NOT NULL,
- "to_date" date
-);
-
-ALTER TABLE ONLY "public"."title" ADD CONSTRAINT "title_pkey" PRIMARY KEY ("emp_no", "title", "from_date");
-
-CREATE VIEW "public"."dept_emp_latest_date" AS
- SELECT emp_no,
- max(from_date) AS from_date,
- max(to_date) AS to_date
- FROM public.dept_emp
- GROUP BY emp_no;
-
-CREATE VIEW "public"."current_dept_emp" AS
- SELECT l.emp_no,
- d.dept_no,
- l.from_date,
- l.to_date
- FROM (public.dept_emp d
- JOIN public.dept_emp_latest_date l ON (((d.emp_no = l.emp_no) AND (d.from_date = l.from_date) AND (l.to_date = d.to_date))));
-
-CREATE TRIGGER salary_log_trigger AFTER DELETE OR UPDATE ON public.salary FOR EACH ROW EXECUTE FUNCTION public.log_dml_operations();
-
-ALTER TABLE "public"."dept_emp"
- ADD CONSTRAINT "dept_emp_dept_no_fkey" FOREIGN KEY ("dept_no")
- REFERENCES "public"."department" ("dept_no");
-
-ALTER TABLE "public"."dept_emp"
- ADD CONSTRAINT "dept_emp_emp_no_fkey" FOREIGN KEY ("emp_no")
- REFERENCES "public"."employee" ("emp_no");
-
-ALTER TABLE "public"."dept_manager"
- ADD CONSTRAINT "dept_manager_dept_no_fkey" FOREIGN KEY ("dept_no")
- REFERENCES "public"."department" ("dept_no");
-
-ALTER TABLE "public"."dept_manager"
- ADD CONSTRAINT "dept_manager_emp_no_fkey" FOREIGN KEY ("emp_no")
- REFERENCES "public"."employee" ("emp_no");
-
-ALTER TABLE "public"."salary"
- ADD CONSTRAINT "salary_emp_no_fkey" FOREIGN KEY ("emp_no")
- REFERENCES "public"."employee" ("emp_no");
-
-ALTER TABLE "public"."title"
- ADD CONSTRAINT "title_emp_no_fkey" FOREIGN KEY ("emp_no")
- REFERENCES "public"."employee" ("emp_no");
-
-') ON CONFLICT DO NOTHING;
-INSERT INTO public.sync_history (id, created_at, instance, db_name, metadata, raw_dump) VALUES (102, '2025-05-26 08:27:35.257294+00', 'test-sample-instance', 'hr_test', '{"name":"hr_test", "schemas":[{"name":"bbdataarchive", "owner":"bbsample"}, {"name":"public", "tables":[{"name":"audit", "columns":[{"name":"id", "position":1, "defaultExpression":"nextval(''public.audit_id_seq''::regclass)", "type":"integer"}, {"name":"operation", "position":2, "type":"text"}, {"name":"query", "position":3, "nullable":true, "type":"text"}, {"name":"user_name", "position":4, "type":"text"}, {"name":"changed_at", "position":5, "defaultExpression":"CURRENT_TIMESTAMP", "nullable":true, "type":"timestamp with time zone"}], "indexes":[{"name":"audit_pkey", "expressions":["id"], "type":"btree", "unique":true, "primary":true, "definition":"CREATE UNIQUE INDEX audit_pkey ON public.audit USING btree (id);", "isConstraint":true}, {"name":"idx_audit_changed_at", "expressions":["changed_at"], "type":"btree", "definition":"CREATE INDEX idx_audit_changed_at ON public.audit USING btree (changed_at);"}, {"name":"idx_audit_operation", "expressions":["operation"], "type":"btree", "definition":"CREATE INDEX idx_audit_operation ON public.audit USING btree (operation);"}, {"name":"idx_audit_username", "expressions":["user_name"], "type":"btree", "definition":"CREATE INDEX idx_audit_username ON public.audit USING btree (user_name);"}], "dataSize":"8192", "indexSize":"32768", "owner":"bbsample"}, {"name":"department", "columns":[{"name":"dept_no", "position":1, "type":"text"}, {"name":"dept_name", "position":2, "type":"text"}], "indexes":[{"name":"department_dept_name_key", "expressions":["dept_name"], "type":"btree", "unique":true, "definition":"CREATE UNIQUE INDEX department_dept_name_key ON public.department USING btree (dept_name);", "isConstraint":true}, {"name":"department_pkey", "expressions":["dept_no"], "type":"btree", "unique":true, "primary":true, "definition":"CREATE UNIQUE INDEX department_pkey ON public.department USING btree (dept_no);", "isConstraint":true}], "dataSize":"16384", "indexSize":"32768", "owner":"bbsample"}, {"name":"dept_emp", "columns":[{"name":"emp_no", "position":1, "type":"integer"}, {"name":"dept_no", "position":2, "type":"text"}, {"name":"from_date", "position":3, "type":"date"}, {"name":"to_date", "position":4, "type":"date"}], "indexes":[{"name":"dept_emp_pkey", "expressions":["emp_no", "dept_no"], "type":"btree", "unique":true, "primary":true, "definition":"CREATE UNIQUE INDEX dept_emp_pkey ON public.dept_emp USING btree (emp_no, dept_no);", "isConstraint":true}], "rowCount":"1103", "dataSize":"106496", "indexSize":"57344", "foreignKeys":[{"name":"dept_emp_dept_no_fkey", "columns":["dept_no"], "referencedSchema":"public", "referencedTable":"department", "referencedColumns":["dept_no"], "onDelete":"CASCADE", "onUpdate":"NO ACTION", "matchType":"SIMPLE"}, {"name":"dept_emp_emp_no_fkey", "columns":["emp_no"], "referencedSchema":"public", "referencedTable":"employee", "referencedColumns":["emp_no"], "onDelete":"CASCADE", "onUpdate":"NO ACTION", "matchType":"SIMPLE"}], "owner":"bbsample"}, {"name":"dept_manager", "columns":[{"name":"emp_no", "position":1, "type":"integer"}, {"name":"dept_no", "position":2, "type":"text"}, {"name":"from_date", "position":3, "type":"date"}, {"name":"to_date", "position":4, "type":"date"}], "indexes":[{"name":"dept_manager_pkey", "expressions":["emp_no", "dept_no"], "type":"btree", "unique":true, "primary":true, "definition":"CREATE UNIQUE INDEX dept_manager_pkey ON public.dept_manager USING btree (emp_no, dept_no);", "isConstraint":true}], "dataSize":"16384", "indexSize":"16384", "foreignKeys":[{"name":"dept_manager_dept_no_fkey", "columns":["dept_no"], "referencedSchema":"public", "referencedTable":"department", "referencedColumns":["dept_no"], "onDelete":"CASCADE", "onUpdate":"NO ACTION", "matchType":"SIMPLE"}, {"name":"dept_manager_emp_no_fkey", "columns":["emp_no"], "referencedSchema":"public", "referencedTable":"employee", "referencedColumns":["emp_no"], "onDelete":"CASCADE", "onUpdate":"NO ACTION", "matchType":"SIMPLE"}], "owner":"bbsample"}, {"name":"employee", "columns":[{"name":"emp_no", "position":1, "defaultExpression":"nextval(''public.employee_emp_no_seq''::regclass)", "type":"integer"}, {"name":"birth_date", "position":2, "type":"date"}, {"name":"first_name", "position":3, "type":"text"}, {"name":"last_name", "position":4, "type":"text"}, {"name":"gender", "position":5, "type":"text"}, {"name":"hire_date", "position":6, "type":"date"}], "indexes":[{"name":"employee_pkey", "expressions":["emp_no"], "type":"btree", "unique":true, "primary":true, "definition":"CREATE UNIQUE INDEX employee_pkey ON public.employee USING btree (emp_no);", "isConstraint":true}, {"name":"idx_employee_hire_date", "expressions":["hire_date"], "type":"btree", "definition":"CREATE INDEX idx_employee_hire_date ON public.employee USING btree (hire_date);"}], "rowCount":"1000", "dataSize":"98304", "indexSize":"98304", "owner":"bbsample"}, {"name":"salary", "columns":[{"name":"emp_no", "position":1, "type":"integer"}, {"name":"amount", "position":2, "type":"integer"}, {"name":"from_date", "position":3, "type":"date"}, {"name":"to_date", "position":4, "type":"date"}], "indexes":[{"name":"idx_salary_amount", "expressions":["amount"], "type":"btree", "definition":"CREATE INDEX idx_salary_amount ON public.salary USING btree (amount);"}, {"name":"salary_pkey", "expressions":["emp_no", "from_date"], "type":"btree", "unique":true, "primary":true, "definition":"CREATE UNIQUE INDEX salary_pkey ON public.salary USING btree (emp_no, from_date);", "isConstraint":true}], "rowCount":"9488", "dataSize":"458752", "indexSize":"548864", "foreignKeys":[{"name":"salary_emp_no_fkey", "columns":["emp_no"], "referencedSchema":"public", "referencedTable":"employee", "referencedColumns":["emp_no"], "onDelete":"CASCADE", "onUpdate":"NO ACTION", "matchType":"SIMPLE"}], "owner":"bbsample", "triggers":[{"name":"salary_log_trigger", "body":"CREATE TRIGGER salary_log_trigger AFTER DELETE OR UPDATE ON public.salary FOR EACH ROW EXECUTE FUNCTION public.log_dml_operations()"}]}, {"name":"title", "columns":[{"name":"emp_no", "position":1, "type":"integer"}, {"name":"title", "position":2, "type":"text"}, {"name":"from_date", "position":3, "type":"date"}, {"name":"to_date", "position":4, "nullable":true, "type":"date"}], "indexes":[{"name":"title_pkey", "expressions":["emp_no", "title", "from_date"], "type":"btree", "unique":true, "primary":true, "definition":"CREATE UNIQUE INDEX title_pkey ON public.title USING btree (emp_no, title, from_date);", "isConstraint":true}], "rowCount":"1470", "dataSize":"131072", "indexSize":"73728", "foreignKeys":[{"name":"title_emp_no_fkey", "columns":["emp_no"], "referencedSchema":"public", "referencedTable":"employee", "referencedColumns":["emp_no"], "onDelete":"CASCADE", "onUpdate":"NO ACTION", "matchType":"SIMPLE"}], "owner":"bbsample"}], "views":[{"name":"current_dept_emp", "definition":" SELECT l.emp_no,\n d.dept_no,\n l.from_date,\n l.to_date\n FROM (public.dept_emp d\n JOIN public.dept_emp_latest_date l ON (((d.emp_no = l.emp_no) AND (d.from_date = l.from_date) AND (l.to_date = d.to_date))));", "dependencyColumns":[{"schema":"public", "table":"dept_emp", "column":"dept_no"}, {"schema":"public", "table":"dept_emp", "column":"emp_no"}, {"schema":"public", "table":"dept_emp", "column":"from_date"}, {"schema":"public", "table":"dept_emp", "column":"to_date"}, {"schema":"public", "table":"dept_emp_latest_date", "column":"emp_no"}, {"schema":"public", "table":"dept_emp_latest_date", "column":"from_date"}, {"schema":"public", "table":"dept_emp_latest_date", "column":"to_date"}], "columns":[{"name":"emp_no", "position":1, "nullable":true, "type":"integer"}, {"name":"dept_no", "position":2, "nullable":true, "type":"text"}, {"name":"from_date", "position":3, "nullable":true, "type":"date"}, {"name":"to_date", "position":4, "nullable":true, "type":"date"}]}, {"name":"dept_emp_latest_date", "definition":" SELECT emp_no,\n max(from_date) AS from_date,\n max(to_date) AS to_date\n FROM public.dept_emp\n GROUP BY emp_no;", "dependencyColumns":[{"schema":"public", "table":"dept_emp", "column":"emp_no"}, {"schema":"public", "table":"dept_emp", "column":"from_date"}, {"schema":"public", "table":"dept_emp", "column":"to_date"}], "columns":[{"name":"emp_no", "position":1, "nullable":true, "type":"integer"}, {"name":"from_date", "position":2, "nullable":true, "type":"date"}, {"name":"to_date", "position":3, "nullable":true, "type":"date"}]}], "functions":[{"name":"log_dml_operations", "definition":"CREATE OR REPLACE FUNCTION public.log_dml_operations()\n RETURNS trigger\n LANGUAGE plpgsql\nAS $function$\nBEGIN\n IF (TG_OP = ''INSERT'') THEN\n INSERT INTO audit (operation, query, user_name)\n VALUES (''INSERT'', current_query(), current_user);\n RETURN NEW;\n ELSIF (TG_OP = ''UPDATE'') THEN\n INSERT INTO audit (operation, query, user_name)\n VALUES (''UPDATE'', current_query(), current_user);\n RETURN NEW;\n ELSIF (TG_OP = ''DELETE'') THEN\n INSERT INTO audit (operation, query, user_name)\n VALUES (''DELETE'', current_query(), current_user);\n RETURN OLD;\n END IF;\n RETURN NULL;\nEND;\n$function$\n", "signature":"log_dml_operations()"}], "sequences":[{"name":"audit_id_seq", "dataType":"integer", "start":"1", "minValue":"1", "maxValue":"2147483647", "increment":"1", "cacheSize":"1", "ownerTable":"audit", "ownerColumn":"id"}, {"name":"employee_emp_no_seq", "dataType":"integer", "start":"1", "minValue":"1", "maxValue":"2147483647", "increment":"1", "cacheSize":"1", "ownerTable":"employee", "ownerColumn":"emp_no"}], "owner":"pg_database_owner"}], "characterSet":"UTF8", "collation":"en_US.UTF-8", "owner":"bbsample"}', '
-SET statement_timeout = 0;
-SET lock_timeout = 0;
-SET idle_in_transaction_session_timeout = 0;
-SET client_encoding = ''UTF8'';
-SET standard_conforming_strings = on;
-SELECT pg_catalog.set_config(''search_path'', '''', false);
-SET check_function_bodies = false;
-SET xmloption = content;
-SET client_min_messages = warning;
-SET row_security = off;
-
-SET default_tablespace = '''';
-
-CREATE SEQUENCE "public"."audit_id_seq"
- AS integer
- START WITH 1
- INCREMENT BY 1
- MINVALUE 1
- MAXVALUE 2147483647
- NO CYCLE;
-
-CREATE TABLE "public"."audit" (
- "id" integer DEFAULT nextval(''public.audit_id_seq''::regclass) NOT NULL,
- "operation" text NOT NULL,
- "query" text,
- "user_name" text NOT NULL,
- "changed_at" timestamp with time zone DEFAULT CURRENT_TIMESTAMP
-);
-
-ALTER SEQUENCE "public"."audit_id_seq" OWNED BY "public"."audit"."id";
-
-ALTER TABLE ONLY "public"."audit" ADD CONSTRAINT "audit_pkey" PRIMARY KEY ("id");
-
-CREATE INDEX "idx_audit_changed_at" ON ONLY "public"."audit" ("changed_at");
-
-CREATE INDEX "idx_audit_operation" ON ONLY "public"."audit" ("operation");
-
-CREATE INDEX "idx_audit_username" ON ONLY "public"."audit" ("user_name");
-
-CREATE TABLE "public"."department" (
- "dept_no" text NOT NULL,
- "dept_name" text NOT NULL
-);
-
-ALTER TABLE ONLY "public"."department" ADD CONSTRAINT "department_pkey" PRIMARY KEY ("dept_no");
-
-ALTER TABLE ONLY "public"."department" ADD CONSTRAINT "department_dept_name_key" UNIQUE ("dept_name");
-
-CREATE TABLE "public"."dept_emp" (
- "emp_no" integer NOT NULL,
- "dept_no" text NOT NULL,
- "from_date" date NOT NULL,
- "to_date" date NOT NULL
-);
-
-ALTER TABLE ONLY "public"."dept_emp" ADD CONSTRAINT "dept_emp_pkey" PRIMARY KEY ("emp_no", "dept_no");
-
-CREATE TABLE "public"."dept_manager" (
- "emp_no" integer NOT NULL,
- "dept_no" text NOT NULL,
- "from_date" date NOT NULL,
- "to_date" date NOT NULL
-);
-
-ALTER TABLE ONLY "public"."dept_manager" ADD CONSTRAINT "dept_manager_pkey" PRIMARY KEY ("emp_no", "dept_no");
-
-CREATE SEQUENCE "public"."employee_emp_no_seq"
- AS integer
- START WITH 1
- INCREMENT BY 1
- MINVALUE 1
- MAXVALUE 2147483647
- NO CYCLE;
-
-CREATE TABLE "public"."employee" (
- "emp_no" integer DEFAULT nextval(''public.employee_emp_no_seq''::regclass) NOT NULL,
- "birth_date" date NOT NULL,
- "first_name" text NOT NULL,
- "last_name" text NOT NULL,
- "gender" text NOT NULL,
- "hire_date" date NOT NULL
-);
-
-ALTER SEQUENCE "public"."employee_emp_no_seq" OWNED BY "public"."employee"."emp_no";
-
-ALTER TABLE ONLY "public"."employee" ADD CONSTRAINT "employee_pkey" PRIMARY KEY ("emp_no");
-
-CREATE INDEX "idx_employee_hire_date" ON ONLY "public"."employee" ("hire_date");
-
-CREATE OR REPLACE FUNCTION public.log_dml_operations()
- RETURNS trigger
- LANGUAGE plpgsql
-AS $function$
-BEGIN
- IF (TG_OP = ''INSERT'') THEN
- INSERT INTO audit (operation, query, user_name)
- VALUES (''INSERT'', current_query(), current_user);
- RETURN NEW;
- ELSIF (TG_OP = ''UPDATE'') THEN
- INSERT INTO audit (operation, query, user_name)
- VALUES (''UPDATE'', current_query(), current_user);
- RETURN NEW;
- ELSIF (TG_OP = ''DELETE'') THEN
- INSERT INTO audit (operation, query, user_name)
- VALUES (''DELETE'', current_query(), current_user);
- RETURN OLD;
- END IF;
- RETURN NULL;
-END;
-$function$
-;
-
-CREATE TABLE "public"."salary" (
- "emp_no" integer NOT NULL,
- "amount" integer NOT NULL,
- "from_date" date NOT NULL,
- "to_date" date NOT NULL
-);
-
-ALTER TABLE ONLY "public"."salary" ADD CONSTRAINT "salary_pkey" PRIMARY KEY ("emp_no", "from_date");
-
-CREATE INDEX "idx_salary_amount" ON ONLY "public"."salary" ("amount");
-
-CREATE TABLE "public"."title" (
- "emp_no" integer NOT NULL,
- "title" text NOT NULL,
- "from_date" date NOT NULL,
- "to_date" date
-);
-
-ALTER TABLE ONLY "public"."title" ADD CONSTRAINT "title_pkey" PRIMARY KEY ("emp_no", "title", "from_date");
-
-CREATE VIEW "public"."dept_emp_latest_date" AS
- SELECT emp_no,
- max(from_date) AS from_date,
- max(to_date) AS to_date
- FROM public.dept_emp
- GROUP BY emp_no;
-
-CREATE VIEW "public"."current_dept_emp" AS
- SELECT l.emp_no,
- d.dept_no,
- l.from_date,
- l.to_date
- FROM (public.dept_emp d
- JOIN public.dept_emp_latest_date l ON (((d.emp_no = l.emp_no) AND (d.from_date = l.from_date) AND (l.to_date = d.to_date))));
-
-CREATE TRIGGER salary_log_trigger AFTER DELETE OR UPDATE ON public.salary FOR EACH ROW EXECUTE FUNCTION public.log_dml_operations();
-
-ALTER TABLE "public"."dept_emp"
- ADD CONSTRAINT "dept_emp_dept_no_fkey" FOREIGN KEY ("dept_no")
- REFERENCES "public"."department" ("dept_no");
-
-ALTER TABLE "public"."dept_emp"
- ADD CONSTRAINT "dept_emp_emp_no_fkey" FOREIGN KEY ("emp_no")
- REFERENCES "public"."employee" ("emp_no");
-
-ALTER TABLE "public"."dept_manager"
- ADD CONSTRAINT "dept_manager_dept_no_fkey" FOREIGN KEY ("dept_no")
- REFERENCES "public"."department" ("dept_no");
-
-ALTER TABLE "public"."dept_manager"
- ADD CONSTRAINT "dept_manager_emp_no_fkey" FOREIGN KEY ("emp_no")
- REFERENCES "public"."employee" ("emp_no");
-
-ALTER TABLE "public"."salary"
- ADD CONSTRAINT "salary_emp_no_fkey" FOREIGN KEY ("emp_no")
- REFERENCES "public"."employee" ("emp_no");
-
-ALTER TABLE "public"."title"
- ADD CONSTRAINT "title_emp_no_fkey" FOREIGN KEY ("emp_no")
- REFERENCES "public"."employee" ("emp_no");
-
-') ON CONFLICT DO NOTHING;
-INSERT INTO public.sync_history (id, created_at, instance, db_name, metadata, raw_dump) VALUES (103, '2025-06-09 02:21:04.275364+00', 'prod-sample-instance', 'hr_prod', '{"name":"hr_prod","schemas":[{"name":"bbdataarchive","owner":"bbsample"},{"name":"public","tables":[{"name":"audit","columns":[{"name":"id","position":1,"defaultExpression":"nextval(''public.audit_id_seq''::regclass)","type":"integer"},{"name":"operation","position":2,"type":"text"},{"name":"query","position":3,"nullable":true,"type":"text"},{"name":"user_name","position":4,"type":"text"},{"name":"changed_at","position":5,"defaultExpression":"CURRENT_TIMESTAMP","nullable":true,"type":"timestamp with time zone"}],"indexes":[{"name":"audit_pkey","expressions":["id"],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX audit_pkey ON public.audit USING btree (id);","isConstraint":true},{"name":"idx_audit_changed_at","expressions":["changed_at"],"type":"btree","definition":"CREATE INDEX idx_audit_changed_at ON public.audit USING btree (changed_at);"},{"name":"idx_audit_operation","expressions":["operation"],"type":"btree","definition":"CREATE INDEX idx_audit_operation ON public.audit USING btree (operation);"},{"name":"idx_audit_username","expressions":["user_name"],"type":"btree","definition":"CREATE INDEX idx_audit_username ON public.audit USING btree (user_name);"}],"dataSize":"8192","indexSize":"32768","owner":"bbsample"},{"name":"department","columns":[{"name":"dept_no","position":1,"type":"text"},{"name":"dept_name","position":2,"type":"text"}],"indexes":[{"name":"department_dept_name_key","expressions":["dept_name"],"type":"btree","unique":true,"definition":"CREATE UNIQUE INDEX department_dept_name_key ON public.department USING btree (dept_name);","isConstraint":true},{"name":"department_pkey","expressions":["dept_no"],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX department_pkey ON public.department USING btree (dept_no);","isConstraint":true}],"dataSize":"16384","indexSize":"32768","owner":"bbsample"},{"name":"dept_emp","columns":[{"name":"emp_no","position":1,"type":"integer"},{"name":"dept_no","position":2,"type":"text"},{"name":"from_date","position":3,"type":"date"},{"name":"to_date","position":4,"type":"date"}],"indexes":[{"name":"dept_emp_pkey","expressions":["emp_no","dept_no"],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX dept_emp_pkey ON public.dept_emp USING btree (emp_no, dept_no);","isConstraint":true}],"rowCount":"1103","dataSize":"106496","indexSize":"57344","foreignKeys":[{"name":"dept_emp_dept_no_fkey","columns":["dept_no"],"referencedSchema":"public","referencedTable":"department","referencedColumns":["dept_no"],"onDelete":"CASCADE","onUpdate":"NO ACTION","matchType":"SIMPLE"},{"name":"dept_emp_emp_no_fkey","columns":["emp_no"],"referencedSchema":"public","referencedTable":"employee","referencedColumns":["emp_no"],"onDelete":"CASCADE","onUpdate":"NO ACTION","matchType":"SIMPLE"}],"owner":"bbsample"},{"name":"dept_manager","columns":[{"name":"emp_no","position":1,"type":"integer"},{"name":"dept_no","position":2,"type":"text"},{"name":"from_date","position":3,"type":"date"},{"name":"to_date","position":4,"type":"date"}],"indexes":[{"name":"dept_manager_pkey","expressions":["emp_no","dept_no"],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX dept_manager_pkey ON public.dept_manager USING btree (emp_no, dept_no);","isConstraint":true}],"dataSize":"16384","indexSize":"16384","foreignKeys":[{"name":"dept_manager_dept_no_fkey","columns":["dept_no"],"referencedSchema":"public","referencedTable":"department","referencedColumns":["dept_no"],"onDelete":"CASCADE","onUpdate":"NO ACTION","matchType":"SIMPLE"},{"name":"dept_manager_emp_no_fkey","columns":["emp_no"],"referencedSchema":"public","referencedTable":"employee","referencedColumns":["emp_no"],"onDelete":"CASCADE","onUpdate":"NO ACTION","matchType":"SIMPLE"}],"owner":"bbsample"},{"name":"employee","columns":[{"name":"emp_no","position":1,"defaultExpression":"nextval(''public.employee_emp_no_seq''::regclass)","type":"integer"},{"name":"birth_date","position":2,"type":"date"},{"name":"first_name","position":3,"type":"text"},{"name":"last_name","position":4,"type":"text"},{"name":"gender","position":5,"type":"text"},{"name":"hire_date","position":6,"type":"date"}],"indexes":[{"name":"employee_pkey","expressions":["emp_no"],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX employee_pkey ON public.employee USING btree (emp_no);","isConstraint":true},{"name":"idx_employee_hire_date","expressions":["hire_date"],"type":"btree","definition":"CREATE INDEX idx_employee_hire_date ON public.employee USING btree (hire_date);"}],"rowCount":"1000","dataSize":"98304","indexSize":"98304","checkConstraints":[{"name":"employee_gender_check","expression":"(gender = ANY (ARRAY[''M''::text, ''F''::text]))"}],"owner":"bbsample"},{"name":"salary","columns":[{"name":"emp_no","position":1,"type":"integer"},{"name":"amount","position":2,"type":"integer"},{"name":"from_date","position":3,"type":"date"},{"name":"to_date","position":4,"type":"date"}],"indexes":[{"name":"idx_salary_amount","expressions":["amount"],"type":"btree","definition":"CREATE INDEX idx_salary_amount ON public.salary USING btree (amount);"},{"name":"salary_pkey","expressions":["emp_no","from_date"],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX salary_pkey ON public.salary USING btree (emp_no, from_date);","isConstraint":true}],"rowCount":"9488","dataSize":"458752","indexSize":"548864","foreignKeys":[{"name":"salary_emp_no_fkey","columns":["emp_no"],"referencedSchema":"public","referencedTable":"employee","referencedColumns":["emp_no"],"onDelete":"CASCADE","onUpdate":"NO ACTION","matchType":"SIMPLE"}],"owner":"bbsample","triggers":[{"name":"salary_log_trigger","body":"CREATE TRIGGER salary_log_trigger AFTER DELETE OR UPDATE ON public.salary FOR EACH ROW EXECUTE FUNCTION public.log_dml_operations()"}]},{"name":"title","columns":[{"name":"emp_no","position":1,"type":"integer"},{"name":"title","position":2,"type":"text"},{"name":"from_date","position":3,"type":"date"},{"name":"to_date","position":4,"nullable":true,"type":"date"}],"indexes":[{"name":"title_pkey","expressions":["emp_no","title","from_date"],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX title_pkey ON public.title USING btree (emp_no, title, from_date);","isConstraint":true}],"rowCount":"1470","dataSize":"131072","indexSize":"73728","foreignKeys":[{"name":"title_emp_no_fkey","columns":["emp_no"],"referencedSchema":"public","referencedTable":"employee","referencedColumns":["emp_no"],"onDelete":"CASCADE","onUpdate":"NO ACTION","matchType":"SIMPLE"}],"owner":"bbsample"}],"views":[{"name":"current_dept_emp","definition":" SELECT l.emp_no,\n d.dept_no,\n l.from_date,\n l.to_date\n FROM (public.dept_emp d\n JOIN public.dept_emp_latest_date l ON (((d.emp_no = l.emp_no) AND (d.from_date = l.from_date) AND (l.to_date = d.to_date))));","dependencyColumns":[{"schema":"public","table":"dept_emp","column":"dept_no"},{"schema":"public","table":"dept_emp","column":"emp_no"},{"schema":"public","table":"dept_emp","column":"from_date"},{"schema":"public","table":"dept_emp","column":"to_date"},{"schema":"public","table":"dept_emp_latest_date","column":"emp_no"},{"schema":"public","table":"dept_emp_latest_date","column":"from_date"},{"schema":"public","table":"dept_emp_latest_date","column":"to_date"}],"columns":[{"name":"emp_no","position":1,"nullable":true,"type":"integer"},{"name":"dept_no","position":2,"nullable":true,"type":"text"},{"name":"from_date","position":3,"nullable":true,"type":"date"},{"name":"to_date","position":4,"nullable":true,"type":"date"}]},{"name":"dept_emp_latest_date","definition":" SELECT emp_no,\n max(from_date) AS from_date,\n max(to_date) AS to_date\n FROM public.dept_emp\n GROUP BY emp_no;","dependencyColumns":[{"schema":"public","table":"dept_emp","column":"emp_no"},{"schema":"public","table":"dept_emp","column":"from_date"},{"schema":"public","table":"dept_emp","column":"to_date"}],"columns":[{"name":"emp_no","position":1,"nullable":true,"type":"integer"},{"name":"from_date","position":2,"nullable":true,"type":"date"},{"name":"to_date","position":3,"nullable":true,"type":"date"}]}],"functions":[{"name":"log_dml_operations","definition":"CREATE OR REPLACE FUNCTION public.log_dml_operations()\n RETURNS trigger\n LANGUAGE plpgsql\nAS $function$\nBEGIN\n IF (TG_OP = ''INSERT'') THEN\n INSERT INTO audit (operation, query, user_name)\n VALUES (''INSERT'', current_query(), current_user);\n RETURN NEW;\n ELSIF (TG_OP = ''UPDATE'') THEN\n INSERT INTO audit (operation, query, user_name)\n VALUES (''UPDATE'', current_query(), current_user);\n RETURN NEW;\n ELSIF (TG_OP = ''DELETE'') THEN\n INSERT INTO audit (operation, query, user_name)\n VALUES (''DELETE'', current_query(), current_user);\n RETURN OLD;\n END IF;\n RETURN NULL;\nEND;\n$function$\n","signature":"log_dml_operations()"}],"sequences":[{"name":"audit_id_seq","dataType":"integer","start":"1","minValue":"1","maxValue":"2147483647","increment":"1","cacheSize":"1","ownerTable":"audit","ownerColumn":"id"},{"name":"employee_emp_no_seq","dataType":"integer","start":"1","minValue":"1","maxValue":"2147483647","increment":"1","cacheSize":"1","ownerTable":"employee","ownerColumn":"emp_no"}],"owner":"pg_database_owner"}],"characterSet":"UTF8","collation":"en_US.UTF-8","owner":"bbsample","searchPath":"\"$user\", public"}', '
-SET statement_timeout = 0;
-SET lock_timeout = 0;
-SET idle_in_transaction_session_timeout = 0;
-SET client_encoding = ''UTF8'';
-SET standard_conforming_strings = on;
-SELECT pg_catalog.set_config(''search_path'', '''', false);
-SET check_function_bodies = false;
-SET xmloption = content;
-SET client_min_messages = warning;
-SET row_security = off;
-
-SET default_tablespace = '''';
-
-CREATE SEQUENCE "public"."audit_id_seq"
- AS integer
- START WITH 1
- INCREMENT BY 1
- MINVALUE 1
- MAXVALUE 2147483647
- NO CYCLE;
-
-CREATE TABLE "public"."audit" (
- "id" integer DEFAULT nextval(''public.audit_id_seq''::regclass) NOT NULL,
- "operation" text NOT NULL,
- "query" text,
- "user_name" text NOT NULL,
- "changed_at" timestamp with time zone DEFAULT CURRENT_TIMESTAMP
-);
-
-ALTER SEQUENCE "public"."audit_id_seq" OWNED BY "public"."audit"."id";
-
-ALTER TABLE ONLY "public"."audit" ADD CONSTRAINT "audit_pkey" PRIMARY KEY ("id");
-
-CREATE INDEX "idx_audit_changed_at" ON ONLY "public"."audit" ("changed_at");
-
-CREATE INDEX "idx_audit_operation" ON ONLY "public"."audit" ("operation");
-
-CREATE INDEX "idx_audit_username" ON ONLY "public"."audit" ("user_name");
-
-CREATE TABLE "public"."department" (
- "dept_no" text NOT NULL,
- "dept_name" text NOT NULL
-);
-
-ALTER TABLE ONLY "public"."department" ADD CONSTRAINT "department_pkey" PRIMARY KEY ("dept_no");
-
-ALTER TABLE ONLY "public"."department" ADD CONSTRAINT "department_dept_name_key" UNIQUE ("dept_name");
-
-CREATE TABLE "public"."dept_emp" (
- "emp_no" integer NOT NULL,
- "dept_no" text NOT NULL,
- "from_date" date NOT NULL,
- "to_date" date NOT NULL
-);
-
-ALTER TABLE ONLY "public"."dept_emp" ADD CONSTRAINT "dept_emp_pkey" PRIMARY KEY ("emp_no", "dept_no");
-
-CREATE TABLE "public"."dept_manager" (
- "emp_no" integer NOT NULL,
- "dept_no" text NOT NULL,
- "from_date" date NOT NULL,
- "to_date" date NOT NULL
-);
-
-ALTER TABLE ONLY "public"."dept_manager" ADD CONSTRAINT "dept_manager_pkey" PRIMARY KEY ("emp_no", "dept_no");
-
-CREATE SEQUENCE "public"."employee_emp_no_seq"
- AS integer
- START WITH 1
- INCREMENT BY 1
- MINVALUE 1
- MAXVALUE 2147483647
- NO CYCLE;
-
-CREATE TABLE "public"."employee" (
- "emp_no" integer DEFAULT nextval(''public.employee_emp_no_seq''::regclass) NOT NULL,
- "birth_date" date NOT NULL,
- "first_name" text NOT NULL,
- "last_name" text NOT NULL,
- "gender" text NOT NULL,
- "hire_date" date NOT NULL,
- CONSTRAINT "employee_gender_check" CHECK (gender = ANY (ARRAY[''M''::text, ''F''::text]))
-);
-
-ALTER SEQUENCE "public"."employee_emp_no_seq" OWNED BY "public"."employee"."emp_no";
-
-ALTER TABLE ONLY "public"."employee" ADD CONSTRAINT "employee_pkey" PRIMARY KEY ("emp_no");
-
-CREATE INDEX "idx_employee_hire_date" ON ONLY "public"."employee" ("hire_date");
-
-CREATE OR REPLACE FUNCTION public.log_dml_operations()
- RETURNS trigger
- LANGUAGE plpgsql
-AS $function$
-BEGIN
- IF (TG_OP = ''INSERT'') THEN
- INSERT INTO audit (operation, query, user_name)
- VALUES (''INSERT'', current_query(), current_user);
- RETURN NEW;
- ELSIF (TG_OP = ''UPDATE'') THEN
- INSERT INTO audit (operation, query, user_name)
- VALUES (''UPDATE'', current_query(), current_user);
- RETURN NEW;
- ELSIF (TG_OP = ''DELETE'') THEN
- INSERT INTO audit (operation, query, user_name)
- VALUES (''DELETE'', current_query(), current_user);
- RETURN OLD;
- END IF;
- RETURN NULL;
-END;
-$function$
-;
-
-CREATE TABLE "public"."salary" (
- "emp_no" integer NOT NULL,
- "amount" integer NOT NULL,
- "from_date" date NOT NULL,
- "to_date" date NOT NULL
-);
-
-ALTER TABLE ONLY "public"."salary" ADD CONSTRAINT "salary_pkey" PRIMARY KEY ("emp_no", "from_date");
-
-CREATE INDEX "idx_salary_amount" ON ONLY "public"."salary" ("amount");
-
-CREATE TABLE "public"."title" (
- "emp_no" integer NOT NULL,
- "title" text NOT NULL,
- "from_date" date NOT NULL,
- "to_date" date
-);
-
-ALTER TABLE ONLY "public"."title" ADD CONSTRAINT "title_pkey" PRIMARY KEY ("emp_no", "title", "from_date");
-
-CREATE VIEW "public"."dept_emp_latest_date" AS
- SELECT emp_no,
- max(from_date) AS from_date,
- max(to_date) AS to_date
- FROM public.dept_emp
- GROUP BY emp_no;
-
-CREATE VIEW "public"."current_dept_emp" AS
- SELECT l.emp_no,
- d.dept_no,
- l.from_date,
- l.to_date
- FROM (public.dept_emp d
- JOIN public.dept_emp_latest_date l ON (((d.emp_no = l.emp_no) AND (d.from_date = l.from_date) AND (l.to_date = d.to_date))));
-
-CREATE TRIGGER salary_log_trigger AFTER DELETE OR UPDATE ON public.salary FOR EACH ROW EXECUTE FUNCTION public.log_dml_operations();
-
-ALTER TABLE "public"."dept_emp"
- ADD CONSTRAINT "dept_emp_dept_no_fkey" FOREIGN KEY ("dept_no")
- REFERENCES "public"."department" ("dept_no");
-
-ALTER TABLE "public"."dept_emp"
- ADD CONSTRAINT "dept_emp_emp_no_fkey" FOREIGN KEY ("emp_no")
- REFERENCES "public"."employee" ("emp_no");
-
-ALTER TABLE "public"."dept_manager"
- ADD CONSTRAINT "dept_manager_dept_no_fkey" FOREIGN KEY ("dept_no")
- REFERENCES "public"."department" ("dept_no");
-
-ALTER TABLE "public"."dept_manager"
- ADD CONSTRAINT "dept_manager_emp_no_fkey" FOREIGN KEY ("emp_no")
- REFERENCES "public"."employee" ("emp_no");
-
-ALTER TABLE "public"."salary"
- ADD CONSTRAINT "salary_emp_no_fkey" FOREIGN KEY ("emp_no")
- REFERENCES "public"."employee" ("emp_no");
-
-ALTER TABLE "public"."title"
- ADD CONSTRAINT "title_emp_no_fkey" FOREIGN KEY ("emp_no")
- REFERENCES "public"."employee" ("emp_no");
-
-') ON CONFLICT DO NOTHING;
-INSERT INTO public.sync_history (id, created_at, instance, db_name, metadata, raw_dump) VALUES (104, '2025-06-09 02:21:07.595494+00', 'test-sample-instance', 'hr_test', '{"name":"hr_test","schemas":[{"name":"bbdataarchive","owner":"bbsample"},{"name":"public","tables":[{"name":"audit","columns":[{"name":"id","position":1,"defaultExpression":"nextval(''public.audit_id_seq''::regclass)","type":"integer"},{"name":"operation","position":2,"type":"text"},{"name":"query","position":3,"nullable":true,"type":"text"},{"name":"user_name","position":4,"type":"text"},{"name":"changed_at","position":5,"defaultExpression":"CURRENT_TIMESTAMP","nullable":true,"type":"timestamp with time zone"}],"indexes":[{"name":"audit_pkey","expressions":["id"],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX audit_pkey ON public.audit USING btree (id);","isConstraint":true},{"name":"idx_audit_changed_at","expressions":["changed_at"],"type":"btree","definition":"CREATE INDEX idx_audit_changed_at ON public.audit USING btree (changed_at);"},{"name":"idx_audit_operation","expressions":["operation"],"type":"btree","definition":"CREATE INDEX idx_audit_operation ON public.audit USING btree (operation);"},{"name":"idx_audit_username","expressions":["user_name"],"type":"btree","definition":"CREATE INDEX idx_audit_username ON public.audit USING btree (user_name);"}],"dataSize":"8192","indexSize":"32768","owner":"bbsample"},{"name":"department","columns":[{"name":"dept_no","position":1,"type":"text"},{"name":"dept_name","position":2,"type":"text"}],"indexes":[{"name":"department_dept_name_key","expressions":["dept_name"],"type":"btree","unique":true,"definition":"CREATE UNIQUE INDEX department_dept_name_key ON public.department USING btree (dept_name);","isConstraint":true},{"name":"department_pkey","expressions":["dept_no"],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX department_pkey ON public.department USING btree (dept_no);","isConstraint":true}],"dataSize":"16384","indexSize":"32768","owner":"bbsample"},{"name":"dept_emp","columns":[{"name":"emp_no","position":1,"type":"integer"},{"name":"dept_no","position":2,"type":"text"},{"name":"from_date","position":3,"type":"date"},{"name":"to_date","position":4,"type":"date"}],"indexes":[{"name":"dept_emp_pkey","expressions":["emp_no","dept_no"],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX dept_emp_pkey ON public.dept_emp USING btree (emp_no, dept_no);","isConstraint":true}],"rowCount":"1103","dataSize":"106496","indexSize":"57344","foreignKeys":[{"name":"dept_emp_dept_no_fkey","columns":["dept_no"],"referencedSchema":"public","referencedTable":"department","referencedColumns":["dept_no"],"onDelete":"CASCADE","onUpdate":"NO ACTION","matchType":"SIMPLE"},{"name":"dept_emp_emp_no_fkey","columns":["emp_no"],"referencedSchema":"public","referencedTable":"employee","referencedColumns":["emp_no"],"onDelete":"CASCADE","onUpdate":"NO ACTION","matchType":"SIMPLE"}],"owner":"bbsample"},{"name":"dept_manager","columns":[{"name":"emp_no","position":1,"type":"integer"},{"name":"dept_no","position":2,"type":"text"},{"name":"from_date","position":3,"type":"date"},{"name":"to_date","position":4,"type":"date"}],"indexes":[{"name":"dept_manager_pkey","expressions":["emp_no","dept_no"],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX dept_manager_pkey ON public.dept_manager USING btree (emp_no, dept_no);","isConstraint":true}],"dataSize":"16384","indexSize":"16384","foreignKeys":[{"name":"dept_manager_dept_no_fkey","columns":["dept_no"],"referencedSchema":"public","referencedTable":"department","referencedColumns":["dept_no"],"onDelete":"CASCADE","onUpdate":"NO ACTION","matchType":"SIMPLE"},{"name":"dept_manager_emp_no_fkey","columns":["emp_no"],"referencedSchema":"public","referencedTable":"employee","referencedColumns":["emp_no"],"onDelete":"CASCADE","onUpdate":"NO ACTION","matchType":"SIMPLE"}],"owner":"bbsample"},{"name":"employee","columns":[{"name":"emp_no","position":1,"defaultExpression":"nextval(''public.employee_emp_no_seq''::regclass)","type":"integer"},{"name":"birth_date","position":2,"type":"date"},{"name":"first_name","position":3,"type":"text"},{"name":"last_name","position":4,"type":"text"},{"name":"gender","position":5,"type":"text"},{"name":"hire_date","position":6,"type":"date"}],"indexes":[{"name":"employee_pkey","expressions":["emp_no"],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX employee_pkey ON public.employee USING btree (emp_no);","isConstraint":true},{"name":"idx_employee_hire_date","expressions":["hire_date"],"type":"btree","definition":"CREATE INDEX idx_employee_hire_date ON public.employee USING btree (hire_date);"}],"rowCount":"1000","dataSize":"98304","indexSize":"98304","checkConstraints":[{"name":"employee_gender_check","expression":"(gender = ANY (ARRAY[''M''::text, ''F''::text]))"}],"owner":"bbsample"},{"name":"salary","columns":[{"name":"emp_no","position":1,"type":"integer"},{"name":"amount","position":2,"type":"integer"},{"name":"from_date","position":3,"type":"date"},{"name":"to_date","position":4,"type":"date"}],"indexes":[{"name":"idx_salary_amount","expressions":["amount"],"type":"btree","definition":"CREATE INDEX idx_salary_amount ON public.salary USING btree (amount);"},{"name":"salary_pkey","expressions":["emp_no","from_date"],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX salary_pkey ON public.salary USING btree (emp_no, from_date);","isConstraint":true}],"rowCount":"9488","dataSize":"458752","indexSize":"548864","foreignKeys":[{"name":"salary_emp_no_fkey","columns":["emp_no"],"referencedSchema":"public","referencedTable":"employee","referencedColumns":["emp_no"],"onDelete":"CASCADE","onUpdate":"NO ACTION","matchType":"SIMPLE"}],"owner":"bbsample","triggers":[{"name":"salary_log_trigger","body":"CREATE TRIGGER salary_log_trigger AFTER DELETE OR UPDATE ON public.salary FOR EACH ROW EXECUTE FUNCTION public.log_dml_operations()"}]},{"name":"title","columns":[{"name":"emp_no","position":1,"type":"integer"},{"name":"title","position":2,"type":"text"},{"name":"from_date","position":3,"type":"date"},{"name":"to_date","position":4,"nullable":true,"type":"date"}],"indexes":[{"name":"title_pkey","expressions":["emp_no","title","from_date"],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX title_pkey ON public.title USING btree (emp_no, title, from_date);","isConstraint":true}],"rowCount":"1470","dataSize":"131072","indexSize":"73728","foreignKeys":[{"name":"title_emp_no_fkey","columns":["emp_no"],"referencedSchema":"public","referencedTable":"employee","referencedColumns":["emp_no"],"onDelete":"CASCADE","onUpdate":"NO ACTION","matchType":"SIMPLE"}],"owner":"bbsample"}],"views":[{"name":"current_dept_emp","definition":" SELECT l.emp_no,\n d.dept_no,\n l.from_date,\n l.to_date\n FROM (public.dept_emp d\n JOIN public.dept_emp_latest_date l ON (((d.emp_no = l.emp_no) AND (d.from_date = l.from_date) AND (l.to_date = d.to_date))));","dependencyColumns":[{"schema":"public","table":"dept_emp","column":"dept_no"},{"schema":"public","table":"dept_emp","column":"emp_no"},{"schema":"public","table":"dept_emp","column":"from_date"},{"schema":"public","table":"dept_emp","column":"to_date"},{"schema":"public","table":"dept_emp_latest_date","column":"emp_no"},{"schema":"public","table":"dept_emp_latest_date","column":"from_date"},{"schema":"public","table":"dept_emp_latest_date","column":"to_date"}],"columns":[{"name":"emp_no","position":1,"nullable":true,"type":"integer"},{"name":"dept_no","position":2,"nullable":true,"type":"text"},{"name":"from_date","position":3,"nullable":true,"type":"date"},{"name":"to_date","position":4,"nullable":true,"type":"date"}]},{"name":"dept_emp_latest_date","definition":" SELECT emp_no,\n max(from_date) AS from_date,\n max(to_date) AS to_date\n FROM public.dept_emp\n GROUP BY emp_no;","dependencyColumns":[{"schema":"public","table":"dept_emp","column":"emp_no"},{"schema":"public","table":"dept_emp","column":"from_date"},{"schema":"public","table":"dept_emp","column":"to_date"}],"columns":[{"name":"emp_no","position":1,"nullable":true,"type":"integer"},{"name":"from_date","position":2,"nullable":true,"type":"date"},{"name":"to_date","position":3,"nullable":true,"type":"date"}]}],"functions":[{"name":"log_dml_operations","definition":"CREATE OR REPLACE FUNCTION public.log_dml_operations()\n RETURNS trigger\n LANGUAGE plpgsql\nAS $function$\nBEGIN\n IF (TG_OP = ''INSERT'') THEN\n INSERT INTO audit (operation, query, user_name)\n VALUES (''INSERT'', current_query(), current_user);\n RETURN NEW;\n ELSIF (TG_OP = ''UPDATE'') THEN\n INSERT INTO audit (operation, query, user_name)\n VALUES (''UPDATE'', current_query(), current_user);\n RETURN NEW;\n ELSIF (TG_OP = ''DELETE'') THEN\n INSERT INTO audit (operation, query, user_name)\n VALUES (''DELETE'', current_query(), current_user);\n RETURN OLD;\n END IF;\n RETURN NULL;\nEND;\n$function$\n","signature":"log_dml_operations()"}],"sequences":[{"name":"audit_id_seq","dataType":"integer","start":"1","minValue":"1","maxValue":"2147483647","increment":"1","cacheSize":"1","ownerTable":"audit","ownerColumn":"id"},{"name":"employee_emp_no_seq","dataType":"integer","start":"1","minValue":"1","maxValue":"2147483647","increment":"1","cacheSize":"1","ownerTable":"employee","ownerColumn":"emp_no"}],"owner":"pg_database_owner"}],"characterSet":"UTF8","collation":"en_US.UTF-8","owner":"bbsample","searchPath":"\"$user\", public"}', '
-SET statement_timeout = 0;
-SET lock_timeout = 0;
-SET idle_in_transaction_session_timeout = 0;
-SET client_encoding = ''UTF8'';
-SET standard_conforming_strings = on;
-SELECT pg_catalog.set_config(''search_path'', '''', false);
-SET check_function_bodies = false;
-SET xmloption = content;
-SET client_min_messages = warning;
-SET row_security = off;
-
-SET default_tablespace = '''';
-
-CREATE SEQUENCE "public"."audit_id_seq"
- AS integer
- START WITH 1
- INCREMENT BY 1
- MINVALUE 1
- MAXVALUE 2147483647
- NO CYCLE;
-
-CREATE TABLE "public"."audit" (
- "id" integer DEFAULT nextval(''public.audit_id_seq''::regclass) NOT NULL,
- "operation" text NOT NULL,
- "query" text,
- "user_name" text NOT NULL,
- "changed_at" timestamp with time zone DEFAULT CURRENT_TIMESTAMP
-);
-
-ALTER SEQUENCE "public"."audit_id_seq" OWNED BY "public"."audit"."id";
-
-ALTER TABLE ONLY "public"."audit" ADD CONSTRAINT "audit_pkey" PRIMARY KEY ("id");
-
-CREATE INDEX "idx_audit_changed_at" ON ONLY "public"."audit" ("changed_at");
-
-CREATE INDEX "idx_audit_operation" ON ONLY "public"."audit" ("operation");
-
-CREATE INDEX "idx_audit_username" ON ONLY "public"."audit" ("user_name");
-
-CREATE TABLE "public"."department" (
- "dept_no" text NOT NULL,
- "dept_name" text NOT NULL
-);
-
-ALTER TABLE ONLY "public"."department" ADD CONSTRAINT "department_pkey" PRIMARY KEY ("dept_no");
-
-ALTER TABLE ONLY "public"."department" ADD CONSTRAINT "department_dept_name_key" UNIQUE ("dept_name");
-
-CREATE TABLE "public"."dept_emp" (
- "emp_no" integer NOT NULL,
- "dept_no" text NOT NULL,
- "from_date" date NOT NULL,
- "to_date" date NOT NULL
-);
-
-ALTER TABLE ONLY "public"."dept_emp" ADD CONSTRAINT "dept_emp_pkey" PRIMARY KEY ("emp_no", "dept_no");
-
-CREATE TABLE "public"."dept_manager" (
- "emp_no" integer NOT NULL,
- "dept_no" text NOT NULL,
- "from_date" date NOT NULL,
- "to_date" date NOT NULL
-);
-
-ALTER TABLE ONLY "public"."dept_manager" ADD CONSTRAINT "dept_manager_pkey" PRIMARY KEY ("emp_no", "dept_no");
-
-CREATE SEQUENCE "public"."employee_emp_no_seq"
- AS integer
- START WITH 1
- INCREMENT BY 1
- MINVALUE 1
- MAXVALUE 2147483647
- NO CYCLE;
-
-CREATE TABLE "public"."employee" (
- "emp_no" integer DEFAULT nextval(''public.employee_emp_no_seq''::regclass) NOT NULL,
- "birth_date" date NOT NULL,
- "first_name" text NOT NULL,
- "last_name" text NOT NULL,
- "gender" text NOT NULL,
- "hire_date" date NOT NULL,
- CONSTRAINT "employee_gender_check" CHECK (gender = ANY (ARRAY[''M''::text, ''F''::text]))
-);
-
-ALTER SEQUENCE "public"."employee_emp_no_seq" OWNED BY "public"."employee"."emp_no";
-
-ALTER TABLE ONLY "public"."employee" ADD CONSTRAINT "employee_pkey" PRIMARY KEY ("emp_no");
-
-CREATE INDEX "idx_employee_hire_date" ON ONLY "public"."employee" ("hire_date");
-
-CREATE OR REPLACE FUNCTION public.log_dml_operations()
- RETURNS trigger
- LANGUAGE plpgsql
-AS $function$
-BEGIN
- IF (TG_OP = ''INSERT'') THEN
- INSERT INTO audit (operation, query, user_name)
- VALUES (''INSERT'', current_query(), current_user);
- RETURN NEW;
- ELSIF (TG_OP = ''UPDATE'') THEN
- INSERT INTO audit (operation, query, user_name)
- VALUES (''UPDATE'', current_query(), current_user);
- RETURN NEW;
- ELSIF (TG_OP = ''DELETE'') THEN
- INSERT INTO audit (operation, query, user_name)
- VALUES (''DELETE'', current_query(), current_user);
- RETURN OLD;
- END IF;
- RETURN NULL;
-END;
-$function$
-;
-
-CREATE TABLE "public"."salary" (
- "emp_no" integer NOT NULL,
- "amount" integer NOT NULL,
- "from_date" date NOT NULL,
- "to_date" date NOT NULL
-);
-
-ALTER TABLE ONLY "public"."salary" ADD CONSTRAINT "salary_pkey" PRIMARY KEY ("emp_no", "from_date");
-
-CREATE INDEX "idx_salary_amount" ON ONLY "public"."salary" ("amount");
-
-CREATE TABLE "public"."title" (
- "emp_no" integer NOT NULL,
- "title" text NOT NULL,
- "from_date" date NOT NULL,
- "to_date" date
-);
-
-ALTER TABLE ONLY "public"."title" ADD CONSTRAINT "title_pkey" PRIMARY KEY ("emp_no", "title", "from_date");
-
-CREATE VIEW "public"."dept_emp_latest_date" AS
- SELECT emp_no,
- max(from_date) AS from_date,
- max(to_date) AS to_date
- FROM public.dept_emp
- GROUP BY emp_no;
-
-CREATE VIEW "public"."current_dept_emp" AS
- SELECT l.emp_no,
- d.dept_no,
- l.from_date,
- l.to_date
- FROM (public.dept_emp d
- JOIN public.dept_emp_latest_date l ON (((d.emp_no = l.emp_no) AND (d.from_date = l.from_date) AND (l.to_date = d.to_date))));
-
-CREATE TRIGGER salary_log_trigger AFTER DELETE OR UPDATE ON public.salary FOR EACH ROW EXECUTE FUNCTION public.log_dml_operations();
-
-ALTER TABLE "public"."dept_emp"
- ADD CONSTRAINT "dept_emp_dept_no_fkey" FOREIGN KEY ("dept_no")
- REFERENCES "public"."department" ("dept_no");
-
-ALTER TABLE "public"."dept_emp"
- ADD CONSTRAINT "dept_emp_emp_no_fkey" FOREIGN KEY ("emp_no")
- REFERENCES "public"."employee" ("emp_no");
-
-ALTER TABLE "public"."dept_manager"
- ADD CONSTRAINT "dept_manager_dept_no_fkey" FOREIGN KEY ("dept_no")
- REFERENCES "public"."department" ("dept_no");
-
-ALTER TABLE "public"."dept_manager"
- ADD CONSTRAINT "dept_manager_emp_no_fkey" FOREIGN KEY ("emp_no")
- REFERENCES "public"."employee" ("emp_no");
-
-ALTER TABLE "public"."salary"
- ADD CONSTRAINT "salary_emp_no_fkey" FOREIGN KEY ("emp_no")
- REFERENCES "public"."employee" ("emp_no");
-
-ALTER TABLE "public"."title"
- ADD CONSTRAINT "title_emp_no_fkey" FOREIGN KEY ("emp_no")
- REFERENCES "public"."employee" ("emp_no");
-
-') ON CONFLICT DO NOTHING;
-INSERT INTO public.sync_history (id, created_at, instance, db_name, metadata, raw_dump) VALUES (105, '2025-09-09 03:27:04.924+00', 'prod-sample-instance', 'hr_prod', '{"name":"hr_prod","schemas":[{"name":"bbdataarchive","owner":"bbsample"},{"name":"public","tables":[{"name":"audit","columns":[{"name":"id","position":1,"default":"nextval(''public.audit_id_seq''::regclass)","type":"integer"},{"name":"operation","position":2,"type":"text"},{"name":"query","position":3,"nullable":true,"type":"text"},{"name":"user_name","position":4,"type":"text"},{"name":"changed_at","position":5,"default":"CURRENT_TIMESTAMP","nullable":true,"type":"timestamp(6) with time zone"}],"indexes":[{"name":"audit_pkey","expressions":["id"],"descending":[false],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX audit_pkey ON public.audit USING btree (id);","isConstraint":true,"opclassNames":["int4_ops"],"opclassDefaults":[true]},{"name":"idx_audit_changed_at","expressions":["changed_at"],"descending":[false],"type":"btree","definition":"CREATE INDEX idx_audit_changed_at ON public.audit USING btree (changed_at);","opclassNames":["timestamptz_ops"],"opclassDefaults":[true]},{"name":"idx_audit_operation","expressions":["operation"],"descending":[false],"type":"btree","definition":"CREATE INDEX idx_audit_operation ON public.audit USING btree (operation);","opclassNames":["text_ops"],"opclassDefaults":[true]},{"name":"idx_audit_username","expressions":["user_name"],"descending":[false],"type":"btree","definition":"CREATE INDEX idx_audit_username ON public.audit USING btree (user_name);","opclassNames":["text_ops"],"opclassDefaults":[true]}],"dataSize":"8192","indexSize":"32768","owner":"bbsample"},{"name":"department","columns":[{"name":"dept_no","position":1,"type":"text"},{"name":"dept_name","position":2,"type":"text"}],"indexes":[{"name":"department_dept_name_key","expressions":["dept_name"],"descending":[false],"type":"btree","unique":true,"definition":"CREATE UNIQUE INDEX department_dept_name_key ON public.department USING btree (dept_name);","isConstraint":true,"opclassNames":["text_ops"],"opclassDefaults":[true]},{"name":"department_pkey","expressions":["dept_no"],"descending":[false],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX department_pkey ON public.department USING btree (dept_no);","isConstraint":true,"opclassNames":["text_ops"],"opclassDefaults":[true]}],"dataSize":"16384","indexSize":"32768","owner":"bbsample"},{"name":"dept_emp","columns":[{"name":"emp_no","position":1,"type":"integer"},{"name":"dept_no","position":2,"type":"text"},{"name":"from_date","position":3,"type":"date"},{"name":"to_date","position":4,"type":"date"}],"indexes":[{"name":"dept_emp_pkey","expressions":["emp_no","dept_no"],"descending":[false,false],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX dept_emp_pkey ON public.dept_emp USING btree (emp_no, dept_no);","isConstraint":true,"opclassNames":["int4_ops","text_ops"],"opclassDefaults":[true,true]}],"rowCount":"1103","dataSize":"106496","indexSize":"57344","foreignKeys":[{"name":"dept_emp_dept_no_fkey","columns":["dept_no"],"referencedSchema":"public","referencedTable":"department","referencedColumns":["dept_no"],"onDelete":"CASCADE","onUpdate":"NO ACTION","matchType":"SIMPLE"},{"name":"dept_emp_emp_no_fkey","columns":["emp_no"],"referencedSchema":"public","referencedTable":"employee","referencedColumns":["emp_no"],"onDelete":"CASCADE","onUpdate":"NO ACTION","matchType":"SIMPLE"}],"owner":"bbsample"},{"name":"dept_manager","columns":[{"name":"emp_no","position":1,"type":"integer"},{"name":"dept_no","position":2,"type":"text"},{"name":"from_date","position":3,"type":"date"},{"name":"to_date","position":4,"type":"date"}],"indexes":[{"name":"dept_manager_pkey","expressions":["emp_no","dept_no"],"descending":[false,false],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX dept_manager_pkey ON public.dept_manager USING btree (emp_no, dept_no);","isConstraint":true,"opclassNames":["int4_ops","text_ops"],"opclassDefaults":[true,true]}],"dataSize":"16384","indexSize":"16384","foreignKeys":[{"name":"dept_manager_dept_no_fkey","columns":["dept_no"],"referencedSchema":"public","referencedTable":"department","referencedColumns":["dept_no"],"onDelete":"CASCADE","onUpdate":"NO ACTION","matchType":"SIMPLE"},{"name":"dept_manager_emp_no_fkey","columns":["emp_no"],"referencedSchema":"public","referencedTable":"employee","referencedColumns":["emp_no"],"onDelete":"CASCADE","onUpdate":"NO ACTION","matchType":"SIMPLE"}],"owner":"bbsample"},{"name":"employee","columns":[{"name":"emp_no","position":1,"default":"nextval(''public.employee_emp_no_seq''::regclass)","type":"integer"},{"name":"birth_date","position":2,"type":"date"},{"name":"first_name","position":3,"type":"text"},{"name":"last_name","position":4,"type":"text"},{"name":"gender","position":5,"type":"text"},{"name":"hire_date","position":6,"type":"date"}],"indexes":[{"name":"employee_pkey","expressions":["emp_no"],"descending":[false],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX employee_pkey ON public.employee USING btree (emp_no);","isConstraint":true,"opclassNames":["int4_ops"],"opclassDefaults":[true]},{"name":"idx_employee_hire_date","expressions":["hire_date"],"descending":[false],"type":"btree","definition":"CREATE INDEX idx_employee_hire_date ON public.employee USING btree (hire_date);","opclassNames":["date_ops"],"opclassDefaults":[true]}],"rowCount":"1000","dataSize":"98304","indexSize":"98304","checkConstraints":[{"name":"employee_gender_check","expression":"(gender = ANY (ARRAY[''M''::text, ''F''::text]))"}],"owner":"bbsample"},{"name":"salary","columns":[{"name":"emp_no","position":1,"type":"integer"},{"name":"amount","position":2,"type":"integer"},{"name":"from_date","position":3,"type":"date"},{"name":"to_date","position":4,"type":"date"}],"indexes":[{"name":"idx_salary_amount","expressions":["amount"],"descending":[false],"type":"btree","definition":"CREATE INDEX idx_salary_amount ON public.salary USING btree (amount);","opclassNames":["int4_ops"],"opclassDefaults":[true]},{"name":"salary_pkey","expressions":["emp_no","from_date"],"descending":[false,false],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX salary_pkey ON public.salary USING btree (emp_no, from_date);","isConstraint":true,"opclassNames":["int4_ops","date_ops"],"opclassDefaults":[true,true]}],"rowCount":"9488","dataSize":"458752","indexSize":"548864","foreignKeys":[{"name":"salary_emp_no_fkey","columns":["emp_no"],"referencedSchema":"public","referencedTable":"employee","referencedColumns":["emp_no"],"onDelete":"CASCADE","onUpdate":"NO ACTION","matchType":"SIMPLE"}],"owner":"bbsample","triggers":[{"name":"salary_log_trigger","body":"CREATE TRIGGER salary_log_trigger AFTER DELETE OR UPDATE ON public.salary FOR EACH ROW EXECUTE FUNCTION public.log_dml_operations()"}]},{"name":"title","columns":[{"name":"emp_no","position":1,"type":"integer"},{"name":"title","position":2,"type":"text"},{"name":"from_date","position":3,"type":"date"},{"name":"to_date","position":4,"nullable":true,"type":"date"}],"indexes":[{"name":"title_pkey","expressions":["emp_no","title","from_date"],"descending":[false,false,false],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX title_pkey ON public.title USING btree (emp_no, title, from_date);","isConstraint":true,"opclassNames":["int4_ops","text_ops","date_ops"],"opclassDefaults":[true,true,true]}],"rowCount":"1470","dataSize":"131072","indexSize":"73728","foreignKeys":[{"name":"title_emp_no_fkey","columns":["emp_no"],"referencedSchema":"public","referencedTable":"employee","referencedColumns":["emp_no"],"onDelete":"CASCADE","onUpdate":"NO ACTION","matchType":"SIMPLE"}],"owner":"bbsample"}],"views":[{"name":"current_dept_emp","definition":" SELECT l.emp_no,\n d.dept_no,\n l.from_date,\n l.to_date\n FROM (public.dept_emp d\n JOIN public.dept_emp_latest_date l ON (((d.emp_no = l.emp_no) AND (d.from_date = l.from_date) AND (l.to_date = d.to_date))));","dependencyColumns":[{"schema":"public","table":"dept_emp","column":"dept_no"},{"schema":"public","table":"dept_emp","column":"emp_no"},{"schema":"public","table":"dept_emp","column":"from_date"},{"schema":"public","table":"dept_emp","column":"to_date"},{"schema":"public","table":"dept_emp_latest_date","column":"emp_no"},{"schema":"public","table":"dept_emp_latest_date","column":"from_date"},{"schema":"public","table":"dept_emp_latest_date","column":"to_date"}],"columns":[{"name":"emp_no","position":1,"nullable":true,"type":"integer"},{"name":"dept_no","position":2,"nullable":true,"type":"text"},{"name":"from_date","position":3,"nullable":true,"type":"date"},{"name":"to_date","position":4,"nullable":true,"type":"date"}]},{"name":"dept_emp_latest_date","definition":" SELECT emp_no,\n max(from_date) AS from_date,\n max(to_date) AS to_date\n FROM public.dept_emp\n GROUP BY emp_no;","dependencyColumns":[{"schema":"public","table":"dept_emp","column":"emp_no"},{"schema":"public","table":"dept_emp","column":"from_date"},{"schema":"public","table":"dept_emp","column":"to_date"}],"columns":[{"name":"emp_no","position":1,"nullable":true,"type":"integer"},{"name":"from_date","position":2,"nullable":true,"type":"date"},{"name":"to_date","position":3,"nullable":true,"type":"date"}]}],"functions":[{"name":"log_dml_operations","definition":"CREATE OR REPLACE FUNCTION public.log_dml_operations()\n RETURNS trigger\n LANGUAGE plpgsql\nAS $function$\nBEGIN\n IF (TG_OP = ''INSERT'') THEN\n INSERT INTO audit (operation, query, user_name)\n VALUES (''INSERT'', current_query(), current_user);\n RETURN NEW;\n ELSIF (TG_OP = ''UPDATE'') THEN\n INSERT INTO audit (operation, query, user_name)\n VALUES (''UPDATE'', current_query(), current_user);\n RETURN NEW;\n ELSIF (TG_OP = ''DELETE'') THEN\n INSERT INTO audit (operation, query, user_name)\n VALUES (''DELETE'', current_query(), current_user);\n RETURN OLD;\n END IF;\n RETURN NULL;\nEND;\n$function$\n","signature":"log_dml_operations()"}],"sequences":[{"name":"audit_id_seq","dataType":"integer","start":"1","minValue":"1","maxValue":"2147483647","increment":"1","cacheSize":"1","ownerTable":"audit","ownerColumn":"id"},{"name":"employee_emp_no_seq","dataType":"integer","start":"1","minValue":"1","maxValue":"2147483647","increment":"1","cacheSize":"1","ownerTable":"employee","ownerColumn":"emp_no"}],"owner":"pg_database_owner","comment":"standard public schema"}],"characterSet":"UTF8","collation":"en_US.UTF-8","owner":"bbsample","searchPath":"\"$user\", public"}', '
-SET statement_timeout = 0;
-SET lock_timeout = 0;
-SET idle_in_transaction_session_timeout = 0;
-SET client_encoding = ''UTF8'';
-SET standard_conforming_strings = on;
-SELECT pg_catalog.set_config(''search_path'', '''', false);
-SET check_function_bodies = false;
-SET xmloption = content;
-SET client_min_messages = warning;
-SET row_security = off;
-
-SET default_tablespace = '''';
-
-CREATE SEQUENCE "public"."audit_id_seq"
- AS integer
- START WITH 1
- INCREMENT BY 1
- MINVALUE 1
- MAXVALUE 2147483647
- NO CYCLE;
-
-CREATE TABLE "public"."audit" (
- "id" integer DEFAULT nextval(''public.audit_id_seq''::regclass) NOT NULL,
- "operation" text NOT NULL,
- "query" text,
- "user_name" text NOT NULL,
- "changed_at" timestamp(6) with time zone DEFAULT CURRENT_TIMESTAMP
-);
-
-ALTER SEQUENCE "public"."audit_id_seq" OWNED BY "public"."audit"."id";
-
-ALTER TABLE ONLY "public"."audit" ADD CONSTRAINT "audit_pkey" PRIMARY KEY ("id");
-
-CREATE INDEX "idx_audit_changed_at" ON ONLY "public"."audit" (changed_at);
-
-CREATE INDEX "idx_audit_operation" ON ONLY "public"."audit" (operation);
-
-CREATE INDEX "idx_audit_username" ON ONLY "public"."audit" (user_name);
-
-CREATE TABLE "public"."department" (
- "dept_no" text NOT NULL,
- "dept_name" text NOT NULL
-);
-
-ALTER TABLE ONLY "public"."department" ADD CONSTRAINT "department_pkey" PRIMARY KEY ("dept_no");
-
-ALTER TABLE ONLY "public"."department" ADD CONSTRAINT "department_dept_name_key" UNIQUE ("dept_name");
-
-CREATE TABLE "public"."dept_emp" (
- "emp_no" integer NOT NULL,
- "dept_no" text NOT NULL,
- "from_date" date NOT NULL,
- "to_date" date NOT NULL
-);
-
-ALTER TABLE ONLY "public"."dept_emp" ADD CONSTRAINT "dept_emp_pkey" PRIMARY KEY ("emp_no", "dept_no");
-
-CREATE TABLE "public"."dept_manager" (
- "emp_no" integer NOT NULL,
- "dept_no" text NOT NULL,
- "from_date" date NOT NULL,
- "to_date" date NOT NULL
-);
-
-ALTER TABLE ONLY "public"."dept_manager" ADD CONSTRAINT "dept_manager_pkey" PRIMARY KEY ("emp_no", "dept_no");
-
-CREATE SEQUENCE "public"."employee_emp_no_seq"
- AS integer
- START WITH 1
- INCREMENT BY 1
- MINVALUE 1
- MAXVALUE 2147483647
- NO CYCLE;
-
-CREATE TABLE "public"."employee" (
- "emp_no" integer DEFAULT nextval(''public.employee_emp_no_seq''::regclass) NOT NULL,
- "birth_date" date NOT NULL,
- "first_name" text NOT NULL,
- "last_name" text NOT NULL,
- "gender" text NOT NULL,
- "hire_date" date NOT NULL,
- CONSTRAINT "employee_gender_check" CHECK (gender = ANY (ARRAY[''M''::text, ''F''::text]))
-);
-
-ALTER SEQUENCE "public"."employee_emp_no_seq" OWNED BY "public"."employee"."emp_no";
-
-ALTER TABLE ONLY "public"."employee" ADD CONSTRAINT "employee_pkey" PRIMARY KEY ("emp_no");
-
-CREATE INDEX "idx_employee_hire_date" ON ONLY "public"."employee" (hire_date);
-
-CREATE OR REPLACE FUNCTION public.log_dml_operations()
- RETURNS trigger
- LANGUAGE plpgsql
-AS $function$
-BEGIN
- IF (TG_OP = ''INSERT'') THEN
- INSERT INTO audit (operation, query, user_name)
- VALUES (''INSERT'', current_query(), current_user);
- RETURN NEW;
- ELSIF (TG_OP = ''UPDATE'') THEN
- INSERT INTO audit (operation, query, user_name)
- VALUES (''UPDATE'', current_query(), current_user);
- RETURN NEW;
- ELSIF (TG_OP = ''DELETE'') THEN
- INSERT INTO audit (operation, query, user_name)
- VALUES (''DELETE'', current_query(), current_user);
- RETURN OLD;
- END IF;
- RETURN NULL;
-END;
-$function$
-;
-
-CREATE TABLE "public"."salary" (
- "emp_no" integer NOT NULL,
- "amount" integer NOT NULL,
- "from_date" date NOT NULL,
- "to_date" date NOT NULL
-);
-
-ALTER TABLE ONLY "public"."salary" ADD CONSTRAINT "salary_pkey" PRIMARY KEY ("emp_no", "from_date");
-
-CREATE INDEX "idx_salary_amount" ON ONLY "public"."salary" (amount);
-
-CREATE TABLE "public"."title" (
- "emp_no" integer NOT NULL,
- "title" text NOT NULL,
- "from_date" date NOT NULL,
- "to_date" date
-);
-
-ALTER TABLE ONLY "public"."title" ADD CONSTRAINT "title_pkey" PRIMARY KEY ("emp_no", "title", "from_date");
-
-CREATE VIEW "public"."dept_emp_latest_date" AS
- SELECT emp_no,
- max(from_date) AS from_date,
- max(to_date) AS to_date
- FROM public.dept_emp
- GROUP BY emp_no;
-
-CREATE VIEW "public"."current_dept_emp" AS
- SELECT l.emp_no,
- d.dept_no,
- l.from_date,
- l.to_date
- FROM (public.dept_emp d
- JOIN public.dept_emp_latest_date l ON (((d.emp_no = l.emp_no) AND (d.from_date = l.from_date) AND (l.to_date = d.to_date))));
-
-CREATE TRIGGER salary_log_trigger AFTER DELETE OR UPDATE ON public.salary FOR EACH ROW EXECUTE FUNCTION public.log_dml_operations();
-
-ALTER TABLE "public"."dept_emp"
- ADD CONSTRAINT "dept_emp_dept_no_fkey" FOREIGN KEY ("dept_no")
- REFERENCES "public"."department" ("dept_no")
- ON DELETE CASCADE;
-
-ALTER TABLE "public"."dept_emp"
- ADD CONSTRAINT "dept_emp_emp_no_fkey" FOREIGN KEY ("emp_no")
- REFERENCES "public"."employee" ("emp_no")
- ON DELETE CASCADE;
-
-ALTER TABLE "public"."dept_manager"
- ADD CONSTRAINT "dept_manager_dept_no_fkey" FOREIGN KEY ("dept_no")
- REFERENCES "public"."department" ("dept_no")
- ON DELETE CASCADE;
-
-ALTER TABLE "public"."dept_manager"
- ADD CONSTRAINT "dept_manager_emp_no_fkey" FOREIGN KEY ("emp_no")
- REFERENCES "public"."employee" ("emp_no")
- ON DELETE CASCADE;
-
-ALTER TABLE "public"."salary"
- ADD CONSTRAINT "salary_emp_no_fkey" FOREIGN KEY ("emp_no")
- REFERENCES "public"."employee" ("emp_no")
- ON DELETE CASCADE;
-
-ALTER TABLE "public"."title"
- ADD CONSTRAINT "title_emp_no_fkey" FOREIGN KEY ("emp_no")
- REFERENCES "public"."employee" ("emp_no")
- ON DELETE CASCADE;
-
-') ON CONFLICT DO NOTHING;
-INSERT INTO public.sync_history (id, created_at, instance, db_name, metadata, raw_dump) VALUES (106, '2025-09-09 03:27:11.847779+00', 'test-sample-instance', 'hr_test', '{"name":"hr_test","schemas":[{"name":"bbdataarchive","owner":"bbsample"},{"name":"public","tables":[{"name":"audit","columns":[{"name":"id","position":1,"default":"nextval(''public.audit_id_seq''::regclass)","type":"integer"},{"name":"operation","position":2,"type":"text"},{"name":"query","position":3,"nullable":true,"type":"text"},{"name":"user_name","position":4,"type":"text"},{"name":"changed_at","position":5,"default":"CURRENT_TIMESTAMP","nullable":true,"type":"timestamp(6) with time zone"}],"indexes":[{"name":"audit_pkey","expressions":["id"],"descending":[false],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX audit_pkey ON public.audit USING btree (id);","isConstraint":true,"opclassNames":["int4_ops"],"opclassDefaults":[true]},{"name":"idx_audit_changed_at","expressions":["changed_at"],"descending":[false],"type":"btree","definition":"CREATE INDEX idx_audit_changed_at ON public.audit USING btree (changed_at);","opclassNames":["timestamptz_ops"],"opclassDefaults":[true]},{"name":"idx_audit_operation","expressions":["operation"],"descending":[false],"type":"btree","definition":"CREATE INDEX idx_audit_operation ON public.audit USING btree (operation);","opclassNames":["text_ops"],"opclassDefaults":[true]},{"name":"idx_audit_username","expressions":["user_name"],"descending":[false],"type":"btree","definition":"CREATE INDEX idx_audit_username ON public.audit USING btree (user_name);","opclassNames":["text_ops"],"opclassDefaults":[true]}],"dataSize":"8192","indexSize":"32768","owner":"bbsample"},{"name":"department","columns":[{"name":"dept_no","position":1,"type":"text"},{"name":"dept_name","position":2,"type":"text"}],"indexes":[{"name":"department_dept_name_key","expressions":["dept_name"],"descending":[false],"type":"btree","unique":true,"definition":"CREATE UNIQUE INDEX department_dept_name_key ON public.department USING btree (dept_name);","isConstraint":true,"opclassNames":["text_ops"],"opclassDefaults":[true]},{"name":"department_pkey","expressions":["dept_no"],"descending":[false],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX department_pkey ON public.department USING btree (dept_no);","isConstraint":true,"opclassNames":["text_ops"],"opclassDefaults":[true]}],"dataSize":"16384","indexSize":"32768","owner":"bbsample"},{"name":"dept_emp","columns":[{"name":"emp_no","position":1,"type":"integer"},{"name":"dept_no","position":2,"type":"text"},{"name":"from_date","position":3,"type":"date"},{"name":"to_date","position":4,"type":"date"}],"indexes":[{"name":"dept_emp_pkey","expressions":["emp_no","dept_no"],"descending":[false,false],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX dept_emp_pkey ON public.dept_emp USING btree (emp_no, dept_no);","isConstraint":true,"opclassNames":["int4_ops","text_ops"],"opclassDefaults":[true,true]}],"rowCount":"1103","dataSize":"106496","indexSize":"57344","foreignKeys":[{"name":"dept_emp_dept_no_fkey","columns":["dept_no"],"referencedSchema":"public","referencedTable":"department","referencedColumns":["dept_no"],"onDelete":"CASCADE","onUpdate":"NO ACTION","matchType":"SIMPLE"},{"name":"dept_emp_emp_no_fkey","columns":["emp_no"],"referencedSchema":"public","referencedTable":"employee","referencedColumns":["emp_no"],"onDelete":"CASCADE","onUpdate":"NO ACTION","matchType":"SIMPLE"}],"owner":"bbsample"},{"name":"dept_manager","columns":[{"name":"emp_no","position":1,"type":"integer"},{"name":"dept_no","position":2,"type":"text"},{"name":"from_date","position":3,"type":"date"},{"name":"to_date","position":4,"type":"date"}],"indexes":[{"name":"dept_manager_pkey","expressions":["emp_no","dept_no"],"descending":[false,false],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX dept_manager_pkey ON public.dept_manager USING btree (emp_no, dept_no);","isConstraint":true,"opclassNames":["int4_ops","text_ops"],"opclassDefaults":[true,true]}],"dataSize":"16384","indexSize":"16384","foreignKeys":[{"name":"dept_manager_dept_no_fkey","columns":["dept_no"],"referencedSchema":"public","referencedTable":"department","referencedColumns":["dept_no"],"onDelete":"CASCADE","onUpdate":"NO ACTION","matchType":"SIMPLE"},{"name":"dept_manager_emp_no_fkey","columns":["emp_no"],"referencedSchema":"public","referencedTable":"employee","referencedColumns":["emp_no"],"onDelete":"CASCADE","onUpdate":"NO ACTION","matchType":"SIMPLE"}],"owner":"bbsample"},{"name":"employee","columns":[{"name":"emp_no","position":1,"default":"nextval(''public.employee_emp_no_seq''::regclass)","type":"integer"},{"name":"birth_date","position":2,"type":"date"},{"name":"first_name","position":3,"type":"text"},{"name":"last_name","position":4,"type":"text"},{"name":"gender","position":5,"type":"text"},{"name":"hire_date","position":6,"type":"date"}],"indexes":[{"name":"employee_pkey","expressions":["emp_no"],"descending":[false],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX employee_pkey ON public.employee USING btree (emp_no);","isConstraint":true,"opclassNames":["int4_ops"],"opclassDefaults":[true]},{"name":"idx_employee_hire_date","expressions":["hire_date"],"descending":[false],"type":"btree","definition":"CREATE INDEX idx_employee_hire_date ON public.employee USING btree (hire_date);","opclassNames":["date_ops"],"opclassDefaults":[true]}],"rowCount":"1000","dataSize":"98304","indexSize":"98304","checkConstraints":[{"name":"employee_gender_check","expression":"(gender = ANY (ARRAY[''M''::text, ''F''::text]))"}],"owner":"bbsample"},{"name":"salary","columns":[{"name":"emp_no","position":1,"type":"integer"},{"name":"amount","position":2,"type":"integer"},{"name":"from_date","position":3,"type":"date"},{"name":"to_date","position":4,"type":"date"}],"indexes":[{"name":"idx_salary_amount","expressions":["amount"],"descending":[false],"type":"btree","definition":"CREATE INDEX idx_salary_amount ON public.salary USING btree (amount);","opclassNames":["int4_ops"],"opclassDefaults":[true]},{"name":"salary_pkey","expressions":["emp_no","from_date"],"descending":[false,false],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX salary_pkey ON public.salary USING btree (emp_no, from_date);","isConstraint":true,"opclassNames":["int4_ops","date_ops"],"opclassDefaults":[true,true]}],"rowCount":"9488","dataSize":"458752","indexSize":"548864","foreignKeys":[{"name":"salary_emp_no_fkey","columns":["emp_no"],"referencedSchema":"public","referencedTable":"employee","referencedColumns":["emp_no"],"onDelete":"CASCADE","onUpdate":"NO ACTION","matchType":"SIMPLE"}],"owner":"bbsample","triggers":[{"name":"salary_log_trigger","body":"CREATE TRIGGER salary_log_trigger AFTER DELETE OR UPDATE ON public.salary FOR EACH ROW EXECUTE FUNCTION public.log_dml_operations()"}]},{"name":"title","columns":[{"name":"emp_no","position":1,"type":"integer"},{"name":"title","position":2,"type":"text"},{"name":"from_date","position":3,"type":"date"},{"name":"to_date","position":4,"nullable":true,"type":"date"}],"indexes":[{"name":"title_pkey","expressions":["emp_no","title","from_date"],"descending":[false,false,false],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX title_pkey ON public.title USING btree (emp_no, title, from_date);","isConstraint":true,"opclassNames":["int4_ops","text_ops","date_ops"],"opclassDefaults":[true,true,true]}],"rowCount":"1470","dataSize":"131072","indexSize":"73728","foreignKeys":[{"name":"title_emp_no_fkey","columns":["emp_no"],"referencedSchema":"public","referencedTable":"employee","referencedColumns":["emp_no"],"onDelete":"CASCADE","onUpdate":"NO ACTION","matchType":"SIMPLE"}],"owner":"bbsample"}],"views":[{"name":"current_dept_emp","definition":" SELECT l.emp_no,\n d.dept_no,\n l.from_date,\n l.to_date\n FROM (public.dept_emp d\n JOIN public.dept_emp_latest_date l ON (((d.emp_no = l.emp_no) AND (d.from_date = l.from_date) AND (l.to_date = d.to_date))));","dependencyColumns":[{"schema":"public","table":"dept_emp","column":"dept_no"},{"schema":"public","table":"dept_emp","column":"emp_no"},{"schema":"public","table":"dept_emp","column":"from_date"},{"schema":"public","table":"dept_emp","column":"to_date"},{"schema":"public","table":"dept_emp_latest_date","column":"emp_no"},{"schema":"public","table":"dept_emp_latest_date","column":"from_date"},{"schema":"public","table":"dept_emp_latest_date","column":"to_date"}],"columns":[{"name":"emp_no","position":1,"nullable":true,"type":"integer"},{"name":"dept_no","position":2,"nullable":true,"type":"text"},{"name":"from_date","position":3,"nullable":true,"type":"date"},{"name":"to_date","position":4,"nullable":true,"type":"date"}]},{"name":"dept_emp_latest_date","definition":" SELECT emp_no,\n max(from_date) AS from_date,\n max(to_date) AS to_date\n FROM public.dept_emp\n GROUP BY emp_no;","dependencyColumns":[{"schema":"public","table":"dept_emp","column":"emp_no"},{"schema":"public","table":"dept_emp","column":"from_date"},{"schema":"public","table":"dept_emp","column":"to_date"}],"columns":[{"name":"emp_no","position":1,"nullable":true,"type":"integer"},{"name":"from_date","position":2,"nullable":true,"type":"date"},{"name":"to_date","position":3,"nullable":true,"type":"date"}]}],"functions":[{"name":"log_dml_operations","definition":"CREATE OR REPLACE FUNCTION public.log_dml_operations()\n RETURNS trigger\n LANGUAGE plpgsql\nAS $function$\nBEGIN\n IF (TG_OP = ''INSERT'') THEN\n INSERT INTO audit (operation, query, user_name)\n VALUES (''INSERT'', current_query(), current_user);\n RETURN NEW;\n ELSIF (TG_OP = ''UPDATE'') THEN\n INSERT INTO audit (operation, query, user_name)\n VALUES (''UPDATE'', current_query(), current_user);\n RETURN NEW;\n ELSIF (TG_OP = ''DELETE'') THEN\n INSERT INTO audit (operation, query, user_name)\n VALUES (''DELETE'', current_query(), current_user);\n RETURN OLD;\n END IF;\n RETURN NULL;\nEND;\n$function$\n","signature":"log_dml_operations()"}],"sequences":[{"name":"audit_id_seq","dataType":"integer","start":"1","minValue":"1","maxValue":"2147483647","increment":"1","cacheSize":"1","ownerTable":"audit","ownerColumn":"id"},{"name":"employee_emp_no_seq","dataType":"integer","start":"1","minValue":"1","maxValue":"2147483647","increment":"1","cacheSize":"1","ownerTable":"employee","ownerColumn":"emp_no"}],"owner":"pg_database_owner","comment":"standard public schema"}],"characterSet":"UTF8","collation":"en_US.UTF-8","owner":"bbsample","searchPath":"\"$user\", public"}', '
-SET statement_timeout = 0;
-SET lock_timeout = 0;
-SET idle_in_transaction_session_timeout = 0;
-SET client_encoding = ''UTF8'';
-SET standard_conforming_strings = on;
-SELECT pg_catalog.set_config(''search_path'', '''', false);
-SET check_function_bodies = false;
-SET xmloption = content;
-SET client_min_messages = warning;
-SET row_security = off;
-
-SET default_tablespace = '''';
-
-CREATE SEQUENCE "public"."audit_id_seq"
- AS integer
- START WITH 1
- INCREMENT BY 1
- MINVALUE 1
- MAXVALUE 2147483647
- NO CYCLE;
-
-CREATE TABLE "public"."audit" (
- "id" integer DEFAULT nextval(''public.audit_id_seq''::regclass) NOT NULL,
- "operation" text NOT NULL,
- "query" text,
- "user_name" text NOT NULL,
- "changed_at" timestamp(6) with time zone DEFAULT CURRENT_TIMESTAMP
-);
-
-ALTER SEQUENCE "public"."audit_id_seq" OWNED BY "public"."audit"."id";
-
-ALTER TABLE ONLY "public"."audit" ADD CONSTRAINT "audit_pkey" PRIMARY KEY ("id");
-
-CREATE INDEX "idx_audit_changed_at" ON ONLY "public"."audit" (changed_at);
-
-CREATE INDEX "idx_audit_operation" ON ONLY "public"."audit" (operation);
-
-CREATE INDEX "idx_audit_username" ON ONLY "public"."audit" (user_name);
-
-CREATE TABLE "public"."department" (
- "dept_no" text NOT NULL,
- "dept_name" text NOT NULL
-);
-
-ALTER TABLE ONLY "public"."department" ADD CONSTRAINT "department_pkey" PRIMARY KEY ("dept_no");
-
-ALTER TABLE ONLY "public"."department" ADD CONSTRAINT "department_dept_name_key" UNIQUE ("dept_name");
-
-CREATE TABLE "public"."dept_emp" (
- "emp_no" integer NOT NULL,
- "dept_no" text NOT NULL,
- "from_date" date NOT NULL,
- "to_date" date NOT NULL
-);
-
-ALTER TABLE ONLY "public"."dept_emp" ADD CONSTRAINT "dept_emp_pkey" PRIMARY KEY ("emp_no", "dept_no");
-
-CREATE TABLE "public"."dept_manager" (
- "emp_no" integer NOT NULL,
- "dept_no" text NOT NULL,
- "from_date" date NOT NULL,
- "to_date" date NOT NULL
-);
-
-ALTER TABLE ONLY "public"."dept_manager" ADD CONSTRAINT "dept_manager_pkey" PRIMARY KEY ("emp_no", "dept_no");
-
-CREATE SEQUENCE "public"."employee_emp_no_seq"
- AS integer
- START WITH 1
- INCREMENT BY 1
- MINVALUE 1
- MAXVALUE 2147483647
- NO CYCLE;
-
-CREATE TABLE "public"."employee" (
- "emp_no" integer DEFAULT nextval(''public.employee_emp_no_seq''::regclass) NOT NULL,
- "birth_date" date NOT NULL,
- "first_name" text NOT NULL,
- "last_name" text NOT NULL,
- "gender" text NOT NULL,
- "hire_date" date NOT NULL,
- CONSTRAINT "employee_gender_check" CHECK (gender = ANY (ARRAY[''M''::text, ''F''::text]))
-);
-
-ALTER SEQUENCE "public"."employee_emp_no_seq" OWNED BY "public"."employee"."emp_no";
-
-ALTER TABLE ONLY "public"."employee" ADD CONSTRAINT "employee_pkey" PRIMARY KEY ("emp_no");
-
-CREATE INDEX "idx_employee_hire_date" ON ONLY "public"."employee" (hire_date);
-
-CREATE OR REPLACE FUNCTION public.log_dml_operations()
- RETURNS trigger
- LANGUAGE plpgsql
-AS $function$
-BEGIN
- IF (TG_OP = ''INSERT'') THEN
- INSERT INTO audit (operation, query, user_name)
- VALUES (''INSERT'', current_query(), current_user);
- RETURN NEW;
- ELSIF (TG_OP = ''UPDATE'') THEN
- INSERT INTO audit (operation, query, user_name)
- VALUES (''UPDATE'', current_query(), current_user);
- RETURN NEW;
- ELSIF (TG_OP = ''DELETE'') THEN
- INSERT INTO audit (operation, query, user_name)
- VALUES (''DELETE'', current_query(), current_user);
- RETURN OLD;
- END IF;
- RETURN NULL;
-END;
-$function$
-;
-
-CREATE TABLE "public"."salary" (
- "emp_no" integer NOT NULL,
- "amount" integer NOT NULL,
- "from_date" date NOT NULL,
- "to_date" date NOT NULL
-);
-
-ALTER TABLE ONLY "public"."salary" ADD CONSTRAINT "salary_pkey" PRIMARY KEY ("emp_no", "from_date");
-
-CREATE INDEX "idx_salary_amount" ON ONLY "public"."salary" (amount);
-
-CREATE TABLE "public"."title" (
- "emp_no" integer NOT NULL,
- "title" text NOT NULL,
- "from_date" date NOT NULL,
- "to_date" date
-);
-
-ALTER TABLE ONLY "public"."title" ADD CONSTRAINT "title_pkey" PRIMARY KEY ("emp_no", "title", "from_date");
-
-CREATE VIEW "public"."dept_emp_latest_date" AS
- SELECT emp_no,
- max(from_date) AS from_date,
- max(to_date) AS to_date
- FROM public.dept_emp
- GROUP BY emp_no;
-
-CREATE VIEW "public"."current_dept_emp" AS
- SELECT l.emp_no,
- d.dept_no,
- l.from_date,
- l.to_date
- FROM (public.dept_emp d
- JOIN public.dept_emp_latest_date l ON (((d.emp_no = l.emp_no) AND (d.from_date = l.from_date) AND (l.to_date = d.to_date))));
-
-CREATE TRIGGER salary_log_trigger AFTER DELETE OR UPDATE ON public.salary FOR EACH ROW EXECUTE FUNCTION public.log_dml_operations();
-
-ALTER TABLE "public"."dept_emp"
- ADD CONSTRAINT "dept_emp_dept_no_fkey" FOREIGN KEY ("dept_no")
- REFERENCES "public"."department" ("dept_no")
- ON DELETE CASCADE;
-
-ALTER TABLE "public"."dept_emp"
- ADD CONSTRAINT "dept_emp_emp_no_fkey" FOREIGN KEY ("emp_no")
- REFERENCES "public"."employee" ("emp_no")
- ON DELETE CASCADE;
-
-ALTER TABLE "public"."dept_manager"
- ADD CONSTRAINT "dept_manager_dept_no_fkey" FOREIGN KEY ("dept_no")
- REFERENCES "public"."department" ("dept_no")
- ON DELETE CASCADE;
-
-ALTER TABLE "public"."dept_manager"
- ADD CONSTRAINT "dept_manager_emp_no_fkey" FOREIGN KEY ("emp_no")
- REFERENCES "public"."employee" ("emp_no")
- ON DELETE CASCADE;
-
-ALTER TABLE "public"."salary"
- ADD CONSTRAINT "salary_emp_no_fkey" FOREIGN KEY ("emp_no")
- REFERENCES "public"."employee" ("emp_no")
- ON DELETE CASCADE;
-
-ALTER TABLE "public"."title"
- ADD CONSTRAINT "title_emp_no_fkey" FOREIGN KEY ("emp_no")
- REFERENCES "public"."employee" ("emp_no")
- ON DELETE CASCADE;
-
-') ON CONFLICT DO NOTHING;
-INSERT INTO public.sync_history (id, created_at, instance, db_name, metadata, raw_dump) VALUES (107, '2025-10-10 07:15:40.833999+00', 'prod-sample-instance', 'hr_prod', '{"name":"hr_prod","schemas":[{"name":"bbdataarchive","owner":"bbsample"},{"name":"public","tables":[{"name":"audit","columns":[{"name":"id","position":1,"default":"nextval(''public.audit_id_seq''::regclass)","type":"integer"},{"name":"operation","position":2,"type":"text"},{"name":"query","position":3,"nullable":true,"type":"text"},{"name":"user_name","position":4,"type":"text"},{"name":"changed_at","position":5,"default":"CURRENT_TIMESTAMP","nullable":true,"type":"timestamp(6) with time zone"}],"indexes":[{"name":"audit_pkey","expressions":["id"],"descending":[false],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX audit_pkey ON public.audit USING btree (id);","isConstraint":true,"opclassNames":["int4_ops"],"opclassDefaults":[true]},{"name":"idx_audit_changed_at","expressions":["changed_at"],"descending":[false],"type":"btree","definition":"CREATE INDEX idx_audit_changed_at ON public.audit USING btree (changed_at);","opclassNames":["timestamptz_ops"],"opclassDefaults":[true]},{"name":"idx_audit_operation","expressions":["operation"],"descending":[false],"type":"btree","definition":"CREATE INDEX idx_audit_operation ON public.audit USING btree (operation);","opclassNames":["text_ops"],"opclassDefaults":[true]},{"name":"idx_audit_username","expressions":["user_name"],"descending":[false],"type":"btree","definition":"CREATE INDEX idx_audit_username ON public.audit USING btree (user_name);","opclassNames":["text_ops"],"opclassDefaults":[true]}],"dataSize":"8192","indexSize":"32768","owner":"bbsample"},{"name":"department","columns":[{"name":"dept_no","position":1,"type":"text"},{"name":"dept_name","position":2,"type":"text"}],"indexes":[{"name":"department_dept_name_key","expressions":["dept_name"],"descending":[false],"type":"btree","unique":true,"definition":"CREATE UNIQUE INDEX department_dept_name_key ON public.department USING btree (dept_name);","isConstraint":true,"opclassNames":["text_ops"],"opclassDefaults":[true]},{"name":"department_pkey","expressions":["dept_no"],"descending":[false],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX department_pkey ON public.department USING btree (dept_no);","isConstraint":true,"opclassNames":["text_ops"],"opclassDefaults":[true]}],"dataSize":"16384","indexSize":"32768","owner":"bbsample"},{"name":"dept_emp","columns":[{"name":"emp_no","position":1,"type":"integer"},{"name":"dept_no","position":2,"type":"text"},{"name":"from_date","position":3,"type":"date"},{"name":"to_date","position":4,"type":"date"}],"indexes":[{"name":"dept_emp_pkey","expressions":["emp_no","dept_no"],"descending":[false,false],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX dept_emp_pkey ON public.dept_emp USING btree (emp_no, dept_no);","isConstraint":true,"opclassNames":["int4_ops","text_ops"],"opclassDefaults":[true,true]}],"rowCount":"1103","dataSize":"106496","indexSize":"57344","foreignKeys":[{"name":"dept_emp_dept_no_fkey","columns":["dept_no"],"referencedSchema":"public","referencedTable":"department","referencedColumns":["dept_no"],"onDelete":"CASCADE","onUpdate":"NO ACTION","matchType":"SIMPLE"},{"name":"dept_emp_emp_no_fkey","columns":["emp_no"],"referencedSchema":"public","referencedTable":"employee","referencedColumns":["emp_no"],"onDelete":"CASCADE","onUpdate":"NO ACTION","matchType":"SIMPLE"}],"owner":"bbsample"},{"name":"dept_manager","columns":[{"name":"emp_no","position":1,"type":"integer"},{"name":"dept_no","position":2,"type":"text"},{"name":"from_date","position":3,"type":"date"},{"name":"to_date","position":4,"type":"date"}],"indexes":[{"name":"dept_manager_pkey","expressions":["emp_no","dept_no"],"descending":[false,false],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX dept_manager_pkey ON public.dept_manager USING btree (emp_no, dept_no);","isConstraint":true,"opclassNames":["int4_ops","text_ops"],"opclassDefaults":[true,true]}],"dataSize":"16384","indexSize":"16384","foreignKeys":[{"name":"dept_manager_dept_no_fkey","columns":["dept_no"],"referencedSchema":"public","referencedTable":"department","referencedColumns":["dept_no"],"onDelete":"CASCADE","onUpdate":"NO ACTION","matchType":"SIMPLE"},{"name":"dept_manager_emp_no_fkey","columns":["emp_no"],"referencedSchema":"public","referencedTable":"employee","referencedColumns":["emp_no"],"onDelete":"CASCADE","onUpdate":"NO ACTION","matchType":"SIMPLE"}],"owner":"bbsample"},{"name":"employee","columns":[{"name":"emp_no","position":1,"default":"nextval(''public.employee_emp_no_seq''::regclass)","type":"integer"},{"name":"birth_date","position":2,"type":"date"},{"name":"first_name","position":3,"type":"text"},{"name":"last_name","position":4,"type":"text"},{"name":"gender","position":5,"type":"text"},{"name":"hire_date","position":6,"type":"date"}],"indexes":[{"name":"employee_pkey","expressions":["emp_no"],"descending":[false],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX employee_pkey ON public.employee USING btree (emp_no);","isConstraint":true,"opclassNames":["int4_ops"],"opclassDefaults":[true]},{"name":"idx_employee_hire_date","expressions":["hire_date"],"descending":[false],"type":"btree","definition":"CREATE INDEX idx_employee_hire_date ON public.employee USING btree (hire_date);","opclassNames":["date_ops"],"opclassDefaults":[true]}],"rowCount":"1000","dataSize":"98304","indexSize":"98304","checkConstraints":[{"name":"employee_gender_check","expression":"(gender = ANY (ARRAY[''M''::text, ''F''::text]))"}],"owner":"bbsample"},{"name":"salary","columns":[{"name":"emp_no","position":1,"type":"integer"},{"name":"amount","position":2,"type":"integer"},{"name":"from_date","position":3,"type":"date"},{"name":"to_date","position":4,"type":"date"}],"indexes":[{"name":"idx_salary_amount","expressions":["amount"],"descending":[false],"type":"btree","definition":"CREATE INDEX idx_salary_amount ON public.salary USING btree (amount);","opclassNames":["int4_ops"],"opclassDefaults":[true]},{"name":"salary_pkey","expressions":["emp_no","from_date"],"descending":[false,false],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX salary_pkey ON public.salary USING btree (emp_no, from_date);","isConstraint":true,"opclassNames":["int4_ops","date_ops"],"opclassDefaults":[true,true]}],"rowCount":"9488","dataSize":"458752","indexSize":"548864","foreignKeys":[{"name":"salary_emp_no_fkey","columns":["emp_no"],"referencedSchema":"public","referencedTable":"employee","referencedColumns":["emp_no"],"onDelete":"CASCADE","onUpdate":"NO ACTION","matchType":"SIMPLE"}],"owner":"bbsample","triggers":[{"name":"salary_log_trigger","body":"CREATE TRIGGER salary_log_trigger AFTER DELETE OR UPDATE ON public.salary FOR EACH ROW EXECUTE FUNCTION public.log_dml_operations()"}]},{"name":"title","columns":[{"name":"emp_no","position":1,"type":"integer"},{"name":"title","position":2,"type":"text"},{"name":"from_date","position":3,"type":"date"},{"name":"to_date","position":4,"nullable":true,"type":"date"}],"indexes":[{"name":"title_pkey","expressions":["emp_no","title","from_date"],"descending":[false,false,false],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX title_pkey ON public.title USING btree (emp_no, title, from_date);","isConstraint":true,"opclassNames":["int4_ops","text_ops","date_ops"],"opclassDefaults":[true,true,true]}],"rowCount":"1470","dataSize":"131072","indexSize":"73728","foreignKeys":[{"name":"title_emp_no_fkey","columns":["emp_no"],"referencedSchema":"public","referencedTable":"employee","referencedColumns":["emp_no"],"onDelete":"CASCADE","onUpdate":"NO ACTION","matchType":"SIMPLE"}],"owner":"bbsample"}],"views":[{"name":"current_dept_emp","definition":" SELECT l.emp_no,\n d.dept_no,\n l.from_date,\n l.to_date\n FROM (public.dept_emp d\n JOIN public.dept_emp_latest_date l ON (((d.emp_no = l.emp_no) AND (d.from_date = l.from_date) AND (l.to_date = d.to_date))));","dependencyColumns":[{"schema":"public","table":"dept_emp","column":"dept_no"},{"schema":"public","table":"dept_emp","column":"emp_no"},{"schema":"public","table":"dept_emp","column":"from_date"},{"schema":"public","table":"dept_emp","column":"to_date"},{"schema":"public","table":"dept_emp_latest_date","column":"emp_no"},{"schema":"public","table":"dept_emp_latest_date","column":"from_date"},{"schema":"public","table":"dept_emp_latest_date","column":"to_date"}],"columns":[{"name":"emp_no","position":1,"nullable":true,"type":"integer"},{"name":"dept_no","position":2,"nullable":true,"type":"text"},{"name":"from_date","position":3,"nullable":true,"type":"date"},{"name":"to_date","position":4,"nullable":true,"type":"date"}]},{"name":"dept_emp_latest_date","definition":" SELECT emp_no,\n max(from_date) AS from_date,\n max(to_date) AS to_date\n FROM public.dept_emp\n GROUP BY emp_no;","dependencyColumns":[{"schema":"public","table":"dept_emp","column":"emp_no"},{"schema":"public","table":"dept_emp","column":"from_date"},{"schema":"public","table":"dept_emp","column":"to_date"}],"columns":[{"name":"emp_no","position":1,"nullable":true,"type":"integer"},{"name":"from_date","position":2,"nullable":true,"type":"date"},{"name":"to_date","position":3,"nullable":true,"type":"date"}]}],"functions":[{"name":"log_dml_operations","definition":"CREATE OR REPLACE FUNCTION public.log_dml_operations()\n RETURNS trigger\n LANGUAGE plpgsql\nAS $function$\nBEGIN\n IF (TG_OP = ''INSERT'') THEN\n INSERT INTO audit (operation, query, user_name)\n VALUES (''INSERT'', current_query(), current_user);\n RETURN NEW;\n ELSIF (TG_OP = ''UPDATE'') THEN\n INSERT INTO audit (operation, query, user_name)\n VALUES (''UPDATE'', current_query(), current_user);\n RETURN NEW;\n ELSIF (TG_OP = ''DELETE'') THEN\n INSERT INTO audit (operation, query, user_name)\n VALUES (''DELETE'', current_query(), current_user);\n RETURN OLD;\n END IF;\n RETURN NULL;\nEND;\n$function$\n","signature":"log_dml_operations()"}],"sequences":[{"name":"audit_id_seq","dataType":"integer","start":"1","minValue":"1","maxValue":"2147483647","increment":"1","cacheSize":"1","ownerTable":"audit","ownerColumn":"id"},{"name":"employee_emp_no_seq","dataType":"integer","start":"1","minValue":"1","maxValue":"2147483647","increment":"1","cacheSize":"1","ownerTable":"employee","ownerColumn":"emp_no"}],"owner":"pg_database_owner","comment":"standard public schema"}],"characterSet":"UTF8","collation":"en_US.UTF-8","owner":"bbsample","searchPath":"\"$user\", public"}', '
-SET statement_timeout = 0;
-SET lock_timeout = 0;
-SET idle_in_transaction_session_timeout = 0;
-SET client_encoding = ''UTF8'';
-SET standard_conforming_strings = on;
-SELECT pg_catalog.set_config(''search_path'', '''', false);
-SET check_function_bodies = false;
-SET xmloption = content;
-SET client_min_messages = warning;
-SET row_security = off;
-
-CREATE SEQUENCE "public"."audit_id_seq"
- AS integer
- START WITH 1
- INCREMENT BY 1
- MINVALUE 1
- MAXVALUE 2147483647
- NO CYCLE;
-
-CREATE SEQUENCE "public"."employee_emp_no_seq"
- AS integer
- START WITH 1
- INCREMENT BY 1
- MINVALUE 1
- MAXVALUE 2147483647
- NO CYCLE;
-
-SET default_tablespace = '''';
-
-CREATE TABLE "public"."audit" (
- "id" integer DEFAULT nextval(''public.audit_id_seq''::regclass) NOT NULL,
- "operation" text NOT NULL,
- "query" text,
- "user_name" text NOT NULL,
- "changed_at" timestamp(6) with time zone DEFAULT CURRENT_TIMESTAMP
-);
-
-ALTER SEQUENCE "public"."audit_id_seq" OWNED BY "public"."audit"."id";
-
-ALTER TABLE ONLY "public"."audit" ADD CONSTRAINT "audit_pkey" PRIMARY KEY (id);
-
-CREATE INDEX "idx_audit_changed_at" ON ONLY "public"."audit" (changed_at);
-
-CREATE INDEX "idx_audit_operation" ON ONLY "public"."audit" (operation);
-
-CREATE INDEX "idx_audit_username" ON ONLY "public"."audit" (user_name);
-
-CREATE TABLE "public"."department" (
- "dept_no" text NOT NULL,
- "dept_name" text NOT NULL
-);
-
-ALTER TABLE ONLY "public"."department" ADD CONSTRAINT "department_pkey" PRIMARY KEY (dept_no);
-
-ALTER TABLE ONLY "public"."department" ADD CONSTRAINT "department_dept_name_key" UNIQUE (dept_name);
-
-CREATE TABLE "public"."dept_emp" (
- "emp_no" integer NOT NULL,
- "dept_no" text NOT NULL,
- "from_date" date NOT NULL,
- "to_date" date NOT NULL
-);
-
-ALTER TABLE ONLY "public"."dept_emp" ADD CONSTRAINT "dept_emp_pkey" PRIMARY KEY (emp_no, dept_no);
-
-CREATE TABLE "public"."dept_manager" (
- "emp_no" integer NOT NULL,
- "dept_no" text NOT NULL,
- "from_date" date NOT NULL,
- "to_date" date NOT NULL
-);
-
-ALTER TABLE ONLY "public"."dept_manager" ADD CONSTRAINT "dept_manager_pkey" PRIMARY KEY (emp_no, dept_no);
-
-CREATE TABLE "public"."employee" (
- "emp_no" integer DEFAULT nextval(''public.employee_emp_no_seq''::regclass) NOT NULL,
- "birth_date" date NOT NULL,
- "first_name" text NOT NULL,
- "last_name" text NOT NULL,
- "gender" text NOT NULL,
- "hire_date" date NOT NULL,
- CONSTRAINT "employee_gender_check" CHECK (gender = ANY (ARRAY[''M''::text, ''F''::text]))
-);
-
-ALTER SEQUENCE "public"."employee_emp_no_seq" OWNED BY "public"."employee"."emp_no";
-
-ALTER TABLE ONLY "public"."employee" ADD CONSTRAINT "employee_pkey" PRIMARY KEY (emp_no);
-
-CREATE INDEX "idx_employee_hire_date" ON ONLY "public"."employee" (hire_date);
-
-CREATE OR REPLACE FUNCTION public.log_dml_operations()
- RETURNS trigger
- LANGUAGE plpgsql
-AS $function$
-BEGIN
- IF (TG_OP = ''INSERT'') THEN
- INSERT INTO audit (operation, query, user_name)
- VALUES (''INSERT'', current_query(), current_user);
- RETURN NEW;
- ELSIF (TG_OP = ''UPDATE'') THEN
- INSERT INTO audit (operation, query, user_name)
- VALUES (''UPDATE'', current_query(), current_user);
- RETURN NEW;
- ELSIF (TG_OP = ''DELETE'') THEN
- INSERT INTO audit (operation, query, user_name)
- VALUES (''DELETE'', current_query(), current_user);
- RETURN OLD;
- END IF;
- RETURN NULL;
-END;
-$function$
-;
-
-CREATE TABLE "public"."salary" (
- "emp_no" integer NOT NULL,
- "amount" integer NOT NULL,
- "from_date" date NOT NULL,
- "to_date" date NOT NULL
-);
-
-ALTER TABLE ONLY "public"."salary" ADD CONSTRAINT "salary_pkey" PRIMARY KEY (emp_no, from_date);
-
-CREATE INDEX "idx_salary_amount" ON ONLY "public"."salary" (amount);
-
-CREATE TABLE "public"."title" (
- "emp_no" integer NOT NULL,
- "title" text NOT NULL,
- "from_date" date NOT NULL,
- "to_date" date
-);
-
-ALTER TABLE ONLY "public"."title" ADD CONSTRAINT "title_pkey" PRIMARY KEY (emp_no, title, from_date);
-
-CREATE VIEW "public"."dept_emp_latest_date" AS
- SELECT emp_no,
- max(from_date) AS from_date,
- max(to_date) AS to_date
- FROM public.dept_emp
- GROUP BY emp_no;
-
-CREATE VIEW "public"."current_dept_emp" AS
- SELECT l.emp_no,
- d.dept_no,
- l.from_date,
- l.to_date
- FROM (public.dept_emp d
- JOIN public.dept_emp_latest_date l ON (((d.emp_no = l.emp_no) AND (d.from_date = l.from_date) AND (l.to_date = d.to_date))));
-
-CREATE TRIGGER salary_log_trigger AFTER DELETE OR UPDATE ON public.salary FOR EACH ROW EXECUTE FUNCTION public.log_dml_operations();
-
-ALTER TABLE "public"."dept_emp"
- ADD CONSTRAINT "dept_emp_dept_no_fkey" FOREIGN KEY ("dept_no")
- REFERENCES "public"."department" ("dept_no")
- ON DELETE CASCADE;
-
-ALTER TABLE "public"."dept_emp"
- ADD CONSTRAINT "dept_emp_emp_no_fkey" FOREIGN KEY ("emp_no")
- REFERENCES "public"."employee" ("emp_no")
- ON DELETE CASCADE;
-
-ALTER TABLE "public"."dept_manager"
- ADD CONSTRAINT "dept_manager_dept_no_fkey" FOREIGN KEY ("dept_no")
- REFERENCES "public"."department" ("dept_no")
- ON DELETE CASCADE;
-
-ALTER TABLE "public"."dept_manager"
- ADD CONSTRAINT "dept_manager_emp_no_fkey" FOREIGN KEY ("emp_no")
- REFERENCES "public"."employee" ("emp_no")
- ON DELETE CASCADE;
-
-ALTER TABLE "public"."salary"
- ADD CONSTRAINT "salary_emp_no_fkey" FOREIGN KEY ("emp_no")
- REFERENCES "public"."employee" ("emp_no")
- ON DELETE CASCADE;
-
-ALTER TABLE "public"."title"
- ADD CONSTRAINT "title_emp_no_fkey" FOREIGN KEY ("emp_no")
- REFERENCES "public"."employee" ("emp_no")
- ON DELETE CASCADE;
-
-') ON CONFLICT DO NOTHING;
-INSERT INTO public.sync_history (id, created_at, instance, db_name, metadata, raw_dump) VALUES (108, '2025-10-10 07:15:45.141539+00', 'test-sample-instance', 'hr_test', '{"name":"hr_test","schemas":[{"name":"bbdataarchive","owner":"bbsample"},{"name":"public","tables":[{"name":"audit","columns":[{"name":"id","position":1,"default":"nextval(''public.audit_id_seq''::regclass)","type":"integer"},{"name":"operation","position":2,"type":"text"},{"name":"query","position":3,"nullable":true,"type":"text"},{"name":"user_name","position":4,"type":"text"},{"name":"changed_at","position":5,"default":"CURRENT_TIMESTAMP","nullable":true,"type":"timestamp(6) with time zone"}],"indexes":[{"name":"audit_pkey","expressions":["id"],"descending":[false],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX audit_pkey ON public.audit USING btree (id);","isConstraint":true,"opclassNames":["int4_ops"],"opclassDefaults":[true]},{"name":"idx_audit_changed_at","expressions":["changed_at"],"descending":[false],"type":"btree","definition":"CREATE INDEX idx_audit_changed_at ON public.audit USING btree (changed_at);","opclassNames":["timestamptz_ops"],"opclassDefaults":[true]},{"name":"idx_audit_operation","expressions":["operation"],"descending":[false],"type":"btree","definition":"CREATE INDEX idx_audit_operation ON public.audit USING btree (operation);","opclassNames":["text_ops"],"opclassDefaults":[true]},{"name":"idx_audit_username","expressions":["user_name"],"descending":[false],"type":"btree","definition":"CREATE INDEX idx_audit_username ON public.audit USING btree (user_name);","opclassNames":["text_ops"],"opclassDefaults":[true]}],"dataSize":"8192","indexSize":"32768","owner":"bbsample"},{"name":"department","columns":[{"name":"dept_no","position":1,"type":"text"},{"name":"dept_name","position":2,"type":"text"}],"indexes":[{"name":"department_dept_name_key","expressions":["dept_name"],"descending":[false],"type":"btree","unique":true,"definition":"CREATE UNIQUE INDEX department_dept_name_key ON public.department USING btree (dept_name);","isConstraint":true,"opclassNames":["text_ops"],"opclassDefaults":[true]},{"name":"department_pkey","expressions":["dept_no"],"descending":[false],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX department_pkey ON public.department USING btree (dept_no);","isConstraint":true,"opclassNames":["text_ops"],"opclassDefaults":[true]}],"dataSize":"16384","indexSize":"32768","owner":"bbsample"},{"name":"dept_emp","columns":[{"name":"emp_no","position":1,"type":"integer"},{"name":"dept_no","position":2,"type":"text"},{"name":"from_date","position":3,"type":"date"},{"name":"to_date","position":4,"type":"date"}],"indexes":[{"name":"dept_emp_pkey","expressions":["emp_no","dept_no"],"descending":[false,false],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX dept_emp_pkey ON public.dept_emp USING btree (emp_no, dept_no);","isConstraint":true,"opclassNames":["int4_ops","text_ops"],"opclassDefaults":[true,true]}],"rowCount":"1103","dataSize":"106496","indexSize":"57344","foreignKeys":[{"name":"dept_emp_dept_no_fkey","columns":["dept_no"],"referencedSchema":"public","referencedTable":"department","referencedColumns":["dept_no"],"onDelete":"CASCADE","onUpdate":"NO ACTION","matchType":"SIMPLE"},{"name":"dept_emp_emp_no_fkey","columns":["emp_no"],"referencedSchema":"public","referencedTable":"employee","referencedColumns":["emp_no"],"onDelete":"CASCADE","onUpdate":"NO ACTION","matchType":"SIMPLE"}],"owner":"bbsample"},{"name":"dept_manager","columns":[{"name":"emp_no","position":1,"type":"integer"},{"name":"dept_no","position":2,"type":"text"},{"name":"from_date","position":3,"type":"date"},{"name":"to_date","position":4,"type":"date"}],"indexes":[{"name":"dept_manager_pkey","expressions":["emp_no","dept_no"],"descending":[false,false],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX dept_manager_pkey ON public.dept_manager USING btree (emp_no, dept_no);","isConstraint":true,"opclassNames":["int4_ops","text_ops"],"opclassDefaults":[true,true]}],"dataSize":"16384","indexSize":"16384","foreignKeys":[{"name":"dept_manager_dept_no_fkey","columns":["dept_no"],"referencedSchema":"public","referencedTable":"department","referencedColumns":["dept_no"],"onDelete":"CASCADE","onUpdate":"NO ACTION","matchType":"SIMPLE"},{"name":"dept_manager_emp_no_fkey","columns":["emp_no"],"referencedSchema":"public","referencedTable":"employee","referencedColumns":["emp_no"],"onDelete":"CASCADE","onUpdate":"NO ACTION","matchType":"SIMPLE"}],"owner":"bbsample"},{"name":"employee","columns":[{"name":"emp_no","position":1,"default":"nextval(''public.employee_emp_no_seq''::regclass)","type":"integer"},{"name":"birth_date","position":2,"type":"date"},{"name":"first_name","position":3,"type":"text"},{"name":"last_name","position":4,"type":"text"},{"name":"gender","position":5,"type":"text"},{"name":"hire_date","position":6,"type":"date"}],"indexes":[{"name":"employee_pkey","expressions":["emp_no"],"descending":[false],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX employee_pkey ON public.employee USING btree (emp_no);","isConstraint":true,"opclassNames":["int4_ops"],"opclassDefaults":[true]},{"name":"idx_employee_hire_date","expressions":["hire_date"],"descending":[false],"type":"btree","definition":"CREATE INDEX idx_employee_hire_date ON public.employee USING btree (hire_date);","opclassNames":["date_ops"],"opclassDefaults":[true]}],"rowCount":"1000","dataSize":"98304","indexSize":"98304","checkConstraints":[{"name":"employee_gender_check","expression":"(gender = ANY (ARRAY[''M''::text, ''F''::text]))"}],"owner":"bbsample"},{"name":"salary","columns":[{"name":"emp_no","position":1,"type":"integer"},{"name":"amount","position":2,"type":"integer"},{"name":"from_date","position":3,"type":"date"},{"name":"to_date","position":4,"type":"date"}],"indexes":[{"name":"idx_salary_amount","expressions":["amount"],"descending":[false],"type":"btree","definition":"CREATE INDEX idx_salary_amount ON public.salary USING btree (amount);","opclassNames":["int4_ops"],"opclassDefaults":[true]},{"name":"salary_pkey","expressions":["emp_no","from_date"],"descending":[false,false],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX salary_pkey ON public.salary USING btree (emp_no, from_date);","isConstraint":true,"opclassNames":["int4_ops","date_ops"],"opclassDefaults":[true,true]}],"rowCount":"9488","dataSize":"458752","indexSize":"548864","foreignKeys":[{"name":"salary_emp_no_fkey","columns":["emp_no"],"referencedSchema":"public","referencedTable":"employee","referencedColumns":["emp_no"],"onDelete":"CASCADE","onUpdate":"NO ACTION","matchType":"SIMPLE"}],"owner":"bbsample","triggers":[{"name":"salary_log_trigger","body":"CREATE TRIGGER salary_log_trigger AFTER DELETE OR UPDATE ON public.salary FOR EACH ROW EXECUTE FUNCTION public.log_dml_operations()"}]},{"name":"title","columns":[{"name":"emp_no","position":1,"type":"integer"},{"name":"title","position":2,"type":"text"},{"name":"from_date","position":3,"type":"date"},{"name":"to_date","position":4,"nullable":true,"type":"date"}],"indexes":[{"name":"title_pkey","expressions":["emp_no","title","from_date"],"descending":[false,false,false],"type":"btree","unique":true,"primary":true,"definition":"CREATE UNIQUE INDEX title_pkey ON public.title USING btree (emp_no, title, from_date);","isConstraint":true,"opclassNames":["int4_ops","text_ops","date_ops"],"opclassDefaults":[true,true,true]}],"rowCount":"1470","dataSize":"131072","indexSize":"73728","foreignKeys":[{"name":"title_emp_no_fkey","columns":["emp_no"],"referencedSchema":"public","referencedTable":"employee","referencedColumns":["emp_no"],"onDelete":"CASCADE","onUpdate":"NO ACTION","matchType":"SIMPLE"}],"owner":"bbsample"}],"views":[{"name":"current_dept_emp","definition":" SELECT l.emp_no,\n d.dept_no,\n l.from_date,\n l.to_date\n FROM (public.dept_emp d\n JOIN public.dept_emp_latest_date l ON (((d.emp_no = l.emp_no) AND (d.from_date = l.from_date) AND (l.to_date = d.to_date))));","dependencyColumns":[{"schema":"public","table":"dept_emp","column":"dept_no"},{"schema":"public","table":"dept_emp","column":"emp_no"},{"schema":"public","table":"dept_emp","column":"from_date"},{"schema":"public","table":"dept_emp","column":"to_date"},{"schema":"public","table":"dept_emp_latest_date","column":"emp_no"},{"schema":"public","table":"dept_emp_latest_date","column":"from_date"},{"schema":"public","table":"dept_emp_latest_date","column":"to_date"}],"columns":[{"name":"emp_no","position":1,"nullable":true,"type":"integer"},{"name":"dept_no","position":2,"nullable":true,"type":"text"},{"name":"from_date","position":3,"nullable":true,"type":"date"},{"name":"to_date","position":4,"nullable":true,"type":"date"}]},{"name":"dept_emp_latest_date","definition":" SELECT emp_no,\n max(from_date) AS from_date,\n max(to_date) AS to_date\n FROM public.dept_emp\n GROUP BY emp_no;","dependencyColumns":[{"schema":"public","table":"dept_emp","column":"emp_no"},{"schema":"public","table":"dept_emp","column":"from_date"},{"schema":"public","table":"dept_emp","column":"to_date"}],"columns":[{"name":"emp_no","position":1,"nullable":true,"type":"integer"},{"name":"from_date","position":2,"nullable":true,"type":"date"},{"name":"to_date","position":3,"nullable":true,"type":"date"}]}],"functions":[{"name":"log_dml_operations","definition":"CREATE OR REPLACE FUNCTION public.log_dml_operations()\n RETURNS trigger\n LANGUAGE plpgsql\nAS $function$\nBEGIN\n IF (TG_OP = ''INSERT'') THEN\n INSERT INTO audit (operation, query, user_name)\n VALUES (''INSERT'', current_query(), current_user);\n RETURN NEW;\n ELSIF (TG_OP = ''UPDATE'') THEN\n INSERT INTO audit (operation, query, user_name)\n VALUES (''UPDATE'', current_query(), current_user);\n RETURN NEW;\n ELSIF (TG_OP = ''DELETE'') THEN\n INSERT INTO audit (operation, query, user_name)\n VALUES (''DELETE'', current_query(), current_user);\n RETURN OLD;\n END IF;\n RETURN NULL;\nEND;\n$function$\n","signature":"log_dml_operations()"}],"sequences":[{"name":"audit_id_seq","dataType":"integer","start":"1","minValue":"1","maxValue":"2147483647","increment":"1","cacheSize":"1","ownerTable":"audit","ownerColumn":"id"},{"name":"employee_emp_no_seq","dataType":"integer","start":"1","minValue":"1","maxValue":"2147483647","increment":"1","cacheSize":"1","ownerTable":"employee","ownerColumn":"emp_no"}],"owner":"pg_database_owner","comment":"standard public schema"}],"characterSet":"UTF8","collation":"en_US.UTF-8","owner":"bbsample","searchPath":"\"$user\", public"}', '
-SET statement_timeout = 0;
-SET lock_timeout = 0;
-SET idle_in_transaction_session_timeout = 0;
-SET client_encoding = ''UTF8'';
-SET standard_conforming_strings = on;
-SELECT pg_catalog.set_config(''search_path'', '''', false);
-SET check_function_bodies = false;
-SET xmloption = content;
-SET client_min_messages = warning;
-SET row_security = off;
-
-CREATE SEQUENCE "public"."audit_id_seq"
- AS integer
- START WITH 1
- INCREMENT BY 1
- MINVALUE 1
- MAXVALUE 2147483647
- NO CYCLE;
-
-CREATE SEQUENCE "public"."employee_emp_no_seq"
- AS integer
- START WITH 1
- INCREMENT BY 1
- MINVALUE 1
- MAXVALUE 2147483647
- NO CYCLE;
-
-SET default_tablespace = '''';
-
-CREATE TABLE "public"."audit" (
- "id" integer DEFAULT nextval(''public.audit_id_seq''::regclass) NOT NULL,
- "operation" text NOT NULL,
- "query" text,
- "user_name" text NOT NULL,
- "changed_at" timestamp(6) with time zone DEFAULT CURRENT_TIMESTAMP
-);
-
-ALTER SEQUENCE "public"."audit_id_seq" OWNED BY "public"."audit"."id";
-
-ALTER TABLE ONLY "public"."audit" ADD CONSTRAINT "audit_pkey" PRIMARY KEY (id);
-
-CREATE INDEX "idx_audit_changed_at" ON ONLY "public"."audit" (changed_at);
-
-CREATE INDEX "idx_audit_operation" ON ONLY "public"."audit" (operation);
-
-CREATE INDEX "idx_audit_username" ON ONLY "public"."audit" (user_name);
-
-CREATE TABLE "public"."department" (
- "dept_no" text NOT NULL,
- "dept_name" text NOT NULL
-);
-
-ALTER TABLE ONLY "public"."department" ADD CONSTRAINT "department_pkey" PRIMARY KEY (dept_no);
-
-ALTER TABLE ONLY "public"."department" ADD CONSTRAINT "department_dept_name_key" UNIQUE (dept_name);
-
-CREATE TABLE "public"."dept_emp" (
- "emp_no" integer NOT NULL,
- "dept_no" text NOT NULL,
- "from_date" date NOT NULL,
- "to_date" date NOT NULL
-);
-
-ALTER TABLE ONLY "public"."dept_emp" ADD CONSTRAINT "dept_emp_pkey" PRIMARY KEY (emp_no, dept_no);
-
-CREATE TABLE "public"."dept_manager" (
- "emp_no" integer NOT NULL,
- "dept_no" text NOT NULL,
- "from_date" date NOT NULL,
- "to_date" date NOT NULL
-);
-
-ALTER TABLE ONLY "public"."dept_manager" ADD CONSTRAINT "dept_manager_pkey" PRIMARY KEY (emp_no, dept_no);
-
-CREATE TABLE "public"."employee" (
- "emp_no" integer DEFAULT nextval(''public.employee_emp_no_seq''::regclass) NOT NULL,
- "birth_date" date NOT NULL,
- "first_name" text NOT NULL,
- "last_name" text NOT NULL,
- "gender" text NOT NULL,
- "hire_date" date NOT NULL,
- CONSTRAINT "employee_gender_check" CHECK (gender = ANY (ARRAY[''M''::text, ''F''::text]))
-);
-
-ALTER SEQUENCE "public"."employee_emp_no_seq" OWNED BY "public"."employee"."emp_no";
-
-ALTER TABLE ONLY "public"."employee" ADD CONSTRAINT "employee_pkey" PRIMARY KEY (emp_no);
-
-CREATE INDEX "idx_employee_hire_date" ON ONLY "public"."employee" (hire_date);
-
-CREATE OR REPLACE FUNCTION public.log_dml_operations()
- RETURNS trigger
- LANGUAGE plpgsql
-AS $function$
-BEGIN
- IF (TG_OP = ''INSERT'') THEN
- INSERT INTO audit (operation, query, user_name)
- VALUES (''INSERT'', current_query(), current_user);
- RETURN NEW;
- ELSIF (TG_OP = ''UPDATE'') THEN
- INSERT INTO audit (operation, query, user_name)
- VALUES (''UPDATE'', current_query(), current_user);
- RETURN NEW;
- ELSIF (TG_OP = ''DELETE'') THEN
- INSERT INTO audit (operation, query, user_name)
- VALUES (''DELETE'', current_query(), current_user);
- RETURN OLD;
- END IF;
- RETURN NULL;
-END;
-$function$
-;
-
-CREATE TABLE "public"."salary" (
- "emp_no" integer NOT NULL,
- "amount" integer NOT NULL,
- "from_date" date NOT NULL,
- "to_date" date NOT NULL
-);
-
-ALTER TABLE ONLY "public"."salary" ADD CONSTRAINT "salary_pkey" PRIMARY KEY (emp_no, from_date);
-
-CREATE INDEX "idx_salary_amount" ON ONLY "public"."salary" (amount);
-
-CREATE TABLE "public"."title" (
- "emp_no" integer NOT NULL,
- "title" text NOT NULL,
- "from_date" date NOT NULL,
- "to_date" date
-);
-
-ALTER TABLE ONLY "public"."title" ADD CONSTRAINT "title_pkey" PRIMARY KEY (emp_no, title, from_date);
-
-CREATE VIEW "public"."dept_emp_latest_date" AS
- SELECT emp_no,
- max(from_date) AS from_date,
- max(to_date) AS to_date
- FROM public.dept_emp
- GROUP BY emp_no;
-
-CREATE VIEW "public"."current_dept_emp" AS
- SELECT l.emp_no,
- d.dept_no,
- l.from_date,
- l.to_date
- FROM (public.dept_emp d
- JOIN public.dept_emp_latest_date l ON (((d.emp_no = l.emp_no) AND (d.from_date = l.from_date) AND (l.to_date = d.to_date))));
-
-CREATE TRIGGER salary_log_trigger AFTER DELETE OR UPDATE ON public.salary FOR EACH ROW EXECUTE FUNCTION public.log_dml_operations();
-
-ALTER TABLE "public"."dept_emp"
- ADD CONSTRAINT "dept_emp_dept_no_fkey" FOREIGN KEY ("dept_no")
- REFERENCES "public"."department" ("dept_no")
- ON DELETE CASCADE;
-
-ALTER TABLE "public"."dept_emp"
- ADD CONSTRAINT "dept_emp_emp_no_fkey" FOREIGN KEY ("emp_no")
- REFERENCES "public"."employee" ("emp_no")
- ON DELETE CASCADE;
-
-ALTER TABLE "public"."dept_manager"
- ADD CONSTRAINT "dept_manager_dept_no_fkey" FOREIGN KEY ("dept_no")
- REFERENCES "public"."department" ("dept_no")
- ON DELETE CASCADE;
-
-ALTER TABLE "public"."dept_manager"
- ADD CONSTRAINT "dept_manager_emp_no_fkey" FOREIGN KEY ("emp_no")
- REFERENCES "public"."employee" ("emp_no")
- ON DELETE CASCADE;
-
-ALTER TABLE "public"."salary"
- ADD CONSTRAINT "salary_emp_no_fkey" FOREIGN KEY ("emp_no")
- REFERENCES "public"."employee" ("emp_no")
- ON DELETE CASCADE;
-
-ALTER TABLE "public"."title"
- ADD CONSTRAINT "title_emp_no_fkey" FOREIGN KEY ("emp_no")
- REFERENCES "public"."employee" ("emp_no")
- ON DELETE CASCADE;
-
-') ON CONFLICT DO NOTHING;
-
-
---
--- Data for Name: task; Type: TABLE DATA; Schema: public; Owner: -
---
-
-
-
---
--- Data for Name: task_run; Type: TABLE DATA; Schema: public; Owner: -
---
-
-
-
---
--- Data for Name: task_run_log; Type: TABLE DATA; Schema: public; Owner: -
---
-
-
-
---
--- Data for Name: user_group; Type: TABLE DATA; Schema: public; Owner: -
---
-
-INSERT INTO public.user_group (email, name, description, payload, id) VALUES ('[email protected]', 'QA Group', '', '{"members": [{"role": "OWNER", "member": "users/[email protected]"}, {"role": "MEMBER", "member": "users/[email protected]"}]}', '46c5bb90-f607-4b23-b610-8c065dab2acb') ON CONFLICT DO NOTHING;
-
-
---
--- Data for Name: web_refresh_token; Type: TABLE DATA; Schema: public; Owner: -
---
-
-INSERT INTO public.web_refresh_token (token_hash, user_email, expires_at) VALUES ('qrBwEuiUhh5KcPtcrikuuGtV3w9RmW-6j7SH8BiW0ys', '[email protected]', '2026-03-17 08:27:36.105103+00') ON CONFLICT DO NOTHING;
-
-
---
--- Data for Name: workload_identity; Type: TABLE DATA; Schema: public; Owner: -
---
-
-
-
---
--- Data for Name: worksheet; Type: TABLE DATA; Schema: public; Owner: -
---
-
-INSERT INTO public.worksheet (id, created_at, updated_at, project, instance, db_name, name, statement, visibility, payload, creator) VALUES (101, '2025-05-26 07:59:09.119115+00', '2025-05-26 07:59:12.540192+00', 'metadb', 'bytebase-meta', 'bb', 'Issues created by user', '-- Issues created by user
-SELECT
- issue.creator_id,
- principal.email,
- COUNT(issue.creator_id) AS amount
-FROM
- issue
- INNER JOIN principal ON issue.creator_id = principal.id
-GROUP BY
- issue.creator_id,
- principal.email
-ORDER BY
- COUNT(issue.creator_id) DESC;', 'PROJECT_READ', '{}', '[email protected]') ON CONFLICT DO NOTHING;
-
-
---
--- Data for Name: worksheet_organizer; Type: TABLE DATA; Schema: public; Owner: -
---
-
-
-
---
--- Name: audit_log_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
---
-
-SELECT pg_catalog.setval('public.audit_log_id_seq', 193, true);
-
-
---
--- Name: changelog_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
---
-
-SELECT pg_catalog.setval('public.changelog_id_seq', 108, true);
-
-
---
--- Name: export_archive_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
---
-
-SELECT pg_catalog.setval('public.export_archive_id_seq', 1, false);
-
-
---
--- Name: instance_change_history_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
---
-
-SELECT pg_catalog.setval('public.instance_change_history_id_seq', 264, true);
-
-
---
--- Name: issue_comment_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
---
-
-SELECT pg_catalog.setval('public.issue_comment_id_seq', 101, false);
-
-
---
--- Name: issue_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
---
-
-SELECT pg_catalog.setval('public.issue_id_seq', 101, true);
-
-
---
--- Name: plan_check_run_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
---
-
-SELECT pg_catalog.setval('public.plan_check_run_id_seq', 106, true);
-
-
---
--- Name: plan_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
---
-
-SELECT pg_catalog.setval('public.plan_id_seq', 101, true);
-
-
---
--- Name: principal_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
---
-
-SELECT pg_catalog.setval('public.principal_id_seq', 106, true);
-
-
---
--- Name: project_webhook_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
---
-
-SELECT pg_catalog.setval('public.project_webhook_id_seq', 101, false);
-
-
---
--- Name: query_history_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
---
-
-SELECT pg_catalog.setval('public.query_history_id_seq', 105, true);
-
-
---
--- Name: revision_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
---
-
-SELECT pg_catalog.setval('public.revision_id_seq', 101, false);
-
-
---
--- Name: sync_history_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
---
-
-SELECT pg_catalog.setval('public.sync_history_id_seq', 108, true);
-
-
---
--- Name: task_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
---
-
-SELECT pg_catalog.setval('public.task_id_seq', 102, true);
-
-
---
--- Name: task_run_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
---
-
-SELECT pg_catalog.setval('public.task_run_id_seq', 101, false);
-
-
---
--- Name: worksheet_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
---
-
-SELECT pg_catalog.setval('public.worksheet_id_seq', 101, true);
-
-
---
--- Name: worksheet_organizer_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
---
-
-SELECT pg_catalog.setval('public.worksheet_organizer_id_seq', 1, false);
-
-
---
--- Name: access_grant access_grant_pkey; Type: CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.access_grant
- ADD CONSTRAINT access_grant_pkey PRIMARY KEY (id);
-
-
---
--- Name: audit_log audit_log_pkey; Type: CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.audit_log
- ADD CONSTRAINT audit_log_pkey PRIMARY KEY (id);
-
-
---
--- Name: changelog changelog_pkey; Type: CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.changelog
- ADD CONSTRAINT changelog_pkey PRIMARY KEY (id);
-
-
---
--- Name: db_group db_group_pkey; Type: CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.db_group
- ADD CONSTRAINT db_group_pkey PRIMARY KEY (project, resource_id);
-
-
---
--- Name: db db_pkey; Type: CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.db
- ADD CONSTRAINT db_pkey PRIMARY KEY (instance, name);
-
-
---
--- Name: db_schema db_schema_pkey; Type: CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.db_schema
- ADD CONSTRAINT db_schema_pkey PRIMARY KEY (instance, db_name);
-
-
---
--- Name: export_archive export_archive_pkey; Type: CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.export_archive
- ADD CONSTRAINT export_archive_pkey PRIMARY KEY (id);
-
-
---
--- Name: idp idp_pkey; Type: CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.idp
- ADD CONSTRAINT idp_pkey PRIMARY KEY (resource_id);
-
-
---
--- Name: instance_change_history instance_change_history_pkey; Type: CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.instance_change_history
- ADD CONSTRAINT instance_change_history_pkey PRIMARY KEY (id);
-
-
---
--- Name: instance instance_pkey; Type: CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.instance
- ADD CONSTRAINT instance_pkey PRIMARY KEY (resource_id);
-
-
---
--- Name: issue_comment issue_comment_pkey; Type: CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.issue_comment
- ADD CONSTRAINT issue_comment_pkey PRIMARY KEY (id);
-
-
---
--- Name: issue issue_pkey; Type: CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.issue
- ADD CONSTRAINT issue_pkey PRIMARY KEY (id);
-
-
---
--- Name: oauth2_authorization_code oauth2_authorization_code_pkey; Type: CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.oauth2_authorization_code
- ADD CONSTRAINT oauth2_authorization_code_pkey PRIMARY KEY (code);
-
-
---
--- Name: oauth2_client oauth2_client_pkey; Type: CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.oauth2_client
- ADD CONSTRAINT oauth2_client_pkey PRIMARY KEY (client_id);
-
-
---
--- Name: oauth2_refresh_token oauth2_refresh_token_pkey; Type: CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.oauth2_refresh_token
- ADD CONSTRAINT oauth2_refresh_token_pkey PRIMARY KEY (token_hash);
-
-
---
--- Name: plan_check_run plan_check_run_pkey; Type: CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.plan_check_run
- ADD CONSTRAINT plan_check_run_pkey PRIMARY KEY (id);
-
-
---
--- Name: plan plan_pkey; Type: CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.plan
- ADD CONSTRAINT plan_pkey PRIMARY KEY (id);
-
-
---
--- Name: plan_webhook_delivery plan_webhook_delivery_pkey; Type: CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.plan_webhook_delivery
- ADD CONSTRAINT plan_webhook_delivery_pkey PRIMARY KEY (plan_id);
-
-
---
--- Name: policy policy_pkey; Type: CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.policy
- ADD CONSTRAINT policy_pkey PRIMARY KEY (resource_type, resource, type);
-
-
---
--- Name: principal principal_pkey; Type: CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.principal
- ADD CONSTRAINT principal_pkey PRIMARY KEY (id);
-
-
---
--- Name: project project_pkey; Type: CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.project
- ADD CONSTRAINT project_pkey PRIMARY KEY (resource_id);
-
-
---
--- Name: project_webhook project_webhook_pkey; Type: CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.project_webhook
- ADD CONSTRAINT project_webhook_pkey PRIMARY KEY (id);
-
-
---
--- Name: query_history query_history_pkey; Type: CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.query_history
- ADD CONSTRAINT query_history_pkey PRIMARY KEY (id);
-
-
---
--- Name: release release_pkey; Type: CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.release
- ADD CONSTRAINT release_pkey PRIMARY KEY (project, train, iteration);
-
-
---
--- Name: replica_heartbeat replica_heartbeat_pkey; Type: CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.replica_heartbeat
- ADD CONSTRAINT replica_heartbeat_pkey PRIMARY KEY (replica_id);
-
-
---
--- Name: review_config review_config_pkey; Type: CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.review_config
- ADD CONSTRAINT review_config_pkey PRIMARY KEY (id);
-
-
---
--- Name: revision revision_pkey; Type: CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.revision
- ADD CONSTRAINT revision_pkey PRIMARY KEY (id);
-
-
---
--- Name: role role_pkey; Type: CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.role
- ADD CONSTRAINT role_pkey PRIMARY KEY (resource_id);
-
-
---
--- Name: service_account service_account_pkey; Type: CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.service_account
- ADD CONSTRAINT service_account_pkey PRIMARY KEY (email);
-
-
---
--- Name: setting setting_pkey; Type: CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.setting
- ADD CONSTRAINT setting_pkey PRIMARY KEY (name);
-
-
---
--- Name: sheet_blob sheet_blob_pkey; Type: CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.sheet_blob
- ADD CONSTRAINT sheet_blob_pkey PRIMARY KEY (sha256);
-
-
---
--- Name: sync_history sync_history_pkey; Type: CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.sync_history
- ADD CONSTRAINT sync_history_pkey PRIMARY KEY (id);
-
-
---
--- Name: task task_pkey; Type: CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.task
- ADD CONSTRAINT task_pkey PRIMARY KEY (id);
-
-
---
--- Name: task_run_log task_run_log_pkey; Type: CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.task_run_log
- ADD CONSTRAINT task_run_log_pkey PRIMARY KEY (task_run_id, created_at);
-
-
---
--- Name: task_run task_run_pkey; Type: CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.task_run
- ADD CONSTRAINT task_run_pkey PRIMARY KEY (id);
-
-
---
--- Name: user_group user_group_pkey; Type: CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.user_group
- ADD CONSTRAINT user_group_pkey PRIMARY KEY (id);
-
-
---
--- Name: web_refresh_token web_refresh_token_pkey; Type: CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.web_refresh_token
- ADD CONSTRAINT web_refresh_token_pkey PRIMARY KEY (token_hash);
-
-
---
--- Name: workload_identity workload_identity_pkey; Type: CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.workload_identity
- ADD CONSTRAINT workload_identity_pkey PRIMARY KEY (email);
-
-
---
--- Name: worksheet_organizer worksheet_organizer_pkey; Type: CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.worksheet_organizer
- ADD CONSTRAINT worksheet_organizer_pkey PRIMARY KEY (id);
-
-
---
--- Name: worksheet worksheet_pkey; Type: CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.worksheet
- ADD CONSTRAINT worksheet_pkey PRIMARY KEY (id);
-
-
---
--- Name: idx_access_grant_project_creator_expire_time; Type: INDEX; Schema: public; Owner: -
---
-
-CREATE INDEX idx_access_grant_project_creator_expire_time ON public.access_grant USING btree (project, creator, expire_time);
-
-
---
--- Name: idx_audit_log_created_at; Type: INDEX; Schema: public; Owner: -
---
-
-CREATE INDEX idx_audit_log_created_at ON public.audit_log USING btree (created_at);
-
-
---
--- Name: idx_audit_log_payload_method; Type: INDEX; Schema: public; Owner: -
---
-
-CREATE INDEX idx_audit_log_payload_method ON public.audit_log USING btree (((payload ->> 'method'::text)));
-
-
---
--- Name: idx_audit_log_payload_parent; Type: INDEX; Schema: public; Owner: -
---
-
-CREATE INDEX idx_audit_log_payload_parent ON public.audit_log USING btree (((payload ->> 'parent'::text)));
-
-
---
--- Name: idx_audit_log_payload_resource; Type: INDEX; Schema: public; Owner: -
---
-
-CREATE INDEX idx_audit_log_payload_resource ON public.audit_log USING btree (((payload ->> 'resource'::text)));
-
-
---
--- Name: idx_audit_log_payload_user; Type: INDEX; Schema: public; Owner: -
---
-
-CREATE INDEX idx_audit_log_payload_user ON public.audit_log USING btree (((payload ->> 'user'::text)));
-
-
---
--- Name: idx_changelog_instance_db_name; Type: INDEX; Schema: public; Owner: -
---
-
-CREATE INDEX idx_changelog_instance_db_name ON public.changelog USING btree (instance, db_name);
-
-
---
--- Name: idx_db_project; Type: INDEX; Schema: public; Owner: -
---
-
-CREATE INDEX idx_db_project ON public.db USING btree (project);
-
-
---
--- Name: idx_instance_change_history_unique_version; Type: INDEX; Schema: public; Owner: -
---
-
-CREATE UNIQUE INDEX idx_instance_change_history_unique_version ON public.instance_change_history USING btree (version);
-
-
---
--- Name: idx_instance_metadata_engine; Type: INDEX; Schema: public; Owner: -
---
-
-CREATE INDEX idx_instance_metadata_engine ON public.instance USING btree (((metadata ->> 'engine'::text)));
-
-
---
--- Name: idx_issue_comment_issue_id; Type: INDEX; Schema: public; Owner: -
---
-
-CREATE INDEX idx_issue_comment_issue_id ON public.issue_comment USING btree (issue_id);
-
-
---
--- Name: idx_issue_creator; Type: INDEX; Schema: public; Owner: -
---
-
-CREATE INDEX idx_issue_creator ON public.issue USING btree (creator);
-
-
---
--- Name: idx_issue_project; Type: INDEX; Schema: public; Owner: -
---
-
-CREATE INDEX idx_issue_project ON public.issue USING btree (project);
-
-
---
--- Name: idx_issue_ts_vector; Type: INDEX; Schema: public; Owner: -
---
-
-CREATE INDEX idx_issue_ts_vector ON public.issue USING gin (ts_vector);
-
-
---
--- Name: idx_issue_unique_plan_id; Type: INDEX; Schema: public; Owner: -
---
-
-CREATE UNIQUE INDEX idx_issue_unique_plan_id ON public.issue USING btree (plan_id);
-
-
---
--- Name: idx_oauth2_authorization_code_expires_at; Type: INDEX; Schema: public; Owner: -
---
-
-CREATE INDEX idx_oauth2_authorization_code_expires_at ON public.oauth2_authorization_code USING btree (expires_at);
-
-
---
--- Name: idx_oauth2_client_last_active_at; Type: INDEX; Schema: public; Owner: -
---
-
-CREATE INDEX idx_oauth2_client_last_active_at ON public.oauth2_client USING btree (last_active_at);
-
-
---
--- Name: idx_oauth2_refresh_token_expires_at; Type: INDEX; Schema: public; Owner: -
---
-
-CREATE INDEX idx_oauth2_refresh_token_expires_at ON public.oauth2_refresh_token USING btree (expires_at);
-
-
---
--- Name: idx_plan_check_run_active_status; Type: INDEX; Schema: public; Owner: -
---
-
-CREATE INDEX idx_plan_check_run_active_status ON public.plan_check_run USING btree (status, id) WHERE (status = ANY (ARRAY['AVAILABLE'::text, 'RUNNING'::text]));
-
-
---
--- Name: idx_plan_check_run_unique_plan_id; Type: INDEX; Schema: public; Owner: -
---
-
-CREATE UNIQUE INDEX idx_plan_check_run_unique_plan_id ON public.plan_check_run USING btree (plan_id);
-
-
---
--- Name: idx_plan_config_has_rollout; Type: INDEX; Schema: public; Owner: -
---
-
-CREATE INDEX idx_plan_config_has_rollout ON public.plan USING btree (((config ->> 'hasRollout'::text)));
-
-
---
--- Name: idx_plan_creator; Type: INDEX; Schema: public; Owner: -
---
-
-CREATE INDEX idx_plan_creator ON public.plan USING btree (creator);
-
-
---
--- Name: idx_plan_project; Type: INDEX; Schema: public; Owner: -
---
-
-CREATE INDEX idx_plan_project ON public.plan USING btree (project);
-
-
---
--- Name: idx_principal_unique_email; Type: INDEX; Schema: public; Owner: -
---
-
-CREATE UNIQUE INDEX idx_principal_unique_email ON public.principal USING btree (email);
-
-
---
--- Name: idx_project_webhook_project; Type: INDEX; Schema: public; Owner: -
---
-
-CREATE INDEX idx_project_webhook_project ON public.project_webhook USING btree (project);
-
-
---
--- Name: idx_query_history_creator_created_at_project_id; Type: INDEX; Schema: public; Owner: -
---
-
-CREATE INDEX idx_query_history_creator_created_at_project_id ON public.query_history USING btree (creator, created_at, project_id DESC);
-
-
---
--- Name: idx_release_category; Type: INDEX; Schema: public; Owner: -
---
-
-CREATE INDEX idx_release_category ON public.release USING btree (project, category);
-
-
---
--- Name: idx_release_project; Type: INDEX; Schema: public; Owner: -
---
-
-CREATE INDEX idx_release_project ON public.release USING btree (project);
-
-
---
--- Name: idx_release_project_release_id; Type: INDEX; Schema: public; Owner: -
---
-
-CREATE INDEX idx_release_project_release_id ON public.release USING btree (project, release_id);
-
-
---
--- Name: idx_revision_instance_db_name_type_version; Type: INDEX; Schema: public; Owner: -
---
-
-CREATE INDEX idx_revision_instance_db_name_type_version ON public.revision USING btree (instance, db_name, ((payload ->> 'type'::text)), version);
-
-
---
--- Name: idx_revision_unique_instance_db_name_type_version_deleted_at_nu; Type: INDEX; Schema: public; Owner: -
---
-
-CREATE UNIQUE INDEX idx_revision_unique_instance_db_name_type_version_deleted_at_nu ON public.revision USING btree (instance, db_name, ((payload ->> 'type'::text)), version) WHERE (deleted_at IS NULL);
-
-
---
--- Name: idx_service_account_project; Type: INDEX; Schema: public; Owner: -
---
-
-CREATE INDEX idx_service_account_project ON public.service_account USING btree (project) WHERE (project IS NOT NULL);
-
-
---
--- Name: idx_sync_history_instance_db_name_created_at; Type: INDEX; Schema: public; Owner: -
---
-
-CREATE INDEX idx_sync_history_instance_db_name_created_at ON public.sync_history USING btree (instance, db_name, created_at);
-
-
---
--- Name: idx_task_plan_id_environment; Type: INDEX; Schema: public; Owner: -
---
-
-CREATE INDEX idx_task_plan_id_environment ON public.task USING btree (plan_id, environment);
-
-
---
--- Name: idx_task_run_active_status_id; Type: INDEX; Schema: public; Owner: -
---
-
-CREATE INDEX idx_task_run_active_status_id ON public.task_run USING btree (status, id) WHERE (status = ANY (ARRAY['PENDING'::text, 'AVAILABLE'::text, 'RUNNING'::text]));
-
-
---
--- Name: idx_task_run_log_task_run_id; Type: INDEX; Schema: public; Owner: -
---
-
-CREATE INDEX idx_task_run_log_task_run_id ON public.task_run_log USING btree (task_run_id);
-
-
---
--- Name: idx_task_run_running_replica; Type: INDEX; Schema: public; Owner: -
---
-
-CREATE INDEX idx_task_run_running_replica ON public.task_run USING btree (replica_id) WHERE ((status = 'RUNNING'::text) AND (replica_id IS NOT NULL));
-
-
---
--- Name: idx_task_run_task_id; Type: INDEX; Schema: public; Owner: -
---
-
-CREATE INDEX idx_task_run_task_id ON public.task_run USING btree (task_id);
-
-
---
--- Name: idx_user_group_unique_email; Type: INDEX; Schema: public; Owner: -
---
-
-CREATE UNIQUE INDEX idx_user_group_unique_email ON public.user_group USING btree (email) WHERE (email IS NOT NULL);
-
-
---
--- Name: idx_web_refresh_token_expires_at; Type: INDEX; Schema: public; Owner: -
---
-
-CREATE INDEX idx_web_refresh_token_expires_at ON public.web_refresh_token USING btree (expires_at);
-
-
---
--- Name: idx_web_refresh_token_user_email; Type: INDEX; Schema: public; Owner: -
---
-
-CREATE INDEX idx_web_refresh_token_user_email ON public.web_refresh_token USING btree (user_email);
-
-
---
--- Name: idx_workload_identity_project; Type: INDEX; Schema: public; Owner: -
---
-
-CREATE INDEX idx_workload_identity_project ON public.workload_identity USING btree (project) WHERE (project IS NOT NULL);
-
-
---
--- Name: idx_worksheet_creator_project; Type: INDEX; Schema: public; Owner: -
---
-
-CREATE INDEX idx_worksheet_creator_project ON public.worksheet USING btree (creator, project);
-
-
---
--- Name: idx_worksheet_organizer_payload; Type: INDEX; Schema: public; Owner: -
---
-
-CREATE INDEX idx_worksheet_organizer_payload ON public.worksheet_organizer USING gin (payload);
-
-
---
--- Name: idx_worksheet_organizer_principal; Type: INDEX; Schema: public; Owner: -
---
-
-CREATE INDEX idx_worksheet_organizer_principal ON public.worksheet_organizer USING btree (principal);
-
-
---
--- Name: idx_worksheet_organizer_unique_sheet_id_principal; Type: INDEX; Schema: public; Owner: -
---
-
-CREATE UNIQUE INDEX idx_worksheet_organizer_unique_sheet_id_principal ON public.worksheet_organizer USING btree (worksheet_id, principal);
-
-
---
--- Name: uk_task_run_task_id_attempt; Type: INDEX; Schema: public; Owner: -
---
-
-CREATE UNIQUE INDEX uk_task_run_task_id_attempt ON public.task_run USING btree (task_id, attempt);
-
-
---
--- Name: access_grant access_grant_project_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.access_grant
- ADD CONSTRAINT access_grant_project_fkey FOREIGN KEY (project) REFERENCES public.project(resource_id);
-
-
---
--- Name: changelog changelog_instance_db_name_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.changelog
- ADD CONSTRAINT changelog_instance_db_name_fkey FOREIGN KEY (instance, db_name) REFERENCES public.db(instance, name);
-
-
---
--- Name: changelog changelog_sync_history_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.changelog
- ADD CONSTRAINT changelog_sync_history_id_fkey FOREIGN KEY (sync_history_id) REFERENCES public.sync_history(id);
-
-
---
--- Name: db_group db_group_project_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.db_group
- ADD CONSTRAINT db_group_project_fkey FOREIGN KEY (project) REFERENCES public.project(resource_id);
-
-
---
--- Name: db db_instance_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.db
- ADD CONSTRAINT db_instance_fkey FOREIGN KEY (instance) REFERENCES public.instance(resource_id);
-
-
---
--- Name: db db_project_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.db
- ADD CONSTRAINT db_project_fkey FOREIGN KEY (project) REFERENCES public.project(resource_id);
-
-
---
--- Name: db_schema db_schema_instance_db_name_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.db_schema
- ADD CONSTRAINT db_schema_instance_db_name_fkey FOREIGN KEY (instance, db_name) REFERENCES public.db(instance, name);
-
-
---
--- Name: issue_comment issue_comment_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.issue_comment
- ADD CONSTRAINT issue_comment_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES public.issue(id);
-
-
---
--- Name: issue issue_plan_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.issue
- ADD CONSTRAINT issue_plan_id_fkey FOREIGN KEY (plan_id) REFERENCES public.plan(id);
-
-
---
--- Name: issue issue_project_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.issue
- ADD CONSTRAINT issue_project_fkey FOREIGN KEY (project) REFERENCES public.project(resource_id);
-
-
---
--- Name: oauth2_authorization_code oauth2_authorization_code_client_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.oauth2_authorization_code
- ADD CONSTRAINT oauth2_authorization_code_client_id_fkey FOREIGN KEY (client_id) REFERENCES public.oauth2_client(client_id) ON DELETE CASCADE;
-
-
---
--- Name: oauth2_authorization_code oauth2_authorization_code_user_email_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.oauth2_authorization_code
- ADD CONSTRAINT oauth2_authorization_code_user_email_fkey FOREIGN KEY (user_email) REFERENCES public.principal(email) ON UPDATE CASCADE;
-
-
---
--- Name: oauth2_refresh_token oauth2_refresh_token_client_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.oauth2_refresh_token
- ADD CONSTRAINT oauth2_refresh_token_client_id_fkey FOREIGN KEY (client_id) REFERENCES public.oauth2_client(client_id) ON DELETE CASCADE;
-
-
---
--- Name: oauth2_refresh_token oauth2_refresh_token_user_email_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.oauth2_refresh_token
- ADD CONSTRAINT oauth2_refresh_token_user_email_fkey FOREIGN KEY (user_email) REFERENCES public.principal(email) ON UPDATE CASCADE;
-
-
---
--- Name: plan_check_run plan_check_run_plan_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.plan_check_run
- ADD CONSTRAINT plan_check_run_plan_id_fkey FOREIGN KEY (plan_id) REFERENCES public.plan(id);
-
-
---
--- Name: plan plan_project_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.plan
- ADD CONSTRAINT plan_project_fkey FOREIGN KEY (project) REFERENCES public.project(resource_id);
-
-
---
--- Name: plan_webhook_delivery plan_webhook_delivery_plan_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.plan_webhook_delivery
- ADD CONSTRAINT plan_webhook_delivery_plan_id_fkey FOREIGN KEY (plan_id) REFERENCES public.plan(id);
-
-
---
--- Name: project_webhook project_webhook_project_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.project_webhook
- ADD CONSTRAINT project_webhook_project_fkey FOREIGN KEY (project) REFERENCES public.project(resource_id);
-
-
---
--- Name: release release_project_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.release
- ADD CONSTRAINT release_project_fkey FOREIGN KEY (project) REFERENCES public.project(resource_id);
-
-
---
--- Name: revision revision_instance_db_name_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.revision
- ADD CONSTRAINT revision_instance_db_name_fkey FOREIGN KEY (instance, db_name) REFERENCES public.db(instance, name);
-
-
---
--- Name: service_account service_account_project_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.service_account
- ADD CONSTRAINT service_account_project_fkey FOREIGN KEY (project) REFERENCES public.project(resource_id);
-
-
---
--- Name: sync_history sync_history_instance_db_name_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.sync_history
- ADD CONSTRAINT sync_history_instance_db_name_fkey FOREIGN KEY (instance, db_name) REFERENCES public.db(instance, name);
-
-
---
--- Name: task task_instance_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.task
- ADD CONSTRAINT task_instance_fkey FOREIGN KEY (instance) REFERENCES public.instance(resource_id);
-
-
---
--- Name: task task_plan_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.task
- ADD CONSTRAINT task_plan_id_fkey FOREIGN KEY (plan_id) REFERENCES public.plan(id);
-
-
---
--- Name: task_run_log task_run_log_task_run_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.task_run_log
- ADD CONSTRAINT task_run_log_task_run_id_fkey FOREIGN KEY (task_run_id) REFERENCES public.task_run(id);
-
-
---
--- Name: task_run task_run_task_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.task_run
- ADD CONSTRAINT task_run_task_id_fkey FOREIGN KEY (task_id) REFERENCES public.task(id);
-
-
---
--- Name: web_refresh_token web_refresh_token_user_email_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.web_refresh_token
- ADD CONSTRAINT web_refresh_token_user_email_fkey FOREIGN KEY (user_email) REFERENCES public.principal(email) ON UPDATE CASCADE;
-
-
---
--- Name: workload_identity workload_identity_project_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.workload_identity
- ADD CONSTRAINT workload_identity_project_fkey FOREIGN KEY (project) REFERENCES public.project(resource_id);
-
-
---
--- Name: worksheet_organizer worksheet_organizer_worksheet_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.worksheet_organizer
- ADD CONSTRAINT worksheet_organizer_worksheet_id_fkey FOREIGN KEY (worksheet_id) REFERENCES public.worksheet(id) ON DELETE CASCADE;
-
-
---
--- Name: worksheet worksheet_project_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.worksheet
- ADD CONSTRAINT worksheet_project_fkey FOREIGN KEY (project) REFERENCES public.project(resource_id);
-
-
---
--- PostgreSQL database dump complete
---
-
diff --git a/backend/demo/demo.go b/backend/demo/demo.go
deleted file mode 100644
index 7baccfe39d..0000000000
--- a/backend/demo/demo.go
+++ /dev/null
@@ -1,56 +0,0 @@
-package demo
-
-import (
- "context"
- "database/sql"
- "embed"
- "io/fs"
- "log/slog"
-)
-
-//go:embed data
-var demoFS embed.FS
-
-// LoadDemoData loads the demo data.
-func LoadDemoData(ctx context.Context, db *sql.DB) error {
- slog.Info("Setting up demo...")
-
- // This query in the dump.sql will poison the connection.
- // SELECT pg_catalog.set_config('search_path', '', false);
- var ok bool
- if err := db.QueryRowContext(ctx,
- `SELECT EXISTS (SELECT 1 FROM information_schema.tables WHERE table_name = 'principal')`,
- ).Scan(&ok); err != nil {
- return err
- }
- if ok {
- slog.Info("Skip setting up demo data. Data already exists.")
- return nil
- }
-
- buf, err := fs.ReadFile(demoFS, "data/dump.sql")
- if err != nil {
- return err
- }
- txn, err := db.Begin()
- if err != nil {
- return err
- }
- defer txn.Rollback()
- if _, err := txn.Exec(string(buf)); err != nil {
- return err
- }
- if err := txn.Commit(); err != nil {
- return err
- }
-
- // Reset the search_path to public after loading demo data
- // The dump.sql contains pg_catalog.set_config('search_path', '', false) which
- // clears the search_path for the session, causing subsequent queries to fail
- if _, err := db.Exec("SET search_path TO public"); err != nil {
- return err
- }
-
- slog.Info("Completed demo data setup.")
- return nil
-}
diff --git a/backend/generated-go/v1/actuator_service.pb.go b/backend/generated-go/v1/actuator_service.pb.go
index b59c6808af..d2b510f3fe 100644
--- a/backend/generated-go/v1/actuator_service.pb.go
+++ b/backend/generated-go/v1/actuator_service.pb.go
@@ -241,8 +241,6 @@ type ActuatorInfo struct {
Readonly bool `protobuf:"varint,3,opt,name=readonly,proto3" json:"readonly,omitempty"`
// Whether the Bytebase instance is running in SaaS mode where some features cannot be edited by users.
Saas bool `protobuf:"varint,4,opt,name=saas,proto3" json:"saas,omitempty"`
- // Whether the Bytebase instance is running in demo mode.
- Demo bool `protobuf:"varint,5,opt,name=demo,proto3" json:"demo,omitempty"`
// The host address of the Bytebase instance.
Host string `protobuf:"bytes,6,opt,name=host,proto3" json:"host,omitempty"`
// The port number of the Bytebase instance.
@@ -338,13 +336,6 @@ func (x *ActuatorInfo) GetSaas() bool {
return false
}
-func (x *ActuatorInfo) GetDemo() bool {
- if x != nil {
- return x.Demo
- }
- return false
-}
-
func (x *ActuatorInfo) GetHost() string {
if x != nil {
return x.Host
@@ -472,14 +463,13 @@ const file_v1_actuator_service_proto_rawDesc = "" +
"\x18disallow_password_signin\x18\x02 \x01(\bB\x03\xe0A\x03R\x16disallowPasswordSignin\x12p\n" +
"\x14password_restriction\x18\x03 \x01(\v28.bytebase.v1.WorkspaceProfileSetting.PasswordRestrictionB\x03\xe0A\x03R\x13passwordRestriction\x12:\n" +
"\x17allow_email_code_signin\x18\x04 \x01(\bB\x03\xe0A\x03R\x14allowEmailCodeSignin\x129\n" +
- "\x16password_reset_enabled\x18\x05 \x01(\bB\x03\xe0A\x03R\x14passwordResetEnabled\"\xbd\a\n" +
+ "\x16password_reset_enabled\x18\x05 \x01(\bB\x03\xe0A\x03R\x14passwordResetEnabled\"\xaa\a\n" +
"\fActuatorInfo\x12\x1d\n" +
"\aversion\x18\x01 \x01(\tB\x03\xe0A\x03R\aversion\x12\"\n" +
"\n" +
"git_commit\x18\x02 \x01(\tB\x03\xe0A\x03R\tgitCommit\x12\x1f\n" +
"\breadonly\x18\x03 \x01(\bB\x03\xe0A\x03R\breadonly\x12\x17\n" +
"\x04saas\x18\x04 \x01(\bB\x03\xe0A\x03R\x04saas\x12\x17\n" +
- "\x04demo\x18\x05 \x01(\bB\x03\xe0A\x03R\x04demo\x12\x17\n" +
"\x04host\x18\x06 \x01(\tB\x03\xe0A\x03R\x04host\x12\x17\n" +
"\x04port\x18\a \x01(\tB\x03\xe0A\x03R\x04port\x12&\n" +
"\fexternal_url\x18\b \x01(\tB\x03\xe0A\x03R\vexternalUrl\x12I\n" +
@@ -495,7 +485,7 @@ const file_v1_actuator_service_proto_rawDesc = "" +
"\rreplica_count\x18\x18 \x01(\x05B\x03\xe0A\x03R\freplicaCount\x12?\n" +
"\vrestriction\x18\x19 \x01(\v2\x18.bytebase.v1.RestrictionB\x03\xe0A\x03R\vrestriction\x12,\n" +
"\x0fdefault_project\x18\x1a \x01(\tB\x03\xe0A\x03R\x0edefaultProject\x12.\n" +
- "\x11user_count_in_iam\x18\x1b \x01(\x05B\x03\xe0A\x03R\x0euserCountInIamJ\x04\b\t\x10\n" +
+ "\x11user_count_in_iam\x18\x1b \x01(\x05B\x03\xe0A\x03R\x0euserCountInIamJ\x04\b\x05\x10\x06J\x04\b\t\x10\n" +
"J\x04\b\n" +
"\x10\vJ\x04\b\f\x10\rJ\x04\b\x10\x10\x11J\x04\b\x11\x10\x12J\x04\b\x0e\x10\x0f2\x9d\x03\n" +
"\x0fActuatorService\x12\x9c\x01\n" +
diff --git a/backend/generated-go/v1/actuator_service_equal.pb.go b/backend/generated-go/v1/actuator_service_equal.pb.go
index 5a6cd1baee..077170f64c 100644
--- a/backend/generated-go/v1/actuator_service_equal.pb.go
+++ b/backend/generated-go/v1/actuator_service_equal.pb.go
@@ -80,9 +80,6 @@ func (x *ActuatorInfo) Equal(y *ActuatorInfo) bool {
if x.Saas != y.Saas {
return false
}
- if x.Demo != y.Demo {
- return false
- }
if x.Host != y.Host {
return false
}
diff --git a/backend/server/minimal.go b/backend/server/minimal.go
deleted file mode 100644
index 9cd40782ce..0000000000
--- a/backend/server/minimal.go
+++ /dev/null
@@ -1,24 +0,0 @@
-package server
-
-import (
- // This includes the first-class database, Postgres.
-
- // Drivers.
- _ "github.com/bytebase/bytebase/backend/plugin/db/pg"
-
- // Parsers.
- _ "github.com/bytebase/bytebase/backend/plugin/parser/pg"
-
- // Schema designer.
- _ "github.com/bytebase/bytebase/backend/plugin/schema/pg"
-
- // Advisors.
- _ "github.com/bytebase/bytebase/backend/plugin/advisor/pg"
-
- // IM webhooks.
- _ "github.com/bytebase/bytebase/backend/plugin/webhook/dingtalk"
- _ "github.com/bytebase/bytebase/backend/plugin/webhook/feishu"
- _ "github.com/bytebase/bytebase/backend/plugin/webhook/googlechat"
- _ "github.com/bytebase/bytebase/backend/plugin/webhook/slack"
- _ "github.com/bytebase/bytebase/backend/plugin/webhook/wecom"
-)
diff --git a/backend/server/server.go b/backend/server/server.go
index cf527c712c..62c42eed5f 100644
--- a/backend/server/server.go
+++ b/backend/server/server.go
@@ -28,7 +28,6 @@ import (
"github.com/bytebase/bytebase/backend/component/sampleinstance"
"github.com/bytebase/bytebase/backend/component/sheet"
"github.com/bytebase/bytebase/backend/component/webhook"
- "github.com/bytebase/bytebase/backend/demo"
"github.com/bytebase/bytebase/backend/enterprise"
storepb "github.com/bytebase/bytebase/backend/generated-go/store"
v1pb "github.com/bytebase/bytebase/backend/generated-go/v1"
@@ -101,7 +100,6 @@ func NewServer(ctx context.Context, profile *config.Profile) (*Server, error) {
slog.Info("-----Config BEGIN-----")
slog.Info(fmt.Sprintf("mode=%s", profile.Mode))
slog.Info(fmt.Sprintf("dataDir=%s", profile.DataDir))
- slog.Info(fmt.Sprintf("demo=%v", profile.Demo))
slog.Info(fmt.Sprintf("replicaID=%s", profile.ReplicaID))
slog.Info("-----Config END-------")
@@ -119,9 +117,6 @@ func NewServer(ctx context.Context, profile *config.Profile) (*Server, error) {
var pgURL string
if profile.UseEmbedDB() {
pgDataDir := path.Join(profile.DataDir, "pgdata")
- if profile.Demo {
- pgDataDir = path.Join(profile.DataDir, "pgdata-demo")
- }
stopper, err := postgres.StartMetadataInstance(ctx, pgDataDir, profile.DatastorePort, profile.Mode)
if err != nil {
@@ -139,12 +134,6 @@ func NewServer(ctx context.Context, profile *config.Profile) (*Server, error) {
return nil, errors.Wrapf(err, "failed to new store")
}
- if profile.Demo {
- if err := demo.LoadDemoData(ctx, stores.GetDB()); err != nil {
- stores.Close()
- return nil, errors.Wrapf(err, "failed to load demo data")
- }
- }
if err := migrator.MigrateSchema(ctx, stores.GetDB()); err != nil {
stores.Close()
return nil, errors.Wrapf(err, "failed to migrate schema")
diff --git a/backend/server/ultimate.go b/backend/server/ultimate.go
index 83be71675c..89e24a5587 100644
--- a/backend/server/ultimate.go
+++ b/backend/server/ultimate.go
@@ -1,5 +1,3 @@
-//go:build !minidemo
-
package server
import (
@@ -17,6 +15,7 @@ import (
_ "github.com/bytebase/bytebase/backend/plugin/db/mssql"
_ "github.com/bytebase/bytebase/backend/plugin/db/mysql"
_ "github.com/bytebase/bytebase/backend/plugin/db/oracle"
+ _ "github.com/bytebase/bytebase/backend/plugin/db/pg"
_ "github.com/bytebase/bytebase/backend/plugin/db/redis"
_ "github.com/bytebase/bytebase/backend/plugin/db/redshift"
_ "github.com/bytebase/bytebase/backend/plugin/db/snowflake"
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index 615b0022ff..19a91e3037 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -126,7 +126,6 @@
"profile-setup": "Profile Setup",
"sign-in": {
"code-sent-hint": "A verification code was sent to {email}.",
- "demo-account": "Demo Account",
"email-code-tab": "Email Code",
"failed-to-send-code": "Failed to send verification code. {error}",
"forget-password": "Forgot your password?",
@@ -147,12 +146,9 @@
"token-expired-title": "Token expired"
},
"banner": {
- "cloud": "Cloud",
- "deploy": "Self Host",
"external-url": "Bytebase has not configured --external-url",
"license-expired": "Your license for {plan} has expired on {expireAt}.",
"license-expires": "Your license for {plan} will expire in {days} days on {expireAt}.",
- "request-demo": "Book a 30-minute product demo.",
"trial-expires": "Your free trial for {plan} will expire in {days} days on {expireAt}."
},
"bbkit": {
@@ -259,7 +255,6 @@
"delete-resource": "Delete {type}",
"delete-resource-description": "Once you delete \"{name}\", there is no going back. Please be certain.",
"deleted": "Deleted",
- "demo-mode": "Demo",
"deny": "Deny",
"description": "Description",
"detail": "Detail",
diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.json
index 233d1aaabe..6e4ab5e397 100644
--- a/frontend/src/locales/es-ES.json
+++ b/frontend/src/locales/es-ES.json
@@ -126,7 +126,6 @@
"profile-setup": "Configurar perfil",
"sign-in": {
"code-sent-hint": "Se ha enviado un código de verificación a {email}.",
- "demo-account": "Demo Account",
"email-code-tab": "Código por email",
"failed-to-send-code": "No se pudo enviar el código de verificación. Inténtalo de nuevo.",
"forget-password": "¿Olvidaste tu contraseña?",
@@ -147,12 +146,9 @@
"token-expired-title": "Token expirado"
},
"banner": {
- "cloud": "Cloud",
- "deploy": "Auto Hospedaje",
"external-url": "Bytebase no ha configurado --external-url",
"license-expired": "Su licencia para {plan} ha expirado el {expireAt}.",
"license-expires": "Su licencia para {plan} ha caducado el {expireAt}.",
- "request-demo": "Reserva una demo de producto de 30 minutos.",
"trial-expires": "Su prueba gratuita para {plan} caducará en {days} días el {expireAt}."
},
"bbkit": {
@@ -259,7 +255,6 @@
"delete-resource": "Delete {type}",
"delete-resource-description": "Once you delete \"{name}\", there is no going back. Please be certain.",
"deleted": "Eliminado",
- "demo-mode": "Demostración",
"deny": "Denegar",
"description": "Descripción",
"detail": "Detalle",
diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.json
index 7d19729c35..7a483a9597 100644
--- a/frontend/src/locales/ja-JP.json
+++ b/frontend/src/locales/ja-JP.json
@@ -126,7 +126,6 @@
"profile-setup": "プロフィール設定",
"sign-in": {
"code-sent-hint": "{email} に認証コードを送信しました。",
- "demo-account": "Demo Account",
"email-code-tab": "メール認証コード",
"failed-to-send-code": "認証コードの送信に失敗しました。もう一度お試しください。",
"forget-password": "パスワードを忘れましたか?",
@@ -147,12 +146,9 @@
"token-expired-title": "トークンの有効期限が切れました"
},
"banner": {
- "cloud": "クラウドサービス",
- "deploy": "ローカル展開",
"external-url": "Bytebase は --extern-url を設定していません",
"license-expired": "{plan} のライセンスは {expireAt} に期限切れになりました。",
"license-expires": "{plan} ライセンスは {expireAt} に期限切れになりました",
- "request-demo": "30 分間の製品デモを予約してください。",
"trial-expires": "{plan} トライアルは {days} 日後に期限切れになります"
},
"bbkit": {
@@ -259,7 +255,6 @@
"delete-resource": "Delete {type}",
"delete-resource-description": "Once you delete \"{name}\", there is no going back. Please be certain.",
"deleted": "削除されました",
- "demo-mode": "デモモード",
"deny": "拒否",
"description": "説明",
"detail": "詳細",
diff --git a/frontend/src/locales/vi-VN.json b/frontend/src/locales/vi-VN.json
index 07dbf1d4a9..e7257b24c4 100644
--- a/frontend/src/locales/vi-VN.json
+++ b/frontend/src/locales/vi-VN.json
@@ -126,7 +126,6 @@
"profile-setup": "Thiết lập hồ sơ",
"sign-in": {
"code-sent-hint": "Mã xác minh đã được gửi đến {email}.",
- "demo-account": "Demo Account",
"email-code-tab": "Mã qua email",
"failed-to-send-code": "Không gửi được mã xác minh. Vui lòng thử lại.",
"forget-password": "Quên mật khẩu?",
@@ -147,12 +146,9 @@
"token-expired-title": "Mã thông báo đã hết hạn"
},
"banner": {
- "cloud": "Đám mây",
- "deploy": "Tự lưu trữ",
"external-url": "Bytebase chưa được cấu hình --external-url",
"license-expired": "Giấy phép {plan} của bạn đã hết hạn vào {expireAt}.",
"license-expires": "Giấy phép {plan} của bạn sẽ hết hạn sau {days} ngày vào {expireAt}.",
- "request-demo": "Đặt lịch giới thiệu sản phẩm 30 phút.",
"trial-expires": "Bản dùng thử miễn phí {plan} của bạn sẽ hết hạn trong {days} ngày nữa vào {expireAt}."
},
"bbkit": {
@@ -259,7 +255,6 @@
"delete-resource": "Delete {type}",
"delete-resource-description": "Once you delete \"{name}\", there is no going back. Please be certain.",
"deleted": "Đã xóa",
- "demo-mode": "Chế độ Demo",
"deny": "Từ chối",
"description": "Mô tả",
"detail": "Chi tiết",
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index 721a10b898..5ea2c4f687 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -126,7 +126,6 @@
"profile-setup": "设置个人资料",
"sign-in": {
"code-sent-hint": "验证码已发送至 {email}。",
- "demo-account": "Demo Account",
"email-code-tab": "邮箱验证码",
"failed-to-send-code": "发送验证码失败,请重试。",
"forget-password": "忘记密码?",
@@ -147,12 +146,9 @@
"token-expired-title": "Token 已过期"
},
"banner": {
- "cloud": "云服务",
- "deploy": "本地部署",
"external-url": "Bytebase 还没有配置 --external-url",
"license-expired": "您的{plan}证书已在 {expireAt} 过期",
"license-expires": "您的{plan}证书将在 {days} 天后({expireAt})过期",
- "request-demo": "预约一个 30 分钟的产品演示。",
"trial-expires": "您的{plan}试用将在 {days} 天后({expireAt})过期"
},
"bbkit": {
@@ -259,7 +255,6 @@
"delete-resource": "删除{type}",
"delete-resource-description": "删除「{name}」后将无法恢复,请确认。",
"deleted": "已删除",
- "demo-mode": "演示模式",
"deny": "拒绝",
"description": "描述",
"detail": "详情",
diff --git a/frontend/src/react/components/BannersWrapper.test.tsx b/frontend/src/react/components/BannersWrapper.test.tsx
index dbbdcc159d..d6fd435169 100644
--- a/frontend/src/react/components/BannersWrapper.test.tsx
+++ b/frontend/src/react/components/BannersWrapper.test.tsx
@@ -27,12 +27,9 @@ const mocks = vi.hoisted(() => ({
}));
const translations: Record<string, string> = {
- "banner.cloud": "Cloud",
- "banner.deploy": "Self Host",
"banner.external-url": "Bytebase has not configured --external-url",
"banner.license-expired": "{{plan}} expired on {{expireAt}}",
"banner.license-expires": "{{plan}} expires in {{days}} days on {{expireAt}}",
- "banner.request-demo": "Book a demo",
"banner.trial-expires":
"{{plan}} trial expires in {{days}} days on {{expireAt}}",
"common.configure-now": "Configure now",
@@ -154,26 +151,6 @@ beforeEach(async () => {
});
describe("BannersWrapper", () => {
- test("renders and dismisses demo banner", () => {
- mocks.useServerState.mockReturnValue({
- needConfigureExternalUrl: false,
- serverInfo: { demo: true },
- });
- const { container, unmount } = renderIntoContainer(<BannersWrapper />);
-
- expect(container.textContent).toContain("Book a demo");
-
- const dismissButton = Array.from(container.querySelectorAll("button")).find(
- (button) => button.textContent === "Dismiss"
- );
- act(() => {
- dismissButton?.dispatchEvent(new MouseEvent("click", { bubbles: true }));
- });
-
- expect(container.textContent).not.toContain("Book a demo");
- unmount();
- });
-
test("renders trialing subscription banner with subscription action", () => {
mocks.useSubscriptionState.mockReturnValue({
...defaultSubscriptionState,
diff --git a/frontend/src/react/components/BannersWrapper.tsx b/frontend/src/react/components/BannersWrapper.tsx
index f0e0bd633f..e699f0a9c0 100644
--- a/frontend/src/react/components/BannersWrapper.tsx
+++ b/frontend/src/react/components/BannersWrapper.tsx
@@ -1,8 +1,6 @@
import {
AlertCircle,
ArrowRight,
- Cloud,
- Download,
ShoppingCart,
Sparkles,
Wrench,
@@ -79,60 +77,6 @@ function BannerDismissButton({
);
}
-function BannerDemo() {
- const { t } = useTranslation();
- const [show, setShow] = useState(true);
-
- if (!show) return null;
-
- return (
- <div className="bg-accent">
- <div className="mx-auto px-3 py-1">
- <div className="flex flex-wrap items-center justify-between">
- <div className="flex w-0 flex-1 items-center">
- <p className="flex items-center truncate font-medium text-white">
- <a
- href="https://cal.com/bytebase/product-walkthrough"
- target="_blank"
- rel="noreferrer"
- className="flex items-center gap-x-1 underline"
- >
- {t("banner.request-demo")}
- </a>
- </p>
- </div>
- <div className="order-3 my-2 flex w-full shrink-0 flex-row gap-x-4 sm:order-2 sm:my-0 sm:w-auto sm:py-1">
- <a
- href="https://docs.bytebase.com/get-started/self-host-vs-cloud/?source=demo"
- target="_blank"
- rel="noreferrer"
- className="flex items-center justify-center rounded-xs border border-transparent bg-white py-1 pr-2 pl-4 text-base font-medium text-accent hover:bg-indigo-50"
- >
- {t("banner.deploy")}
- <Download className="ml-1 size-5" />
- </a>
- <a
- href="https://hub.bytebase.com/workspace?source=demo"
- target="_blank"
- rel="noreferrer"
- className="flex items-center justify-center rounded-xs border border-transparent bg-white py-1 pr-2 pl-4 text-base font-medium text-accent hover:bg-indigo-50"
- >
- {t("banner.cloud")}
- <Cloud className="ml-1 size-5" />
- </a>
- </div>
- <div className="order-2 -mr-1 shrink-0 sm:order-3 sm:ml-3">
- <BannerDismissButton
- label={t("common.dismiss")}
- onClick={() => setShow(false)}
- />
- </div>
- </div>
- </div>
- </div>
- );
-}
-
function BannerExternalUrl() {
const { t } = useTranslation();
const navigate = useNavigate();
@@ -396,7 +340,7 @@ function BannerUpgradeSubscription() {
}
export function BannersWrapper() {
- const { serverInfo, needConfigureExternalUrl } = useServerState();
+ const { needConfigureExternalUrl } = useServerState();
const { currentPlan, daysBeforeExpire, isExpired, isTrialing } =
useSubscriptionState();
@@ -410,7 +354,6 @@ export function BannersWrapper() {
return (
<>
<BannerUpgradeSubscription />
- {serverInfo?.demo ? <BannerDemo /> : null}
{shouldShowSubscriptionBanner ? <BannerSubscription /> : null}
{shouldShowExternalUrlBanner ? <BannerExternalUrl /> : null}
<BannerAnnouncement />
diff --git a/frontend/src/react/components/auth/DemoSigninForm.tsx b/frontend/src/react/components/auth/DemoSigninForm.tsx
deleted file mode 100644
index e47b491cf2..0000000000
--- a/frontend/src/react/components/auth/DemoSigninForm.tsx
+++ /dev/null
@@ -1,71 +0,0 @@
-import { create } from "@bufbuild/protobuf";
-import { useState } from "react";
-import { useTranslation } from "react-i18next";
-import { Button } from "@/react/components/ui/button";
-import {
- type LoginRequest,
- LoginRequestSchema,
-} from "@/types/proto-es/v1/auth_service_pb";
-
-type Props = {
- readonly loading: boolean;
- readonly onSignin: (request: LoginRequest) => void;
-};
-
-// NOSONAR: Not a real credential — fixed demo account password, only used in demo mode.
-const DEMO_PASSWORD = "12345678"; // NOSONAR
-
-const ACCOUNT_OPTIONS = [
- { label: "Demo (Workspace Admin)", value: "[email protected]" },
- { label: "Dev1 (Developer)", value: "[email protected]" },
- { label: "DBA1 (DBA)", value: "[email protected]" },
- { label: "QA1 (QA)", value: "[email protected]" },
-];
-
-export function DemoSigninForm({ loading, onSignin }: Props) {
- const { t } = useTranslation();
- const [selectedEmail, setSelectedEmail] = useState("[email protected]");
-
- const trySignin = (e: React.FormEvent) => {
- e.preventDefault();
- onSignin(
- create(LoginRequestSchema, {
- email: selectedEmail,
- password: DEMO_PASSWORD,
- })
- );
- };
-
- return (
- <form className="flex flex-col gap-y-6 px-1" onSubmit={trySignin}>
- <div>
- <label
- htmlFor="demo-account"
- className="block text-sm font-medium leading-5 text-control"
- >
- {t("auth.sign-in.demo-account")}
- </label>
- <div className="mt-1">
- <select
- id="demo-account"
- value={selectedEmail}
- onChange={(e) => setSelectedEmail(e.target.value)}
- className="flex h-10 w-full rounded-xs border border-control-border bg-transparent px-3 text-sm text-main focus:outline-hidden"
- >
- {ACCOUNT_OPTIONS.map((opt) => (
- <option key={opt.value} value={opt.value}>
- {opt.label}
- </option>
- ))}
- </select>
- </div>
- </div>
-
- <div className="w-full">
- <Button type="submit" size="lg" className="w-full" disabled={loading}>
- {t("common.sign-in")}
- </Button>
- </div>
- </form>
- );
-}
diff --git a/frontend/src/react/components/header/VersionMenuItem.test.tsx b/frontend/src/react/components/header/VersionMenuItem.test.tsx
index 59e18daa15..8fcf990dcc 100644
--- a/frontend/src/react/components/header/VersionMenuItem.test.tsx
+++ b/frontend/src/react/components/header/VersionMenuItem.test.tsx
@@ -15,7 +15,6 @@ const mocks = vi.hoisted(() => ({
version: "1.0.0",
gitCommit: "backend123",
saas: false,
- demo: false,
},
subscription: {
plan: 1,
@@ -28,7 +27,6 @@ vi.mock("react-i18next", () => ({
useTranslation: () => ({
t: (key: string, params?: Record<string, string>) =>
({
- "common.demo-mode": "Demo Mode",
"subscription.plan.free.title": "Free",
"subscription.plan.team.title": "Team",
"subscription.plan.enterprise.title": "Enterprise",
@@ -120,7 +118,6 @@ beforeEach(async () => {
version: "1.0.0",
gitCommit: "backend123",
saas: false,
- demo: false,
};
mocks.subscription = {
plan: PlanType.TEAM,
@@ -156,7 +153,6 @@ describe("VersionMenuItem", () => {
version: "1.0.0",
gitCommit: "backend123",
saas: true,
- demo: false,
};
const { container, render, unmount } = renderIntoContainer(
<VersionMenuItem onCloseMenu={mocks.closeMenu} />
diff --git a/frontend/src/react/components/header/VersionMenuItem.tsx b/frontend/src/react/components/header/VersionMenuItem.tsx
index 38c6655ddf..154a28e761 100644
--- a/frontend/src/react/components/header/VersionMenuItem.tsx
+++ b/frontend/src/react/components/header/VersionMenuItem.tsx
@@ -1,6 +1,5 @@
import { useMemo } from "react";
import { useTranslation } from "react-i18next";
-import { Badge } from "@/react/components/ui/badge";
import {
useServerInfo,
useSubscription,
@@ -46,9 +45,7 @@ export function VersionMenuItem({ onCloseMenu }: { onCloseMenu: () => void }) {
<>
<div className="px-3 py-2">
<div className="mb-2 flex items-center gap-x-2">
- {serverInfo?.demo ? (
- <Badge variant="secondary">{t("common.demo-mode")}</Badge>
- ) : canManageSettings ? (
+ {canManageSettings ? (
<button
type="button"
className="cursor-pointer text-sm text-accent hover:underline"
diff --git a/frontend/src/react/locales/en-US.json b/frontend/src/react/locales/en-US.json
index 75d4e582c1..ef7b72a285 100644
--- a/frontend/src/react/locales/en-US.json
+++ b/frontend/src/react/locales/en-US.json
@@ -136,7 +136,6 @@
},
"sign-in": {
"code-sent-hint": "A verification code was sent to {{email}}.",
- "demo-account": "Demo Account",
"email-code-tab": "Email Code",
"failed-to-send-code": "Failed to send verification code. {{error}}",
"forget-password": "Forgot your password?",
@@ -158,12 +157,9 @@
},
"auth.token-expired-title": "Token expired",
"banner": {
- "cloud": "Cloud",
- "deploy": "Self Host",
"external-url": "Bytebase has not configured --external-url",
"license-expired": "Your license for {{plan}} has expired on {{expireAt}}.",
"license-expires": "Your license for {{plan}} will expire in {{days}} days on {{expireAt}}.",
- "request-demo": "Book a 30-minute product demo.",
"trial-expires": "Your free trial for {{plan}} will expire in {{days}} days on {{expireAt}}."
},
"bbkit": {
@@ -262,7 +258,6 @@
"delete-resource": "Delete {{type}}",
"delete-resource-description": "Once you delete \"{{name}}\", there is no going back. Please be certain.",
"deleted": "Deleted",
- "demo-mode": "Demo",
"deny": "Deny",
"description": "Description",
"deselect-all": "Deselect all",
@@ -472,7 +467,6 @@
"common.delete": "Delete",
"common.delete-resource": "Delete {{type}}",
"common.deleted": "Deleted",
- "common.demo-mode": "Demo",
"common.detail": "Detail",
"common.detailed-guide": "detailed guide",
"common.edit": "Edit",
diff --git a/frontend/src/react/locales/es-ES.json b/frontend/src/react/locales/es-ES.json
index 4706e83ad4..c03b4d63cc 100644
--- a/frontend/src/react/locales/es-ES.json
+++ b/frontend/src/react/locales/es-ES.json
@@ -135,7 +135,6 @@
},
"sign-in": {
"code-sent-hint": "Se ha enviado un código de verificación a {{email}}.",
- "demo-account": "Demo Account",
"email-code-tab": "Código por email",
"failed-to-send-code": "No se pudo enviar el código de verificación. {{error}}",
"forget-password": "¿Olvidaste tu contraseña?",
@@ -157,12 +156,9 @@
},
"auth.token-expired-title": "Token expirado",
"banner": {
- "cloud": "Cloud",
- "deploy": "Auto Hospedaje",
"external-url": "Bytebase no ha configurado --external-url",
"license-expired": "Su licencia para {{plan}} ha expirado el {{expireAt}}.",
"license-expires": "Su licencia para {{plan}} caducará en {{days}} días el {{expireAt}}.",
- "request-demo": "Reserva una demo de producto de 30 minutos.",
"trial-expires": "Su prueba gratuita para {{plan}} caducará en {{days}} días el {{expireAt}}."
},
"bbkit": {
@@ -465,7 +461,6 @@
"common.delete": "Eliminar",
"common.delete-resource": "Delete {{type}}",
"common.deleted": "Eliminado",
- "common.demo-mode": "Demo",
"common.detail": "Detail",
"common.detailed-guide": "guía detallada",
"common.edit": "Editar",
diff --git a/frontend/src/react/locales/ja-JP.json b/frontend/src/react/locales/ja-JP.json
index f3b624cbf1..5d796dd533 100644
--- a/frontend/src/react/locales/ja-JP.json
+++ b/frontend/src/react/locales/ja-JP.json
@@ -135,7 +135,6 @@
},
"sign-in": {
"code-sent-hint": "{{email}} に認証コードを送信しました。",
- "demo-account": "Demo Account",
"email-code-tab": "メール認証コード",
"failed-to-send-code": "認証コードの送信に失敗しました。{{error}}",
"forget-password": "パスワードを忘れましたか?",
@@ -157,12 +156,9 @@
},
"auth.token-expired-title": "トークンの期限切れ",
"banner": {
- "cloud": "クラウドサービス",
- "deploy": "ローカル展開",
"external-url": "Bytebase は --extern-url を設定していません",
"license-expired": "{{plan}} のライセンスは {{expireAt}} に期限切れになりました。",
"license-expires": "{{plan}} ライセンスは {{days}} 日後の {{expireAt}} に期限切れになります",
- "request-demo": "30 分間の製品デモを予約してください。",
"trial-expires": "{{plan}} トライアルは {{days}} 日後の {{expireAt}} に期限切れになります"
},
"bbkit": {
@@ -465,7 +461,6 @@
"common.delete": "消去",
"common.delete-resource": "Delete {{type}}",
"common.deleted": "削除されました",
- "common.demo-mode": "Demo",
"common.detail": "Detail",
"common.detailed-guide": "詳細ガイド",
"common.edit": "編集",
diff --git a/frontend/src/react/locales/vi-VN.json b/frontend/src/react/locales/vi-VN.json
index 7529b3fbd1..cb28edbae4 100644
--- a/frontend/src/react/locales/vi-VN.json
+++ b/frontend/src/react/locales/vi-VN.json
@@ -135,7 +135,6 @@
},
"sign-in": {
"code-sent-hint": "Mã xác minh đã được gửi đến {{email}}.",
- "demo-account": "Demo Account",
"email-code-tab": "Mã qua email",
"failed-to-send-code": "Không gửi được mã xác minh. {{error}}",
"forget-password": "Quên mật khẩu?",
@@ -157,12 +156,9 @@
},
"auth.token-expired-title": "Mã thông báo đã hết hạn",
"banner": {
- "cloud": "Đám mây",
- "deploy": "Tự lưu trữ",
"external-url": "Bytebase chưa được cấu hình --external-url",
"license-expired": "Giấy phép {{plan}} của bạn đã hết hạn vào {{expireAt}}.",
"license-expires": "Giấy phép {{plan}} của bạn sẽ hết hạn sau {{days}} ngày vào {{expireAt}}.",
- "request-demo": "Đặt lịch giới thiệu sản phẩm 30 phút.",
"trial-expires": "Bản dùng thử miễn phí {{plan}} của bạn sẽ hết hạn trong {{days}} ngày nữa vào {{expireAt}}."
},
"bbkit": {
@@ -465,7 +461,6 @@
"common.delete": "Xóa",
"common.delete-resource": "Delete {{type}}",
"common.deleted": "Đã xóa",
- "common.demo-mode": "Demo",
"common.detail": "Detail",
"common.detailed-guide": "Hướng dẫn chi tiết",
"common.edit": "Chỉnh sửa",
diff --git a/frontend/src/react/locales/zh-CN.json b/frontend/src/react/locales/zh-CN.json
index 30f4dcfe78..8ec17450c1 100644
--- a/frontend/src/react/locales/zh-CN.json
+++ b/frontend/src/react/locales/zh-CN.json
@@ -135,7 +135,6 @@
},
"sign-in": {
"code-sent-hint": "验证码已发送至 {{email}}。",
- "demo-account": "Demo Account",
"email-code-tab": "邮箱验证码",
"failed-to-send-code": "发送验证码失败。{{error}}",
"forget-password": "忘记密码?",
@@ -157,12 +156,9 @@
},
"auth.token-expired-title": "令牌已过期",
"banner": {
- "cloud": "云服务",
- "deploy": "本地部署",
"external-url": "Bytebase 还没有配置 --external-url",
"license-expired": "您的{{plan}}证书已在 {{expireAt}} 过期",
"license-expires": "您的{{plan}}证书将在 {{days}} 天后({{expireAt}})过期",
- "request-demo": "预约一个 30 分钟的产品演示。",
"trial-expires": "您的{{plan}}试用将在 {{days}} 天后({{expireAt}})过期"
},
"bbkit": {
@@ -465,7 +461,6 @@
"common.delete": "删除",
"common.delete-resource": "删除{{type}}",
"common.deleted": "已删除",
- "common.demo-mode": "Demo",
"common.detail": "Detail",
"common.detailed-guide": "详细指南",
"common.edit": "编辑",
diff --git a/frontend/src/react/pages/auth/SigninPage.test.tsx b/frontend/src/react/pages/auth/SigninPage.test.tsx
index a7f3de908c..6abc3acd75 100644
--- a/frontend/src/react/pages/auth/SigninPage.test.tsx
+++ b/frontend/src/react/pages/auth/SigninPage.test.tsx
@@ -99,7 +99,6 @@ beforeEach(async () => {
disallowSignup: false,
},
},
- isDemo: false,
isSaaSMode: false,
activeUserCount: 1,
fetchServerInfo: vi.fn(async () => ({})),
diff --git a/frontend/src/react/pages/auth/SigninPage.tsx b/frontend/src/react/pages/auth/SigninPage.tsx
index ea93458e00..a9e10c91e1 100644
--- a/frontend/src/react/pages/auth/SigninPage.tsx
+++ b/frontend/src/react/pages/auth/SigninPage.tsx
@@ -1,7 +1,6 @@
import { useEffect, useRef, useState } from "react";
import { useTranslation } from "react-i18next";
import { AuthFooter } from "@/react/components/auth/AuthFooter";
-import { DemoSigninForm } from "@/react/components/auth/DemoSigninForm";
import { EmailCodeSigninForm } from "@/react/components/auth/EmailCodeSigninForm";
import { PasswordSigninForm } from "@/react/components/auth/PasswordSigninForm";
import { BytebaseLogo } from "@/react/components/BytebaseLogo";
@@ -49,7 +48,6 @@ export function SigninPage(props: SigninPageProps) {
const [initialized, setInitialized] = useState(false);
const serverInfo = useVueState(() => useActuatorV1Store().serverInfo);
- const isDemo = useVueState(() => useActuatorV1Store().isDemo);
const isSaaSMode = useVueState(() => useActuatorV1Store().isSaaSMode);
const activeUserCount = useVueState(
() => useActuatorV1Store().activeUserCount
@@ -205,33 +203,27 @@ export function SigninPage(props: SigninPageProps) {
</TabsList>
{!serverInfo?.restriction?.disallowPasswordSignin && (
<TabsPanel value="standard" className="pt-3">
- {isDemo ? (
- <DemoSigninForm loading={isLoading} onSignin={trySignin} />
- ) : (
- <>
- <PasswordSigninForm
- loading={isLoading}
- onSignin={trySignin}
- />
- {!disallowSignup && (
- <div className="mt-3 flex justify-center items-center text-sm text-control gap-x-2">
- <span>{t("auth.sign-in.new-user")}</span>
- <a
- href="#"
- className="accent-link"
- onClick={(e) => {
- e.preventDefault();
- router.push({
- name: AUTH_SIGNUP_MODULE,
- query,
- });
- }}
- >
- {t("common.sign-up")}
- </a>
- </div>
- )}
- </>
+ <PasswordSigninForm
+ loading={isLoading}
+ onSignin={trySignin}
+ />
+ {!disallowSignup && (
+ <div className="mt-3 flex justify-center items-center text-sm text-control gap-x-2">
+ <span>{t("auth.sign-in.new-user")}</span>
+ <a
+ href="#"
+ className="accent-link"
+ onClick={(e) => {
+ e.preventDefault();
+ router.push({
+ name: AUTH_SIGNUP_MODULE,
+ query,
+ });
+ }}
+ >
+ {t("common.sign-up")}
+ </a>
+ </div>
)}
</TabsPanel>
)}
diff --git a/frontend/src/store/modules/v1/actuator.ts b/frontend/src/store/modules/v1/actuator.ts
index 19fdc13eaa..a7a33771d8 100644
--- a/frontend/src/store/modules/v1/actuator.ts
+++ b/frontend/src/store/modules/v1/actuator.ts
@@ -45,8 +45,6 @@ export const useActuatorV1Store = defineStore("actuator_v1", () => {
return commit === "" ? "unknown" : commit;
});
- const isDemo = computed(() => serverInfo.value?.demo);
-
const isDocker = computed(() => serverInfo.value?.docker || false);
const isSaaSMode = computed(() => serverInfo.value?.saas || false);
@@ -152,7 +150,6 @@ export const useActuatorV1Store = defineStore("actuator_v1", () => {
version,
gitCommitBE,
gitCommitFE,
- isDemo,
isDocker,
isSaaSMode,
workspaceResourceName,
diff --git a/frontend/src/types/proto-es/v1/actuator_service_pb.d.ts b/frontend/src/types/proto-es/v1/actuator_service_pb.d.ts
index 0b1de92114..167f4a7869 100644
--- a/frontend/src/types/proto-es/v1/actuator_service_pb.d.ts
+++ b/frontend/src/types/proto-es/v1/actuator_service_pb.d.ts
@@ -145,13 +145,6 @@ export declare type ActuatorInfo = Message<"bytebase.v1.ActuatorInfo"> & {
*/
saas: boolean;
- /**
- * Whether the Bytebase instance is running in demo mode.
- *
- * @generated from field: bool demo = 5;
- */
- demo: boolean;
-
/**
* The host address of the Bytebase instance.
*
diff --git a/frontend/src/types/proto-es/v1/actuator_service_pb.js b/frontend/src/types/proto-es/v1/actuator_service_pb.js
index b6f09db9a7..3fff07ae5b 100644
--- a/frontend/src/types/proto-es/v1/actuator_service_pb.js
+++ b/frontend/src/types/proto-es/v1/actuator_service_pb.js
@@ -15,7 +15,7 @@ import { file_v1_setting_service } from "./setting_service_pb";
* Describes the file v1/actuator_service.proto.
*/
export const file_v1_actuator_service = /*@__PURE__*/
- fileDesc("Chl2MS9hY3R1YXRvcl9zZXJ2aWNlLnByb3RvEgtieXRlYmFzZS52MSIUChJTZXR1cFNhbXBsZVJlcXVlc3QiQwoWR2V0QWN0dWF0b3JJbmZvUmVxdWVzdBIpCgRuYW1lGAEgASgJQhv6QRgKFmJ5dGViYXNlLmNvbS9Xb3Jrc3BhY2UiFAoSRGVsZXRlQ2FjaGVSZXF1ZXN0IvoBCgtSZXN0cmljdGlvbhIcCg9kaXNhbGxvd19zaWdudXAYASABKAhCA+BBAxIlChhkaXNhbGxvd19wYXNzd29yZF9zaWduaW4YAiABKAhCA+BBAxJbChRwYXNzd29yZF9yZXN0cmljdGlvbhgDIAEoCzI4LmJ5dGViYXNlLnYxLldvcmtzcGFjZVByb2ZpbGVTZXR0aW5nLlBhc3N3b3JkUmVzdHJpY3Rpb25CA+BBAxIkChdhbGxvd19lbWFpbF9jb2RlX3NpZ25pbhgEIAEoCEID4EEDEiMKFnBhc3N3b3JkX3Jlc2V0X2VuYWJsZWQYBSABKAhCA+BBAyKlBQoMQWN0dWF0b3JJbmZvEhQKB3ZlcnNpb24YASABKAlCA+BBAxIXCgpnaXRfY29tbWl0GAIgASgJQgPgQQMSFQoIcmVhZG9ubHkYAyABKAhCA+BBAxIRCgRzYWFzGAQgASgIQgPgQQMSEQoEZGVtbxgFIAEoCEID4EEDEhEKBGhvc3QYBiABKAlCA+BBAxIRCgRwb3J0GAcgASgJQgPgQQMSGQoMZXh0ZXJuYWxfdXJsGAggASgJQgPgQQMSOQoQbGFzdF9hY3RpdmVfdGltZRgLIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXBCA+BBAxIWCgl3b3Jrc3BhY2UYDSABKAlCA+BBAxIgChN1bmxpY2Vuc2VkX2ZlYXR1cmVzGA8gAygJQgPgQQMSEwoGZG9ja2VyGBIgASgIQgPgQQMSIQoUYWN0aXZhdGVkX3VzZXJfY291bnQYEyABKAVCA+BBAxIlChhhY3RpdmF0ZWRfaW5zdGFuY2VfY291bnQYFCABKAVCA+BBAxIhChR0b3RhbF9pbnN0YW5jZV9jb3VudBgVIAEoBUID4EEDEhoKDWVuYWJsZV9zYW1wbGUYFiABKAhCA+BBAxIjChZleHRlcm5hbF91cmxfZnJvbV9mbGFnGBcgASgIQgPgQQMSGgoNcmVwbGljYV9jb3VudBgYIAEoBUID4EEDEjIKC3Jlc3RyaWN0aW9uGBkgASgLMhguYnl0ZWJhc2UudjEuUmVzdHJpY3Rpb25CA+BBAxIcCg9kZWZhdWx0X3Byb2plY3QYGiABKAlCA+BBAxIeChF1c2VyX2NvdW50X2luX2lhbRgbIAEoBUID4EEDSgQICRAKSgQIChALSgQIDBANSgQIEBARSgQIERASSgQIDhAPMp0DCg9BY3R1YXRvclNlcnZpY2USnAEKD0dldEFjdHVhdG9ySW5mbxIjLmJ5dGViYXNlLnYxLkdldEFjdHVhdG9ySW5mb1JlcXVlc3QaGS5ieXRlYmFzZS52MS5BY3R1YXRvckluZm8iSdpBAIDqMAGC0+STAjxaJxIlL3YxL3tuYW1lPXdvcmtzcGFjZXMvKn0vYWN0dWF0b3IvaW5mbxIRL3YxL2FjdHVhdG9yL2luZm8SggEKC1NldHVwU2FtcGxlEh8uYnl0ZWJhc2UudjEuU2V0dXBTYW1wbGVSZXF1ZXN0GhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5IjqK6jASYmIucHJvamVjdHMuY3JlYXRlkOowAYLT5JMCGiIYL3YxL2FjdHVhdG9yOnNldHVwU2FtcGxlEmYKC0RlbGV0ZUNhY2hlEh8uYnl0ZWJhc2UudjEuRGVsZXRlQ2FjaGVSZXF1ZXN0GhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5Ih6A6jABgtPkkwIUKhIvdjEvYWN0dWF0b3IvY2FjaGVCqgEKD2NvbS5ieXRlYmFzZS52MUIUQWN0dWF0b3JTZXJ2aWNlUHJvdG9QAVo0Z2l0aHViLmNvbS9ieXRlYmFzZS9ieXRlYmFzZS9iYWNrZW5kL2dlbmVyYXRlZC1nby92MaICA0JYWKoCC0J5dGViYXNlLlYxygILQnl0ZWJhc2VcVjHiAhdCeXRlYmFzZVxWMVxHUEJNZXRhZGF0YeoCDEJ5dGViYXNlOjpWMWIGcHJvdG8z", [file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_empty, file_google_protobuf_timestamp, file_v1_annotation, file_v1_setting_service]);
+ fileDesc("Chl2MS9hY3R1YXRvcl9zZXJ2aWNlLnByb3RvEgtieXRlYmFzZS52MSIUChJTZXR1cFNhbXBsZVJlcXVlc3QiQwoWR2V0QWN0dWF0b3JJbmZvUmVxdWVzdBIpCgRuYW1lGAEgASgJQhv6QRgKFmJ5dGViYXNlLmNvbS9Xb3Jrc3BhY2UiFAoSRGVsZXRlQ2FjaGVSZXF1ZXN0IvoBCgtSZXN0cmljdGlvbhIcCg9kaXNhbGxvd19zaWdudXAYASABKAhCA+BBAxIlChhkaXNhbGxvd19wYXNzd29yZF9zaWduaW4YAiABKAhCA+BBAxJbChRwYXNzd29yZF9yZXN0cmljdGlvbhgDIAEoCzI4LmJ5dGViYXNlLnYxLldvcmtzcGFjZVByb2ZpbGVTZXR0aW5nLlBhc3N3b3JkUmVzdHJpY3Rpb25CA+BBAxIkChdhbGxvd19lbWFpbF9jb2RlX3NpZ25pbhgEIAEoCEID4EEDEiMKFnBhc3N3b3JkX3Jlc2V0X2VuYWJsZWQYBSABKAhCA+BBAyKYBQoMQWN0dWF0b3JJbmZvEhQKB3ZlcnNpb24YASABKAlCA+BBAxIXCgpnaXRfY29tbWl0GAIgASgJQgPgQQMSFQoIcmVhZG9ubHkYAyABKAhCA+BBAxIRCgRzYWFzGAQgASgIQgPgQQMSEQoEaG9zdBgGIAEoCUID4EEDEhEKBHBvcnQYByABKAlCA+BBAxIZCgxleHRlcm5hbF91cmwYCCABKAlCA+BBAxI5ChBsYXN0X2FjdGl2ZV90aW1lGAsgASgLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcEID4EEDEhYKCXdvcmtzcGFjZRgNIAEoCUID4EEDEiAKE3VubGljZW5zZWRfZmVhdHVyZXMYDyADKAlCA+BBAxITCgZkb2NrZXIYEiABKAhCA+BBAxIhChRhY3RpdmF0ZWRfdXNlcl9jb3VudBgTIAEoBUID4EEDEiUKGGFjdGl2YXRlZF9pbnN0YW5jZV9jb3VudBgUIAEoBUID4EEDEiEKFHRvdGFsX2luc3RhbmNlX2NvdW50GBUgASgFQgPgQQMSGgoNZW5hYmxlX3NhbXBsZRgWIAEoCEID4EEDEiMKFmV4dGVybmFsX3VybF9mcm9tX2ZsYWcYFyABKAhCA+BBAxIaCg1yZXBsaWNhX2NvdW50GBggASgFQgPgQQMSMgoLcmVzdHJpY3Rpb24YGSABKAsyGC5ieXRlYmFzZS52MS5SZXN0cmljdGlvbkID4EEDEhwKD2RlZmF1bHRfcHJvamVjdBgaIAEoCUID4EEDEh4KEXVzZXJfY291bnRfaW5faWFtGBsgASgFQgPgQQNKBAgFEAZKBAgJEApKBAgKEAtKBAgMEA1KBAgQEBFKBAgREBJKBAgOEA8ynQMKD0FjdHVhdG9yU2VydmljZRKcAQoPR2V0QWN0dWF0b3JJbmZvEiMuYnl0ZWJhc2UudjEuR2V0QWN0dWF0b3JJbmZvUmVxdWVzdBoZLmJ5dGViYXNlLnYxLkFjdHVhdG9ySW5mbyJJ2kEAgOowAYLT5JMCPFonEiUvdjEve25hbWU9d29ya3NwYWNlcy8qfS9hY3R1YXRvci9pbmZvEhEvdjEvYWN0dWF0b3IvaW5mbxKCAQoLU2V0dXBTYW1wbGUSHy5ieXRlYmFzZS52MS5TZXR1cFNhbXBsZVJlcXVlc3QaFi5nb29nbGUucHJvdG9idWYuRW1wdHkiOorqMBJiYi5wcm9qZWN0cy5jcmVhdGWQ6jABgtPkkwIaIhgvdjEvYWN0dWF0b3I6c2V0dXBTYW1wbGUSZgoLRGVsZXRlQ2FjaGUSHy5ieXRlYmFzZS52MS5EZWxldGVDYWNoZVJlcXVlc3QaFi5nb29nbGUucHJvdG9idWYuRW1wdHkiHoDqMAGC0+STAhQqEi92MS9hY3R1YXRvci9jYWNoZUKqAQoPY29tLmJ5dGViYXNlLnYxQhRBY3R1YXRvclNlcnZpY2VQcm90b1ABWjRnaXRodWIuY29tL2J5dGViYXNlL2J5dGViYXNlL2JhY2tlbmQvZ2VuZXJhdGVkLWdvL3YxogIDQlhYqgILQnl0ZWJhc2UuVjHKAgtCeXRlYmFzZVxWMeICF0J5dGViYXNlXFYxXEdQQk1ldGFkYXRh6gIMQnl0ZWJhc2U6OlYxYgZwcm90bzM", [file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_empty, file_google_protobuf_timestamp, file_v1_annotation, file_v1_setting_service]);
/**
* Describes the message bytebase.v1.SetupSampleRequest.
diff --git a/frontend/tests/e2e/AGENTS.md b/frontend/tests/e2e/AGENTS.md
index d6c452aca8..476ce757af 100644
--- a/frontend/tests/e2e/AGENTS.md
+++ b/frontend/tests/e2e/AGENTS.md
@@ -18,7 +18,7 @@ execSql(env, dbName, `INSERT INTO my_feature_test.t VALUES (1, 'KnownValue')`);
execSql(env, dbName, `DROP SCHEMA IF EXISTS my_feature_test CASCADE`);
```
-**Don't:** Query `information_schema` or scan the demo data to find something usable. Discovery-based tests are fragile — they fail when demo data changes, when tables are empty, or when pre-existing masking hides the values you need.
+**Don't:** Query `information_schema` or scan the sample data to find something usable. Discovery-based tests are fragile — they fail when sample data changes, when tables are empty, or when pre-existing masking hides the values you need.
**Why:** A test that owns its fixtures is deterministic. You know exactly what values exist, what's masked, what's not, and what state is left when the test completes. `masking-exemption.spec.ts:createMaskingTestData` is the canonical example.
@@ -144,8 +144,10 @@ Get the correct port from `getInstance(env.instance)` rather than hardcoding the
## Known Constraints
-- **Demo mode only**: tests run against `--demo` data. Demo data is pre-seeded with sample instances and has a built-in enterprise license.
+- **Sample-data bootstrap**: tests run against data provisioned by `SetupSample` (called from `globalSetup`). The two sample Postgres instances (`test-sample-instance`, `prod-sample-instance`) come up on `PORT+3` / `PORT+4`.
+- **Free plan by default**: the freshly signed-up workspace has no enterprise license. Specs that exercise gated features (masking, classification, etc.) need one. Set `BYTEBASE_E2E_LICENSE` to a license JWT before running and `globalSetup` will install it via `PATCH /v1/subscription/license`; the bootstrap then sets `env.hasLicense = true`. The JWT must be signed by Bytebase's license RSA key — not stored in this repo; ask Bytebase ops for a dev/test license. Without the env var, `env.hasLicense` is false and the bootstrap logs a warning. Enterprise-gated specs must call `test.skip(!env.hasLicense, "…")` in their `beforeAll` (see `masking-exemption.spec.ts` for the pattern) so they're skipped rather than failed on free-plan setups.
- **Serial execution**: `fullyParallel: false` + `workers: 1`. Tests within and across files are sequential.
- **`psql` dependency**: must be on PATH for DDL/DML setup.
- **Unix-like OS only**: the sample Postgres uses Unix sockets in `/tmp`.
-- **Demo admin credentials**: hardcoded `[email protected]` / `12345678` (the well-known demo defaults, not a secret).
+- **Admin credentials**: hardcoded `[email protected]` / `12345678`. The first user created via `/v1/auth/signup` becomes workspace admin, so e2e signs up this fixture.
+- **DBA fixture**: `[email protected]` / `12345678` is created during `globalSetup` and granted `roles/workspaceDBA`. Used as the second approver by plan-detail approval specs. If a spec needs additional users (developer, QA, etc.), provision them the same way in `mode-start-new-bytebase.ts` — don't assume they exist.
diff --git a/frontend/tests/e2e/README.md b/frontend/tests/e2e/README.md
index cfab4e2cad..4f3a6ab2bf 100644
--- a/frontend/tests/e2e/README.md
+++ b/frontend/tests/e2e/README.md
@@ -1,6 +1,6 @@
# E2E Tests
-Playwright-based end-to-end tests for Bytebase. Starts a disposable Bytebase server with `--demo` data, runs tests, tears down.
+Playwright-based end-to-end tests for Bytebase. Starts a disposable Bytebase server, signs up an admin, provisions sample instances, runs tests, tears down.
## Prerequisites
@@ -56,8 +56,8 @@ frontend/tests/e2e/
## How It Works
-1. **`globalSetup`**: Cleans orphaned processes, starts Bytebase with `--demo` + embedded Postgres on a random high port, reconciles sample instance data source ports.
-2. **Setup project** (runs as a Playwright test before all others): Logs in as the demo admin (`[email protected]` / `12345678`), discovers instances/databases/projects, saves auth state to `.auth/state.json`.
+1. **`globalSetup`**: Cleans orphaned processes, starts Bytebase + embedded Postgres on a random high port, signs up the admin (`[email protected]` / `12345678`), and calls `SetupSample` to provision the sample project and instances on `PORT+3` / `PORT+4`.
+2. **Setup project** (runs as a Playwright test before all others): Logs in as the admin, discovers instances/databases/projects, saves auth state to `.auth/state.json`.
3. **Tests run**: Each spec file shares one browser context/page (see [AGENTS.md](./AGENTS.md)). Tests call `loadTestEnv()` to get the API client and env data, create their own test data, and run UI-driven verification.
4. **`globalTeardown`**: Kills the server process group, removes temp data dir and PID file.
diff --git a/frontend/tests/e2e/framework/api-client.ts b/frontend/tests/e2e/framework/api-client.ts
index 743bb6c221..cec163e0d4 100644
--- a/frontend/tests/e2e/framework/api-client.ts
+++ b/frontend/tests/e2e/framework/api-client.ts
@@ -59,6 +59,66 @@ export class BytebaseApiClient {
return token;
}
+ // Signup creates the first user on a fresh server. The first user becomes
+ // workspace admin. Signup always sets cookies (no body token), so callers
+ // should login() afterwards to obtain a body token for non-browser API calls.
+ async signup(email: string, password: string, title: string): Promise<void> {
+ const resp = await fetch(`${this.baseURL}/v1/auth/signup`, {
+ method: "POST",
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify({ email, password, title }),
+ });
+ if (!resp.ok) {
+ throw new Error(`API POST /v1/auth/signup failed (${resp.status}): ${await resp.text()}`);
+ }
+ }
+
+ async setupSample(): Promise<void> {
+ await this.request<unknown>("POST", "/v1/actuator:setupSample", {});
+ }
+
+ // Installs an enterprise license JWT. The JWT must be signed by Bytebase's
+ // license RSA key — generate it out of band; this client only uploads it.
+ async uploadLicense(license: string): Promise<void> {
+ await this.request<unknown>("PATCH", "/v1/subscription/license", { license });
+ }
+
+ // Returns server info — notably the current workspace resource name.
+ async getActuatorInfo(): Promise<{ workspace: string }> {
+ return this.request<{ workspace: string }>("GET", "/v1/actuator/info");
+ }
+
+ // Creates an end-user with the given email/password/title in the caller's
+ // workspace. Caller must be a workspace admin.
+ async createUser(email: string, password: string, title: string): Promise<void> {
+ await this.request<unknown>("POST", "/v1/users", { email, password, title });
+ }
+
+ // Grants `email` the given role at the workspace level by merging a new
+ // binding into the existing IAM policy. Idempotent: if the binding already
+ // includes the member, returns without re-issuing setIamPolicy.
+ async addWorkspaceRoleMember(workspace: string, email: string, role: string): Promise<void> {
+ type Binding = { role: string; members: string[]; condition?: unknown };
+ const policy = await this.request<{ bindings: Binding[]; etag: string }>(
+ "GET",
+ `/v1/${workspace}:getIamPolicy`
+ );
+ const member = `user:${email}`;
+ const bindings: Binding[] = policy.bindings ?? [];
+ const existing = bindings.find((b) => b.role === role);
+ if (existing) {
+ if (existing.members?.includes(member)) return;
+ existing.members = [...(existing.members ?? []), member];
+ } else {
+ bindings.push({ role, members: [member] });
+ }
+ await this.request<unknown>("POST", `/v1/${workspace}:setIamPolicy`, {
+ resource: workspace,
+ policy: { bindings, etag: policy.etag },
+ etag: policy.etag,
+ });
+ }
+
// Discovery
async listInstances() {
return this.request<{ instances: { name: string; engine: string; title: string }[] }>("GET", "/v1/instances?pageSize=100&showDeleted=false");
diff --git a/frontend/tests/e2e/framework/env.ts b/frontend/tests/e2e/framework/env.ts
index 2e004b9f33..fd7fe98fd2 100644
--- a/frontend/tests/e2e/framework/env.ts
+++ b/frontend/tests/e2e/framework/env.ts
@@ -8,6 +8,10 @@ export interface TestEnv {
baseURL: string;
adminEmail: string;
adminPassword: string;
+ // True iff an enterprise license was installed via BYTEBASE_E2E_LICENSE
+ // during globalSetup. Specs that depend on gated features (masking,
+ // classification) should `test.skip(!env.hasLicense, ...)` when false.
+ hasLicense: boolean;
project: string;
instance: string;
instanceId: string;
diff --git a/frontend/tests/e2e/framework/global-setup.ts b/frontend/tests/e2e/framework/global-setup.ts
index ae3c138556..d073738ab2 100644
--- a/frontend/tests/e2e/framework/global-setup.ts
+++ b/frontend/tests/e2e/framework/global-setup.ts
@@ -3,9 +3,9 @@ import { cleanupOrphans, startServer } from "./mode-start-new-bytebase";
async function globalSetup() {
cleanupOrphans();
- const { baseURL, adminEmail, adminPassword } = await startServer();
+ const { baseURL, adminEmail, adminPassword, hasLicense } = await startServer();
saveTestEnv({
- baseURL, adminEmail, adminPassword,
+ baseURL, adminEmail, adminPassword, hasLicense,
project: "", instance: "", instanceId: "", database: "", databaseId: "",
});
}
diff --git a/frontend/tests/e2e/framework/mode-start-new-bytebase.ts b/frontend/tests/e2e/framework/mode-start-new-bytebase.ts
index a7cf16b558..a61b5b37c6 100644
--- a/frontend/tests/e2e/framework/mode-start-new-bytebase.ts
+++ b/frontend/tests/e2e/framework/mode-start-new-bytebase.ts
@@ -8,10 +8,16 @@ import { BytebaseApiClient } from "./api-client";
const PID_FILE = "/tmp/bytebase-e2e-pid";
const DEFAULT_PORT = 18234;
-const DEFAULT_TIMEOUT = 300000; // 5 minutes — server startup includes embedded Postgres + migrations + demo data
-// Demo mode pre-populates this admin user with workspace admin role
+const DEFAULT_TIMEOUT = 300000; // 5 minutes — server startup includes embedded Postgres + migrations + sample-instance bring-up
const ADMIN_EMAIL = "[email protected]";
-const ADMIN_PASSWORD = "12345678"; // NOSONAR: fixed demo account password
+const ADMIN_PASSWORD = "12345678"; // NOSONAR: e2e fixture
+const ADMIN_TITLE = "Demo";
+// DBA fixture used as the second approver by plan-detail approval specs.
+// Previously seeded by the demo dump; now provisioned explicitly post-signup.
+const DBA_EMAIL = "[email protected]";
+const DBA_PASSWORD = "12345678"; // NOSONAR: e2e fixture
+const DBA_TITLE = "DBA1";
+const DBA_ROLE = "roles/workspaceDBA";
let serverProcess: child_process.ChildProcess | undefined;
let tempDir: string | undefined;
@@ -63,11 +69,54 @@ function checkPort(port: number): Promise<boolean> {
});
}
-// Bytebase --demo allocates 4 ports based on the main --port value:
+// True when something is actively listening on the port. Inverse of checkPort.
+function isPortListening(port: number): Promise<boolean> {
+ return new Promise((resolve) => {
+ const socket = new net.Socket();
+ socket.setTimeout(500);
+ socket.once("connect", () => {
+ socket.destroy();
+ resolve(true);
+ });
+ socket.once("timeout", () => {
+ socket.destroy();
+ resolve(false);
+ });
+ socket.once("error", () => {
+ socket.destroy();
+ resolve(false);
+ });
+ socket.connect(port, "127.0.0.1");
+ });
+}
+
+// Poll until predicate succeeds or deadline passes. On timeout, throws with
+// the last underlying error so the cause isn't swallowed.
+async function pollUntil(
+ predicate: () => Promise<void>,
+ deadline: number,
+ intervalMs: number,
+ timeoutMessage: string
+): Promise<void> {
+ let lastError: unknown;
+ while (Date.now() < deadline) {
+ try {
+ await predicate();
+ return;
+ } catch (err) {
+ lastError = err;
+ }
+ await new Promise((r) => setTimeout(r, intervalMs));
+ }
+ const cause = lastError instanceof Error ? lastError.message : String(lastError ?? "no error captured");
+ throw new Error(`${timeoutMessage} Last error: ${cause}`);
+}
+
+// Bytebase allocates 4 ports based on the main --port value:
// PORT — main HTTP server
// PORT + 2 — embedded metadata Postgres
-// PORT + 3 — test-sample-instance Postgres
-// PORT + 4 — prod-sample-instance Postgres
+// PORT + 3 — test-sample-instance Postgres (provisioned via SetupSample)
+// PORT + 4 — prod-sample-instance Postgres (provisioned via SetupSample)
// All four must be free before we commit to a base port.
export async function findAvailablePort(): Promise<number> {
let port = DEFAULT_PORT;
@@ -84,6 +133,7 @@ export async function startServer(): Promise<{
baseURL: string;
adminEmail: string;
adminPassword: string;
+ hasLicense: boolean;
}> {
// Check both CWD-relative and repo-root-relative paths
const candidates = [
@@ -106,7 +156,7 @@ export async function startServer(): Promise<{
const child = child_process.spawn(
binPath,
- ["--port", String(port), "--data", tempDir, "--demo"],
+ ["--port", String(port), "--data", tempDir],
{
detached: true,
stdio: "ignore",
@@ -128,60 +178,99 @@ export async function startServer(): Promise<{
const deadline = Date.now() + timeout;
// Phase 1: Poll /healthz
- while (Date.now() < deadline) {
- try {
+ await pollUntil(
+ async () => {
const resp = await fetch(`${baseURL}/healthz`);
- if (resp.ok) break;
- } catch {
- /* not ready */
- }
- await new Promise((r) => setTimeout(r, 500));
- }
- if (Date.now() >= deadline) {
- throw new Error(
- `Bytebase server did not become healthy within ${timeout}ms`
- );
- }
+ if (!resp.ok) throw new Error(`/healthz returned ${resp.status}`);
+ },
+ deadline,
+ 500,
+ `Bytebase server did not become healthy within ${timeout}ms.`
+ );
- // Phase 2: Retry login until success (demo admin is pre-populated)
+ // Phase 2: Signup the first admin. Retry while the server finishes
+ // migrating its metadata schema (signup returns 4xx until the principal
+ // table exists). The first signup becomes workspace admin automatically.
const api = new BytebaseApiClient({ baseURL });
- while (Date.now() < deadline) {
- try {
- await api.login(ADMIN_EMAIL, ADMIN_PASSWORD);
- break;
- } catch {
- /* not ready — demo data still loading */
- }
- await new Promise((r) => setTimeout(r, 500));
- }
- if (Date.now() >= deadline) {
- throw new Error(
- "Failed to login as demo admin. Server may not be fully initialized."
+ await pollUntil(
+ () => api.signup(ADMIN_EMAIL, ADMIN_PASSWORD, ADMIN_TITLE),
+ deadline,
+ 500,
+ "Failed to signup admin. Server may not be fully initialized."
+ );
+
+ // Phase 3: Login to obtain a body token for subsequent API calls.
+ // Signup sets cookies only; this api-client uses bearer tokens.
+ await api.login(ADMIN_EMAIL, ADMIN_PASSWORD);
+
+ // Phase 3b: Install an enterprise license if one was provided via
+ // BYTEBASE_E2E_LICENSE. Specs that exercise gated features (masking,
+ // classification) require this; specs read env.hasLicense and skip
+ // themselves when it's false. See frontend/tests/e2e/AGENTS.md for how
+ // to obtain a dev license.
+ const license = process.env.BYTEBASE_E2E_LICENSE?.trim();
+ const hasLicense = Boolean(license);
+ if (license) {
+ await api.uploadLicense(license);
+ } else {
+ // eslint-disable-next-line no-console
+ console.warn(
+ "[e2e bootstrap] BYTEBASE_E2E_LICENSE not set — workspace will run on the free plan. Enterprise-gated specs will skip themselves."
);
}
- // Reconcile sample instance data source ports.
- // The demo dump has ports from when it was captured (e.g. 8083/8084).
- // The actual sample Postgres runs on PORT+3/PORT+4.
- const sampleInstances = [
- { id: "test-sample-instance", port: String(port + 3) },
- { id: "prod-sample-instance", port: String(port + 4) },
- ];
- for (const si of sampleInstances) {
- try {
- const instance = await api.getInstance(`instances/${si.id}`);
- for (const ds of instance.dataSources ?? []) {
- if (ds.port !== si.port) {
- console.log(`Reconciling ${si.id} data source port: ${ds.port} → ${si.port}`);
- await api.updateInstanceDataSource(`instances/${si.id}`, ds.id, si.port);
- }
+ // Phase 3c: Provision the DBA fixture user that plan-detail approval
+ // specs use as the second approver. The previous demo dump pre-seeded
+ // additional users (dba1/dev1/qa1); now we create only what's actually
+ // referenced. Add more fixtures here if new specs need them.
+ const { workspace } = await api.getActuatorInfo();
+ await api.createUser(DBA_EMAIL, DBA_PASSWORD, DBA_TITLE);
+ await api.addWorkspaceRoleMember(workspace, DBA_EMAIL, DBA_ROLE);
+
+ // Phase 4: Provision the sample project + instances on PORT+3 / PORT+4.
+ // SetupSample is async on the server but returns immediately; sample
+ // Postgres instances come up shortly after.
+ await api.setupSample();
+
+ // Wait for both sample instances to register before handing control back —
+ // tests rely on discovery finding them via listInstances().
+ const requiredInstances = new Set([
+ "instances/test-sample-instance",
+ "instances/prod-sample-instance",
+ ]);
+ await pollUntil(
+ async () => {
+ const { instances } = await api.listInstances();
+ const found = new Set(instances?.map((i) => i.name) ?? []);
+ const missing = [...requiredInstances].filter((name) => !found.has(name));
+ if (missing.length > 0) {
+ throw new Error(`Missing sample instances: ${missing.join(", ")}`);
}
- } catch (err) {
- console.warn(`Failed to reconcile instance ${si.id}:`, err);
- }
- }
+ },
+ deadline,
+ 500,
+ "Sample instances did not appear after SetupSample."
+ );
+
+ // Phase 5: Wait for the sample Postgres backings to accept TCP connections.
+ // listInstances() above only proves the metadata rows exist; the embedded
+ // postgres processes come up shortly after. Tests that psql into these
+ // instances race against startup without this probe.
+ const samplePorts = [port + 3, port + 4];
+ await pollUntil(
+ async () => {
+ const listening = await Promise.all(samplePorts.map(isPortListening));
+ const downIdx = listening.findIndex((l) => !l);
+ if (downIdx !== -1) {
+ throw new Error(`Sample Postgres port ${samplePorts[downIdx]} not accepting connections`);
+ }
+ },
+ deadline,
+ 500,
+ "Sample Postgres instances did not start listening on PORT+3 / PORT+4."
+ );
- return { baseURL, adminEmail: ADMIN_EMAIL, adminPassword: ADMIN_PASSWORD };
+ return { baseURL, adminEmail: ADMIN_EMAIL, adminPassword: ADMIN_PASSWORD, hasLicense };
}
export function stopServer(): void {
diff --git a/frontend/tests/e2e/framework/setup-project.ts b/frontend/tests/e2e/framework/setup-project.ts
index fcbb5f5e67..ec24f5f92a 100644
--- a/frontend/tests/e2e/framework/setup-project.ts
+++ b/frontend/tests/e2e/framework/setup-project.ts
@@ -12,16 +12,9 @@ setup("authenticate and discover", async ({ page }) => {
// Browser login for auth cookies
await page.goto(`${env.baseURL}/auth/signin`);
if (page.url().includes("/auth")) {
- const emailField = page.getByRole("textbox", { name: /email/i });
- const hasDemoLogin = await emailField.count() === 0;
-
- if (hasDemoLogin) {
- await page.getByRole("button", { name: "Sign in", exact: true }).click();
- } else {
- await emailField.fill(env.adminEmail);
- await page.getByRole("textbox", { name: /password/i }).fill(env.adminPassword);
- await page.getByRole("button", { name: "Sign in", exact: true }).click();
- }
+ await page.getByRole("textbox", { name: /email/i }).fill(env.adminEmail);
+ await page.getByRole("textbox", { name: /password/i }).fill(env.adminPassword);
+ await page.getByRole("button", { name: "Sign in", exact: true }).click();
await expect(page).not.toHaveURL(/\/auth/, { timeout: 60000 });
}
diff --git a/frontend/tests/e2e/masking-exemption/masking-exemption.spec.ts b/frontend/tests/e2e/masking-exemption/masking-exemption.spec.ts
index 47b17a8a02..503d4fa876 100644
--- a/frontend/tests/e2e/masking-exemption/masking-exemption.spec.ts
+++ b/frontend/tests/e2e/masking-exemption/masking-exemption.spec.ts
@@ -186,6 +186,12 @@ async function revokeAllExemptions(): Promise<void> {
test.beforeAll(async ({ browser }) => {
env = loadTestEnv();
+ // Masking and classification are enterprise-gated; without a license the
+ // policies cannot be created, so skip the entire suite rather than failing.
+ test.skip(
+ !env.hasLicense,
+ "BYTEBASE_E2E_LICENSE not set — masking specs require an enterprise license"
+ );
projectId = env.project.split("/").pop()!;
await env.api.login(env.adminEmail, env.adminPassword);
diff --git a/proto/gen/grpc-doc/openapi.yaml b/proto/gen/grpc-doc/openapi.yaml
index f02e6c515d..1173055e7f 100644
--- a/proto/gen/grpc-doc/openapi.yaml
+++ b/proto/gen/grpc-doc/openapi.yaml
@@ -16847,11 +16847,6 @@ components:
title: saas
description: Whether the Bytebase instance is running in SaaS mode where some features cannot be edited by users.
readOnly: true
- demo:
- type: boolean
- title: demo
- description: Whether the Bytebase instance is running in demo mode.
- readOnly: true
host:
type: string
title: host
diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.md
index 6ddb74c9e8..8f4dccae22 100644
--- a/proto/gen/grpc-doc/v1/README.md
+++ b/proto/gen/grpc-doc/v1/README.md
@@ -6820,7 +6820,6 @@ Actuator concept is similar to the Spring Boot Actuator.
| git_commit | [string](#string) | | The git commit hash of the build. |
| readonly | [bool](#bool) | | Whether the Bytebase instance is running in read-only mode. |
| saas | [bool](#bool) | | Whether the Bytebase instance is running in SaaS mode where some features cannot be edited by users. |
-| demo | [bool](#bool) | | Whether the Bytebase instance is running in demo mode. |
| host | [string](#string) | | The host address of the Bytebase instance. |
| port | [string](#string) | | The port number of the Bytebase instance. |
| external_url | [string](#string) | | The external URL where users or webhook callbacks access Bytebase. |
diff --git a/proto/gen/grpc-doc/v1/index.html b/proto/gen/grpc-doc/v1/index.html
index 33e5a3c997..6b7252c714 100644
--- a/proto/gen/grpc-doc/v1/index.html
+++ b/proto/gen/grpc-doc/v1/index.html
@@ -19820,13 +19820,6 @@ Permissions required: bb.settings.set</p></td>
<td><p>Whether the Bytebase instance is running in SaaS mode where some features cannot be edited by users. </p></td>
</tr>
- <tr>
- <td>demo</td>
- <td><a href="#bool">bool</a></td>
- <td></td>
- <td><p>Whether the Bytebase instance is running in demo mode. </p></td>
- </tr>
-
<tr>
<td>host</td>
<td><a href="#string">string</a></td>
diff --git a/proto/v1/v1/actuator_service.proto b/proto/v1/v1/actuator_service.proto
index b6017d8623..368c83ee14 100644
--- a/proto/v1/v1/actuator_service.proto
+++ b/proto/v1/v1/actuator_service.proto
@@ -83,7 +83,7 @@ message Restriction {
// System information and configuration for the Bytebase instance.
// Actuator concept is similar to the Spring Boot Actuator.
message ActuatorInfo {
- reserved 9, 10, 12, 16, 17, 14;
+ reserved 5, 9, 10, 12, 16, 17, 14;
// The Bytebase server version.
string version = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
@@ -97,9 +97,6 @@ message ActuatorInfo {
// Whether the Bytebase instance is running in SaaS mode where some features cannot be edited by users.
bool saas = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
- // Whether the Bytebase instance is running in demo mode.
- bool demo = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
-
// The host address of the Bytebase instance.
string host = 6 [(google.api.field_behavior) = OUTPUT_ONLY];
diff --git a/scripts/Dockerfile b/scripts/Dockerfile
index 67449d4d3e..242e4dfd1e 100644
--- a/scripts/Dockerfile
+++ b/scripts/Dockerfile
@@ -13,7 +13,6 @@ RUN pnpm --dir ./frontend release-docker
FROM golang:1.26.3-alpine3.23 AS backend
ARG VERSION
ARG GIT_COMMIT
-ARG RELEASE="release"
ADD go.mod go.sum /
@@ -29,7 +28,7 @@ COPY --from=frontend /frontend-build/frontend/dist ./backend/server/dist
# -ldflags="-w -s" means omit DWARF symbol table and the symbol table and debug information
RUN CC=clang go build \
- --tags "${RELEASE},embed_frontend,docker" \
+ --tags "release,embed_frontend,docker" \
-ldflags="-extldflags '-Wl,-z,stack-size=0x1000000' -w -s -X 'github.com/bytebase/bytebase/backend/bin/server/cmd.version=${VERSION}' -X 'github.com/bytebase/bytebase/backend/bin/server/cmd.gitcommit=${GIT_COMMIT}'" \
-o bytebase ./backend/bin/server/main.go
@@ -45,8 +44,6 @@ LABEL org.opencontainers.image.revision=${GIT_COMMIT}
RUN addgroup --gid 113 --system bytebase && adduser --uid 113 --system bytebase && adduser bytebase bytebase
# Directory to store the data, which can be referenced as the mounting point.
RUN mkdir -p /var/opt/bytebase
-# Directory to store the demo data.
-RUN mkdir -p /var/opt/bytebase/pgdata-demo
RUN apk update
RUN apk add --no-cache gnupg curl psmisc procps ncurses krb5
# Install postgresql.