Difference between revisions of "HOWTO:Sync And Purge"
Wirecadadmin (Talk | contribs) |
Wirecadadmin (Talk | contribs) |
||
(4 intermediate revisions by the same user not shown) | |||
Line 16: | Line 16: | ||
See these topics on file location:<br> | See these topics on file location:<br> | ||
[[Settings:Application_Global_Database_Location]]<br> | [[Settings:Application_Global_Database_Location]]<br> | ||
− | [[Knowledge_Base#Q:_Where_Does_WireCAD_Put_Files.3F]]<br> | + | [[Knowledge_Base#Q:_Where_Does_WireCAD_Put_Files.3F|Where does WireCAD put files?]]<br> |
== Proceedure == | == Proceedure == | ||
+ | {{note|The following steps should be performed on your clean database}} | ||
# Back up your database. Did I say that? | # Back up your database. Did I say that? | ||
− | # Open your global Manufacturers database. Database>Manufacturers Grid. | + | # Open your global Manufacturers database. Database>Manufacturers Grid. |
− | # We will be using the [User Added] field to store a flag ([User Added] is the only user field in this table) | + | # We will be using the [User Added] field to store a flag that we can filter on later ([User Added] is the only user field in this table). If the [User Added] field does not show in the grid, right-click any column header and click Column Chooser, then drag the [User Added] field onto the column header row. |
# Populate the [User Added] field with some known data that we can filter on later. For purposes of this tutorial we will use "1" as the flag but you can substitute anything you like. | # Populate the [User Added] field with some known data that we can filter on later. For purposes of this tutorial we will use "1" as the flag but you can substitute anything you like. | ||
## Enter 1 in the top row. | ## Enter 1 in the top row. | ||
## Drag from the top row to the bottom row. Be careful to only select the [User Added] column. | ## Drag from the top row to the bottom row. Be careful to only select the [User Added] column. | ||
− | ## Click Edit>Copy Down. This will copy 1( | + | ## Click Edit>Copy Down. This will copy 1 (the top row) into all the cells in the [User Added] column. |
## Click File>Save. | ## Click File>Save. | ||
+ | # Repeat Step 4 for your Global Equipment grid - Database>Equipment Grid. Here you can use any of the user fields [User1]-[User4]. | ||
+ | # Repeat Step 4 for your Global Cable Types grid - Database>Cable Types Grid. Here you can use any of the user fields [User1]-[User4]. | ||
+ | # Repeat Step 4 for your Global Signal Types grid - Database>Signal Types Grid. Here you can use the [Modified By] this field only takes integers. | ||
+ | # Open the syncronizer tool. Database>Sync Equipment Libraries... | ||
+ | # Tell the synchronizer where the dirty database is. This one's on you. | ||
+ | # Select Bi-directional sync. | ||
+ | # Click [Sync]. Go get coffee. | ||
+ | |||
+ | Now we should have dirty data in with our shiny-clean flagged data. Let's remove the dirty stuff. | ||
+ | # Close all data grids. | ||
+ | # Open your global Manufacturers database. Database>Manufacturers Grid. | ||
+ | # Delete all non-flagged records | ||
+ | ## Click on the [User Added] column header to sort the grid by the flagged value. This will move all empty flagged field to the top of the grid. | ||
+ | ## Select all records where the flagged field is empty. | ||
+ | ## Click Edit>Delete Selected Rows. This may take a minute. | ||
+ | ## Click File>Save. | ||
+ | # Repeat Step 3 for your Global Equipment grid - Database>Equipment Grid. Be sure to sort or filter on the field that you used to hold your flag. NOTE that most of your non-flagged records will be deleted as a result of cascading deletes from the Manufactures database. | ||
+ | # Repeat Step 3 for your Global Cable Types grid - Database>Cable Types Grid. Be sure to sort or filter on the field that you used to hold your flag. | ||
+ | # Repeat Step 3 for your Global Signal Types grid - Database>Signal Types Grid. Be sure to sort or filter on the field that you used to hold your flag. | ||
+ | |||
+ | |||
+ | == Testing The Result == | ||
+ | Your clean database should now be clean again with only the equipment we chose to keep. All other records keys are now stored in their corresponding _tombstones tables. If you sync with an unclean database that contains records with keys contained in a _tombstones table those records will be removed. | ||
+ | |||
+ | # Open the syncronizer tool. Database>Sync Equipment Libraries... | ||
+ | # Tell the synchronizer where the dirty database is. This one's on you. | ||
+ | # Select Bi-directional sync. | ||
+ | # Click [Sync]. Go get coffee. | ||
+ | |||
+ | Verify that only flagged records exist in the clean database. |
Latest revision as of 14:28, 13 February 2012
Command Line Shortcut: NONE User Permissions Level: All |
Warning: Backup your database before doing this. I'm not kidding. |
Concept
The WireCAD synchronizer prioritizes deleted records by placing the key for the deleted record in a special table called [TABLENAME]_tombstones. Once a key exists in the [TABLENAME]_tombstones table any record that attempting to sync that has a matching key will be deleted. Using this knowledge we can purge a database of undesirable records (maybe you are wanting to remove all data from the stock WireCAD database and use only records that are important to you) thus ensuring that those records will always be deleted when syncing two WireCAD global databases even though one may contain stock data.
Before You Start
Backup your database before doing this. Your global database may be on your local machine or on a network share or a SQL server. We can't tell from here. You will need to figure this out so you can properly back up.
See these topics on file location:
Settings:Application_Global_Database_Location
Where does WireCAD put files?
Proceedure
Note: The following steps should be performed on your clean database |
- Back up your database. Did I say that?
- Open your global Manufacturers database. Database>Manufacturers Grid.
- We will be using the [User Added] field to store a flag that we can filter on later ([User Added] is the only user field in this table). If the [User Added] field does not show in the grid, right-click any column header and click Column Chooser, then drag the [User Added] field onto the column header row.
- Populate the [User Added] field with some known data that we can filter on later. For purposes of this tutorial we will use "1" as the flag but you can substitute anything you like.
- Enter 1 in the top row.
- Drag from the top row to the bottom row. Be careful to only select the [User Added] column.
- Click Edit>Copy Down. This will copy 1 (the top row) into all the cells in the [User Added] column.
- Click File>Save.
- Repeat Step 4 for your Global Equipment grid - Database>Equipment Grid. Here you can use any of the user fields [User1]-[User4].
- Repeat Step 4 for your Global Cable Types grid - Database>Cable Types Grid. Here you can use any of the user fields [User1]-[User4].
- Repeat Step 4 for your Global Signal Types grid - Database>Signal Types Grid. Here you can use the [Modified By] this field only takes integers.
- Open the syncronizer tool. Database>Sync Equipment Libraries...
- Tell the synchronizer where the dirty database is. This one's on you.
- Select Bi-directional sync.
- Click [Sync]. Go get coffee.
Now we should have dirty data in with our shiny-clean flagged data. Let's remove the dirty stuff.
- Close all data grids.
- Open your global Manufacturers database. Database>Manufacturers Grid.
- Delete all non-flagged records
- Click on the [User Added] column header to sort the grid by the flagged value. This will move all empty flagged field to the top of the grid.
- Select all records where the flagged field is empty.
- Click Edit>Delete Selected Rows. This may take a minute.
- Click File>Save.
- Repeat Step 3 for your Global Equipment grid - Database>Equipment Grid. Be sure to sort or filter on the field that you used to hold your flag. NOTE that most of your non-flagged records will be deleted as a result of cascading deletes from the Manufactures database.
- Repeat Step 3 for your Global Cable Types grid - Database>Cable Types Grid. Be sure to sort or filter on the field that you used to hold your flag.
- Repeat Step 3 for your Global Signal Types grid - Database>Signal Types Grid. Be sure to sort or filter on the field that you used to hold your flag.
Testing The Result
Your clean database should now be clean again with only the equipment we chose to keep. All other records keys are now stored in their corresponding _tombstones tables. If you sync with an unclean database that contains records with keys contained in a _tombstones table those records will be removed.
- Open the syncronizer tool. Database>Sync Equipment Libraries...
- Tell the synchronizer where the dirty database is. This one's on you.
- Select Bi-directional sync.
- Click [Sync]. Go get coffee.
Verify that only flagged records exist in the clean database.