How do you manage databases in development, test, and production?

前端 未结 14 2050
情书的邮戳
情书的邮戳 2020-11-30 16:23

I\'ve had a hard time trying to find good examples of how to manage database schemas and data between development, test, and production servers.

Here\'s our setup. E

14条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-30 17:09

    There are a couple of good options. I wouldn't use the "restore a backup" strategy.

    1. Script all your schema changes, and have your CI server run those scripts on the database. Have a version table to keep track of the current database version, and only execute the scripts if they are for a newer version.

    2. Use a migration solution. These solutions vary by language, but for .NET I use Migrator.NET. This allows you to version your database and move up and down between versions. Your schema is specified in C# code.

提交回复
热议问题