- ;; Delete the instance records
- (with-ignore-errors
- (usql:delete-instance-records company1)
- (usql:delete-instance-records employee1)
- (usql:delete-instance-records employee2)
- (usql:delete-instance-records employee3)
- (usql:delete-instance-records employee4)
- (usql:delete-instance-records employee5)
- (usql:delete-instance-records employee6)
- (usql:delete-instance-records employee7)
- (usql:delete-instance-records employee8)
- (usql:delete-instance-records employee9)
- (usql:delete-instance-records employee10)
- ;; Drop the required tables if they exist
- (usql:drop-view-from-class 'employee)
- (usql:drop-view-from-class 'company))
- ;; Create the tables for our view classes
- (usql:create-view-from-class 'employee)
- (usql:create-view-from-class 'company)
+ ;; Remove the tables to support cases when destroy-database isn't supported, like odbc
+ (ignore-errors (clsql:drop-table "EMPLOYEE"))
+ (ignore-errors (clsql:drop-table "COMPANY"))
+ (ignore-errors (clsql:drop-table "FOO"))
+ (clsql:create-view-from-class 'employee)
+ (clsql:create-view-from-class 'company)
+
+ (setf company1 (make-instance 'company
+ :companyid 1
+ :groupid 1
+ :name "Widgets Inc.")
+ employee1 (make-instance 'employee
+ :emplid 1
+ :groupid 1
+ :married t
+ :height (1+ (random 1.00))
+ :birthday (clsql-base:get-time)
+ :first-name "Vladamir"
+ :last-name "Lenin"
+ :email "lenin@soviet.org")
+ employee2 (make-instance 'employee
+ :emplid 2
+ :groupid 1
+ :height (1+ (random 1.00))
+ :married t
+ :birthday (clsql-base:get-time)
+ :first-name "Josef"
+ :last-name "Stalin"
+ :email "stalin@soviet.org")
+ employee3 (make-instance 'employee
+ :emplid 3
+ :groupid 1
+ :height (1+ (random 1.00))
+ :married t
+ :birthday (clsql-base:get-time)
+ :first-name "Leon"
+ :last-name "Trotsky"
+ :email "trotsky@soviet.org")
+ employee4 (make-instance 'employee
+ :emplid 4
+ :groupid 1
+ :height (1+ (random 1.00))
+ :married nil
+ :birthday (clsql-base:get-time)
+ :first-name "Nikita"
+ :last-name "Kruschev"
+ :email "kruschev@soviet.org")
+
+ employee5 (make-instance 'employee
+ :emplid 5
+ :groupid 1
+ :married nil
+ :height (1+ (random 1.00))
+ :birthday (clsql-base:get-time)
+ :first-name "Leonid"
+ :last-name "Brezhnev"
+ :email "brezhnev@soviet.org")
+
+ employee6 (make-instance 'employee
+ :emplid 6
+ :groupid 1
+ :married nil
+ :height (1+ (random 1.00))
+ :birthday (clsql-base:get-time)
+ :first-name "Yuri"
+ :last-name "Andropov"
+ :email "andropov@soviet.org")
+ employee7 (make-instance 'employee
+ :emplid 7
+ :groupid 1
+ :height (1+ (random 1.00))
+ :married nil
+ :birthday (clsql-base:get-time)
+ :first-name "Konstantin"
+ :last-name "Chernenko"
+ :email "chernenko@soviet.org")
+ employee8 (make-instance 'employee
+ :emplid 8
+ :groupid 1
+ :height (1+ (random 1.00))
+ :married nil
+ :birthday (clsql-base:get-time)
+ :first-name "Mikhail"
+ :last-name "Gorbachev"
+ :email "gorbachev@soviet.org")
+ employee9 (make-instance 'employee
+ :emplid 9
+ :groupid 1
+ :married nil
+ :height (1+ (random 1.00))
+ :birthday (clsql-base:get-time)
+ :first-name "Boris"
+ :last-name "Yeltsin"
+ :email "yeltsin@soviet.org")
+ employee10 (make-instance 'employee
+ :emplid 10
+ :groupid 1
+ :married nil
+ :height (1+ (random 1.00))
+ :birthday (clsql-base:get-time)
+ :first-name "Vladamir"
+ :last-name "Putin"
+ :email "putin@soviet.org"))
+