Tables and Schema

The Schema component copies the complete structure of your database: tables, columns, constraints, indexes, sequences, custom types, extensions, and views.

What Is Copied

Extensions

PostgreSQL extensions enabled on the source are enabled on the target. Common examples:

  • uuid-ossp — UUID generation
  • pgcrypto — cryptographic functions
  • pg_trgm — similarity search
  • postgis — geographic data

Custom Types

Enums and composite types are recreated on the target. For example:

CREATE TYPE user_role AS ENUM ('admin', 'member', 'guest');

Tables

Each table is recreated with:

  • Columns — name, data type, nullable, default value
  • Primary keys
  • Foreign keys — including cross-schema FKs
  • UNIQUE and CHECK constraints
  • Default values — expressions, sequences, gen_random_uuid(), etc.

Indexes

All non-system indexes are recreated:

  • Simple and composite indexes
  • Unique indexes
  • Partial indexes (with WHERE condition)
  • GIN, GiST, and other index types

Sequences

Sequences used by serial or identity columns are recreated and synchronized.

Views

SQL views are recreated with their complete definition.

Re-cloning

If you clone to a project that already contains tables:

  • CREATE TABLE IF NOT EXISTS prevents errors on existing tables
  • Missing columns are automatically added via ALTER TABLE ADD COLUMN
  • Existing constraints and indexes are not duplicated

This is designed to be idempotent — you can re-run the clone without risk.

Key Considerations

SituationBehavior
Table with the same name on the targetStructure is completed (missing columns added)
Extension not availableCloning of that extension fails, others continue
FK to a table not yet createdFKs are added after all tables
Views depending on other viewsCreation order is respected

Next Steps