Skip to content

Schema Sources

Seedforge has two ways to learn about your tables: live database introspection and ORM file parsing. Both code paths build the same internal DatabaseSchema model — a map of tables, columns, enums, and foreign keys — so downstream generation, FK resolution, and output work identically regardless of source.

Pick live introspection when you have a migrated dev database handy. Pick file parsing when you want to generate a .sql file from an ORM schema without spinning up a database (handy for CI artifacts or seeding a fresh container on boot).

Seedforge reads the system catalog directly — it does not execute migrations or need any prior data. Connect with --db and it walks the schema, resolves FK graph, and generates rows.

Connection format: postgres://[user[:pass]@]host[:port]/database or postgresql://.... Seedforge queries pg_catalog and information_schema to pull tables, columns, types, constraints, FKs, enums, and sequences.

  • Version: PostgreSQL 12+
  • Direct insert: yes
  • COPY fast mode: yes (--fast)
  • File export: yes
Terminal window
seedforge --db postgres://user:pass@localhost:5432/mydb --count 100

Use --schema to introspect a namespace other than public:

Terminal window
seedforge --db postgres://localhost/mydb --schema app

Connection format: mysql://[user[:pass]@]host[:port]/database. Seedforge queries information_schema for tables, columns, and foreign keys.

  • Version: MySQL 5.7+ (also works with MariaDB)
  • Direct insert: yes
  • COPY fast mode: no
  • File export: yes
Terminal window
seedforge --db mysql://root:pass@localhost:3306/mydb --count 100

Connection format: sqlite:///path/to/file.db or a bare .db / .sqlite path. Seedforge reads sqlite_master and PRAGMA table_info / PRAGMA foreign_key_list for each table.

  • Direct insert: yes (single-file, in-process)
  • COPY fast mode: no
  • File export: yes
Terminal window
seedforge --db sqlite:///./dev.db --count 50
seedforge --db ./data.sqlite --output seed.sql

Point --prisma at your schema.prisma file. Seedforge parses the Prisma DSL, including @relation directives, to build the foreign-key graph without connecting to a database. If --prisma is omitted and no other source is given, Seedforge auto-detects ./prisma/schema.prisma.

Terminal window
# File output — no live DB needed
seedforge --prisma ./prisma/schema.prisma --output seed.sql
# Parse schema, insert into a live database
seedforge --prisma ./prisma/schema.prisma --db postgres://localhost/mydb

The parser honors @id, @unique, @default, @relation(fields: [...], references: [...]), and enum blocks when computing the insert plan.

Point --drizzle at a single schema file or a directory of schema files. Seedforge parses the TypeScript source to pick up pgTable / mysqlTable / sqliteTable declarations, column types, and references() FK links.

Terminal window
# Single file
seedforge --drizzle ./src/db/schema.ts --output seed.sql
# Directory of schema files
seedforge --drizzle ./src/db/ --output seed.sql
# Parse Drizzle + insert into a live Postgres database
seedforge --drizzle ./src/db/schema.ts --db postgres://localhost/mydb

Point --typeorm at a directory of entity classes. Seedforge reads the TypeScript source and resolves standard TypeORM decorators — @Entity, @Column, @PrimaryGeneratedColumn, @ManyToOne, @OneToMany, @JoinColumn — to build the schema model.

Terminal window
seedforge --typeorm ./src/entities/ --output seed.sql

Point --jpa at a directory of Java entity classes. Seedforge parses @Entity, @Table, @Column, @Id, @GeneratedValue, @ManyToOne, @OneToMany, @JoinColumn, and @Enumerated annotations.

Terminal window
seedforge --jpa ./src/main/java/com/example/entities/ --output seed.sql

If none of the built-in parsers fit, ship a custom one via --plugin. A plugin exports a SchemaParserPlugin with a detect() + parse() pair that returns the same DatabaseSchema model the built-in parsers produce.

Terminal window
seedforge --plugin ./my-parser-plugin.ts --output seed.sql

Plugins can also auto-detect — if you pass --plugin without any other schema source, Seedforge calls each plugin’s detect(cwd) and uses the first one that claims the project. See the plugin section in the project README for the full SchemaParserPlugin interface.

All parsers and introspectors normalize to this shared type set. Unknown types fall back to safe defaults (typically TEXT).

CategoryTypes
TextTEXT, VARCHAR, CHAR
IntegerINTEGER, BIGINT, SMALLINT, SERIAL, BIGSERIAL
FloatingREAL, DOUBLE, DECIMAL, NUMERIC
BooleanBOOLEAN
TemporalDATE, TIME, TIMESTAMP, TIMESTAMPTZ, INTERVAL
IdentifiersUUID
StructuredJSON, JSONB, ARRAY, ENUM
BinaryBYTEA
NetworkINET, CIDR, MACADDR
GeometricPOINT

Each column is additionally matched against 190+ name patterns across 10 domains (person, contact, location, finance, etc.) to pick a realistic Faker.js generator on top of the base type. See the column patterns reference for the full list.