Ejemplo n.º 1
0
        private void UpgradeDatabase(int newDatabaseVersion)
        {
            IDatabaseVersionBll bll = new DatabaseVersionBll(_log);

            var dbVersion = bll.Get();

            if (dbVersion != null)
            {
                var result    = true;
                var upgradeTo = dbVersion.version_number + 1;

                while (upgradeTo <= newDatabaseVersion)
                {
                    var scriptUpgrade = DatabaseVersionHelper.ListOfUpgradeDatabaseScript[upgradeTo];
                    result = ExecSQL(scriptUpgrade);

                    if (!result)
                    {
                        break;
                    }

                    upgradeTo++;
                    if (!(bll.UpdateVersion() > 0))
                    {
                        break;
                    }
                }
            }
        }
Ejemplo n.º 2
0
        private void UpgradeDatabase(int newDatabaseVersion)
        {
            IDatabaseVersionBll bll = new DatabaseVersionBll(_log);

            var dbVersion = bll.Get();

            if (dbVersion != null)
            {
                var upgradeTo = dbVersion.version_number + 1;

                while (upgradeTo <= newDatabaseVersion)
                {
                    switch (upgradeTo)
                    {
                    case 2:
                        ExecSQL("patch_db_1_to_2.sql");
                        break;

                    case 3:
                        ExecSQL("patch_db_2_to_3.sql");
                        break;

                    case 4:
                        break;

                    default:
                        break;
                    }

                    upgradeTo++;
                    bll.UpdateVersion();
                }
            }
        }
Ejemplo n.º 3
0
        private void UpgradeDatabase(int newDatabaseVersion)
        {
            IDatabaseVersionBll bll = new DatabaseVersionBll(_log);

            var dbVersion = bll.Get();

            if (dbVersion != null)
            {
                var result    = true;
                var upgradeTo = dbVersion.version_number + 1;

                while (upgradeTo <= newDatabaseVersion)
                {
                    switch (upgradeTo)
                    {
                    case 2:     // upgrade database v1 ke v2
                        result = ExecSQL(DatabaseVersionHelper.UpgradeStrukturDatabase_v1_to_v2);
                        break;

                    case 3:     // upgrade database v2 ke v3
                        result = ExecSQL(DatabaseVersionHelper.UpgradeStrukturDatabase_v2_to_v3);
                        break;

                    default:
                        break;
                    }

                    if (!result)
                    {
                        break;
                    }

                    upgradeTo++;
                    if (!(bll.UpdateVersion() > 0))
                    {
                        break;
                    }
                }
            }
        }
Ejemplo n.º 4
0
        private void UpgradeDatabase(int newDatabaseVersion)
        {
            IDatabaseVersionBll bll = new DatabaseVersionBll(_log);

            var dbVersion = bll.Get();

            if (dbVersion != null)
            {
                var listOfUpgradeDatabaseScript = new Dictionary <int, string>
                {
                    { 2, DatabaseVersionHelper.UpgradeStrukturDatabase_v1_to_v2 },
                    { 3, DatabaseVersionHelper.UpgradeStrukturDatabase_v2_to_v3 },
                    { 4, DatabaseVersionHelper.UpgradeStrukturDatabase_v3_to_v4 },
                    { 5, DatabaseVersionHelper.UpgradeStrukturDatabase_v4_to_v5 },
                    { 6, DatabaseVersionHelper.UpgradeStrukturDatabase_v5_to_v6 }
                };

                var result    = true;
                var upgradeTo = dbVersion.version_number + 1;

                while (upgradeTo <= newDatabaseVersion)
                {
                    var scriptUpgrade = listOfUpgradeDatabaseScript[upgradeTo];
                    result = ExecSQL(scriptUpgrade);

                    if (!result)
                    {
                        break;
                    }

                    upgradeTo++;
                    if (!(bll.UpdateVersion() > 0))
                    {
                        break;
                    }
                }
            }
        }