Breaking Changes. Upgrade Script in Sql directory. Deployed

This commit is contained in:
unknown committed 2011-02-18 22:24:48 +05:30
1 parent d4cfa92848
commit 9ed5843dbd
86 files changed
+2616 -2358

No files matched your search

+32 -13
View File
@@ -6,6 +6,9 @@ using Tanshu.Accounts.Entities.Auth;
using Tanshu.Accounts.SqlDAO;
using System.Reflection;
using Tanshu.Accounts.Contracts;
using System;
using System.IO;
using NHibernate.Cfg;
namespace Tanshu.Accounts.Repository
{
@@ -14,10 +17,7 @@ namespace Tanshu.Accounts.Repository
public static bool CreateSchema()
{
var cfg = SessionManager.Configuration;
new SchemaExport(cfg).Execute(true, true, true);
new SchemaExport(cfg).Execute(true, true, false);
// next line is just for checking how the nhibernate xml configuration files look
//persistenceModel.WriteMappingsTo(@"C:\Temp");
Recreate(cfg);
Fixtures.InsertRole();
Fixtures.InsertUser();
Fixtures.InsertGroup();
@@ -37,7 +37,26 @@ namespace Tanshu.Accounts.Repository
InsertProductGroupModifier();
return true;
}
private static void Recreate(Configuration cfg)
{
new SchemaExport(cfg).Execute(true, true, true);
new SchemaExport(cfg).Execute(true, true, false);
}
private static void Update(Configuration cfg)
{
string path = @"C:\Users\tanshu\update.sql";
Action<string> updateExport = x =>
{
using (var file = new FileStream(path, FileMode.Create, FileAccess.Write))
using (var sw = new StreamWriter(file))
{
sw.Write(x);
sw.Close();
}
};
new SchemaUpdate(cfg).Execute(updateExport, true);
}
#region role
public static void InsertRole()
{
@@ -399,15 +418,15 @@ namespace Tanshu.Accounts.Repository
#region settle_option
public static void InsertSettleOption()
{
using (var session = SessionManager.StatelessSession)
{
session.Insert(SettleOptionFactory.OUnsettled);
session.Insert(SettleOptionFactory.OCash);
session.Insert(SettleOptionFactory.OCreditCard);
session.Insert(SettleOptionFactory.ONoCharge);
session.Insert(SettleOptionFactory.OBillToCompany);
session.Insert(SettleOptionFactory.OStaff);
}
//using (var session = SessionManager.StatelessSession)
//{
// session.Insert(SettleOption.Unsettled);
// session.Insert(SettleOption.Cash);
// session.Insert(SettleOption.CreditCard);
// session.Insert(SettleOption.NoCharge);
// session.Insert(SettleOption.BillToCompany);
// session.Insert(SettleOption.Staff);
//}
}
#endregion