From c22b4ace0c0834ed64d4c1f7abea85c31d83c984 Mon Sep 17 00:00:00 2001 From: Shahed Nasser Date: Thu, 1 Jun 2023 14:23:45 +0300 Subject: [PATCH] docs: remove mentions of SQLite (#4045) * docs: removed mentions of sqlite * removed mentions of the seed option * remove sidebar link * Made PostgreSQL a required tool * fixed heading --- docs/content/admin/quickstart.mdx | 2 +- docs/content/cli/reference.md | 1 - docs/content/contribution-guidelines.md | 4 +- docs/content/create-medusa-app.mdx | 2 +- .../server/deploying-on-microtica.md | 2 +- .../development/backend/configurations.md | 34 ++-------- docs/content/development/backend/install.mdx | 10 ++- .../backend/prepare-environment.mdx | 18 ++---- .../content/development/batch-jobs/create.mdx | 4 -- .../batch-jobs/customize-import.md | 4 -- .../entities/migrations/overview.mdx | 6 -- docs/content/plugins/cms/contentful/index.md | 5 +- docs/content/plugins/cms/strapi.md | 35 ++++++----- .../troubleshooting/signing-in-to-admin.md | 2 +- .../transaction-error-in-checkout.md | 63 ------------------- www/docs/sidebars.js | 5 -- 16 files changed, 46 insertions(+), 151 deletions(-) delete mode 100644 docs/content/troubleshooting/transaction-error-in-checkout.md diff --git a/docs/content/admin/quickstart.mdx b/docs/content/admin/quickstart.mdx index 639c6a8223..e6a828e977 100644 --- a/docs/content/admin/quickstart.mdx +++ b/docs/content/admin/quickstart.mdx @@ -187,7 +187,7 @@ This runs the admin dashboard on `localhost:7001`. ## Demo Credentials -If you installed the demo data when you installed the Medusa backend by using the `--seed` option or running: +If you installed the demo data when you installed the Medusa backend by running: ```bash npm2yarn npm run seed diff --git a/docs/content/cli/reference.md b/docs/content/cli/reference.md index 247fbe637f..8336da2e34 100644 --- a/docs/content/cli/reference.md +++ b/docs/content/cli/reference.md @@ -115,7 +115,6 @@ medusa new [ []] | Name | Description | | --- | --- | -| `--seed` | If the flag is set the command will attempt to seed the database after setup. | | `-y`, `--useDefaults` | If the flag is set the command will not interactively collect database credentials. | | `--skip-db` | If the flag is set the command will not attempt to complete the database setup. | | `--skip-migrations` | If the flag is set the command will not attempt to complete the database migration. | diff --git a/docs/content/contribution-guidelines.md b/docs/content/contribution-guidelines.md index 269e5047ba..63afdd46b6 100644 --- a/docs/content/contribution-guidelines.md +++ b/docs/content/contribution-guidelines.md @@ -366,7 +366,7 @@ For example: ~~~md ```bash noReport -medusa new my-medusa-store --seed +medusa new my-medusa-store ``` ~~~ @@ -378,7 +378,7 @@ For example: ~~~md ```bash noCopy -medusa new my-medusa-store --seed +medusa new my-medusa-store ``` ~~~ diff --git a/docs/content/create-medusa-app.mdx b/docs/content/create-medusa-app.mdx index 8c09037a30..b1c0dcc986 100644 --- a/docs/content/create-medusa-app.mdx +++ b/docs/content/create-medusa-app.mdx @@ -92,7 +92,7 @@ You can either pick the default Medusa backend starter, the Contentful starter o Other ``` -The backend will be installed under the `backend` directory under the project directory. An SQLite database will be created inside that directory as well with demo data seeded into it. +The backend will be installed under the `backend` directory under the project directory. ### Step 3: Choose Storefront Starter diff --git a/docs/content/deployments/server/deploying-on-microtica.md b/docs/content/deployments/server/deploying-on-microtica.md index 82ae8008cc..986f8d340e 100644 --- a/docs/content/deployments/server/deploying-on-microtica.md +++ b/docs/content/deployments/server/deploying-on-microtica.md @@ -72,7 +72,7 @@ The second step provides customization posibilities by configuring environment v Add an application name and the admin credentials that will be used to create an initial admin user with which you can later sign in to your Medusa Admin. -Then, choose whether you want a production Medusa Backend environment or a development one. The production template will provision your managed Relational Database Service (RDS) PostgreSQL and Redis instances. On the other hand, the development template will use a local SQLite and a fake Redis instance. +Then, choose whether you want a production Medusa Backend environment or a development one. The production template will provision your managed Relational Database Service (RDS) PostgreSQL and Redis instances. ### Step 3: Connect an AWS account diff --git a/docs/content/development/backend/configurations.md b/docs/content/development/backend/configurations.md index fb22a0a934..69b998a6c8 100644 --- a/docs/content/development/backend/configurations.md +++ b/docs/content/development/backend/configurations.md @@ -22,29 +22,7 @@ Some of the configurations mentioned in this document are already defined in `me ## Database Configuration -Medusa supports two database types: SQLite and PostgreSQL. - -:::tip - -You can use SQLite for development purposes, however, it’s recommended to use PostgreSQL. - -::: - -### SQLite Configurations - -For SQLite you mainly need two configurations: - -```jsx -module.exports = { - projectConfig: { - // ...other configurations - database_type: "sqlite", - database_database: "./medusa-db.sql", - }, -} -``` - -Where `database_type` is `sqlite` and `database_database` is the location you want the SQLite database to be created in. +Medusa only supports using a PostgreSQL database. ### PostgreSQL Configurations @@ -54,9 +32,9 @@ Before getting started with configuring PostgreSQL, you should have created a Po ::: -For PostgreSQL you mainly need two configurations: +The following configurations are required for PostgreSQL -```jsx +```js module.exports = { projectConfig: { // ...other configurations @@ -86,9 +64,9 @@ postgres://localhost/store?options=-c search_path=test Where `test` is the name of the database schema that should be used instead of `public`. -### Changing Database Type +### Changing or Setting Database -Remember to run migrations after you change your database type to `postgres` from another type: +Remember to run migrations after you change or set your database: ```bash npx @medusajs/medusa-cli migrations run @@ -103,7 +81,7 @@ As Medusa internally uses [Typeorm](https://typeorm.io/) to connect to the datab These configurations are not required and can be omitted. -```jsx +```js module.exports = { projectConfig: { // ...other configurations diff --git a/docs/content/development/backend/install.mdx b/docs/content/development/backend/install.mdx index ae4ed4aabf..520b4e7016 100644 --- a/docs/content/development/backend/install.mdx +++ b/docs/content/development/backend/install.mdx @@ -40,7 +40,7 @@ If you run into any errors while installing the CLI tool, check out the [trouble ### 2. Create a new Medusa project ```bash noReport - medusa new my-medusa-store --seed + medusa new my-medusa-store ``` You'll then be asked to specify your PostgreSQL database credentials. You can choose "Continue" to use the default credentials shown in the terminal, choose "Change credentials" to specify your PostgreSQL credentails, or choose "Skip database setup" to create the database later. @@ -65,6 +65,14 @@ If you run into any errors while installing the CLI tool, check out the [trouble negativeQuestion="Please describe the issue you faced." /> +### Seed Data + +For better testing, you can add demo data to your Medusa backend by running the seed command in your Medusa backend directory: + +```bash +medusa seed --seed-file=data/seed.json +``` + ### Test the Backend After these three steps and in only a couple of minutes, you now have a complete commerce engine running locally. You can test it out by sending a request using a tool like Postman or through the command line: diff --git a/docs/content/development/backend/prepare-environment.mdx b/docs/content/development/backend/prepare-environment.mdx index 7da962da5d..6dd0c18cd4 100644 --- a/docs/content/development/backend/prepare-environment.mdx +++ b/docs/content/development/backend/prepare-environment.mdx @@ -142,21 +142,9 @@ If you run into any errors while installing the CLI tool, check out the [trouble ::: ---- - -## Install Medusa Backend - -If you're not interested in installing the optional tools and want to get started with Medusa quickly, check out the [Medusa Backend Quickstart](./install.mdx). - ---- - -## Optional Tools - -These tools are not required to have to run a Medusa backend, but it's highly recommended that you have them installed. - ### PostgreSQL -Although you can use an SQLite database with Medusa which would require no necessary database installations, it is recommended to use a PostgreSQL database for your backend. +The Medusa backend uses PostgreSQL to store data of your commerce system. :::tip @@ -195,6 +183,10 @@ You can download PostgreSQL on your macOS using [the installer on their website] --- +## Install Medusa Backend + +If you're not interested in installing the optional tools and want to get started with Medusa quickly, check out the [Medusa Backend Quickstart](./install.mdx). + ## See Also - [Install Medusa backend](./install.mdx) diff --git a/docs/content/development/batch-jobs/create.mdx b/docs/content/development/batch-jobs/create.mdx index 8efcfe81b8..96c4b81fe6 100644 --- a/docs/content/development/batch-jobs/create.mdx +++ b/docs/content/development/batch-jobs/create.mdx @@ -30,10 +30,6 @@ This documentation helps you learn how to create a batch job strategy. The batch It is assumed that you already have a Medusa backend installed and set up. If not, you can follow our [quickstart guide](../backend/install.mdx) to get started. The Medusa backend must also have an event bus module installed, which is available when using the default Medusa backend starter. -### PostgreSQL - -If you use SQLite during your development, it’s highly recommended that you use PostgreSQL when working with batch jobs. Learn how to [install PostgreSQL](../backend/prepare-environment.mdx#postgresql) and [configure it with your Medusa backend](../backend/configurations.md#postgresql-configurations). - --- ## 1. Create a File diff --git a/docs/content/development/batch-jobs/customize-import.md b/docs/content/development/batch-jobs/customize-import.md index 3740a7ce80..b9ba71056e 100644 --- a/docs/content/development/batch-jobs/customize-import.md +++ b/docs/content/development/batch-jobs/customize-import.md @@ -21,10 +21,6 @@ Although this documentation specifically targets import strategies, you can use It's assumed that you already have a Medusa backend installed and set up. If not, you can follow our [quickstart guide](../backend/install.mdx) to get started. The Medusa backend must also have an event bus module installed, which is available when using the default Medusa backend starter. -### PostgreSQL - -If you use SQLite during your development, it’s highly recommended that you use PostgreSQL when working with batch jobs. Learn how to [install PostgreSQL](../backend/prepare-environment.mdx#postgresql) and [configure it with your Medusa backend](../backend/configurations.md#postgresql-configurations). - --- ## Override Batch Job Strategy diff --git a/docs/content/development/entities/migrations/overview.mdx b/docs/content/development/entities/migrations/overview.mdx index b75babc607..8a20ce1c16 100644 --- a/docs/content/development/entities/migrations/overview.mdx +++ b/docs/content/development/entities/migrations/overview.mdx @@ -9,12 +9,6 @@ import Icons from '@theme/Icon'; In this document, you'll learn what Migrations are in Medusa. -:::note - -Medusa’s Migrations do not work with SQLite databases. They are intended to be used with PostgreSQL databases, which is the recommended database for using Medusa in production. - -::: - ## What are Migrations Migrations are scripts that are used to make additions or changes to your database schema. In Medusa, they are essential for both when you first install your backend and for subsequent backend upgrades later on. diff --git a/docs/content/plugins/cms/contentful/index.md b/docs/content/plugins/cms/contentful/index.md index 71774bfb6d..811f92d744 100644 --- a/docs/content/plugins/cms/contentful/index.md +++ b/docs/content/plugins/cms/contentful/index.md @@ -113,7 +113,7 @@ You can find the format of the PostgreSQL database URL in [PostgreSQL’s docume ::: -Then, in `medusa-config.js` in the exported object, comment out or remove the SQLite database configurations and add the PostgreSQL database configurations: +Then, in `medusa-config.js` in the exported object, add the PostgreSQL database configurations: ```jsx title=medusa-config.js module.exports = { @@ -121,9 +121,6 @@ module.exports = { // ... database_url: DATABASE_URL, database_type: "postgres", - // REMOVE OR COMMENT OUT THE BELOW: - // database_database: "./medusa-db.sql", - // database_type: "sqlite", }, } ``` diff --git a/docs/content/plugins/cms/strapi.md b/docs/content/plugins/cms/strapi.md index 0f048bb4a1..b9da746415 100644 --- a/docs/content/plugins/cms/strapi.md +++ b/docs/content/plugins/cms/strapi.md @@ -86,32 +86,35 @@ You can use the Strapi plugin on an existing Medusa backend, however, existing d To create your Medusa backend, run the following command: ```bash -medusa new medusa-backend --seed +medusa new medusa-backend ``` -The `--seed` flag creates an SQLite database and seeds it with some demo data. - ### Configure your Backend -Once the command is done executing, change to the newly created `medusa-backend` directory. Then, in `medusa-config.js`, change the exported object at the end of the file to enable Redis: +Once the command is done executing, change to the newly created `medusa-backend` directory: -```jsx title=medusa-config.js -module.exports = { - projectConfig: { - redis_url: REDIS_URL, - // ... - }, - // ... -} +```bash +cd medusa-backend ``` -This uses the default Redis configurations. If you want to learn more about configuring Redis, [check out this documentation](../../development/backend/configurations.md#redis). +You must then configure your backend to: -:::tip +- Connect to a PostgreSQL database, as explained [here](../../development/backend/configurations.md#database-configuration) +- Install and configure an event-bus module, as explained [here](../../development/backend/configurations.md#recommended-event-bus-modules) -It is also recommended to use PostgreSQL for an optimal experience, however, it is not required. Learn how to [install](../../development/backend/prepare-environment.mdx#postgres) and [configure](../../development/backend/configurations.md#postgresql-configurations) it on your Medusa backend. +### Run Migrations -::: +After configuring the connection to the database, you must run migrations to add the necessary database schema definitions in your database. To do that, run the following command in the `medusa-backend` directory: + +```bash +medusa migrations run +``` + +You can optionally seed your database with demo data by running the `seed` command: + +```bash +medusa seed --seed-file=data/seed.json +``` --- diff --git a/docs/content/troubleshooting/signing-in-to-admin.md b/docs/content/troubleshooting/signing-in-to-admin.md index acbc7da796..50f2c2b478 100644 --- a/docs/content/troubleshooting/signing-in-to-admin.md +++ b/docs/content/troubleshooting/signing-in-to-admin.md @@ -1,6 +1,6 @@ # Signing in to Medusa Admin -If you've created a new Medusa backend with the `--seed` option or used the `seed` script or command, the default credentials are: +If you've created a new Medusa backend and used the `seed` command, the default credentials are: ```bash noReport email: admin@medusa-test.com diff --git a/docs/content/troubleshooting/transaction-error-in-checkout.md b/docs/content/troubleshooting/transaction-error-in-checkout.md deleted file mode 100644 index 6f362b20a7..0000000000 --- a/docs/content/troubleshooting/transaction-error-in-checkout.md +++ /dev/null @@ -1,63 +0,0 @@ -# Error 409 in checkout - -To provide the most frictionless onboarding and quickstart, Medusa uses SQLite as the backend's database by default. SQLite runs on all machines and operating systems. So, it allows you to get quickly started without installing PostgreSQL. - -However, this comes at the expense of important features that are needed in a production environment. - -Therefore, you might experience the following error when going through a checkout flow in one of Medusa's starters while using SQLite: - -```bash noReport -Error: Transaction already started for the given connection, commit current transaction before starting a new one. -``` - -This error occurs because SQLite does not allow for multiple write transactions at the same time. To resolve it, you need to use PostgreSQL instead. - -You can learn how to install PostgreSQL on your machine in the [Set Up your Development Environment documentation](../development/backend/prepare-environment.mdx#postgresql). - -Then in your `medusa-config.js`, you should change the project configuration to use Postgres as the database type: - -```jsx title=medusa-config.js -module.exports = { - projectConfig: { - // ... - database_url: DATABASE_URL, - database_type: "postgres", - }, - plugins, -} -``` - -Where `DATABASE_URL` is the connection string to your PostgreSQL database. You can check out how to format it in [PostgreSQL’s documentation](https://www.postgresql.org/docs/current/libpq-connect.html). - -Make sure to also remove the following lines that are used to configure an SQLite database: - - - -```jsx title=medusa-config.js -database_type: "sqlite", -database_database: "./medusa-db.sql", -``` - -Then, migrate the database schema to the new PostgreSQL database: - -```bash -npx @medusajs/medusa-cli migrations run -``` - -:::tip - -If you want to add demo data into your backend, you should also seed the database using the following command: - -```bash npm2yarn -npm run seed -``` - -::: - ---- - -## See Also - -- [Set up your development environment](../development/backend/prepare-environment.mdx) -- [Configure the Medusa backend](../development/backend/configurations.md) -- [Medusa CLI tool reference](../cli/reference.md) diff --git a/www/docs/sidebars.js b/www/docs/sidebars.js index 4291fd161c..c1fd68a5a6 100644 --- a/www/docs/sidebars.js +++ b/www/docs/sidebars.js @@ -358,11 +358,6 @@ module.exports = { id: "troubleshooting/awilix-resolution-error", label: "Handling AwilixResolutionError", }, - { - type: "doc", - id: "troubleshooting/transaction-error-in-checkout", - label: "Error 409 in checkout", - }, { type: "doc", id: "troubleshooting/missing-payment-providers",