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
22 changes: 18 additions & 4 deletions dummy/social-media-clone/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -316,8 +316,15 @@
"type": "string"
},
"respondedAt": {
"format": "date-time",
"type": "string"
"anyOf": [
{
"format": "date-time",
"type": "string"
},
{
"type": "null"
}
]
},
"status": {
"enum": [
Expand Down Expand Up @@ -376,8 +383,15 @@
"type": "string"
},
"respondedAt": {
"format": "date-time",
"type": "string"
"anyOf": [
{
"format": "date-time",
"type": "string"
},
{
"type": "null"
}
]
},
"status": {
"enum": [
Expand Down
24 changes: 19 additions & 5 deletions dummy/social-media-clone/x.manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"manifestVersion": 1,
"buildId": "1496a31926c0d80a",
"buildId": "d5c348a7bab60ad4",
"app": {
"name": "social-media-clone",
"version": "0.1.0"
Expand Down Expand Up @@ -1152,8 +1152,15 @@
]
},
"respondedAt": {
"type": "string",
"format": "date-time"
"anyOf": [
{
"type": "string",
"format": "date-time"
},
{
"type": "null"
}
]
},
"createdAt": {
"type": "string",
Expand Down Expand Up @@ -1224,8 +1231,15 @@
]
},
"respondedAt": {
"type": "string",
"format": "date-time"
"anyOf": [
{
"type": "string",
"format": "date-time"
},
{
"type": "null"
}
]
},
"createdAt": {
"type": "string",
Expand Down
77 changes: 63 additions & 14 deletions examples/dummy/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,15 @@
"type": "string"
},
"coverUrl": {
"format": "uri",
"type": "string"
"anyOf": [
{
"format": "uri",
"type": "string"
},
{
"type": "null"
}
]
},
"excerpt": {
"maxLength": 200,
Expand All @@ -186,8 +193,15 @@
"type": "string"
},
"publishedAt": {
"format": "date-time",
"type": "string"
"anyOf": [
{
"format": "date-time",
"type": "string"
},
{
"type": "null"
}
]
},
"slug": {
"maxLength": 80,
Expand Down Expand Up @@ -447,8 +461,15 @@
"type": "string"
},
"coverUrl": {
"format": "uri",
"type": "string"
"anyOf": [
{
"format": "uri",
"type": "string"
},
{
"type": "null"
}
]
},
"excerpt": {
"maxLength": 200,
Expand All @@ -468,8 +489,15 @@
"type": "string"
},
"publishedAt": {
"format": "date-time",
"type": "string"
"anyOf": [
{
"format": "date-time",
"type": "string"
},
{
"type": "null"
}
]
},
"slug": {
"maxLength": 80,
Expand Down Expand Up @@ -518,8 +546,15 @@
"additionalProperties": false,
"properties": {
"url": {
"minLength": 1,
"type": "string"
"anyOf": [
{
"minLength": 1,
"type": "string"
},
{
"type": "null"
}
]
}
},
"required": [
Expand Down Expand Up @@ -604,8 +639,15 @@
"type": "string"
},
"coverUrl": {
"format": "uri",
"type": "string"
"anyOf": [
{
"format": "uri",
"type": "string"
},
{
"type": "null"
}
]
},
"excerpt": {
"maxLength": 200,
Expand All @@ -625,8 +667,15 @@
"type": "string"
},
"publishedAt": {
"format": "date-time",
"type": "string"
"anyOf": [
{
"format": "date-time",
"type": "string"
},
{
"type": "null"
}
]
},
"slug": {
"maxLength": 80,
Expand Down
23 changes: 23 additions & 0 deletions examples/dummy/packages/db/migrations/0002_money_scale.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
-- 0002_money_scale
-- HAND-WRITTEN, and it has to be: `x db gen "money scale"` answers X_MIGRATION_SNAPSHOT_MISSING
-- in this app — 0001_init records no `.snapshot.json`, so the generator has nothing to diff
-- against and refuses rather than emitting `create table` for everything that already exists.
-- The statement below is byte-for-byte what `generateMigration`'s `diffTable`/`columnClause`
-- emits for this column, and the CHECK is `@ultimat3/entity`'s own `scaleCheck` — so a psql
-- session cannot write a scale the app would refuse to read back.
-- Editing an applied migration changes its checksum: X_MIGRATION_CONFLICT on the next apply.
--
-- `plans.monthly` is this app's only `money()` column, and money is three physical columns since
-- `MoneyValue.scale` began to persist: without `monthly_scale` every read of this table names a
-- column it does not have. NULL is the right value for every existing row — it means "the
-- currency's own minor unit", which is what those rows always meant. `0` would mean whole units.
--
-- No `.hash` sidecar on purpose. The sidecar records a hash of the WHOLE schema source, and this
-- app's `drift` step is pinned red (scripts/lib/gated-apps.ts) because 0001's recorded hash
-- already predates that source. One column does not earn the claim that the migrations describe
-- it, and a hash written here would make the pin go green without regenerating anything.

alter table "plans" add column "monthly_scale" integer check (monthly_scale is null or (monthly_scale >= 0 and monthly_scale <= 15));

-- down
alter table "plans" drop column "monthly_scale";
85 changes: 70 additions & 15 deletions examples/dummy/x.manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"manifestVersion": 1,
"buildId": "0d787d16185d9e2b",
"buildId": "834838ba19f3f7b0",
"app": {
"name": "@postly/root",
"version": "0.0.1"
Expand Down Expand Up @@ -361,6 +361,12 @@
"nullable": false,
"primaryKey": false
},
{
"name": "monthly_scale",
"type": "integer",
"nullable": true,
"primaryKey": false
},
{
"name": "seats",
"type": "integer",
Expand Down Expand Up @@ -677,8 +683,15 @@
"minLength": 1
},
"coverUrl": {
"type": "string",
"format": "uri"
"anyOf": [
{
"type": "string",
"format": "uri"
},
{
"type": "null"
}
]
},
"status": {
"type": "string",
Expand All @@ -693,8 +706,15 @@
"minimum": 0
},
"publishedAt": {
"type": "string",
"format": "date-time"
"anyOf": [
{
"type": "string",
"format": "date-time"
},
{
"type": "null"
}
]
},
"authorId": {
"type": "string",
Expand Down Expand Up @@ -999,8 +1019,15 @@
"minLength": 1
},
"coverUrl": {
"type": "string",
"format": "uri"
"anyOf": [
{
"type": "string",
"format": "uri"
},
{
"type": "null"
}
]
},
"status": {
"type": "string",
Expand All @@ -1015,8 +1042,15 @@
"minimum": 0
},
"publishedAt": {
"type": "string",
"format": "date-time"
"anyOf": [
{
"type": "string",
"format": "date-time"
},
{
"type": "null"
}
]
},
"authorId": {
"type": "string",
Expand Down Expand Up @@ -1071,8 +1105,15 @@
"type": "object",
"properties": {
"url": {
"type": "string",
"minLength": 1
"anyOf": [
{
"type": "string",
"minLength": 1
},
{
"type": "null"
}
]
}
},
"required": [
Expand Down Expand Up @@ -1146,8 +1187,15 @@
"minLength": 1
},
"coverUrl": {
"type": "string",
"format": "uri"
"anyOf": [
{
"type": "string",
"format": "uri"
},
{
"type": "null"
}
]
},
"status": {
"type": "string",
Expand All @@ -1162,8 +1210,15 @@
"minimum": 0
},
"publishedAt": {
"type": "string",
"format": "date-time"
"anyOf": [
{
"type": "string",
"format": "date-time"
},
{
"type": "null"
}
]
},
"authorId": {
"type": "string",
Expand Down
Loading