Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save martonlanga/c59350c2d9e3cae56ef63d059fb29fa2 to your computer and use it in GitHub Desktop.
Save martonlanga/c59350c2d9e3cae56ef63d059fb29fa2 to your computer and use it in GitHub Desktop.
# Failed applyMigration at 2019-12-20T20:09:34.862Z
## RPC One-Liner
```json
{"id":7,"jsonrpc":"2.0","method":"applyMigration","params":{"projectInfo":"","force":true,"migrationId":"watch-20191220210856","steps":[{"stepType":"CreateModel","model":"Statistics"},{"stepType":"CreateField","model":"Statistics","field":"id","type":"String","arity":"required"},{"stepType":"CreateDirective","model":"Statistics","field":"id","directive":"default"},{"stepType":"CreateDirectiveArgument","model":"Statistics","field":"id","directive":"default","argument":"","value":"cuid()"},{"stepType":"CreateDirective","model":"Statistics","field":"id","directive":"id"},{"stepType":"CreateField","model":"Statistics","field":"streak","type":"Int","arity":"required"},{"stepType":"CreateDirective","model":"Statistics","field":"streak","directive":"default"},{"stepType":"CreateDirectiveArgument","model":"Statistics","field":"streak","directive":"default","argument":"","value":"0"},{"stepType":"DeleteModel","model":"Statistic"},{"stepType":"CreateField","model":"User","field":"statistics","type":"Statistics","arity":"required"},{"stepType":"DeleteField","model":"User","field":"statistic"}],"sourceConfig":"generator photon {\n provider = \"photonjs\"\n}\n\ndatasource db {\n provider = \"postgresql\"\n url = env(\"POSTGRESQL_URL\")\n}\n\nmodel User {\n id String @default(cuid()) @id\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n email String @unique\n password String\n name String\n image String?\n emailVerified Boolean @default(false)\n reviewStates ReviewState[]\n decks Deck[] @relation(\"usersDecks\")\n ownedDecks Deck[] @relation(\"ownedDecks\")\n badges Badge[]\n statistics Statistics\n}\n\nmodel Statistics {\n id String @default(cuid()) @id\n streak Int @default(0)\n // points Int @default(0)\n // longestStreak Int @default(0)\n // numberOfDaysReviewed Int @default(0)\n // numberOfCardsReviewed Int @default(0)\n // totalCards Int @default(0)\n // totalTimeSpentLearning Int @default(0)\n // averageTimeSpentPerCard Int @default(0)\n // averageTimeSpentPerDay Int @default(0)\n // averageCardsReviewedPerDay Int @default(0)\n}\n\nmodel Badge {\n id String @default(cuid()) @id\n type BadgeType\n}\n\nmodel Deck {\n id String @default(cuid()) @id\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n title String\n description String @default(\"\")\n public Boolean @default(false)\n stars Int @default(0)\n image String?\n color Color?\n tags Tag[]\n discussions Discussion[]\n reviews Comment[]\n cards Card[]\n owners User[] @relation(\"ownedDecks\")\n users User[] @relation(\"usersDecks\")\n}\n\nmodel Card {\n id String @default(cuid()) @id\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n raw String\n plainText String\n tags Tag[]\n createdBy User\n deck Deck\n comments Comment[]\n}\n\nmodel Tag {\n id String @default(cuid()) @id\n name String\n color Color\n deck Deck\n children Tag[] @relation(\"nestedTags\")\n parent Tag? @relation(\"nestedTags\")\n cards Card[]\n}\n\nmodel ReviewState {\n id String @default(cuid()) @id\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n due DateTime @default(now())\n active Boolean @default(true)\n ease Float @default(2.5)\n interval Int @default(0)\n reviews Review[]\n card Card\n user User\n}\n\nmodel Review {\n id String @default(cuid()) @id\n date DateTime @default(now())\n grade Int\n timeSpent Int\n reviewState ReviewState\n}\n\nmodel Discussion {\n id String @default(cuid()) @id\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n title String\n closed Boolean @default(false)\n type DiscussionType\n tags Tag[]\n user User\n comments Comment[]\n}\n\nmodel Comment {\n id String @default(cuid()) @id\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n content String\n user User\n}\n\nenum DiscussionType {\n EDIT\n ADD\n}\n\nenum Color {\n cyan\n blue\n purple\n pink\n red\n brown\n orange\n yellow\n green\n teal\n gray\n}\n\nenum BadgeType {\n earlyBird\n}"}}
```
## RPC Input Readable
```json
{
"id": 7,
"jsonrpc": "2.0",
"method": "applyMigration",
"params": {
"projectInfo": "",
"force": true,
"migrationId": "watch-20191220210856",
"steps": [
{
"stepType": "CreateModel",
"model": "Statistics"
},
{
"stepType": "CreateField",
"model": "Statistics",
"field": "id",
"type": "String",
"arity": "required"
},
{
"stepType": "CreateDirective",
"model": "Statistics",
"field": "id",
"directive": "default"
},
{
"stepType": "CreateDirectiveArgument",
"model": "Statistics",
"field": "id",
"directive": "default",
"argument": "",
"value": "cuid()"
},
{
"stepType": "CreateDirective",
"model": "Statistics",
"field": "id",
"directive": "id"
},
{
"stepType": "CreateField",
"model": "Statistics",
"field": "streak",
"type": "Int",
"arity": "required"
},
{
"stepType": "CreateDirective",
"model": "Statistics",
"field": "streak",
"directive": "default"
},
{
"stepType": "CreateDirectiveArgument",
"model": "Statistics",
"field": "streak",
"directive": "default",
"argument": "",
"value": "0"
},
{
"stepType": "DeleteModel",
"model": "Statistic"
},
{
"stepType": "CreateField",
"model": "User",
"field": "statistics",
"type": "Statistics",
"arity": "required"
},
{
"stepType": "DeleteField",
"model": "User",
"field": "statistic"
}
],
"sourceConfig": "generator photon {\n provider = \"photonjs\"\n}\n\ndatasource db {\n provider = \"postgresql\"\n url = env(\"POSTGRESQL_URL\")\n}\n\nmodel User {\n id String @default(cuid()) @id\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n email String @unique\n password String\n name String\n image String?\n emailVerified Boolean @default(false)\n reviewStates ReviewState[]\n decks Deck[] @relation(\"usersDecks\")\n ownedDecks Deck[] @relation(\"ownedDecks\")\n badges Badge[]\n statistics Statistics\n}\n\nmodel Statistics {\n id String @default(cuid()) @id\n streak Int @default(0)\n // points Int @default(0)\n // longestStreak Int @default(0)\n // numberOfDaysReviewed Int @default(0)\n // numberOfCardsReviewed Int @default(0)\n // totalCards Int @default(0)\n // totalTimeSpentLearning Int @default(0)\n // averageTimeSpentPerCard Int @default(0)\n // averageTimeSpentPerDay Int @default(0)\n // averageCardsReviewedPerDay Int @default(0)\n}\n\nmodel Badge {\n id String @default(cuid()) @id\n type BadgeType\n}\n\nmodel Deck {\n id String @default(cuid()) @id\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n title String\n description String @default(\"\")\n public Boolean @default(false)\n stars Int @default(0)\n image String?\n color Color?\n tags Tag[]\n discussions Discussion[]\n reviews Comment[]\n cards Card[]\n owners User[] @relation(\"ownedDecks\")\n users User[] @relation(\"usersDecks\")\n}\n\nmodel Card {\n id String @default(cuid()) @id\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n raw String\n plainText String\n tags Tag[]\n createdBy User\n deck Deck\n comments Comment[]\n}\n\nmodel Tag {\n id String @default(cuid()) @id\n name String\n color Color\n deck Deck\n children Tag[] @relation(\"nestedTags\")\n parent Tag? @relation(\"nestedTags\")\n cards Card[]\n}\n\nmodel ReviewState {\n id String @default(cuid()) @id\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n due DateTime @default(now())\n active Boolean @default(true)\n ease Float @default(2.5)\n interval Int @default(0)\n reviews Review[]\n card Card\n user User\n}\n\nmodel Review {\n id String @default(cuid()) @id\n date DateTime @default(now())\n grade Int\n timeSpent Int\n reviewState ReviewState\n}\n\nmodel Discussion {\n id String @default(cuid()) @id\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n title String\n closed Boolean @default(false)\n type DiscussionType\n tags Tag[]\n user User\n comments Comment[]\n}\n\nmodel Comment {\n id String @default(cuid()) @id\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n content String\n user User\n}\n\nenum DiscussionType {\n EDIT\n ADD\n}\n\nenum Color {\n cyan\n blue\n purple\n pink\n red\n brown\n orange\n yellow\n green\n teal\n gray\n}\n\nenum BadgeType {\n earlyBird\n}"
}
}
```
## Stack Trace
```bash
Dec 20 21:08:06.940 INFO migration_engine: Starting migration engine RPC server git_hash="3c4da1d6caa0c40a0210a346ec982c77f74e18c7"
Dec 20 21:08:06.948 INFO quaint::single: Starting a postgresql pool with 1 connections.
Dec 20 21:08:06.977 INFO ListMigrations: migration_engine::commands::list_migrations: Returning 6 migrations (0 pending).
Dec 20 21:08:07.078 INFO ListMigrations: migration_engine::commands::list_migrations: Returning 6 migrations (0 pending).
Dec 20 21:08:56.071 INFO ListMigrations: migration_engine::commands::list_migrations: Returning 7 migrations (0 pending).
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment