Convert PostgreSQL schemas to SQLite DDL

Review real SQLite DDL generated from a PostgreSQL-shaped schema, including affinity mapping, inline foreign keys and translated defaults.

target
SQLite DDL
access
Free export
source specimen
3 of 13 tables · seed/schema.json

Trellis exports a schema drafted on its canvas using PostgreSQL types. This page does not claim to parse a PostgreSQL dump or a live database.

01 / affinity pass

SQLite changes the storage vocabulary

The excerpt keeps three complete CREATE TABLE statements. It shows type affinities, current_timestamp defaults and foreign keys placed inside each table.

declared → emitted
uuidtext
integerinteger
timestamptztext
vectorblob
actual exporter output3 of 13 tables · account, session, article_embedding
create table account (
  id text not null,
  email text not null,
  display_name text not null,
  status text not null default 'active',
  password_hash text,
  created_at text not null default current_timestamp,
  updated_at text not null default current_timestamp,
  primary key (id),
  constraint account_status_check check (status in ('active', 'suspended', 'closed')),
  unique (email)
);

create table session (
  id text not null,
  account_id text not null,
  token text not null,
  ip text,
  user_agent text,
  expires_at text not null,
  created_at text not null default current_timestamp,
  primary key (id),
  unique (token),
  foreign key (account_id) references account (id)
);

create table article_embedding (
  article_id text not null,
  embedding blob not null,
  model text not null,
  computed_at text not null default current_timestamp,
  primary key (article_id),
  foreign key (article_id) references article (id)
);
02 / application hand-off

Defaults need a clear owner

SQLite can translate the seed’s time defaults, but it cannot manufacture the UUIDs that PostgreSQL generated.

SQLite has no now() function or UUID generator. Trellis maps supported time defaults to current_timestamp and leaves generated UUID defaults for the application.

source / src/lib/exporters/dialects.ts