From 04ae6ce0671ac9923e8adcaa5f53f5edae4f8117 Mon Sep 17 00:00:00 2001 From: Divyendu Singh Date: Tue, 30 Jul 2024 11:35:08 +0200 Subject: [PATCH 1/3] add docs for xata migrate command --- 020-Connect/015-CLI/010-cli.mdx | 60 ++++++++++++++++++++++++++++++++- 1 file changed, 59 insertions(+), 1 deletion(-) diff --git a/020-Connect/015-CLI/010-cli.mdx b/020-Connect/015-CLI/010-cli.mdx index 98e33b76..bc3d2c2f 100644 --- a/020-Connect/015-CLI/010-cli.mdx +++ b/020-Connect/015-CLI/010-cli.mdx @@ -52,7 +52,7 @@ The Xata CLI requires credentials (in the form of an API key) to perform command xata auth login ``` -Running the above will ask if you want to authenticate using an existing API key or by creating a new key. If this is your first time using Xata, choose to create a new key. The CLI willprompt you to visit the Xata website in your browser where a key will be generated. To instead use an existing key, copy a key you previously created on the [account settings][0] page. +Running the above will ask if you want to authenticate using an existing API key or by creating a new key. If this is your first time using Xata, choose to create a new key. The CLI will prompt you to visit the Xata website in your browser where a key will be generated. To instead use an existing key, copy a key you previously created on the [account settings][0] page. Regardless of the method you chose, Xata generates a file at `~/.config/xata/credentials` to store your API keys. It looks something like this. @@ -106,6 +106,64 @@ It can run non-interactively for use in build scripts, with `XATA_API_KEY` and ` xata init --db https://workspace-1234.us-east-1.xata.sh/db/database-name --sdk --no-input --yes --codegen=src/xata.ts --force ``` +### migrate + +Use `xata migrate` command to execute and control [multi-schema migrations](https://xata.io/blog/multi-version-schema-migrations) with CLI. The following subcommands are available: start, complete, rollback, status, list. +The following commands use the branch name `main` as an example. + +To start a new migration, use + +```bash +xata migrate start main --migration-json '[{ "alter_column": { "table": "table", "column": "text", "type": "text", "up": "description", "down": "description" } }]' +``` + +OR + +If you want to have the pgroll migration in a separate file, use + +```bash +xata migrate start main migration.json +``` + +Learn about [pgroll](https://github.com/xataio/pgroll). +See possible [pgroll migration examples](https://github.com/xataio/pgroll/tree/main/examples). + +To see the status of a running migration, use + +```bash +xata migrate status main +``` + +To see the list of migration jobs, use + +```bash +xata migrate status main +``` + +To complete a migration, use + +```bash +xata migrate complete main +``` + +To rollback a migration, use + +```bash +xata migrate rollback main +``` + +There are other options available with `xata migrate` commands, use the following to see all options + +```bash +xata migrate --help +``` + +OR for sub-commands + +```bash +xata migrate start --help +``` + ### codegen The `xata codegen` command updates the Xata client and optionally creates typings for a TypeScript based project. On its initial run, the CLI generates these files in the `src/xata.ts` directory. Subsequent runs will update the file. Since this file is automated, it is important that you'd edit it directly, but rerun the `xata codegen` command periodically as you make schema updates. From edb1d422ac686717b0d763a9b7c5646292df15bb Mon Sep 17 00:00:00 2001 From: Divyendu Singh Date: Tue, 30 Jul 2024 11:38:32 +0200 Subject: [PATCH 2/3] fix some typos --- 010-Getting-started/010-what-is-xata.mdx | 2 +- .../030-Framework-starter-guides/010-astro.mdx | 2 +- 010-Getting-started/030-Framework-starter-guides/030-nuxt.mdx | 2 +- .../030-Framework-starter-guides/040-remix.mdx | 2 +- 020-Connect/030-Python/010-xata-sdk.mdx | 4 ++-- 020-Connect/030-Python/120-pg8000.mdx | 2 +- 050-Manage/040-pr-based-workflow.mdx | 2 +- 070-Integrations/005-csv.mdx | 2 +- 070-Integrations/010-airbyte.mdx | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/010-Getting-started/010-what-is-xata.mdx b/010-Getting-started/010-what-is-xata.mdx index a8fc3616..6edaa383 100644 --- a/010-Getting-started/010-what-is-xata.mdx +++ b/010-Getting-started/010-what-is-xata.mdx @@ -1,7 +1,7 @@ --- title: What is Xata? navTitle: What is Xata? -keywords: ['severless', 'data platform', 'PostgreSQL', 'architecture'] +keywords: ['serverless', 'data platform', 'PostgreSQL', 'architecture'] description: An overview of Xata, the data platform for PostgreSQL. slug: concepts/serverless-data-platform published: true diff --git a/010-Getting-started/030-Framework-starter-guides/010-astro.mdx b/010-Getting-started/030-Framework-starter-guides/010-astro.mdx index a206b01d..11c66ea2 100644 --- a/010-Getting-started/030-Framework-starter-guides/010-astro.mdx +++ b/010-Getting-started/030-Framework-starter-guides/010-astro.mdx @@ -639,7 +639,7 @@ export default defineConfig({ }); ``` -With `output` set to `server`, Astro can now read paramaters from the URL. Now, you are ready to add the search functionality. If you like to deploy this project later. Make sure you also add the ssr adaptor parameter `adapter: your adapter here()` as well. Follow the Astro docs for that here: [Astro docs SSR Adapters](https://docs.astro.build/en/guides/server-side-rendering/) +With `output` set to `server`, Astro can now read parameters from the URL. Now, you are ready to add the search functionality. If you like to deploy this project later. Make sure you also add the ssr adaptor parameter `adapter: your adapter here()` as well. Follow the Astro docs for that here: [Astro docs SSR Adapters](https://docs.astro.build/en/guides/server-side-rendering/) After we added our adapter, the above code would then go as follows with the adapter added: diff --git a/010-Getting-started/030-Framework-starter-guides/030-nuxt.mdx b/010-Getting-started/030-Framework-starter-guides/030-nuxt.mdx index f077a660..e1cecafc 100644 --- a/010-Getting-started/030-Framework-starter-guides/030-nuxt.mdx +++ b/010-Getting-started/030-Framework-starter-guides/030-nuxt.mdx @@ -491,7 +491,7 @@ When you insert data into a Xata database, it is automatically indexed for full- any configuration to enable search, just need to use the [TypeScript SDK search feature](/docs/sdk/search). -Aadd this functionality to `/api/posts` API server route: +Add this functionality to `/api/posts` API server route: ```tsx title="server/api/posts.ts" {5-13} import { getXataClient } from '../../src/xata'; diff --git a/010-Getting-started/030-Framework-starter-guides/040-remix.mdx b/010-Getting-started/030-Framework-starter-guides/040-remix.mdx index a119e5e1..7fa2d2be 100644 --- a/010-Getting-started/030-Framework-starter-guides/040-remix.mdx +++ b/010-Getting-started/030-Framework-starter-guides/040-remix.mdx @@ -564,7 +564,7 @@ export async function loader({ params }: LoaderFunctionArgs) { ``` - In case you encounter a `"Runtime.UnhandledPromiseRejection"` when deploying the Remix app, try passing the Remix fetch implenentation to the XataClient. + In case you encounter a `"Runtime.UnhandledPromiseRejection"` when deploying the Remix app, try passing the Remix fetch implementation to the XataClient. ```ts import { fetch as webFetch } from "@remix-run/web-fetch"; import { XataClient } from "src/xata"; diff --git a/020-Connect/030-Python/010-xata-sdk.mdx b/020-Connect/030-Python/010-xata-sdk.mdx index e41fed01..6be947fe 100644 --- a/020-Connect/030-Python/010-xata-sdk.mdx +++ b/020-Connect/030-Python/010-xata-sdk.mdx @@ -693,7 +693,7 @@ from xata.helpers import BulkProcessor client = XataClient() bp = BulkProcessor(client) -# Sub to a queue and continously read messages +# Sub to a queue and continuously read messages while queue.subscribed(): msg = queue.read() @@ -760,7 +760,7 @@ changed to a more concise call in `1.x`: lst = xata.databases().list() ``` -Continously the function arguments are also converted to the pep-8 standard, lowercased and separated by an underscore, `SessionId` becomes `session_id`. +Continuously the function arguments are also converted to the pep-8 standard, lowercased and separated by an underscore, `SessionId` becomes `session_id`. ### Error Handling diff --git a/020-Connect/030-Python/120-pg8000.mdx b/020-Connect/030-Python/120-pg8000.mdx index 0a51268c..0f2c34e7 100644 --- a/020-Connect/030-Python/120-pg8000.mdx +++ b/020-Connect/030-Python/120-pg8000.mdx @@ -11,7 +11,7 @@ The [pg8000](https://pypi.org/project/pg8000/) driver comes with different API's Both API's use the parameterized approach to define the connection parameters. Please replace the placeholders in the connection string or parameters, as indicated on the [connect to Postgres](/docs/postgres) page. -pg8000 does not default to encrypted connections out of the box, and as Xata rejects all [not encyrpted connections](/docs/postgres#sslmode), you need to specify the SSL context. +pg8000 does not default to encrypted connections out of the box, and as Xata rejects all [not encryrpted connections](/docs/postgres#sslmode), you need to specify the SSL context. This is done by adding the `ssl_context=True` in the connection parameters. The following examples both demonstrate this. diff --git a/050-Manage/040-pr-based-workflow.mdx b/050-Manage/040-pr-based-workflow.mdx index 397459f5..954b3cfa 100644 --- a/050-Manage/040-pr-based-workflow.mdx +++ b/050-Manage/040-pr-based-workflow.mdx @@ -217,7 +217,7 @@ The GitHub integration will output errors if your migration files are out of syn Since the `.xata/migrations` folder is simply a code-based ledger of the content we keep on the server, you can always delete the folder and rerun `xata pull my_feature` to rebuild it. Then recommit your files to GitHub and check the results. -If you've already run `xata pull` and committed it, but you are still recieving errors from our app in GitHub, try manually deleting the `preview-my_feature` database branch within the Xata UI. Your next commit to GitHub should create a new, working preview branch from your migration files. +If you've already run `xata pull` and committed it, but you are still receiving errors from our app in GitHub, try manually deleting the `preview-my_feature` database branch within the Xata UI. Your next commit to GitHub should create a new, working preview branch from your migration files. ## Limitations diff --git a/070-Integrations/005-csv.mdx b/070-Integrations/005-csv.mdx index 879d2d24..56d4116d 100644 --- a/070-Integrations/005-csv.mdx +++ b/070-Integrations/005-csv.mdx @@ -42,7 +42,7 @@ Choose a format that matches the data you're entering. Xata columns support the | Datetime | Date and time information. Our CSV importer will attempt to parse all common datetimes | `2023-08-30T00:00:00.000Z` or `26-02-88` or any other date format | | Link to Table | ID of a record in another table | `rec_xyz` or `usr_xyz`if using custom IDs | | Email | Email addresses | `user@example.com` | -| Multiple | Multiple values seperated by a comma or a JSON array | `Red,Green` or `["Red", "Green"]` | +| Multiple | Multiple values separated by a comma or a JSON array | `Red,Green` or `["Red", "Green"]` | | File | Not supported | | | Vector | Not supported | | diff --git a/070-Integrations/010-airbyte.mdx b/070-Integrations/010-airbyte.mdx index 83d3f3ab..6946ad5a 100644 --- a/070-Integrations/010-airbyte.mdx +++ b/070-Integrations/010-airbyte.mdx @@ -2,7 +2,7 @@ title: Airbyte with Xata navTitle: Airbyte keywords: ['airbyte', 'migrate data'] -description: Use Xata with Airbyte, the integration platform that enables efficent data management from multiple sources +description: Use Xata with Airbyte, the integration platform that enables efficient data management from multiple sources slug: integrations/airbyte published: true status: beta From a2b77f45ae440fd6cbdbfaf173b34741d2a7b311 Mon Sep 17 00:00:00 2001 From: Divyendu Singh Date: Tue, 30 Jul 2024 11:59:09 +0200 Subject: [PATCH 3/3] chore: fix case --- 020-Connect/015-CLI/010-cli.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/020-Connect/015-CLI/010-cli.mdx b/020-Connect/015-CLI/010-cli.mdx index bc3d2c2f..ca92ffd0 100644 --- a/020-Connect/015-CLI/010-cli.mdx +++ b/020-Connect/015-CLI/010-cli.mdx @@ -117,7 +117,7 @@ To start a new migration, use xata migrate start main --migration-json '[{ "alter_column": { "table": "table", "column": "text", "type": "text", "up": "description", "down": "description" } }]' ``` -OR +Or If you want to have the pgroll migration in a separate file, use @@ -158,7 +158,7 @@ There are other options available with `xata migrate` commands, use the followin xata migrate --help ``` -OR for sub-commands +Or for sub-commands ```bash xata migrate start --help