Skip to content
Snippets Groups Projects
Commit 67850c97 authored by Neil Drumm's avatar Neil Drumm :wave:
Browse files

Issue #3460888: Remove last use of project_composer_providers table

parent 33e7b5f7
Branches
No related tags found
No related merge requests found
......@@ -145,42 +145,42 @@ function project_composer_schema() {
'primary key' => array('provider_count_id'),
);
$schema['project_composer_namespace_map'] = array(
$schema['project_composer_namespace_map'] = [
'description' => 'Drupal package json metadata file information',
'fields' => array(
'map_id' => array(
'fields' => [
'map_id' => [
'description' => 'Unique ID for a mapping.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'project_nid' => array(
],
'project_nid' => [
'description' => 'The {node}.nid of the project node that includes this provider.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'project_name' => array(
],
'project_name' => [
'description' => 'The machine readable name of a project',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'component_name' => array(
],
'component_name' => [
'description' => 'The component name (module or theme)',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'package_namespace' => array(
],
'package_namespace' => [
'description' => 'The namespace used in the json metadata',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
],
'category' => [
'description' => 'The field_release_category, either “current” or “legacy”',
'type' => 'varchar',
......@@ -188,13 +188,15 @@ function project_composer_schema() {
'not null' => TRUE,
'default' => '',
],
),
'primary key' => array('map_id'),
'indexes' => array(
'project_nid' => array('project_nid'),
],
'primary key' => ['map_id'],
'indexes' => [
'project_nid' => ['project_nid'],
'project_component_category' => ['project_name', 'component_name', 'category'],
),
);
'category_namespace' => ['category', 'package_namespace'],
],
];
$schema['project_composer_component'] = array(
'description' => 'The component(s) contained by a project release.',
'fields' => array(
......@@ -1022,3 +1024,10 @@ function project_composer_update_7022() {
'default' => 0,
]);
}
/**
* Add project_composer_namespace_map.category_namespace index.
*/
function project_composer_update_7023() {
db_add_index('project_composer_namespace_map', 'category_namespace', ['category', 'package_namespace']);
}
......@@ -25,7 +25,7 @@ function project_composer_security_advisories($release_category) {
}
// Get project node IDs.
$project_nids = db_query("SELECT project_nid FROM {project_composer_providers} WHERE release_category = 'current' AND provider_type = 'package' AND provider_name IN (:names)", [
$project_nids = db_query("SELECT map.project_nid, map.map_id, min(dupe.map_id) FROM {project_composer_namespace_map} map INNER JOIN {project_composer_namespace_map} dupe ON dupe.category = map.category AND dupe.project_name = map.project_name WHERE map.category = 'current' AND map.package_namespace IN (:names) GROUP BY map.project_nid HAVING map.map_id = min(dupe.map_id) ORDER BY NULL", [
':names' => $names,
])->fetchCol();
if (in_array('core', $names)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment