From 142fdeb8ce9c2fe264745efe78745ae9a13a370e Mon Sep 17 00:00:00 2001 From: Dan Lynch Date: Thu, 8 Jan 2026 17:33:22 +0000 Subject: [PATCH] Rename api_schemata to api_schemas This change renames the services_public.api_schemata table to api_schemas to match the naming convention used in constructive-db. Changes: - Rename deploy/revert/verify folders from api_schemata to api_schemas - Update all SQL files to use api_schemas table name - Update pgpm.plan to reference api_schemas - Update test file to use api_schemas - Update README.md documentation --- packages/metaschema-schema/README.md | 2 +- .../services_public/tables/api_schemas/table.sql | 7 +++++++ .../tables/api_schemata/table.sql | 7 ------- .../services_public/tables/api_schemas/table.sql | 7 +++++++ .../tables/api_schemata/table.sql | 7 ------- packages/services/__tests__/services.test.ts | 4 ++-- .../{api_schemata => api_schemas}/table.sql | 16 ++++++++-------- packages/services/pgpm.plan | 2 +- .../services_public/tables/api_schemas/table.sql | 7 +++++++ .../tables/api_schemata/table.sql | 7 ------- 10 files changed, 33 insertions(+), 33 deletions(-) create mode 100644 packages/metaschema-schema/revert/schemas/services_public/tables/api_schemas/table.sql delete mode 100644 packages/metaschema-schema/revert/schemas/services_public/tables/api_schemata/table.sql create mode 100644 packages/metaschema-schema/verify/schemas/services_public/tables/api_schemas/table.sql delete mode 100644 packages/metaschema-schema/verify/schemas/services_public/tables/api_schemata/table.sql rename packages/services/deploy/schemas/services_public/tables/{api_schemata => api_schemas}/table.sql (51%) create mode 100644 packages/services/revert/schemas/services_public/tables/api_schemas/table.sql delete mode 100644 packages/services/revert/schemas/services_public/tables/api_schemata/table.sql diff --git a/packages/metaschema-schema/README.md b/packages/metaschema-schema/README.md index 8ab132c9..f3dc7579 100644 --- a/packages/metaschema-schema/README.md +++ b/packages/metaschema-schema/README.md @@ -113,7 +113,7 @@ Application-level metadata: - **apis**: API configurations - **api_extensions**: API extension relationships - **api_modules**: API module definitions -- **api_schemata**: API schema configurations +- **api_schemas**: API schema configurations - **sites**: Site definitions - **apps**: Application definitions - **domains**: Domain configurations diff --git a/packages/metaschema-schema/revert/schemas/services_public/tables/api_schemas/table.sql b/packages/metaschema-schema/revert/schemas/services_public/tables/api_schemas/table.sql new file mode 100644 index 00000000..8a310db7 --- /dev/null +++ b/packages/metaschema-schema/revert/schemas/services_public/tables/api_schemas/table.sql @@ -0,0 +1,7 @@ +-- Revert schemas/services_public/tables/api_schemas/table from pg + +BEGIN; + +DROP TABLE services_public.api_schemas; + +COMMIT; diff --git a/packages/metaschema-schema/revert/schemas/services_public/tables/api_schemata/table.sql b/packages/metaschema-schema/revert/schemas/services_public/tables/api_schemata/table.sql deleted file mode 100644 index ec077183..00000000 --- a/packages/metaschema-schema/revert/schemas/services_public/tables/api_schemata/table.sql +++ /dev/null @@ -1,7 +0,0 @@ --- Revert schemas/services_public/tables/api_schemata/table from pg - -BEGIN; - -DROP TABLE services_public.api_schemata; - -COMMIT; diff --git a/packages/metaschema-schema/verify/schemas/services_public/tables/api_schemas/table.sql b/packages/metaschema-schema/verify/schemas/services_public/tables/api_schemas/table.sql new file mode 100644 index 00000000..49739218 --- /dev/null +++ b/packages/metaschema-schema/verify/schemas/services_public/tables/api_schemas/table.sql @@ -0,0 +1,7 @@ +-- Verify schemas/services_public/tables/api_schemas/table on pg + +BEGIN; + +SELECT verify_table ('services_public.api_schemas'); + +ROLLBACK; diff --git a/packages/metaschema-schema/verify/schemas/services_public/tables/api_schemata/table.sql b/packages/metaschema-schema/verify/schemas/services_public/tables/api_schemata/table.sql deleted file mode 100644 index 2f8826fd..00000000 --- a/packages/metaschema-schema/verify/schemas/services_public/tables/api_schemata/table.sql +++ /dev/null @@ -1,7 +0,0 @@ --- Verify schemas/services_public/tables/api_schemata/table on pg - -BEGIN; - -SELECT verify_table ('services_public.api_schemata'); - -ROLLBACK; diff --git a/packages/services/__tests__/services.test.ts b/packages/services/__tests__/services.test.ts index 326e1b8d..f722a512 100644 --- a/packages/services/__tests__/services.test.ts +++ b/packages/services/__tests__/services.test.ts @@ -167,14 +167,14 @@ describe('services functionality', () => { ); const [publicAssoc] = await pg.any( - `INSERT INTO services_public.api_schemata (database_id, schema_id, api_id) + `INSERT INTO services_public.api_schemas (database_id, schema_id, api_id) VALUES ($1, $2, $3) RETURNING *`, [database_id, schema.id, objs.apis.public.id] ); const [adminAssoc] = await pg.any( - `INSERT INTO services_public.api_schemata (database_id, schema_id, api_id) + `INSERT INTO services_public.api_schemas (database_id, schema_id, api_id) VALUES ($1, $2, $3) RETURNING *`, [database_id, schema.id, objs.apis.admin.id] diff --git a/packages/services/deploy/schemas/services_public/tables/api_schemata/table.sql b/packages/services/deploy/schemas/services_public/tables/api_schemas/table.sql similarity index 51% rename from packages/services/deploy/schemas/services_public/tables/api_schemata/table.sql rename to packages/services/deploy/schemas/services_public/tables/api_schemas/table.sql index 28a1f940..6ed0da28 100644 --- a/packages/services/deploy/schemas/services_public/tables/api_schemata/table.sql +++ b/packages/services/deploy/schemas/services_public/tables/api_schemas/table.sql @@ -1,10 +1,10 @@ --- Deploy schemas/services_public/tables/api_schemata/table to pg +-- Deploy schemas/services_public/tables/api_schemas/table to pg -- requires: schemas/services_public/schema BEGIN; -CREATE TABLE services_public.api_schemata ( +CREATE TABLE services_public.api_schemas ( id uuid PRIMARY KEY DEFAULT uuid_generate_v4 (), database_id uuid NOT NULL, schema_id uuid NOT NULL, @@ -18,13 +18,13 @@ CREATE TABLE services_public.api_schemata ( unique(api_id, schema_id) ); --- COMMENT ON CONSTRAINT schema_fkey ON services_public.api_schemata IS E'@omit manyToMany'; --- COMMENT ON CONSTRAINT api_fkey ON services_public.api_schemata IS E'@omit manyToMany'; -COMMENT ON CONSTRAINT db_fkey ON services_public.api_schemata IS E'@omit manyToMany'; +-- COMMENT ON CONSTRAINT schema_fkey ON services_public.api_schemas IS E'@omit manyToMany'; +-- COMMENT ON CONSTRAINT api_fkey ON services_public.api_schemas IS E'@omit manyToMany'; +COMMENT ON CONSTRAINT db_fkey ON services_public.api_schemas IS E'@omit manyToMany'; -CREATE INDEX api_schemata_database_id_idx ON services_public.api_schemata ( database_id ); -CREATE INDEX api_schemata_schema_id_idx ON services_public.api_schemata ( schema_id ); -CREATE INDEX api_schemata_api_id_idx ON services_public.api_schemata ( api_id ); +CREATE INDEX api_schemas_database_id_idx ON services_public.api_schemas ( database_id ); +CREATE INDEX api_schemas_schema_id_idx ON services_public.api_schemas ( schema_id ); +CREATE INDEX api_schemas_api_id_idx ON services_public.api_schemas ( api_id ); COMMIT; diff --git a/packages/services/pgpm.plan b/packages/services/pgpm.plan index 9700ca7c..034c08e8 100644 --- a/packages/services/pgpm.plan +++ b/packages/services/pgpm.plan @@ -7,7 +7,7 @@ schemas/services_public/schema 2017-08-11T08:11:51Z skitch schemas/services_public/tables/apis/table [schemas/services_public/schema metaschema-schema:schemas/metaschema_public/tables/database/table] 2017-08-11T08:11:51Z skitch # add schemas/services_public/tables/apis/table schemas/services_public/tables/api_extensions/table [schemas/services_public/schema schemas/services_public/tables/apis/table metaschema-schema:schemas/metaschema_public/tables/database_extension/table metaschema-schema:schemas/metaschema_public/tables/extension/table metaschema-schema:schemas/metaschema_public/tables/database/table] 2017-08-11T08:11:51Z skitch # add schemas/services_public/tables/api_extensions/table schemas/services_public/tables/api_modules/table [schemas/services_public/schema schemas/services_public/tables/apis/table metaschema-schema:schemas/metaschema_public/tables/database/table] 2017-08-11T08:11:51Z skitch # add schemas/services_public/tables/api_modules/table -schemas/services_public/tables/api_schemata/table [schemas/services_public/schema] 2017-08-11T08:11:51Z skitch # add schemas/services_public/tables/api_schemata/table +schemas/services_public/tables/api_schemas/table [schemas/services_public/schema] 2017-08-11T08:11:51Z skitch # add schemas/services_public/tables/api_schemas/table schemas/services_public/tables/sites/table [schemas/services_public/schema metaschema-schema:schemas/metaschema_public/tables/database/table] 2017-08-11T08:11:51Z skitch # add schemas/services_public/tables/sites/table schemas/services_public/tables/apps/table [schemas/services_public/schema schemas/services_public/tables/sites/table metaschema-schema:schemas/metaschema_public/tables/database/table] 2017-08-11T08:11:51Z skitch # add schemas/services_public/tables/apps/table schemas/services_public/tables/domains/table [schemas/services_public/schema schemas/services_public/tables/apis/table schemas/services_public/tables/sites/table metaschema-schema:schemas/metaschema_public/tables/database/table] 2017-08-11T08:11:51Z skitch # add schemas/services_public/tables/domains/table diff --git a/packages/services/revert/schemas/services_public/tables/api_schemas/table.sql b/packages/services/revert/schemas/services_public/tables/api_schemas/table.sql new file mode 100644 index 00000000..8a310db7 --- /dev/null +++ b/packages/services/revert/schemas/services_public/tables/api_schemas/table.sql @@ -0,0 +1,7 @@ +-- Revert schemas/services_public/tables/api_schemas/table from pg + +BEGIN; + +DROP TABLE services_public.api_schemas; + +COMMIT; diff --git a/packages/services/revert/schemas/services_public/tables/api_schemata/table.sql b/packages/services/revert/schemas/services_public/tables/api_schemata/table.sql deleted file mode 100644 index ec077183..00000000 --- a/packages/services/revert/schemas/services_public/tables/api_schemata/table.sql +++ /dev/null @@ -1,7 +0,0 @@ --- Revert schemas/services_public/tables/api_schemata/table from pg - -BEGIN; - -DROP TABLE services_public.api_schemata; - -COMMIT;