Daversy Tutorial

Introduction

This tutorial will walk you through the basic steps of using Daversy. It will hopefully help you understand what it is supposed to do and how does it go about doing it.

First thing's first, you'll need to download and install the lastest Daversy binaries from the Downloads page. To install the program, just unzip it in a folder of your choosing.

You should know that Daversy has some limitations for now : it runs only on Windows, suppors only the Oracle and the SQLite databases and can only manage tables and columns. Support for other database objects (indexes, constraints, etc.), for other databases and other operating systems will be added at a later stage.

There are two executables bundled with Daversy : dvs.exe is the command line client that is used mostly for scripting and Daversy.exe is the GUI client we will use throughout this tutorial.

There is one important concept you need to understand before you go on. A state is a term that represents the structure of a database at some point in time. The state contains all the information needed to recreate a database with the same tables, indexes and constraints (and other database objects) without the actual data. We could be talking about a database's state refering to the structure of the database or we could refer to a state file, which is a XML representation of a that structure. For more information on this, you should read the WhatIsDaversy page.

In this tutorial we'll start off with a simple SQLite database with some tables in it. We'll extract its state and save it in a *.state file. Then we'll create an SQL script out of the state file just to see we can. After that, we'll modify the database a little : remove a table, add a few columns and update the state to represent the updated database structure. Finally we'll compare the original state with the updated one and generate an SQL script that can migrate a database similar to the first one into a database similar to the second one.

Main screen

When you start Daversy.exe, it shows a nifty splash screen and the displays its main screen.

Main screen parts

As you can see, the main screen consists of four parts, which are described below :

Part I: The menu - this is a standard menu like most application have and it allows you a centralized access point for all of Daversy's funtionality.

Part II: The working folder - This part consists of a combo box which holds the path of your current working folder and a browse button (...). The working folder is a folder where all temporary data is stored, and it is the default folder for all Daversy operations. If you do not set the working folder, the default is your Desktop.

Part III: The current operation - this is the most important part of the screen, where you choose what operation you'd like to perform and set all the parameters for it. Each operation requires different parameters and we'll discuss each one in detail later.

Part IV: The bottom of the dialog - here you have the Daversy logo and the build version, which should be the latest available.

Now that you are familiar with the main screen parts, lets create a sample database and get busy.

Creating an SQLite database

sqlite3.exe is a command line client for the SQLite database, and the sqlite3.dll that comes bundled with Daversy is the engine that both Daversy and sqlite3.exe use. They are both packaged with Daversy.

Let us set up a small database.

This will create an empty database called myfirst.db in the current folder.

sqlite3.exe myfirst.db

You'll get a prompt looking something like this:

D:\Gooli\Dev\DvsTest>sqlite3 myfirst.db
SQLite version 3.2.2
Enter ".help" for instructions
sqlite> 

We'll now create some tables in this database. Enter those CREATE TABLE commands (you can copy and paste them from here):

CREATE TABLE BONUS (COMM NUMBER, ENAME VARCHAR, JOB VARCHAR, SAL NUMBER);
CREATE TABLE DEPT (DEPTNO NUMBER, DNAME VARCHAR, LOC VARCHAR);
CREATE TABLE EMP (COMM NUMBER, DEPTNO NUMBER, EMPNO NUMBER, ENAME VARCHAR, HIREDATE DATE, JOB VARCHAR, MGR NUMBER, SAL NUMBER);
CREATE TABLE SALGRADE (GRADE NUMBER, HISAL NUMBER, LOSAL NUMBER);

To exit sqlite3.exe use this command :

sqlite> .quit

Our first State file

The first thing you need to do is select a working folder where all of our state files and SQL scripts will be created.

Select a working folder (part II of the main window), by pressing Browse button.

When you press this button a new screen will be shown, that will allow you to choose a working folder :

Browse for folder dialog (win 2k)

Let's move on and extract the state of the myfirst.db database you've created earlier and save its state into the myfirst.state file.

Select the "Extract State" operation on part III of the main window and follow those steps :

  1. Select the database provider.
  2. Select the database name.
  3. Press the GO button.