
Security News
/Company News
Socket Is Sponsoring Composer and Packagist
Socket has joined the new Composer and Packagist sponsorship program as a launch sponsor, supporting the team that keeps PHP's package ecosystem secure.
@prisma-next/sql-schema-ir
Advanced tools
SQL Schema Intermediate Representation (IR) types for Prisma Next.
This package defines the core types for the SQL Schema IR, a target-agnostic representation of SQL database schemas. This IR is used for schema verification, migration planning, and other tooling operations within the SQL family.
SqlSchemaIR, verification logic consumes itSqlSchemaIR, SqlTableIR, SqlColumnIR, etc.)@prisma-next/contract: For Contract type (used in SqlSchemaIR)Dependents:
@prisma-next/family-sql - SQL family instance uses SqlSchemaIR for schema verification@prisma-next/framework-components - Core verification logic (via ./control)@prisma-next/adapter-postgres - Postgres introspection@prisma-next/extension-pgvector - Extension verification hooksSqlSchemaIR - Complete database schema representation with tables, extensions, and annotationsSqlTableIR - Table representation with columns, constraints, indexes, and annotationsSqlColumnIR - Column representation with nativeType (DB-specific type), nullability, and annotationsSqlForeignKeyIR - Foreign key constraint representationSqlUniqueIR - Unique constraint representationSqlIndexIR - Index representationSqlAnnotations - Namespaced extensibility metadata (e.g., { pg: { version: '15' } })Native type primary: Columns capture the database-native type (nativeType, e.g., 'integer', 'vector'). Codec IDs now live exclusively in the contract—schema IR focuses solely on what exists in the database. This keeps schema verification centered on actual storage, while contract metadata handles codec-level concerns.
Annotations: All IR types support optional annotations for extensibility. This allows targets and extensions to attach metadata without modifying the core IR structure.
Shared Plane: This package is in the shared plane, meaning it can be safely imported by both migration-plane (verification, migration planning) and runtime-plane code.
import type { SqlSchemaIR, SqlTableIR, SqlColumnIR } from '@prisma-next/sql-schema-ir/types';
const schemaIR: SqlSchemaIR = {
tables: {
user: {
name: 'user',
columns: {
id: {
name: 'id',
nativeType: 'integer',
nullable: false,
},
email: {
name: 'email',
nativeType: 'text',
nullable: false,
},
},
primaryKey: { columns: ['id'] },
foreignKeys: [],
uniques: [{ columns: ['email'] }],
indexes: [],
},
},
extensions: ['vector'],
annotations: {
pg: {
version: '15',
},
},
};
Adapters produce SqlSchemaIR by querying database catalogs:
// In Postgres adapter
import postgresAdapter from '@prisma-next/adapter-postgres/control';
import type { SqlSchemaIR } from '@prisma-next/sql-schema-ir/types';
const controlAdapter = postgresAdapter.createControlInstance();
const schemaIR: SqlSchemaIR = await controlAdapter.introspect(driver, contract);
Schema verification is performed via the schemaVerify() method on the SQL family instance:
// In SQL family instance
import sql from '@prisma-next/family-sql/control';
import type { SqlSchemaIR } from '@prisma-next/sql-schema-ir/types';
// Create family instance
const familyInstance = sql.create({
target: postgresTargetDescriptor,
adapter: postgresAdapterDescriptor,
driver: postgresDriverDescriptor,
extensions: [],
});
// Schema verification is performed via family instance method
const result = await familyInstance.schemaVerify({
driver,
contractIR,
strict: false,
contractPath: './contract.json',
});
// schemaVerify internally calls adapter.introspect() to get schemaIR
sqlcoresharedThis package sits at the core layer in the shared plane, making it accessible to both migration-plane (authoring, tooling, targets) and runtime-plane (lanes, runtime, adapters) packages.
docs/briefs/11-schema-ir.md - Schema IR project briefdocs/briefs/SQL Schema IR and Verification.md - Detailed design documentpackages/2-sql/3-tooling/family/src/core/instance.ts - SQL family instance with schemaVerify() methodpackages/3-targets/6-adapters/postgres/src/exports/control.ts - Postgres introspection entrypointFAQs
SQL Schema IR types for schema introspection and verification
The npm package @prisma-next/sql-schema-ir receives a total of 20,250 weekly downloads. As such, @prisma-next/sql-schema-ir popularity was classified as popular.
We found that @prisma-next/sql-schema-ir demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
/Company News
Socket has joined the new Composer and Packagist sponsorship program as a launch sponsor, supporting the team that keeps PHP's package ecosystem secure.

Research
/Security News
Benign-looking npm packages split malicious functionality across a dependency chain that deploys a cross-platform RAT targeting Alibaba developers.

Research
/Security News
Two Joyfill npm beta releases contain an import-time implant that uses blockchain transactions to retrieve a remote-access trojan.