|
|
@@ -68,8 +68,8 @@ class PostUpgradeCommand extends Command
|
|
|
}
|
|
|
|
|
|
$this->logger->info('Populate Subdomain table from openassos.sys_domain');
|
|
|
- $sql = "INSERT INTO opentalent.Subdomain (parameters_id, subdomain)
|
|
|
- SELECT o.parameters_id, REGEXP_REPLACE(d.domainName, '^(.+)\\\\.opentalent\\\\.fr$', '\\\\1')
|
|
|
+ $sql = "INSERT INTO opentalent.Subdomain (organization_id, subdomain)
|
|
|
+ SELECT o.id, REGEXP_REPLACE(d.domainName, '^(.+)\\\\.opentalent\\\\.fr$', '\\\\1')
|
|
|
FROM openassos.sys_domain d
|
|
|
inner join opentalent.Organization o on o.cmsId = d.pid
|
|
|
where d.domainName like '%.opentalent.fr';";
|
|
|
@@ -87,20 +87,22 @@ class PostUpgradeCommand extends Command
|
|
|
$cnn->query($sql);
|
|
|
|
|
|
$this->logger->info('Complete with subdomains from Parameters table');
|
|
|
- $sql = "insert into opentalent.Subdomain (parameters_id, subdomain)
|
|
|
- select distinct p.id, p.subDomain
|
|
|
+ $sql = "insert into opentalent.Subdomain (organization_id, subdomain)
|
|
|
+ select distinct o.id, p.subDomain
|
|
|
from opentalent.Parameters p
|
|
|
+ inner join opentalent.Organization o on o.parameters_id = p.id
|
|
|
left join opentalent.Subdomain s
|
|
|
- on s.parameters_id = p.id
|
|
|
+ on s.organization_id = o.id
|
|
|
where s.id is null;";
|
|
|
$cnn->query($sql);
|
|
|
|
|
|
- $sql = "insert into opentalent.Subdomain (parameters_id, subdomain)
|
|
|
- select p.id, p.subDomain
|
|
|
+ $sql = "insert into opentalent.Subdomain (organization_id, subdomain)
|
|
|
+ select o.id, p.subDomain
|
|
|
from opentalent.Parameters p
|
|
|
+ inner join opentalent.Organization o on o.parameters_id = p.id
|
|
|
inner join opentalent.Subdomain s
|
|
|
- on s.parameters_id = p.id
|
|
|
- where p.subDomain not in (select subdomain from opentalent.Subdomain where parameters_id=p.id);";
|
|
|
+ on s.organization_id = o.id
|
|
|
+ where p.subDomain not in (select subdomain from opentalent.Subdomain where organization_id=p.id);";
|
|
|
$cnn->query($sql);
|
|
|
|
|
|
$this->logger->info('Set the current subdomains');
|
|
|
@@ -108,8 +110,8 @@ class PostUpgradeCommand extends Command
|
|
|
$cnn->query($sql);
|
|
|
|
|
|
$sql = "update opentalent.Subdomain s
|
|
|
- inner join opentalent.Parameters p
|
|
|
- on s.parameters_id = p.id and s.subdomain = p.subDomain
|
|
|
+ inner join opentalent.Organization o on o.id = s.organization_id
|
|
|
+ inner join opentalent.Parameters p on p.id = o.parameters_id and s.subdomain = p.subDomain
|
|
|
set s.active = true;";
|
|
|
$cnn->query($sql);
|
|
|
|