Reylo v0.8.1
Reylo v0.8.1 types Turso Cloud's sqlean functions, runs on Drizzle's Postgres driver, plans MySQL grants in migrations and halves the median Postgres analysis on a remote server.
Three changes can surface in an existing project, listed in Upgrading from v0.8.0.
Turso Cloud's sqlean functions
The type check now types the functions of the sqlean extensions Turso Cloud loads, which it refused with no such function (#327).
select id, name, levenshtein(name, :name) as distance
from users
where regexp_like(name, '^[A-Z]')
order by distance
limit 5The functions it types, by extension:
- uuid:
uuid4,uuid7,gen_random_uuid,uuid_str,uuid_blob - crypto:
md5,sha1,sha256,sha384,sha512,blake3,encode,decode - fuzzy:
levenshtein,dlevenshtein,edit_distance,hamming,jaro_winkler,caverphone,translit - stats:
median,percentile,percentile_90,stddev,variance,var_samp - text:
left,right,lpad,rpad,repeat,reverse,split_part,starts_with - regexp:
regexp_like,regexp_substr,regexp_capture,regexp_replace - series:
generate_seriesandstats_seq
The SQLite inside @libsql/client has none of them, so a query that calls one fails on a local file: database.
Drizzle's Postgres driver
Queries now run on the Postgres driver drizzle-orm ships from 1.0.0-rc.6 (#338).
import { Pool } from "drizzle-orm/postgres/client";
import getUser from "./get_user.sql";
const db = new Pool({ url: process.env.DATABASE_URL });
const user = await getUser.run(db, { id: 1 });What it runs on:
- Clients: its
Pool, a connection, a transaction or savepoint, and adrizzle()database over any of them - Neon:
drizzle-orm/postgres/client/neon-ws, over a WebSocket - Refused: the
neon-http,httpandauroraclients, whose results don't name each column's type
MySQL grants in migrations
Migrations now read, compare and plan MySQL grants, which they refused (#328).
-grant select on users to 'reader'@'%';
+grant select, insert on users to 'reader'@'%' with grant option;
+grant update (full_name, code) on users to 'app_role';The migration planned for that change:
grant update (code), update (full_name) on users to `app_role`@`%`;
grant insert on users to `reader`@`%` with grant option;What it covers:
- Objects: grants on the database's tables, views, columns and routines, each with or without
with grant option - Drops and renames: a grant is revoked before what it's on is dropped or renamed, since MySQL keeps it, and granted again after
- Introspection:
reylo db introspectandreylo migrate initwrite the database's grants intoschema.sql - Refused: a grant on every database, the server, another database, a role or a proxy, and
set passwordorset default rolein a migration - Permissions: an account that can't read MySQL's privilege tables is refused grants, with the statements that let it read them
Faster Postgres analysis
Each round of a Postgres analysis now sends its queries together, where each waited for the one before (#335). Over 2,320 statements on a server about 100 ms away:
- Median: 514 ms → 242 ms
- 90th percentile: 2.7 s → 0.9 s
- Slowest: 18.5 s → 2.7 s
Upgrading from v0.8.0
Each change below can surface in a project that upgrades from v0.8.0.
Postgres
- The type check refuses Supabase's transaction pooler on port 6543. Point the type check at the session pooler, which the error names (#334).
MySQL
- A
BITthat a view, derived table orWITHquery computes withcoalesce,ifnull,greatest,leastorany_valueisunknown, where it was bytes. MySQL sends its decimal digits there, not its bytes, so handle theunknownwhere the type check now asks (#329).
SQLite
- The type of
soundex(x)of a nullablexisstring | null, where it wasstring. Handlenull, which Turso Cloud'ssoundexreturns forNULL(#327).