Let's imagine you have two databases, DEV and PROD. Before migrations are enabled, both are in the same state and share the same schema. What you should do is:
enable-migrations // take a snapshot of current state. -IgnoreChanges prevents recreate of existing objects. add-migration InitialBaseline -IgnoreChanges update-database
2 - There are many methods for keeping the other database(s) synchronised:
A) Keep migrations running concurrently by modifying the connection string. So run and point towards PROD.
to apply the initial, blank baseline and construct the __MigrationHistory table. I do not advise using this option for PROD databases (see below).
B) Integrate scripts. Many firms want DBAs to apply scripts rather than EF since they don't want EF making modifications. You may want to set your database initializer to NULL for this option. If so, you may do an
to bring about changes. Since they are already in sync, this would be done on migrations that come after your original baseline. For additional information on this approach, see here.
C) Use a diff tool or database projects to keep everything up to date.
As soon as you update your models in DEV:
add-migration Changes1 update-database
Change the connect string for option A, then do it again. Utilize option B.
Use a tool to resync for option C.
IMPORTANT: "I have to turn on automatic migrations." - Automatic migrations are a whole other issue and may make the procedure more difficult. Look at here.