From 2ac8d8e979edbaa9d0ea191170c51305eab0d6e8 Mon Sep 17 00:00:00 2001 From: Shahed Nasser Date: Tue, 11 Oct 2022 16:33:21 +0300 Subject: [PATCH] docs: added a note about generate command (#2418) --- docs/content/advanced/backend/migrations/index.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/content/advanced/backend/migrations/index.md b/docs/content/advanced/backend/migrations/index.md index 0fb24f620f..f555afdbf5 100644 --- a/docs/content/advanced/backend/migrations/index.md +++ b/docs/content/advanced/backend/migrations/index.md @@ -16,10 +16,16 @@ The migration file must be inside the `src/migrations` directory. When you run t :::tip -You can learn more about writing migrations in [Typeorm’s Documentation](https://typeorm.io/migrations). +You can alternatively use Typeorm's `generate` command to generate a Migration file from existing database tables, which requires setting up a data source in Typeorm. Check out Typeorm's documentation to learn [how to create a data source](https://typeorm.io/data-source#creating-a-new-datasource), then use the [generate command](https://typeorm.io/using-cli#generate-a-migration-from-existing-table-schema). ::: +## Write Migration File + +The migration file contains the necessary commands to create the database columns, foreign keys, and more. + +You can learn more about writing the migration file in You can learn more about writing migrations in [Typeorm’s Documentation](https://typeorm.io/migrations). + ## Build Files Before you can run the migrations you need to run the build command to transpile the TypeScript files to JavaScript files: