4.5 Script a database

Learning Objectives

By the end of this lesson you will be able to:

EXERCISE: Run scripted database files

  1. Open database schema file from the AWSCLI instance. You can also find the file by visiting https://github.com/stelligent/sample_app/tree/master/db
  2. $ cd /home/ec2-user/continuous_integration_example/software/database
    					
    $ sudo vim create-database-mysql.sql 
    					
  3. Add a new table called country to the create-database-mysql.sql file.
  4. Run a private build and verify that the country table was added in MySQL
    cd /home/ec2-user/continuous_integration_example/software/
    ant
    mysql -h localhost -u root -p
    use brewery;
    show tables;
    				
  5. Add, commit and push your changes to Git master.

EXERCISE: Scripted Database (OPTIONAL)

  1. Open database migration file from the AWSCLI instance. You can also find the file by visiting https://github.com/stelligent/sample_app/tree/master/db/migrate
  2. $ cd /home/ec2-user/sample_app/db/migrate
    				
    $ sudo vim 20100821203213_create_users.rb
    				
  3. Open database configuration file from the AWSCLI instance. You can also find the file by visiting https://github.com/stelligent/sample_app/blob/master/config/database.yml
  4. $ cd /home/ec2-user/sample_app/config/
    				
    $ sudo vim database.yml
    				

Scripted Databases

Slide1