I'm currently in need of a way to pragmatically generate DDL scripts for a single database in SQL Server. My current need is to do this in 2012, but it's likely I'll need to be able to do this with 2008 - 2017.
I've seen this question (and answers) SQL Server 2012: Generate Scripts from command line
as well as this one https://stackoverflow.com/questions/483568/how-can-i-automate-the-generate-scripts-task-in-sql-server-management-studio-2
I'm trying to figure out the best way to do this today. I realize this may seem like a duplicate, especially if there's an answer out there that is the best way to do it today (and maybe I just don't realize it).
The simple version of the question:
In SQL Server 2012, what's the best way, that I can schedule, to produce all the DDL needed to make an exact replica of a database?