Reputation: 5966
I'm new to Data Generation Plans in Visual Studio, but I googled a bit and can't find the answer to this question. I've made modifications to my schema on the database side (changed the size of an NVARCHAR field) based on data that was generated by a Data Generation Plan (a procedure broke because the field was too large), and now I want to generate new data based on the new schema.
Is there any way to re-import the schema from the database or to keep it live and connected at all times?
I know I can just switch the field size inside of the generation plan, but this is a simple case of something that will be more complicated later on.
Upvotes: 1
Views: 2177
Reputation: 1914
Use Schema Compare (File menu: Data > Schema Compare > New Schema Comparison) to synchronize project and database schema. After that if you open Data Generation Plan it should ask you to refresh it.
Upvotes: 4
Reputation: 16007
Doesn't the IDE force you to update your data generation plan if your schema changes anyway?
When you create a data generation plan in a database project, the plan is based on the database schema of the project. If you create a data generation plan and then the schema of the database project changes, you are prompted to update the plan. This behavior occurs in the following cases:
- You create a data generation plan in a database project that does not have a schema yet. You then import a schema into the database project.
- You create a data generation plan in a database project that has a schema, and then the schema changes.
In both cases, you are prompted to update the data generation plan when you open it or when it becomes the active document. If you do not update the data generation plan based on the schema changes, you cannot continue to edit the plan. You can close and reopen the data generation plan to display the prompt again.
More evidence from a blog on this subject:
... the schema of the objects inside the database has to match the table inside the database project.
I guess you could dig into the *.dgen file and do a pre-build step (or something similar) that would ensure it always matches your DB schema. Maybe that would automate things enough.
Upvotes: 2