2009-05-05 11:06:02 -04:00
|
|
|
require "dm-core"
|
2010-06-15 10:24:50 -04:00
|
|
|
require "dm-transactions"
|
|
|
|
|
|
|
|
#Datamapper 1.0 requires you to require dm-migrations to automigrate
|
|
|
|
require "dm-migrations"
|
2009-05-05 11:06:02 -04:00
|
|
|
|
|
|
|
# only to please activerecord API used in database_cleaner/examples/features/step_definitions
|
|
|
|
# yes, i know that's lazy ...
|
2010-06-15 10:24:50 -04:00
|
|
|
|
2009-05-05 11:06:02 -04:00
|
|
|
require "dm-validations"
|
|
|
|
require "dm-aggregates"
|
|
|
|
|
2010-05-30 18:08:22 -04:00
|
|
|
DataMapper.setup(:default, "sqlite3:#{DB_DIR}/datamapper_default.db")
|
2010-05-30 14:29:42 -04:00
|
|
|
DataMapper.setup(:one, "sqlite3:#{DB_DIR}/datamapper_one.db")
|
|
|
|
DataMapper.setup(:two, "sqlite3:#{DB_DIR}/datamapper_two.db")
|
2009-05-05 11:06:02 -04:00
|
|
|
|
2010-05-30 14:29:42 -04:00
|
|
|
class DataMapperWidget
|
2009-05-05 11:06:02 -04:00
|
|
|
include DataMapper::Resource
|
2010-05-30 23:12:58 -04:00
|
|
|
|
2009-05-05 11:06:02 -04:00
|
|
|
property :id, Serial
|
|
|
|
property :name, String
|
|
|
|
end
|
|
|
|
|
2010-05-30 14:29:42 -04:00
|
|
|
class DataMapperWidgetUsingDatabaseOne
|
|
|
|
include DataMapper::Resource
|
2010-05-16 17:26:09 -04:00
|
|
|
|
2010-05-30 14:29:42 -04:00
|
|
|
def self.default_repository_name
|
|
|
|
:one
|
2010-05-16 17:26:09 -04:00
|
|
|
end
|
2010-05-30 18:08:22 -04:00
|
|
|
|
2010-05-30 14:29:42 -04:00
|
|
|
property :id, Serial
|
|
|
|
property :name, String
|
2010-05-30 23:12:58 -04:00
|
|
|
|
2010-05-30 14:29:42 -04:00
|
|
|
end
|
2010-05-30 23:12:58 -04:00
|
|
|
|
2010-05-30 14:29:42 -04:00
|
|
|
class DataMapperWidgetUsingDatabaseTwo
|
|
|
|
include DataMapper::Resource
|
|
|
|
|
|
|
|
def self.default_repository_name
|
|
|
|
:two
|
2010-05-16 17:26:09 -04:00
|
|
|
end
|
2010-05-30 14:29:42 -04:00
|
|
|
|
|
|
|
property :id, Serial
|
|
|
|
property :name, String
|
2010-05-30 23:12:58 -04:00
|
|
|
|
2010-05-30 14:29:42 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
DataMapperWidget.auto_migrate!
|
|
|
|
DataMapperWidgetUsingDatabaseOne.auto_migrate!
|
|
|
|
DataMapperWidgetUsingDatabaseTwo.auto_migrate!
|