Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions __fixtures__/output/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import * as sqitch from "./schemas/sqitch";
export { sqitch };
import * as inflection from "./schemas/inflection";
export { inflection };
import * as objects_private from "./schemas/objects_private";
export { objects_private };
import * as txs_public from "./schemas/txs_public";
export { txs_public };
import * as object_store_private from "./schemas/object_store_private";
export { object_store_private };
import * as object_tree_public from "./schemas/object_tree_public";
export { object_tree_public };
import * as migrations_public from "./schemas/migrations_public";
export { migrations_public };
import * as db_migrate from "./schemas/db_migrate";
Expand Down
8 changes: 4 additions & 4 deletions __fixtures__/output/schemas/services_public.ts
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ export interface memberships_module {
default_limits_table_id: UUID;
permissions_table_id: UUID;
default_permissions_table_id: UUID;
acl_table_id: UUID;
sprt_table_id: UUID;
admin_grants_table_id: UUID;
admin_grants_table_name: string;
owner_grants_table_id: UUID;
Expand Down Expand Up @@ -638,7 +638,7 @@ export class memberships_module implements memberships_module {
default_limits_table_id: UUID;
permissions_table_id: UUID;
default_permissions_table_id: UUID;
acl_table_id: UUID;
sprt_table_id: UUID;
admin_grants_table_id: UUID;
admin_grants_table_name: string;
owner_grants_table_id: UUID;
Expand Down Expand Up @@ -670,7 +670,7 @@ export class memberships_module implements memberships_module {
this.default_limits_table_id = data.default_limits_table_id;
this.permissions_table_id = data.permissions_table_id;
this.default_permissions_table_id = data.default_permissions_table_id;
this.acl_table_id = data.acl_table_id;
this.sprt_table_id = data.sprt_table_id;
this.admin_grants_table_id = data.admin_grants_table_id;
this.admin_grants_table_name = data.admin_grants_table_name;
this.owner_grants_table_id = data.owner_grants_table_id;
Expand Down Expand Up @@ -1081,4 +1081,4 @@ export class uuid_module implements uuid_module {
this.uuid_function = data.uuid_function;
this.uuid_seed = data.uuid_seed;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
EXTENSION = db-meta-modules
DATA = sql/db-meta-modules--0.14.0.sql
EXTENSION = metaschema-modules
DATA = sql/metaschema-modules--0.14.0.sql

PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# metaschema-modules extension
comment = 'metaschema-modules extension'
default_version = '0.14.0'
module_pathname = '$libdir/metaschema-modules'
requires = 'plpgsql,metaschema-schema,pgpm-verify'
relocatable = false
superuser = false
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
%syntax-version=1.0.0
%project=db-meta-modules
%uri=db-meta-modules
%project=metaschema-modules
%uri=metaschema-modules

schemas/meta_private/schema [db-meta-schema:schemas/meta_public/tables/site_themes/table] 2017-08-11T08:11:51Z skitch <skitch@5b0c196eeb62> # add schemas/meta_private/schema
schemas/meta_public/schema 2017-08-11T08:11:51Z skitch <skitch@5b0c196eeb62> # add schemas/meta_public/schema
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
EXTENSION = db-meta-schema
DATA = sql/db-meta-schema--0.14.0.sql
EXTENSION = metaschema-schema
DATA = sql/metaschema-schema--0.14.0.sql

PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# db-meta-schema extension
comment = 'db-meta-schema extension'
# metaschema-schema extension
comment = 'metaschema-schema extension'
default_version = '0.14.0'
module_pathname = '$libdir/db-meta-schema'
module_pathname = '$libdir/metaschema-schema'
requires = 'citext,hstore,pgpm-inflection,pgpm-database-jobs,pgpm-types,pgcrypto,plpgsql,postgis,uuid-ossp,pgpm-verify'
relocatable = false
superuser = false

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
%syntax-version=1.0.0
%project=db-meta-schema
%uri=db-meta-schema
%project=metaschema-schema
%uri=metaschema-schema

schemas/collections_private/schema [pgpm-inflection:schemas/inflection/tables/inflection_rules/indexes/inflection_rules_type_idx pgpm-database-jobs:schemas/app_jobs/triggers/tg_add_job_with_row pgpm-types:schemas/public/domains/url] 2017-08-11T08:11:51Z skitch <skitch@5b0c196eeb62> # add schemas/collections_private/schema
schemas/collections_public/schema 2017-08-11T08:11:51Z skitch <skitch@5b0c196eeb62> # add schemas/collections_public/schema
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ services:
PGDATABASE: launchql
# API meta configuration (static mode for dev)
API_ENABLE_META: "true"
API_EXPOSED_SCHEMAS: "collections_public,meta_public"
API_EXPOSED_SCHEMAS: "metaschema_public,services_public"
API_ANON_ROLE: "administrator"
API_ROLE_NAME: "administrator"
API_DEFAULT_DATABASE_ID: "dbe"
Expand Down
2 changes: 1 addition & 1 deletion graphile/graphile-settings/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const settings = getGraphileSettings({
},
graphile: {
schema: ['app_public'],
metaSchemas: ['meta_public'],
metaSchemas: ['metaschema_public', 'services_public', 'metaschema_modules_public'],
},
features: {
postgis: true,
Expand Down
6 changes: 3 additions & 3 deletions graphile/graphile-sql-expression-validator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ npm install graphile-sql-expression-validator
Tag columns that contain SQL expressions with `@sqlExpression`:

```sql
COMMENT ON COLUMN collections_public.field.default_value IS E'@sqlExpression';
COMMENT ON COLUMN metaschema_public.field.default_value IS E'@sqlExpression';
```

The plugin will automatically look for a companion `*_ast` column (e.g., `default_value_ast`) to store the parsed AST.
Expand All @@ -26,7 +26,7 @@ By default, the plugin looks for a companion column named `<column>_ast`. You ca

```sql
-- Use a custom AST column name
COMMENT ON COLUMN collections_public.field.default_value IS E'@sqlExpression\n@rawSqlAstField my_custom_ast_column';
COMMENT ON COLUMN metaschema_public.field.default_value IS E'@sqlExpression\n@rawSqlAstField my_custom_ast_column';
```

If `@rawSqlAstField` points to a non-existent column, the plugin will throw an error. If not specified, it falls back to the `<column>_ast` convention (and silently skips AST storage if that column doesn't exist).
Expand All @@ -47,7 +47,7 @@ const postgraphileOptions = {
// Optional: Maximum expression length (default: 10000)
maxExpressionLength: 5000,
// Optional: Auto-allow schemas owned by the current database
// Queries: SELECT schema_name FROM collections_public.schema
// Queries: SELECT schema_name FROM metaschema_public.schema
// WHERE database_id = jwt_private.current_database_id()
allowOwnedSchemas: true,
// Optional: Custom hook for dynamic schema resolution
Expand Down
2 changes: 1 addition & 1 deletion graphile/graphile-sql-expression-validator/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ async function resolveEffectiveOptions(
if (!ownedSchemas) {
try {
const result = await gqlContext.pgClient.query(
`SELECT schema_name FROM collections_public.schema WHERE database_id = jwt_private.current_database_id()`
`SELECT schema_name FROM metaschema_public.schema WHERE database_id = jwt_private.current_database_id()`
);
ownedSchemas = result.rows.map((row: { schema_name: string }) => row.schema_name);
gqlContext[OWNED_SCHEMAS_CACHE_KEY] = ownedSchemas;
Expand Down
2 changes: 1 addition & 1 deletion graphql/env/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ GraphQL defaults are provided by `@constructive-io/graphql-types`:
roleName: 'administrator',
defaultDatabaseId: 'hard-coded',
isPublic: true,
metaSchemas: ['collections_public', 'meta_public']
metaSchemas: ['services_public', 'metaschema_public', 'metaschema_modules_public']
}
}
```
Expand Down
5 changes: 3 additions & 2 deletions graphql/env/__tests__/__snapshots__/merge.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ exports[`getEnvOptions merges pgpm defaults, graphql defaults, config, env, and
"isPublic": true,
"metaSchemas": [
"config_meta",
"collections_public",
"meta_public",
"services_public",
"metaschema_public",
"metaschema_modules_public",
"env_meta1",
"env_meta2",
],
Expand Down
9 changes: 5 additions & 4 deletions graphql/env/__tests__/merge.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,14 @@ describe('getEnvOptions', () => {
},
api: {
exposedSchemas: ['public', 'shared'],
metaSchemas: ['collections_public', 'meta_public', 'config_meta']
metaSchemas: ['metaschema_public', 'services_public', 'config_meta']
}
});

const testEnv: NodeJS.ProcessEnv = {
GRAPHILE_SCHEMA: 'shared_schema,env_schema',
API_EXPOSED_SCHEMAS: 'shared,env_schema',
API_META_SCHEMAS: 'meta_public,env_meta'
API_META_SCHEMAS: 'services_public,env_meta'
};

const result = getEnvOptions(
Expand Down Expand Up @@ -129,9 +129,10 @@ describe('getEnvOptions', () => {
'override_schema'
]);
expect(result.api?.metaSchemas).toEqual([
'collections_public',
'meta_public',
'metaschema_public',
'services_public',
'config_meta',
'metaschema_modules_public',
'env_meta',
'override_meta'
]);
Expand Down
8 changes: 4 additions & 4 deletions jobs/DEVELOPMENT_JOBS.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ From the `constructive-db/` directory (with `pgenv` applied):

```sh
pgpm deploy --yes --database "$PGDATABASE" --package app-svc-local
pgpm deploy --yes --database "$PGDATABASE" --package db-meta
pgpm deploy --yes --database "$PGDATABASE" --package metaschema
pgpm deploy --yes --database "$PGDATABASE" --package pgpm-database-jobs
```

Expand Down Expand Up @@ -126,7 +126,7 @@ In dry-run mode:

## 5. Ensure GraphQL host routing works for `send-email-link`

Constructive selects the API by the HTTP `Host` header using rows in `meta_public.domains`.
Constructive selects the API by the HTTP `Host` header using rows in `services_public.domains`.

For local development, `app-svc-local` seeds `admin.localhost` as the admin API domain. `docker-compose.jobs.yml` adds a Docker network alias so other containers can resolve `admin.localhost` to the `constructive-server` container, and `send-email-link` uses:

Expand All @@ -152,7 +152,7 @@ With the jobs stack running, you can enqueue a test job from your host into the
First, grab a real `database_id` (required by `send-email-link`, optional for `simple-email`):

```sh
DBID="$(docker exec -i postgres psql -U postgres -d launchql -Atc 'SELECT id FROM collections_public.database ORDER BY created_at LIMIT 1;')"
DBID="$(docker exec -i postgres psql -U postgres -d launchql -Atc 'SELECT id FROM metaschema_public.database ORDER BY created_at LIMIT 1;')"
echo "$DBID"
```

Expand All @@ -179,7 +179,7 @@ You should then see the job picked up by `knative-job-service` and the email pay

`send-email-link` queries GraphQL for site/database metadata, so it requires:

- The app/meta packages deployed in step 3 (`app-svc-local`, `db-meta`)
- The app/meta packages deployed in step 3 (`app-svc-local`, `metaschema-schema`, `services`, `metaschema-modules`)
- A real `database_id` (use `$DBID` above)
- A GraphQL hostname that matches a seeded domain route (step 5)
- For localhost development, the site/domain metadata usually resolves to `localhost`.
Expand Down
34 changes: 26 additions & 8 deletions packages/csv-to-pg/__tests__/__snapshots__/export.test.ts.snap
Original file line number Diff line number Diff line change
@@ -1,41 +1,59 @@
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing

exports[`test case arrays 1`] = `
"INSERT INTO collections_public.field (
"INSERT INTO metaschema_public.field (
id,
schemas
) VALUES
('450e3b3b-b68d-4abc-990c-65cb8a1dcdb4', '{a,b}');"
(
'450e3b3b-b68d-4abc-990c-65cb8a1dcdb4',
'{a,b}'
);"
`;

exports[`test case image/attachment 1`] = `
"INSERT INTO collections_public.field (
"INSERT INTO metaschema_public.field (
id,
name,
image,
upload
) VALUES
('450e3b3b-b68d-4abc-990c-65cb8a1dcdb4', 'name here', '{"url":"http://path/to/image.jpg"}', '{"url":"http://path/to/image.jpg"}');"
(
'450e3b3b-b68d-4abc-990c-65cb8a1dcdb4',
'name here',
'{"url":"http://path/to/image.jpg"}',
'{"url":"http://path/to/image.jpg"}'
);"
`;

exports[`test case jsonb/json 1`] = `
"INSERT INTO collections_public.field (
"INSERT INTO metaschema_public.field (
id,
name,
data
) VALUES
('450e3b3b-b68d-4abc-990c-65cb8a1dcdb4', 'name here', '{"a":1}');"
(
'450e3b3b-b68d-4abc-990c-65cb8a1dcdb4',
'name here',
'{"a":1}'
);"
`;

exports[`test case test case 1`] = `Promise {}`;

exports[`test case test case parser 1`] = `
"INSERT INTO collections_public.field (
"INSERT INTO metaschema_public.field (
id,
database_id,
table_id,
name,
description
) VALUES
('450e3b3b-b68d-4abc-990c-65cb8a1dcdb4', '450e3b3b-b68d-4abc-990c-65cb8a1dcdb4', '450e3b3b-b68d-4abc-990c-65cb8a1dcdb4', 'name here', 'description');"
(
'450e3b3b-b68d-4abc-990c-65cb8a1dcdb4',
'450e3b3b-b68d-4abc-990c-65cb8a1dcdb4',
'450e3b3b-b68d-4abc-990c-65cb8a1dcdb4',
'name here',
'description'
);"
`;
8 changes: 4 additions & 4 deletions packages/csv-to-pg/__tests__/export.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { Parser } from '../src/parser';
const testCase = resolve(__dirname + '/../__fixtures__/test-case.csv');

const config = {
schema: 'collections_public',
schema: 'metaschema_public',
singleStmts: true,
table: 'field',
headers: [
Expand Down Expand Up @@ -76,7 +76,7 @@ it('test case parser', async () => {

it('jsonb/json', async () => {
const parser = new Parser({
schema: 'collections_public',
schema: 'metaschema_public',
singleStmts: true,
table: 'field',
fields: {
Expand All @@ -101,7 +101,7 @@ it('jsonb/json', async () => {

it('image/attachment', async () => {
const parser = new Parser({
schema: 'collections_public',
schema: 'metaschema_public',
singleStmts: true,
table: 'field',
fields: {
Expand Down Expand Up @@ -130,7 +130,7 @@ it('image/attachment', async () => {

it('arrays', async () => {
const parser = new Parser({
schema: 'collections_public',
schema: 'metaschema_public',
singleStmts: true,
table: 'field',
fields: {
Expand Down
2 changes: 1 addition & 1 deletion pgpm/core/__tests__/export/export-meta.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ describe('Export Meta Config Drift Detection', () => {
// BUG DOCUMENTATION:
// In export-meta.ts, line 26, the config defines:
// table: 'database_extensions' (plural)
// But the actual table in db-meta-schema is:
// But the actual table in metaschema-schema is:
// metaschema_public.database_extension (singular)
//
// This causes the Parser to generate INSERT statements with the wrong table name,
Expand Down
Loading
Loading