-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2115 from cisagov/dk/1989-export-import-tables
Issue #1989 : export import tables
- Loading branch information
Showing
12 changed files
with
681 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# Export / Import Tables | ||
|
||
A means is provided to export and import individual tables from | ||
one environment to another. This allows for replication of | ||
production data in a development environment. Import and export | ||
are provided through the django admin interface, through a modified | ||
library, django-import-export. Each supported model has an Import | ||
and an Export button on the list view. | ||
|
||
### Export | ||
|
||
When exporting models from the source environment, make sure that | ||
no filters are selected. This will ensure that all rows of the model | ||
are exported. Due to database dependencies, the following models | ||
need to be exported: | ||
|
||
* User | ||
* Contact | ||
* Domain | ||
* DomainRequest | ||
* DomainInformation | ||
* DomainUserRole | ||
* DraftDomain | ||
* Websites | ||
* Host | ||
* HostIP | ||
|
||
### Import | ||
|
||
When importing into the target environment, if the target environment | ||
is different than the source environment, it must be prepared for the | ||
import. This involves clearing out rows in the appropriate tables so | ||
that there are no database conflicts on import. | ||
|
||
#### Preparing Target Environment | ||
|
||
Delete all rows from tables in the following order through django admin: | ||
|
||
* DomainInformation | ||
* DomainRequest | ||
* Domain | ||
* User (all but the current user) | ||
* Contact | ||
* Websites | ||
* DraftDomain | ||
* HostIP | ||
* Host | ||
|
||
#### Importing into Target Environment | ||
|
||
Once target environment is prepared, files can be imported in the following | ||
order: | ||
|
||
* User (After importing User table, you need to delete all rows from Contact table before importing Contacts) | ||
* Contact | ||
* Domain | ||
* Host | ||
* HostIP | ||
* DraftDomain | ||
* Websites | ||
* DomainRequest | ||
* DomainInformation | ||
* UserDomainRole | ||
|
||
Optional step: | ||
* Run fixtures to load fixture users back in |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.