Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var CmdMigrate = &cobra.Command{ Use: "migrate [service...]", Short: "Dump ent schema DDL or generate versioned migration files", Long: `Two modes: DDL dump (default) — for every service with an ent schema, render the table definitions of the generated ent/migrate package into a CREATE TABLE script for the target dialect via ent's schema.DDL — no live database connection is required. The SQL file is written to migrations/schema.<dialect>.sql inside each service directory; --out redirects all files into a single directory. Services without an ent schema are skipped with a warning; missing ent codegen is filled in automatically (as gow ent does). Versioned migrations (--versioned) — for every service with an ent schema, diff the ent schema against a development database and write the changes as versioned migration files into the service's migrations/ directory, in the file format of the selected migration tool. The dev database URL is required and is never written into the generated program (it is passed as a command-line argument at runtime). This follows ent's documented versioned migration flow (schema.WithDir + ModeReplay + WithFormatter). Examples: gow migrate # DDL dump, every ent-based service gow migrate admin --dialect postgres # DDL dump, one service gow migrate --versioned --url mysql://root:pass@localhost:3306/test gow migrate --versioned --tool golang-migrate --url "postgres://user:pass@localhost:5432/test?sslmode=disable" gow migrate admin --versioned --url mysql://root:pass@localhost:3306/test`, RunE: RunDump, SilenceUsage: true, }
CmdMigrate migrate 命令:把服务的 ent schema 逆向为 SQL DDL。
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.