The Schema Design XML file

From the Schema Designer TAB you can save your work to a file. The file will contain two types of information:

1) The position on the canvas and the size of the table symbol for every table that has been defined for this LAYOUT. This is used (of course) when opening a saved LAYOUT. When the Schema Designer TAB is selected the 'file' menu will by default handle Schema Design XML files for open, save etc. You can also use the canvas context menu.

2) The CREATE statement for every table added to this LAYOUT and information about the database it belongs to. This is used when opening a LAYOUT to verify that the tables and the LAYOUT are still 'in sync'. Some other client or session may have changed (DROPPED or ALTERED) the table(s), since the LAYOUT was last saved. In case they are found to be 'out of sync' the program will give you options to either change the LAYOUT or the table(s). Actually a Schema Design XML file can be distributed to other machines or users -first time when it is opened you only need to select to (re)build the tables that are non-existent or different when the program prompts you for your decision on what to do (but of course only STRUCTURE, not DATA is handled by the Schema Designer).

Note that once the LAYOUT has been loaded successfully into the canvas the CREATE statements in the file are not used any more, as from now we will work directly against the MySQL database as explained above.

If you have changed the LAYOUT and not saved it after latest change, you will be prompted if you want to save the changes when the TAB is closed (or the program is). You should normally save (to keep the LAYOUT 'in sync' with the changes you just performed on the database/the tables), but you may undo what you have been doing by NOT saving the file and next opening the file again in another Schema Designer TAB. When prompted for how to solve 'out-of-sync' problems now choose keep the file as it is and change tables instead. We will look into details about this below.

This dialog will display when opening a Schema Design XML file:

First situation: Perfect match.
If you select an existing database the program will validate that the file and the database are 'in sync'. The LAYOUT will display in the Schema Designer TAB after you press 'Continue'.

Second situation: Creating database using the Schema Design XML file.
To perform this you can open the file in a new Database, say 'testsd', 

then you will get a dialog like this,

Again just select the option that you want and the Schema Designer TAB will be populated according to your choice.

Note that this is the same thing that happens when you distribute a Schema Design XML file to other users or computers.

Third situation: Adding table to an existing database as defined in the Schema Design XML file.
This is very similar to the second situation described. You select the existing database that should be updated. The list in the above image will list only those tables which don't exist in the database already. Select which of the two options you want.

Fourth situation: Table names match, but parameters (charset, engine etc.) or columns don't match perfectly in one on more tables...
If some tables exist in both the Schema Design XML file and the selected database, but the CREATE statement is different (likely because the number, order or types of columns do not match) this dialog will appear:

Again just select the option that you want and proceed.

Note: This feature is available in SQLyog Enterprise and Ultimate.