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 generationpgcrypto— cryptographic functionspg_trgm— similarity searchpostgis— 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 EXISTSprevents 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
| Situation | Behavior |
|---|---|
| Table with the same name on the target | Structure is completed (missing columns added) |
| Extension not available | Cloning of that extension fails, others continue |
| FK to a table not yet created | FKs are added after all tables |
| Views depending on other views | Creation order is respected |
Next Steps
- Data — Clone your table rows
- Functions and triggers — Clone business logic