minor changes to vishwass pull request.2

This commit is contained in:
Keith Woodlock
2013-04-03 18:12:52 +01:00
parent 2ae603dcc2
commit 1666b2b452
3 changed files with 7 additions and 22 deletions
@@ -38,7 +38,7 @@ CREATE TABLE `tenants` (
`schema_password` varchar(100) NOT NULL DEFAULT 'mysql', `schema_password` varchar(100) NOT NULL DEFAULT 'mysql',
`auto_update` tinyint(1) NOT NULL DEFAULT '1', `auto_update` tinyint(1) NOT NULL DEFAULT '1',
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8; ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
-- --
@@ -47,8 +47,7 @@ CREATE TABLE `tenants` (
LOCK TABLES `tenants` WRITE; LOCK TABLES `tenants` WRITE;
/*!40000 ALTER TABLE `tenants` DISABLE KEYS */; /*!40000 ALTER TABLE `tenants` DISABLE KEYS */;
INSERT INTO `tenants` VALUES INSERT INTO `tenants` VALUES (1,'default','Default Demo Tenant','mifostenant-default','Asia/Kolkata',NULL,NULL,NULL,NULL,'localhost','3306','root','mysql',1);
(1,'default','Default Demo Tenant','mifostenant-default','Asia/Kolkata',NULL,NULL,NULL,NULL,'localhost','3306','root','mysql');
/*!40000 ALTER TABLE `tenants` ENABLE KEYS */; /*!40000 ALTER TABLE `tenants` ENABLE KEYS */;
UNLOCK TABLES; UNLOCK TABLES;
@@ -87,4 +86,4 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2013-03-04 16:05:03 -- Dump completed on 2013-04-03 18:11:34
@@ -1,13 +0,0 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.mifosplatform.infrastructure.core.service;
public interface ITenantUpgradeService {
void upgradeAllTenants();
}
@@ -17,20 +17,19 @@ import org.springframework.stereotype.Service;
import com.googlecode.flyway.core.Flyway; import com.googlecode.flyway.core.Flyway;
/** /**
* A JDBC implementation of {@link TenantDetailsService} for loading a tenants * A service that picks up on tenants that are configured to auto-update their
* details by a <code>tenantIdentifier</code>. * specific schema on application startup.
*/ */
@Service @Service
public class TenantUpgradeService implements ITenantUpgradeService { public class TenantDatabaseUpgradeService {
private final TenantDetailsService tenantDetailsService; private final TenantDetailsService tenantDetailsService;
@Autowired @Autowired
public TenantUpgradeService(TenantDetailsService detailsService) { public TenantDatabaseUpgradeService(final TenantDetailsService detailsService) {
this.tenantDetailsService = detailsService; this.tenantDetailsService = detailsService;
} }
@Override
@PostConstruct @PostConstruct
public void upgradeAllTenants() { public void upgradeAllTenants() {
List<MifosPlatformTenant> tenants = tenantDetailsService.findAllTenants(); List<MifosPlatformTenant> tenants = tenantDetailsService.findAllTenants();