views:

33

answers:

2

I know it's possible to run extra DDL scripts with NHibernate. For example triggers or indexes. This feature is NHibernate is named "Auxiliary Database Objects".

Is it possible to do same thing in Castle ActiveRecord?

A: 
ActiveRecordStarter.CreateSchemaFromFile("myscript1.sql");

(from http://www.castleproject.org/activerecord/documentation/trunk/usersguide/schemagen.html)

Diego Mijelshon
@Diego, I'm currently generating database schema based on classes. "myscript1.sql" must be run as complementary. It seems to me that `CreateSchemaFromFile` prevents tables to be created from classes.
afsharm
@afsharm: I'm pretty sure you can run both.
Mauricio Scheffer
Did you read the doc I've just linked to?
Diego Mijelshon
@Diego, It does not work. calling `CreateSchemaFromFile` does not do any operation.
afsharm
A: 

Just like Diego said, ActiveRecordStarter.CreateSchemaFromFile is the way to do this.

If it doesn't execute anything, make sure your SQL script has its lines separated by ; (or GO). Even if you have a single line in your file, it has to end with ;

Mauricio Scheffer
@Mauricio: I added ; and go at end of lines and end of scripts files. But still nothing works. I used SQL Profiler but nothing is sent to database.
afsharm