I am running an import script that imports a dump of a CSV database into a local sqlite database using DataMapper.
My models look like this:
class Staff
include DataMapper::Resource
property :staff_id, String, :key => true
property :full_name, String
end
class Project
include DataMapper::Resource
property :project_id, Integer, :key => true
property :title, String
property :status, String
belongs_to :staff
end
The CSV contains the primary key, so when I import, I use it as a key. The next time I start the import, I clear the tables and start again, however the datamapper groans because the primary keys are already done.
Is there a way to stop the datamapper moaning about this or should I just delete the .db file and recreate an empty .db file just before starting the import? If so, what is the easiest way to do this.
source
share