Repository navigation
v0.24.0
Provider contract 25.33 to 25.39
- Contract 25.33: a provider decides whether a declared view's query and the
one the database holds are the same query; a comparison receives the declared
objects of another comparison, such as the topics a YDB transfer reads; a
render reports what it leaves out of a declaration; planning receives the
grants found on each held table, so a rebuild in a migration file grants them
again; a SQL reading returns a role's password, which Ptah binds as an input
and never prints; and an engine states that its server skipsDROP VIEW IF EXISTSof a table. - Contract 25.34: an engine states its lexical rules, such as escape strings,
continued and Unicode strings and nested comments, and Ptah reads its SQL
schema files, migration directives,sql lintinput and lineage by them. A
Spanner schema file withDEFAULT E'it\'s'or a nested comment now parses,
and the column's default isit's, not the textE'it\'s'. - Contract 25.35: an engine states where its connection reads the capabilities
it refines, andptah db capabilitiesprints that line beneath each refined
capability; with ptah-ydb-plugin v0.5.0 it names the cluster's monitoring
endpoint. - Contract 25.36: a reported model names the metric that counts its omitted
objects and the label export diagnostics use, so a DBML or JSON export can
count two changefeeds of one table as two. Ptah refuses two engines that
define one model's omission count differently. - Contract 25.37: a view query comparison receives the columns of every
declared table and may leave a pair undecided for Ptah to compare, and an
object comparison receives the declared facets of another comparison, such
as a table's changefeeds. - Contract 25.38: a provider's SQL reading reports a
statement that changes an object the load does not declare asUNDECLARED,
and Ptah adds, as it does for a built-in engine, that the SQL files of a load
change only what the SQL files declare, naming the file that declares the
object. - Contract 25.39: a read reports the objects outside the provider's model that
block the removal of a table or a column, and Ptah hands them to planning, so
schema apply --dry-runandmigrations generaterefuse such a drop instead
of writing one the server refuses.
This is the first Ptah release of these contracts, so what ptah-ydb-plugin
v0.5.0, ptah-spanner-plugin v0.2.0 and ptah-duckdb-plugin v0.2.0 adopted from
25.33 to 25.35 takes effect with it. YDB replaces a view whose query changed
only in case and refuses a transfer that reads an undeclared topic; Spanner
reads DROP VIEW IF EXISTS of a table as its server runs it; DuckDB replaces a
view whose alias changed case; all three report render omissions.
ptah-spanner-plugin v0.3.0 uses 25.37 and 25.39, and ptah-ydb-plugin v0.6.0
uses 25.37 and 25.38.
The SDK releases are provider-sdk/v0.31.0 (25.33), v0.32.0 (25.34),
v0.33.0 (25.35), v0.34.0 (25.36), v0.35.0 (25.37), v0.36.0 (25.38) and
v0.37.0 (25.39). The contract freezes together with Ptah 1.0 at major 25
(ADR 0102).
Fixes on provider engines
ptah schema renderof a Go, YAML or HCL source left out the table, column
and index comments of a provider that owns table creation; it now writes them
after the table. On YDB, a table whose UNIQUE constraint has a comment needs
ptah-ydb-plugin v0.6.0.- A provider engine's views were ordered by Ptah's own lexer, so a YQL string
that held a view path made a false dependency cycle and a view could come
before the view it reads; views are now ordered by the provider's scanner. schema renderwith several SQL--schema-filesources of a provider engine
loaded each one alone, so a YQLALTER TABLEcould not see a table another
file declares; the SQL sources are now read as one load.- A file-to-file
schema diffthrough a provider replaced every index whose
kind, NULLS order or predicate the provider spells another way, every YDB
global index among them; both documents are now prepared the same way, and a
document diffed with itself is synced. - A Go
ptah:schema:notdescribeddirective with an upper-case kind, such as
kind="COORDINATION_NODE", was refused before the provider saw it; the kind
is now read in any case. - A provider SQL grant on a database-wide object with a dot in its name, such
as the YDB resource poolbatch.v2, kept quotes as part of the name; the
name now stays as written. schema inspect --format hclof a YDB database wrote a group as a plain role
and dropped its memberships, so the document planned back was refused; the
HCLroleblock now takesgroup = trueandmember_of = [...].- A scoped plan kept an object that another one requires, such as the resource
pool of a YDB classifier, on one side only, and planned to create a pool the
database holds; both sides now keep what the desired side requires. - A changed list of enum values planned nothing on an engine that builds an
enum column asTEXTunder aCHECK, such as Spanner; the provider is now
asked about theCHECKthe column gets, and the plan replaces it. - On a provider engine with a lock,
schema apply --lock-timeoutwas refused
andPTAH_LOCK_TIMEOUTwas reported as ignored while the apply took the lock
anyway; both now bound the wait for the provider's lock, and a dry run
accepts the flag. - The down file of a migration that adds a column with its own
CHECKor
foreign key dropped the column alone, which Spanner refuses; the provider now
sees those constraints and drops them first. - An HCL export of a provider read dropped, without a word, the record of an
object the read lists but does not describe, such as a YDB persistent queue
group; the export now warns of it. - An HCL export left out of its
ptah:feature-coverageheader the subjects a
read could not inspect or represent when only a table's platform block holds
their model, and wrote no limit for a table facet the provider could not
encode, such as a YDB changefeed; the header now records both, so applying
the document back keeps what it does not describe. ptah migrations checkpointof a provider engine refused a native object,
such as a YDB coordination node, because the empty baseline named no
database; the baseline now carries the target's database path.
Other fixes
- A migration with a nested block comment on PostgreSQL, CockroachDB or
YugabyteDB was split at the first*/and failed; the comment is now read as
one, as those servers read it. ptah sql lintread a statement's first word by the SQL standard and
reportedSQL004after such a comment; it now reads it by the dialect's
rules.- A PostgreSQL routine's HCL
setvalues rendered unquoted, such asSET work_mem = 8MB, which the server refuses; they now render as SQL the server
takes and compare as it stores them, and a value written with SQL quotes is
a value with quotes in it. - A view's
WITH LOCAL CHECK OPTIONwas refused in a SQL file and a held
LOCALview read as synced againstWITH CHECK OPTION; on PostgreSQL, MySQL
and MariaDB the level is now read, compared, rendered and exported, and a Go
or YAMLwith_checkother thantrue,false,cascadedorlocalis
refused. - A PostgreSQL partition move that takes rows out of their parent, to another
parent or to an ordinary table, was rated a warning; it is now destructive,
somigrations generate --check-destructiverefuses it andmigrations up
needs--allow-destructive. - A PostgreSQL table, view or sequence whose owner revoked default privileges
from itself read as synced;schema plan,schema applyandschema comparenow print anUNMANAGED:line on stderr,schema securityreports
OWN02, and nothing is planned. ptah schema rendersaid nothing of a declaration the target keeps only in
part, such as the length of aVARCHAR(255)on an engine whose string type
has none or a MySQL table option on SQLite; it now prints onenote:line
per omission on stderr, for built-in and provider engines, and stdout stays
DDL.
For provider authors
github.com/stokaro/ptah/sqlsyntaxv0.1.0 is a new module, released with
sqlsyntax/v*tags as provider-sdk is. Its packagepgsyntaxreads the
PostgreSQL family's lexical syntax: tokens, statements split at semicolons,
the value of a string or quoted identifier, and quoting, with options for
backslash escapes and DuckDB's continued escape strings. It knows no keyword
or DDL. Ptah reads nested comments with it, and the Spanner and DuckDB
providers read their text with it.- The conformance suite accepts a provider's refusal of a host that lists no
two-way feature, and of a contract 25.0 host, where the narrowed description
is one the SDK refuses, as it did for a host that leaves out one feature. - The table a rollback plan starts from holds the
CHECKand the foreign key
of each column the forward plan adds, under the names the comparison pairs
them by (fk_<table>_<column>for an unnamed key). - The
CHECKof an enum column is asked of the provider under
schema.check-equivalence, and an offline comparison through a provider asks
too. - A two-document
schema diffprepares the--fromdocument through the
target's table preparation, so a target with indexed tables needs a
preparation service. - A comparison decides
keeps_requiredonce, from its desired side, and each
side keeps those objects where it holds them (ADR 0117). engine.Runtime.RenderSchemareturns a provider's render omissions in
SchemaResult.Omissions, as it does for a built-in engine.
Dependency updates: provider-sdk v0.37.0, sqlsyntax v0.1.0 and
github.com/dlclark/regexp2/v2 v2.13.0; in the sqlsyntax module, go-cmp v0.7.0
and go-internal v1.16.0.
The provider pages on docs.ptah.run follow ptah-ydb-plugin v0.5.0,
ptah-spanner-plugin v0.2.0 and ptah-duckdb-plugin v0.2.0, and each setup page
shows how to check the installed copy with ptah providers check --provider-engine <engine> --json.
Changelog
- a584060 Add a module with the lexical syntax of the PostgreSQL family (#5745)
- 64dc845 Add contract 25.33: view queries, declared objects, omissions, grants, SQL facts (#5749)
- 59dd551 Add contract 25.34: the lexical rules of a provider engine (#5759)
- a5ca4da Add contract 25.35: where an engine's connection reads capabilities (#5772)
- 6b7c997 Add contract 25.36: omission counts of a reported model (#5784)
- 5c3f840 Add contract 25.36: view query context and declared facets (#5785)
- 3ff5bb4 Add contract 25.38: a SQL reading names a statement its load does not declare (#5790)
- 939402c Add contract 25.39: the objects that block a table's removal (#5796)
- 1b45432 Adopt contract 25.33 on the host: view queries, declared objects, omissions, grants, SQL facts (#5753)
- 4e3082c Adopt contract 25.37: view query context and declared facets (#5787)
- 2708065 Adopt contract 25.38: read a provider's undeclared statement as the host's own (#5792)
- eefbbaf Adopt contract 25.39 on the host: removal blockers (#5797)
- bf8def7 Ask a provider about the CHECK it builds for an enum column (#5791)
- 830b1f9 Carry a view's check option level through the model (#5744)
- 06a1900 Carry provider omission counts into export reporting (#5789)
- eec1271 Describe a converted document's indexes as the target prepares them (#5742)
- 8ecf83a Describe a provider's rebuild comments without the deleted engine (#5771)
- e3dd2df Describe provider behavior without the deleted YDB engine (#5774)
- 9efb092 Give the provider_missing test a user cache of its own (#5781)
- 083252e Hand a provider engine's string default over in the standard spelling (#5766)
- 32de703 Import the provider pages from YDB v0.5.0, Spanner v0.2.0 and DuckDB v0.2.0 (#5786)
- cb71d16 Keep unreadable and lost table facets in HCL headers (#5795)
- 6899173 Keep what the desired side requires on both sides of a comparison (#5782)
- 756744c Let a provider's lock decide schema apply's lock timeout (#5793)
- 5ebe334 Let a reader read one PostgreSQL-family token with pgsyntax (#5746)
- 34106d6 Let pgsyntax read DuckDB's continued escape strings (#5755)
- 81beefa Let the SQL syntax module keep its own module identity (#5758)
- 2cee899 Name YDB monitoring flags as capability refinement source (#5751)
- 94af2d6 Name what a render leaves out on stderr (#5779)
- 354ce91 Pin sqlsyntax v0.1.0 and provider-sdk v0.32.0 (#5764)
- c7c1a8e Project the constraints of added columns into a rollback's table (#5794)
- 75c4a7d Rate a partition move that takes rows out of a parent as destructive (#5741)
- b452b33 Read a linted statement's first word by the dialect's rules (#5769)
- 8cfa51a Read a provider engine's text by the lexical rules it states (#5761)
- 3328749 Read nested block comments on the PostgreSQL family through pgsyntax (#5750)
- 76572d2 Read string and identifier values with pgsyntax (#5752)
- e676210 Read the cast and := as one token in pgsyntax (#5756)
- 886a127 Regenerate the schema security DOT sample (#5783)
- 35ae34d Render a routine's HCL set values as SQL the server takes (#5734)
- 36cf714 Report an owner's unmanaged privileges instead of reading them as synced (#5767)
- e763659 Report the provider records an HCL export cannot carry (#5798)
- e31ce4f Show how to check an installed provider on each setup page (#5776)
- ff7fca0 Update github.com/stokaro/ptah/sqlsyntax digest to 76572d2 (#5757)
- 4241af8 Update module github.com/dlclark/regexp2/v2 to v2.13.0 (#5768)
- 6b221a6 Update module github.com/google/go-cmp to v0.7.0 (#5747)
- eb27041 Update module github.com/rogpeppe/go-internal to v1.16.0 (#5748)
- 7f5b66a Word a provider's capability refinements by the line it states (#5773)
- 0f8f718 Write and read YDB groups and memberships in HCL (#5780)
- 5a489b1 feat(export): count omitted objects from model reports (#5763)
- 6054826 feat(provider-sdk): declare omission counts for reported models (#5760)
- ebd1b51 fix(provider): order views with provider SQL scanner (#5740)
- 30551c7 fix(provider): render authored table and index comments (#5736)
- 2c79547 fix(providerhost): normalize Go coverage kind casing (#5775)
- 8b5b356 fix(providerhost): preserve database-wide SQL grant names (#5777)
- 6c526c2 fix(schema): read provider SQL source lists as one load (#5743)
- 24dc5ad fix: bind checkpoint baseline to target database path (#5788)