Search code examples
databasemigrationbeego

Is there any way to create migrations in beego?


I haven't found in documentation anything except "syncdb" command which create database tables from scratch. Is there any command to create and run migrations based on ORM model? Like in django? Add field, change type, etc.


Solution

  • No, orm.RunSyncdb(name, force, verbose) and it's command line equivalent only do a small subset of what tools like django's south can do.

    Beego's orm can:

    • Create new tables from scratch
    • Drop all tables (force = true)
    • Add new columns as you extend your model

    You need to handle dropping columns and any changes to the column parameters used to initially create the table.