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
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -115,7 +115,6 @@ medusa new [<backend_name> [<starter_url>]]
|
||||
|
||||
| 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. |
|
||||
|
||||
@@ -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
|
||||
```
|
||||
~~~
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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",
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
@@ -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
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
<!-- eslint-skip -->
|
||||
|
||||
```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)
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user