### Copy .env.example to .env Source: https://github.com/dbdiff/dbdiff/blob/master/DOCKER.md Initial setup step to create a local .env file from the example, which can then be edited to customize ports, database credentials, and timeouts. ```bash cp .env.example .env # Edit .env to customize ports, database credentials, timeouts, etc. ``` -------------------------------- ### Install Podman on macOS via Homebrew Source: https://github.com/dbdiff/dbdiff/blob/master/DOCKER.md Installs Podman and podman-compose via Homebrew, then initializes and starts the Podman machine. ```bash brew install podman podman-compose podman machine init && podman machine start ``` -------------------------------- ### Start all services Source: https://github.com/dbdiff/dbdiff/blob/master/DOCKER.md Commands to start all databases and PHPMyAdmin instances, or a specific combination. ```bash # Start all databases and PHPMyAdmin instances docker-compose up -d # Or start specific combination docker-compose up -d db-mysql80 phpmyadmin-mysql80 cli-php83-mysql80 ``` -------------------------------- ### Install @dbdiff/cli via npm, npx, or GitHub Packages Source: https://github.com/dbdiff/dbdiff/blob/master/packages/@dbdiff/cli/README.md Installation commands for @dbdiff/cli: global install, one-off via npx, project dev dependency, and installation from GitHub Packages mirror registry. ```bash # Global install npm install -g @dbdiff/cli # One-off via npx npx @dbdiff/cli --help # Project dev dependency npm install --save-dev @dbdiff/cli # Install from GitHub Packages (mirror registry) npm install -g @dbdiff/cli --registry=https://npm.pkg.github.com ``` -------------------------------- ### Install pre-built Linux binary Source: https://github.com/dbdiff/dbdiff/blob/master/README.md Make the downloaded Linux x64 binary executable, move it to /usr/local/bin, and verify the installation with dbdiff --version. ```bash chmod +x dbdiff-linux-x64 sudo mv dbdiff-linux-x64 /usr/local/bin/dbdiff dbdiff --version ``` -------------------------------- ### Install Podman on Ubuntu/Debian Source: https://github.com/dbdiff/dbdiff/blob/master/DOCKER.md Installs Podman and podman-compose on Ubuntu or Debian systems using apt-get. ```bash sudo apt-get install -y podman podman-compose ``` -------------------------------- ### Install dbdiff CLI via npm Source: https://github.com/dbdiff/dbdiff/blob/master/README.md Installs the CLI globally via npm and verifies the installation. The correct platform binary is selected automatically at install time; supported platforms are Linux x64/arm64 (glibc + musl), macOS x64/arm64, and Windows x64/arm64. ```bash npm install -g @dbdiff/cli dbdiff --version ``` -------------------------------- ### Install DBDiff from source via git clone Source: https://github.com/dbdiff/dbdiff/blob/master/README.md Clones the DBDiff repository and installs Composer dependencies with optimized autoloader. After this, continue with the Setup section. ```bash git clone https://github.com/DBDiff/DBDiff.git cd DBDiff composer install --optimize-autoloader ``` -------------------------------- ### Using the Start Script Source: https://github.com/dbdiff/dbdiff/blob/master/DOCKER.md Commands to test PHP/MySQL combinations with the start.sh script, including parallel, record, fast, watch, and interactive modes. ```bash # Test specific PHP/MySQL combination ./start.sh 8.3 8.0 # Test all combinations (sequentially) ./start.sh all all # HIGH PERFORMANCE: Test all combinations in parallel ./start.sh all all --parallel # RECORD MODE: Update expected test fixtures for all versions ./start.sh all all --record # FAST RESTART: Skip heavy Docker cleanup for faster iterations ./start.sh 8.3 8.0 --fast # Watch mode - single combination ./start.sh 8.3 8.0 --watch # Interactive mode - select from menus ./start.sh ``` -------------------------------- ### Start specific database and PHPMyAdmin Source: https://github.com/dbdiff/dbdiff/blob/master/DOCKER.md Commands to start MySQL 8.0, 8.4, or 9.3 with PHPMyAdmin using Docker Compose. ```bash # Start MySQL 8.0 with PHPMyAdmin docker-compose up -d db-mysql80 phpmyadmin-mysql80 # Start MySQL 8.4 with PHPMyAdmin docker-compose up -d db-mysql84 phpmyadmin-mysql84 # Start MySQL 9.3 with PHPMyAdmin docker-compose up -d db-mysql93 phpmyadmin-mysql93 ``` -------------------------------- ### Install dbdiff CLI from GitHub Packages mirror Source: https://github.com/dbdiff/dbdiff/blob/master/README.md Installs the CLI from the GitHub Packages mirror when npmjs.org is unavailable. ```bash npm install -g @dbdiff/cli --registry=https://npm.pkg.github.com ``` -------------------------------- ### Use podman-compose instead of docker-compose Source: https://github.com/dbdiff/dbdiff/blob/master/DOCKER.md Shows how to substitute podman-compose for docker-compose in commands, including starting PostgreSQL, running e2e tests, and stopping services. ```bash # Start PostgreSQL and run Postgres e2e tests podman-compose up -d db-postgres16 podman-compose run --rm \ -e DB_HOST_POSTGRES=db-postgres16 \ cli-php83-postgres16 \ bash -c "scripts/run-tests.sh --postgres db-postgres16" # Stop everything podman-compose down ``` -------------------------------- ### Install Podman on Windows via winget Source: https://github.com/dbdiff/dbdiff/blob/master/DOCKER.md Installs Podman and optionally Podman Desktop (GUI) on Windows using winget. ```powershell winget install RedHat.Podman winget install RedHat.Podman-Desktop # optional GUI ``` -------------------------------- ### Install dbdiff PHAR Source: https://github.com/dbdiff/dbdiff/blob/master/README.md Downloads dbdiff.phar from GitHub Releases, makes it executable, moves it to /usr/local/bin, and verifies the installation. Requires PHP ≥ 8.1. ```bash chmod +x dbdiff.phar sudo mv dbdiff.phar /usr/local/bin/dbdiff dbdiff --version ``` -------------------------------- ### Configure dbdiff.yml for diff and migration runner Source: https://github.com/dbdiff/dbdiff/blob/master/README.md Complete dbdiff.yml configuration for both the diff command and migration runner. Includes server connection settings, driver selection (mysql, pgsql, sqlite), filtering options with glob support, and migration database/history table settings. Copy dbdiff.yml.example to get started. ```yaml # ── Diff command (./dbdiff server1.db:server2.db) ───────────────────────── server1: user: user password: password port: 3306 # MySQL: 3306 | PostgreSQL: 5432 host: localhost server2: user: user password: password port: 3306 host: host2 driver: mysql # mysql | pgsql | sqlite type: all include: all nocomments: true # ── Filtering ───────────────────────────────────────────────────────────── # Include list — only these tables are diffed (supports globs: *, ?). # When set, only matching tables are included. Omit to diff all tables. # tables: # - users # - orders # - wp_* # Exclude list — skip these tables entirely (supports globs). tablesToIgnore: - table1 - table2 # Exclude from data diff only — schema is still diffed (supports globs). # tablesDataToIgnore: # - audit_log # - event_stream # Per-table column exclusion (keys support globs: *, ?). fieldsToIgnore: table1: - field1 - field2 # Per-table row filtering — skip rows matching a column-value regex. # rowsToIgnore: # wp_options: # - { column: option_name, pattern: "_transient_.*" } # - { column: option_name, pattern: "_site_transient_.*" } # sessions: # - { column: status, pattern: "expired|archived" } # Per-table scope override: schema, data, or all (default). # tableScope: # audit_log: schema # config: data # ── Migration runner (dbdiff migration:up) ──────────────────────────────── database: driver: mysql host: localhost port: 3306 name: mydb user: root password: secret migrations: dir: ./migrations history_table: _dbdiff_migrations ``` -------------------------------- ### Usage examples for dbdiff CLI Source: https://github.com/dbdiff/dbdiff/blob/master/packages/@dbdiff/cli/README.md Examples of using the dbdiff command: schema diff between two MySQL databases, full diff with Supabase Postgres, and generating migration files. ```bash # Schema diff between two MySQL databases dbdiff server1.db1:server2.db2 # Full diff (schema + data) with Supabase Postgres dbdiff --supabase --server1=user:pass@host:5432 db1:db2 # Generate migration files dbdiff --type=both --output=migrations/ server1.db1:server2.db2 ``` -------------------------------- ### Install DBDiff globally via Composer Source: https://github.com/dbdiff/dbdiff/blob/master/README.md Installs DBDiff globally via Composer, making the dbdiff command available system-wide. ```bash composer global require "dbdiff/dbdiff:@dev" ``` -------------------------------- ### Run DBDiff with PostgreSQL Source: https://github.com/dbdiff/dbdiff/blob/master/DOCKER.md Commands to start the PostgreSQL service and run a Postgres diff with PHP 8.3. ```bash # Start the PostgreSQL service docker-compose up -d db-postgres16 # Run a Postgres diff with PHP 8.3 docker-compose run --rm cli-php83-postgres16 \ bash -c "./dbdiff --driver=pgsql \ --server1=dbdiff:dbdiff@db-postgres16:5432 \ server1.mydb_staging:server1.mydb_production" ``` -------------------------------- ### Run dbdiff via Docker Source: https://github.com/dbdiff/dbdiff/blob/master/README.md Pulls and runs the pre-built Docker image. No local PHP installation is required. The image is multi-arch (linux/amd64 + linux/arm64) and published to GHCR on every release. ```bash docker pull ghcr.io/dbdiff/dbdiff docker run --rm ghcr.io/dbdiff/dbdiff --version docker run --rm ghcr.io/dbdiff/dbdiff --driver=mysql \ --server1=user:pass@host:3306 server1.mydb:server1.mydb ``` -------------------------------- ### Build dbdiff Docker images locally Source: https://github.com/dbdiff/dbdiff/blob/master/README.md Builds the dbdiff Docker images locally. The slim image requires dist/dbdiff.phar (run `vendor/bin/box compile` first); the full image uses a Composer install from source and does not need a PHAR. Replace 'docker' with 'podman' if using Podman. ```bash # Slim image (requires dist/dbdiff.phar — run `vendor/bin/box compile` first) # Replace 'docker' with 'podman' if using Podman docker build -f docker/Dockerfile.slim -t dbdiff:slim . docker run --rm dbdiff:slim --version # Full image (Composer install from source — no PHAR needed) docker build -f docker/Dockerfile -t dbdiff:full . ``` -------------------------------- ### Supabase diff with local stack auto-fill Source: https://github.com/dbdiff/dbdiff/blob/master/README.md When inside a Supabase project with supabase/config.toml and the local stack running (supabase start), --server1-url is resolved automatically from `supabase status`. Only the remote URL needs to be supplied. ```bash # Only supply the remote (production) URL — local stack fills in automatically ./dbdiff diff --server2-url='postgres://user:pass@db.yyyy.supabase.co:5432/postgres' ``` -------------------------------- ### Configure DBDiff filtering with tables, tablesToIgnore, fieldsToIgnore, rowsToIgnore, and tableScope Source: https://github.com/dbdiff/dbdiff/blob/master/README.md Configuration example for DBDiff filtering. All list values support glob patterns (`*` matches any characters, `?` matches a single character). The include list is applied first, then the exclude list narrows further. `tablesDataToIgnore` removes tables from data comparison only, and `tableScope` can override a table to `schema`, `data`, or `all`. ```yaml # Only diff tables matching these patterns tables: - users - orders - wp_* # Skip these tables entirely tablesToIgnore: - cache_* - _dbdiff_migrations # Skip data diff for these (schema is still compared) tablesDataToIgnore: - audit_log # Exclude columns per table (keys support globs) fieldsToIgnore: users: - updated_at - last_login wp_*: - ID # Skip rows matching column-value regex rowsToIgnore: wp_options: - { column: option_name, pattern: "_transient_.*" } sessions: - { column: status, pattern: "expired|archived" } # Override scope per table: schema | data | all tableScope: audit_log: schema config: data ``` -------------------------------- ### DBDiff destructive changes output Source: https://github.com/dbdiff/dbdiff/blob/master/README.md Example output shown when DBDiff detects destructive changes. It lists errors for DROP TABLE and DROP COLUMN, a warning for DROP VIEW, and instructs to re-run with --allow-destructive to generate the migration anyway. ```text Destructive changes detected — 2 destructive error(s), 1 warning(s): [error] drop-table: table `legacy_sessions` → Use --allow-destructive to proceed, or archive the table instead. [error] drop-column: column `users`.`legacy_token` [warning] drop-view: view `active_users` Re-run with --allow-destructive to generate the migration anyway. ``` -------------------------------- ### Run DBDiff with SQLite driver Source: https://github.com/dbdiff/dbdiff/blob/master/README.md Command to run DBDiff against SQLite databases. Use --driver=sqlite and pass the file path as the database name. SQLite 3.x is supported (any version supported by the installed pdo_sqlite PHP extension). ```bash ./dbdiff --driver=sqlite server1./path/to/source.db:server1./path/to/target.db ``` -------------------------------- ### DBDiff schema diff log output Source: https://github.com/dbdiff/dbdiff/blob/master/README.md Example log output from DBDiff's two-pass schema diffing. The pre-scan reports how many tables were skipped because their schema hashes matched on both sides; the batch fetch reports how many changed tables were loaded and the total number of queries used (fixed at 7 per side for PostgreSQL). ```text ℹ Pre-scan: skipped 284 / 291 unchanged tables ``` ```text ℹ Batch schema fetch: loaded 7 changed table(s) in 14 queries ``` -------------------------------- ### Cross-version testing with start.sh Source: https://github.com/dbdiff/dbdiff/blob/master/README.md Run DBDiff locally against any combination of PHP and MySQL. Use `./start.sh 8.3 8.0` for a single combination or `./start.sh all all --parallel` to run all 16 combinations in parallel. ```bash # Single combination ./start.sh 8.3 8.0 # All 16 combinations in parallel ./start.sh all all --parallel ``` -------------------------------- ### MySQL Flyway format with output path Source: https://github.com/dbdiff/dbdiff/blob/master/README.md Generates a Flyway-format migration with a description and includes all changes, writing the SQL files to the specified output directory. ```bash ./dbdiff --format=flyway --description=add_users --include=all \ server1.db1:server2.db2 --output=./sql/ ``` -------------------------------- ### Run dbdiff via Podman Source: https://github.com/dbdiff/dbdiff/blob/master/README.md Pulls and runs the pre-built image using Podman as a drop-in replacement for Docker. Podman on Linux runs rootless by default and requires no daemon. ```bash podman pull ghcr.io/dbdiff/dbdiff podman run --rm ghcr.io/dbdiff/dbdiff --version podman run --rm ghcr.io/dbdiff/dbdiff --driver=mysql \ --server1=user:pass@host:3306 server1.mydb:server1.mydb ``` -------------------------------- ### Install DBDiff as a Composer project dependency Source: https://github.com/dbdiff/dbdiff/blob/master/README.md Adds DBDiff as a project dependency using Composer. Use this when you want to include DBDiff in your own project. ```bash composer require "dbdiff/dbdiff:@dev" ``` -------------------------------- ### Run PostgreSQL Conformance Tests Source: https://github.com/dbdiff/dbdiff/blob/master/DOCKER.md Run the conformance test script against a live PostgreSQL server. Requires the specified host, port, user, and password. ```bash ./scripts/pg-conformance/run.sh --host=127.0.0.1 --port=5432 --user=dbdiff --pass=rootpass ``` -------------------------------- ### SQLite migration UP: create views and trigger Source: https://github.com/dbdiff/dbdiff/blob/master/tests/expected/programmable_objects_sqlite.txt Migration up script that drops old objects, creates a new view 'product_names', recreates 'expensive_products' with a price threshold of 10, and adds a trigger to update 'updated_at' on product updates. ```sql DROP VIEW IF EXISTS "old_report"; DROP TRIGGER IF EXISTS "trg_old_audit"; CREATE VIEW "product_names" AS SELECT "id", "name" FROM "products"; DROP VIEW IF EXISTS "expensive_products"; CREATE VIEW "expensive_products" AS SELECT "id", "name", "price" FROM "products" WHERE "price" > 10; CREATE TRIGGER "trg_products_updated" BEFORE UPDATE ON "products" FOR EACH ROW BEGIN UPDATE "products" SET "updated_at" = datetime('now') WHERE "id" = NEW."id"; END; ``` -------------------------------- ### Encode password with scripts/encode-password.sh Source: https://github.com/dbdiff/dbdiff/blob/master/README.md Uses the included bash script to encode a password when dbdiff is not yet installed. This script requires no Python, Node, or PHP. ```bash PASS=$(scripts/encode-password.sh 'my$ecret#pass@word%123') ``` -------------------------------- ### Prefer podman-compose when docker-compose is unavailable Source: https://github.com/dbdiff/dbdiff/blob/master/DOCKER.md Shows how to force the start.sh script to use podman-compose by setting the COMPOSE_CMD environment variable. ```bash # Prefer podman-compose when docker-compose is unavailable COMPOSE_CMD=podman-compose ./start.sh 8.3 8.0 ``` -------------------------------- ### Manual release commands for DBDiff Source: https://github.com/dbdiff/dbdiff/blob/master/README.md Manual release commands for building the PHAR, tagging, building Linux binaries (requires Podman or Docker), uploading assets to an existing GitHub Release, and updating the Homebrew tap formula. ```bash # Build PHAR + tag scripts/release.sh v2.1.0 git push origin v2.1.0 # Build Linux binaries locally (requires Podman or Docker) SKIP_PHAR=1 scripts/release-binaries.sh 2.1.0 # Upload assets to an existing GitHub Release gh release upload v2.1.0 --clobber \ dist/dbdiff.phar \ packages/@dbdiff/cli-linux-x64/dbdiff \ packages/@dbdiff/cli-linux-x64-musl/dbdiff \ packages/@dbdiff/cli-linux-arm64/dbdiff \ packages/@dbdiff/cli-linux-arm64-musl/dbdiff # Update the Homebrew tap formula scripts/update-homebrew-formula.sh 2.1.0 ../homebrew-dbdiff ``` -------------------------------- ### Build DBDiff PHAR with Composer and Box Source: https://github.com/dbdiff/dbdiff/blob/master/README.md Builds the DBDiff PHAR locally from source. Requires Composer and Box. The output is `dist/dbdiff.phar`, which can be renamed and moved to `/usr/local/bin/dbdiff`. `box.json` is pre-configured with GZ compression and `check-requirements: false` for compatibility with the static micro SAPI runtime. ```bash composer install vendor/bin/box compile ``` -------------------------------- ### DSN URLs diff with --server1-url and --server2-url Source: https://github.com/dbdiff/dbdiff/blob/master/README.md Runs a diff using full DSN URLs for both servers. The --server1-url and --server2-url flags accept PostgreSQL connection strings. ```bash ./dbdiff diff \ --server1-url='postgres://user:pass@db.xxxx.supabase.co:5432/postgres' \ --server2-url='postgres://user:pass@db.yyyy.supabase.co:5432/postgres' ``` -------------------------------- ### Supabase diff with --supabase flag Source: https://github.com/dbdiff/dbdiff/blob/master/README.md Runs a diff against a Supabase-hosted PostgreSQL database using the --supabase flag. The --server1 flag provides the connection string. ```bash ./dbdiff --supabase --server1=postgres:pass@db.xxxx.supabase.co:5432 \ server1.staging:server1.production ``` -------------------------------- ### diff (default command) Source: https://github.com/dbdiff/dbdiff/blob/master/README.md Compares two databases and generates a migration file. Supports various flags for connection, driver, format, and filtering. Flags override settings in the .dbdiff config file. ```APIDOC ## diff (default command) ### Description Compares two databases and generates a migration file. Supports various flags for connection, driver, format, and filtering. Flags override settings in the .dbdiff config file. ### Method CLI ### Command `dbdiff diff` ### Parameters #### Flags - `--server1=user:pass@host:port` - Source connection. Omit if using only one server. - `--server2=user:pass@host:port` - Target connection (if different from server1). - `--server1-url=` - Full DSN URL for source (e.g. `postgres://user:pass@host:5432/db`). - `--server2-url=` - Full DSN URL for target. Supported schemes: `mysql://`, `pgsql://`, `postgres://`, `postgresql://`, `sqlite://`. - `--driver=mysql|pgsql|sqlite` - Database driver. Defaults to `mysql`. - `--supabase` - Shorthand for `--driver=pgsql` + SSL. - `--format=native|flyway|liquibase-xml|liquibase-yaml|laravel` - Output format. Defaults to `native`. - `--description=` - Slug used in generated filenames. - `--template=` - Custom output template. - `--type=schema|data|all` - What to diff. Defaults to `schema`. - `--include=up|down|both` - Directions to include. Defaults to `up`. (`all` is accepted as an alias for `both`.) - `--nocomments` - Strip comment headers from output. - `--config=` - Config file path. Defaults to `.dbdiff`. - `--output=` - Output file path. Defaults to `migration.sql`. - `--memory-limit=` - PHP memory limit for this run (e.g. `512M`, `1G`, `2G`, `-1` for unlimited). Overrides the 1G default and any `memory_limit` setting in your config file. - `--tables=` - Comma-separated table include list (supports globs: `*`, `?`). Only these tables are diffed. Example: `--tables=users,orders,wp_*` - `--ignore-tables=` - Comma-separated table exclude list (supports globs: `*`, `?`). Example: `--ignore-tables=cache_*,temp_*` - `--allow-destructive` - Generate the migration even when it contains data-losing changes. - `--debug` - Enable verbose error output. #### Positional Arguments - `server1.db1:server2.db2` - Databases to compare. Or a single table: `server1.db1.table1:server2.db2.table1`. ### Notes - UP only by default: The generated file includes only the UP (forward) migration by default. To also generate the DOWN (rollback) section, pass `--include=all`. - DSN URLs vs `--server` flags: Use `--server1-url` / `--server2-url` when you have a connection string. Use `--server1` / `--server2` when specifying credentials separately. - Passwords with special characters: Embed the password percent-encoded in the URL. Use `dbdiff url:encode` to safely encode any password. - Memory: The CLI sets a default PHP memory limit of 1G. Diffing very large databases may need more — pass `--memory-limit=2G` on the command line or add `memory_limit: 2G` to your `.dbdiff` / `dbdiff.yml` config. The CLI flag always wins over the config file. ### Example ```bash dbdiff diff --include=all ... ``` ``` -------------------------------- ### Run PHPUnit tests with specific combination Source: https://github.com/dbdiff/dbdiff/blob/master/DOCKER.md Commands to run PHPUnit tests with PHP 8.3/MySQL 8.0 and PHP 8.4/MySQL 8.4, plus PostgreSQL and SQLite end-to-end tests. ```bash # Run tests with PHP 8.3 and MySQL 8.0 docker-compose run --rm cli-php83-mysql80 phpunit # Run tests with PHP 8.4 and MySQL 8.4 docker-compose run --rm cli-php84-mysql84 phpunit # Run PostgreSQL end-to-end tests (record baseline on first run) docker-compose run --rm \ -e DB_HOST_POSTGRES=db-postgres16 \ cli-php83-postgres16 \ bash -c "DBDIFF_RECORD_MODE=true scripts/run-tests.sh --postgres db-postgres16" # Run PostgreSQL end-to-end tests (compare against baseline) docker-compose run --rm \ -e DB_HOST_POSTGRES=db-postgres16 \ cli-php83-postgres16 \ bash -c "scripts/run-tests.sh --postgres db-postgres16" # Run SQLite end-to-end tests (no extra service needed) docker-compose run --rm cli-php83-mysql80 bash -c "scripts/run-tests.sh --sqlite" ``` -------------------------------- ### Run DBDiff diff command Source: https://github.com/dbdiff/dbdiff/blob/master/README.md Runs the default diff command after creating a .dbdiff config file. This command compares the two databases and generates a migration file. ```bash ./dbdiff server1.db1:server1.db2 ``` -------------------------------- ### Run dbdiff diff with --allow-destructive Source: https://github.com/dbdiff/dbdiff/blob/master/README.md Command to generate a migration despite destructive changes. Use --allow-destructive to proceed when DBDiff blocks generation due to DROP TABLE or DROP COLUMN errors. ```bash dbdiff diff --allow-destructive server1.db1:server2.db2 ``` -------------------------------- ### PostgreSQL diff with pgsql driver Source: https://github.com/dbdiff/dbdiff/blob/master/README.md Runs a diff between two PostgreSQL databases using the pgsql driver. The --server1 flag specifies the connection string for the first server. ```bash ./dbdiff --driver=pgsql --server1=user:pass@localhost:5432 server1.staging:server1.production ``` -------------------------------- ### Run DBDiff with Supabase flag Source: https://github.com/dbdiff/dbdiff/blob/master/README.md Command to run DBDiff against Supabase. The --supabase flag sets driver=pgsql and enables SSL automatically. Row level security is diffed as a first-class object, and DBDiff reads the public schema only. ```bash ./dbdiff --supabase --server1=user:pass@db.xxx.supabase.co:5432 server1.mydb:server1.mydb ``` -------------------------------- ### UP and DOWN migration SQL for users table Source: https://github.com/dbdiff/dbdiff/blob/master/tests/expected/single_table_pgsql_15.txt Complete migration script with UP and DOWN sections. The UP section deletes user id 3, drops the 'phone' column, inserts user 2, and updates user 1's name. The DOWN section reverses these operations: deletes user 2, adds the 'phone' column, inserts user 3 with phone, and restores user 1's original name. ```sql #---------- UP ---------- DELETE FROM "users" WHERE "id" = '3'; ALTER TABLE "users" DROP COLUMN "phone" CASCADE; INSERT INTO "users" ("id","name","email") VALUES('2','User 2','user2@example.com'); UPDATE "users" SET "name" = 'User 1' WHERE "id" = '1'; #---------- DOWN ---------- DELETE FROM "users" WHERE "id" = '2'; ALTER TABLE "users" ADD COLUMN "phone" varchar(20) DEFAULT NULL::character varying; INSERT INTO "users" ("id","name","email","phone") VALUES('3','User 3','user3@example.com','555-3333'); UPDATE "users" SET "name" = 'User 1 Modified' WHERE "id" = '1'; ``` -------------------------------- ### SQLite diff with sqlite driver Source: https://github.com/dbdiff/dbdiff/blob/master/README.md Runs a diff between two SQLite database files using the sqlite driver. The server1 argument specifies the two file paths. ```bash ./dbdiff --driver=sqlite server1./var/db/v1.db:server1./var/db/v2.db ```