Linux command
typeorm 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Initialize project
typeorm init
Generate migration
typeorm migration:generate -n [MigrationName]
Run migrations
typeorm migration:run
Revert migration
typeorm migration:revert
Create entity
typeorm entity:create -n [EntityName]
Sync schema
typeorm schema:sync
说明
typeorm is the command-line interface for TypeORM, a TypeScript and JavaScript ORM that supports PostgreSQL, MySQL, SQLite, and other databases. It provides tools for managing database migrations, generating entity scaffolds, and synchronizing schema changes. Migrations track database schema changes as versioned files that can be applied and reverted. The migration:generate command automatically creates migration files by comparing the current entities to the database state. Schema sync provides a simpler alternative that directly updates the database to match entity definitions. The CLI also supports initializing new projects with boilerplate configuration and entity files.
参数
- init
- Initialize project.
- migration:generate
- Generate migration.
- migration:run
- Run migrations.
- migration:revert
- Revert last.
- entity:create
- Create entity.
- schema:sync
- Sync database.
FAQ
What is the typeorm command used for?
typeorm is the command-line interface for TypeORM, a TypeScript and JavaScript ORM that supports PostgreSQL, MySQL, SQLite, and other databases. It provides tools for managing database migrations, generating entity scaffolds, and synchronizing schema changes. Migrations track database schema changes as versioned files that can be applied and reverted. The migration:generate command automatically creates migration files by comparing the current entities to the database state. Schema sync provides a simpler alternative that directly updates the database to match entity definitions. The CLI also supports initializing new projects with boilerplate configuration and entity files.
How do I run a basic typeorm example?
Run `typeorm init` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does init do in typeorm?
Initialize project.