1.0.1 • Published 12 months ago

pg-schema-optimizer v1.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
12 months ago

Postgres schema optimizer

Reorders columns in an SQL schema dump file so that they take up less space. It is a simpler and less robust alternative to pg_column_byte_packer.

The input schema should be well-formed, with each column occupying a single line.

Because it doesn't query a real database, columns with custom data types won't be recognized and will be moved to the end of the table.

CLI usage

npx pg-schema-optimizer -o optimized.sql unoptimized.sql

Library usage

import { optimize_schema } from 'pg-schema-optimizer'

console.log(
  optimize_schema(
    `create table "moomin" (
      "name" text not null,
      "age" int2 not null,
      "id" int not null primary key,
      "favourite_color" text
    );`,
  ),
)
1.0.1

12 months ago

1.0.0

12 months ago