跳转到主要内容

omni_schema

Omnigres 高级模式管理组件

omnigres · Omnigres 高级模式管理组件

概览

ID扩展软件包版本类别许可证编程语言
2963omni_schemaomnigres0.3.0FEATApache-2.0C
属性可执行文件动态库需要预加载需要建扩展可迁移可信
----d--否否否是否否

软件包

类型仓库版本兼容的 PostgreSQL 大版本包名模式依赖
EXTPIGSTY0.3.019 18 17 16 15omnigresomni_sql, omni_vfs, omni_polyfill, omni_yaml, dblink, postgres_fdw, omni_types, omni_cloudevents
RPMPIGSTY2026021219 18 17 16 15omnigres_$vpostgresql$v-contrib, postgresql$v-plpython3, python3-pip
DEBPIGSTY2026021219 18 17 16 15postgresql-$v-omnigrespostgresql-plpython3-$v, python3-pip
Linux / PGPG19PG18PG17PG16PG15
el8.x86_64N/APIGSTY 20260212PIGSTY 20260212PIGSTY 20260212PIGSTY 20260212
el8.aarch64N/APIGSTY 20260212PIGSTY 20260212PIGSTY 20260212PIGSTY 20260212
el9.x86_64N/APIGSTY 20260212PIGSTY 20260212PIGSTY 20260212PIGSTY 20260212
el9.aarch64N/APIGSTY 20260212PIGSTY 20260212PIGSTY 20260212PIGSTY 20260212
el10.x86_64N/APIGSTY 20260212PIGSTY 20260212PIGSTY 20260212PIGSTY 20260212
el10.aarch64N/APIGSTY 20260212PIGSTY 20260212PIGSTY 20260212PIGSTY 20260212
d12.x86_64N/APIGSTY 20260212PIGSTY 20260212PIGSTY 20260212PIGSTY 20260212
d12.aarch64N/APIGSTY 20260212PIGSTY 20260212PIGSTY 20260212PIGSTY 20260212
d13.x86_64N/APIGSTY 20260212PIGSTY 20260212PIGSTY 20260212PIGSTY 20260212
d13.aarch64N/APIGSTY 20260212PIGSTY 20260212PIGSTY 20260212PIGSTY 20260212
u22.x86_64N/APIGSTY 20260212PIGSTY 20260212PIGSTY 20260212PIGSTY 20260212
u22.aarch64N/APIGSTY 20260212PIGSTY 20260212PIGSTY 20260212PIGSTY 20260212
u24.x86_64N/APIGSTY 20260212PIGSTY 20260212PIGSTY 20260212PIGSTY 20260212
u24.aarch64N/APIGSTY 20260212PIGSTY 20260212PIGSTY 20260212PIGSTY 20260212
u26.x86_64N/APIGSTY 20260212PIGSTY 20260212PIGSTY 20260212PIGSTY 20260212
u26.aarch64N/APIGSTY 20260212PIGSTY 20260212PIGSTY 20260212PIGSTY 20260212

源码

pig build pkg omnigres;		# build rpm/deb

安装

启用 PGDG 和 PIGSTY 仓库并更新缓存。

pig repo add pgsql -u   # add both repo and update cache

使用 pig 安装扩展。

pig install omnigres;		# install by package name
pig install omni_schema;		# install by extension name

pig install omni_schema -v 18;   # install for PG 18
pig install omni_schema -v 17;   # install for PG 17
pig install omni_schema -v 16;   # install for PG 16
pig install omni_schema -v 15;   # install for PG 15

在数据库中创建扩展。

CREATE EXTENSION omni_schema CASCADE; -- requires omni_sql, omni_vfs, omni_polyfill, omni_yaml, dblink, postgres_fdw, omni_types, omni_cloudevents

用法

omni_schema: 高级模式管理工具

omni_schema 扩展通过迁移和从文件系统重新加载对象来管理应用模式。

运行迁移

SELECT * FROM omni_schema.migrate_from_fs(omni_vfs.local_fs('/path/to/migrations'));

递归查找 .sql 文件,按路径名顺序应用,跳过已应用的迁移。执行记录保存在 omni_schema.migrations 表中。

重新加载模式对象

SELECT * FROM omni_schema.load_from_fs(omni_vfs.local_fs('/path/to/project'));

从文件系统重新加载函数、策略和视图。要忽略某个文件,在其中放置 omni_schema[[ignore]](通常在注释中)。

迁移表

列类型描述
idint唯一标识符
nametext迁移文件名
migrationtext源代码
applied_attimestamp应用时间

多语言支持

支持 SQL、PL/pgSQL(.sql)、Python(.py)、Perl(.pl)、Tcl(.tcl)和 Rust(.rs)。使用 SQL[[...]] 指令指定函数签名:

# times_ten.py
# SQL[[create function times_ten(a integer) returns integer]]
return a * 10

表格阅读器