You are right, and i was mistaken. NH uses SchemaExport in order to ensure
nothing bad happens, and since SchemaExport is destructive, it will destroy
the schema in the beginning.
I may be mistaken since my mind is about to blow because of biology exam
tomorrow!
On Mon, Oct 27, 2008 at 11:58 PM, Gustavo Ringel
<[EMAIL PROTECTED]>wrote:
> Tuna you said create at the beggining and drop at the end.
> Bill sais drop at the beginning and then create.
>
> Gustavo.
>
> On Mon, Oct 27, 2008 at 11:44 PM, Tuna Toksöz <[EMAIL PROTECTED]> wrote:
>
>> This is what nhibernate does actually in its unit tests. Create at the
>> beginning and drop in the end. Ensures that another tests schema doesn't
>> intersect with the current one.
>>
>> Bill can you send an isolated test case?
>>
>>
>> On Mon, Oct 27, 2008 at 11:36 PM, Gustavo Ringel <
>> [EMAIL PROTECTED]> wrote:
>>
>>> Just wondering why will you drop before creating in a unit test?
>>> And, are you sure DROP column is being sent by the Drop() function? i
>>> never seen DROP Columns in my logs...(that doesn't mean a lot, but in every
>>> app it only drop constraints and tables)
>>>
>>> Gustavo.
>>>
>>>
>>> On Mon, Oct 27, 2008 at 11:29 PM, Bil Simser <[EMAIL PROTECTED]>wrote:
>>>
>>>>
>>>> I have a unit test that generates our database scripts for us. The
>>>> first thing it does is create the drop script then a creation script.
>>>> Its on the drop script that it's failing.
>>>>
>>>> Here's my test:
>>>>
>>>> [Test]
>>>> public void GenerateSqlScripts()
>>>> {
>>>> var cfg = new Configuration();
>>>> cfg.Configure();
>>>> var export = new SchemaExport(cfg);
>>>> export.SetOutputFile("DMTools_Create_Tables.sql");
>>>> export.SetDelimiter("\r\n");
>>>> export.Drop(true, false);
>>>> }
>>>>
>>>> And here's the beginning of the script its creating:
>>>>
>>>> ALTER TABLE NumberRequest DROP COLUMN SubmissionNumber
>>>>
>>>> if exists (select 1 from sys.objects where object_id =
>>>> OBJECT_ID(N'[FK8CF8CE147E4F923C]') AND parent_object_id =
>>>> OBJECT_ID('SubmissionTypeAttribute'))
>>>> alter table SubmissionTypeAttribute drop constraint
>>>> FK8CF8CE147E4F923C
>>>>
>>>>
>>>> if exists (select 1 from sys.objects where object_id =
>>>> OBJECT_ID(N'[FK18FFC40D9E29DE20]') AND parent_object_id =
>>>> OBJECT_ID('NumberRequestAttributeValues'))
>>>> alter table NumberRequestAttributeValues drop constraint
>>>> FK18FFC40D9E29DE20
>>>>
>>>> Obviously the drop script is failing because it tries to ALTER a table
>>>> called NumbeRequest and it's not there (on a new database). Just
>>>> wondering why all the other tables are wrapped in an "if exists"
>>>> statement to prevent errors (in case the table isn't there) but this
>>>> one isn't? It's not any different from other tables in the solution.
>>>>
>>>>
>>>
>>>
>>>
>>
>>
>> --
>> Tuna Toksöz
>>
>> Typos included to enhance the readers attention!
>>
>>
>>
>>
>
> >
>
--
Tuna Toksöz
Typos included to enhance the readers attention!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---