Adding a New Field to an Existing Database

Example

Adding new fields to an existing database table.

MGI Tags

  • mgiEditDatabase

Steps

  1. View the database record administration page in a browser.
  2. Select the database file.
  3. Select the database table.
  4. Export existing records in the database table.
  5. Delete all records in the database table.
  6. View the database field administration page in a browser.
  7. Select the database file.
  8. Select the database table.
  9. Add new fields to the table.
  10. View the database record administration page in a browser.
  11. Select the database file.
  12. Select the database table.
  13. Import the records to the database table.
  14. Populate the new fields for each record.


Step 1: View the database record administration page in a browser.

View the database record administration page in a browser (a database record administration page contains the mgiEditDatabase tag, modifyTables parameter and modifyRecords parameter). The first page of the web-based, administration interface is displayed.

Step 2: Select the database file.

All databases at the same level of the file structure as the database record administration page are displayed beside radio buttons under the sentence "Select a database". Select the radio button beside the database file that contains the table where your current records exist. Click the "Select Database" button to view the tables in the database file.

Step 3: Select the database table.

All tables in the database file are displayed beside radio buttons under the sentence "Select a table:". Select the radio button beside the table that contains your current records. Click the "Select Table" button to view the search screen of the record administration interface.

Step 4: Export existing records in the database table.

Fields cannot be added to a table if the table contains records. To add a new field, export the existing records to a back-up text file. The text file can be imported as is once the field(s) is added. To export all records in a table, click the "Export to File" button. Enter a file name in the text field under the sentence "Enter the name of the export destination file and press the "Export" button:" and click the "Export" button. The message "Export Successful: The TableName table of the DatabaseName database was successfully exported." is displayed after a text file with the name you entered is created. The text file is created at the same level of the file structure as the database record administration page and contains a tab-delimited list of the information from the table. If the file is not successfully exported, an error message containing the export error is displayed.

Step 5: Delete all records in the database table.

After your data is exported to a back-up text file, delete all records in the table. On the "Export Successful" page, click the "Search" button to return to the main menu. Click the "Delete All Records" button. A record verification screen displays the question "Are you sure you want to delete all the records in this table?" To delete all records, click "Yes". If you do not wish to delete records, click "No" or click the Back button on your browser.

Warning: Confirming the deletion of records in a table cannot be undone. Make sure your data has been exported properly before you delete the records in a table.

Step 6: View the database field administration page in a browser.

View the database field administration page in a browser (a database field administration page contains the mgiEditDatabase tag, modifyTables parameter and modifyFields parameter). The first page of the web-based, administration interface is displayed.

Step 7: Select the database file.

All databases at the same level of the file structure as the database field administration page are displayed beside radio buttons under the sentence "Select a database". Select the radio button beside the database file that contains the table where you want to add new fields. Click the "Select Database" button to view the tables in the database file.

Step 8: Select the database table.

All tables in the database file are displayed beside radio buttons under the sentence "Select a table:". Select the radio button beside the table where you want to add new fields. Click the "Select Table" button to view the current fields in the table.

Step 9: Add new fields to the table.

To create a field, enter the case-sensitive field name in the area labeled "Name". Select a field type from the pop-up menu labeled "Type". Select "True" beside the "Indexed" label if the field will be used to order database search results. Select "False" beside the "Indexed" label if the field will not be used to order database search results. Click the "Add Field" button to add the field to the new database table. Fields are listed in the order they are created below the new field interface.

Step 10: View the database record administration page in a browser.

View the database record administration page in a browser (a database record administration page contains the mgiEditDatabase tag, modifyTables parameter and modifyRecords parameter). The first page of the web-based, administration interface is displayed.

Step 11: Select the database file.

All databases at the same level of the file structure as the database record administration page are displayed beside radio buttons under the sentence "Select a database". Select the radio button beside the database file that contains the table where you have added new fields. Click the "Select Database" button to view the tables in the database file.

Step 12: Select the database table.

All tables in the database file are displayed beside radio buttons under the sentence "Select a table:". Select the radio button beside the table where you have added new fields. Click the "Select Table" button to view the search screen of the record administration interface.

Step 13: Import the records to the database table.

At the record search screen, click the "Import File" button. In the text field under the sentence "Enter the import file location and press the "Import File" button:" enter the name of the text file that you exported in Step 4. When all records are imported, the message "The file was successfully imported into the TableName table of the DatabaseName database." is displayed. If the file is not successfully imported, an error message containing the import error is displayed.

Step 14: Populate the new fields for each record.

Data can be added to the new fields by adding to the tab-delimited text file before importing it during Step 13 or by modifying the field for each record and updating the record. To add information to or modify information in an existing record, search or browse to locate the record.
 
To search for the record, click on the "Search" button. Enter search criteria in any record field on the Record Search page and click the "Search" button. A list of all records that match your criteria is displayed. Select the radio button beside the record you wish to modify and click the "View Record" button. The record you selected is displayed. Add or modify information in any field(s) of the record and click the "Update Record" button to save your changes.
 
To browse for a record, click the "Go To First Record" button. Click the "Next" button until you locate the record to modify. Add or modify information in any field(s) of the record and click the "Update Record" button to save your changes.


[Return to the Creating Databases Menu]


[User Guide Main Menu] [Understanding MGI Menu] [Using MGI Menu] [Referencing MGI Menu]