Skip to content
This repository was archived by the owner on Jan 14, 2025. It is now read-only.

Commit fd2e314

Browse files
authored
[ORCT-143] - Remove pgmodeler design (#172)
1 parent f89a122 commit fd2e314

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+911
-1751
lines changed

.sequelizerc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
const path = require('path');
3+
4+
module.exports = {
5+
'config': path.resolve('app', 'config', 'database.js'),
6+
'models-path': path.resolve('app', 'lib', 'database', 'models'),
7+
'seeders-path': path.resolve('app', 'lib', 'database', 'seeders'),
8+
'migrations-path': path.resolve('app', 'lib', 'database', 'migrations')
9+
};

app/config/database.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/**
2+
* @license
3+
* Copyright 2019-2020 CERN and copyright holders of ALICE O2.
4+
* See http://alice-o2.web.cern.ch/copyright for details of the copyright holders.
5+
* All rights not expressly granted are reserved.
6+
*
7+
* This software is distributed under the terms of the GNU General Public
8+
* License v3 (GPL Version 3), copied verbatim in the file "COPYING".
9+
*
10+
* In applying this license CERN does not waive the privileges and immunities
11+
* granted to it by virtue of its status as an Intergovernmental Organization
12+
* or submit itself to any jurisdiction.
13+
*/
14+
const { ResProvider } = require('../lib/utils');
15+
16+
const legacyConfig = ResProvider.database();
17+
18+
const config = { ...legacyConfig,
19+
username: legacyConfig.user, // TEMPORARILY
20+
logging: legacyConfig.logging ? this.logger.debug.bind(this.logger) : false,
21+
dialect: 'postgres',
22+
define: {
23+
underscored: true,
24+
schema: this.schema,
25+
},
26+
};
27+
28+
module.exports = config;

app/config/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ module.exports = Object.freeze({
2121

2222
// App config
2323
winston: ResProvider.winston(),
24-
database: ResProvider.database(),
24+
database: require('./database.js'),
2525
syncTaskAtStart: ResProvider.envOrDef('RCT_SYNC_TASK_AT_START', false, Boolean),
2626
rctData: require('./rct-data'),
2727
public: require('./public.js'),

app/config/rct-data/healthcheckQueries.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const checkStaticData = {
2323
},
2424
particle: {
2525
description: 'Particles dict insert',
26-
query: Object.entries(physicalParticlesData).map(([name, d]) => `INSERT INTO particle_phys_data("id", "name", "full_name", "A", "Z")
26+
query: Object.entries(physicalParticlesData).map(([name, d]) => `INSERT INTO particle_phys_data("id", "name", "full_name", "a", "z")
2727
VALUES (DEFAULT, '${name}', '${d.full_name}', ${d.A}, ${d.Z});`),
2828
},
2929
flags: {
@@ -39,9 +39,9 @@ const metaObj = {
3939
},
4040
};
4141

42-
const queryForName = (name) => `SELECT name, val, extract(epoch from "updatedAt") as "udatedAt" FROM meta WHERE name = '${name}'`;
43-
const updateForName = (name, val) => `INSERT INTO meta (name, val, "updatedAt") values ('${name}', '${val}', now())
44-
ON conflict (name) do update set val = EXCLUDED.val, "updatedAt" = now();`;
42+
const queryForName = (name) => `SELECT name, val, extract(epoch from "updated_at") as "udatedAt" FROM meta WHERE name = '${name}'`;
43+
const updateForName = (name, val) => `INSERT INTO meta (name, val, "updated_at") values ('${name}', '${val}', now())
44+
ON conflict (name) do update set val = EXCLUDED.val, "updated_at" = now();`;
4545

4646
const meta = {
4747
objects: metaObj,

app/lib/alimonitor-services/MonalisaService.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,7 @@ class MonalisaService extends AbstractServiceSynchronizer {
7979
${d.name},
8080
${d.period.name},
8181
${d.description},
82-
${null},
83-
${null},
8482
${d.number_of_events},
85-
${null},
8683
${d.size},
8784
${d.last_run}
8885
);`;

app/lib/alimonitor-services/MonalisaServiceMC.js

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,11 @@ class MonalisaServiceMC extends AbstractServiceSynchronizer {
4646
EndpointsFormatter.mcRaw(),
4747
this.responsePreprocess.bind(this),
4848
this.dataAdjuster.bind(this),
49-
(r) => {
50-
const { anchor_productions, anchor_passes } = r;
51-
return r.period.year >= config.dataFromYearIncluding && anchor_productions.length != 0 && anchor_passes.length != 0;
52-
// MC not anchored to any production so drop out
49+
(simulation_pass) => {
50+
const { anchor_productions, anchor_passes } = simulation_pass;
51+
return simulation_pass.period.year >= config.dataFromYearIncluding
52+
&& anchor_productions.length != 0 && anchor_passes.length != 0;
53+
// MC not anchored to any production or pass so drop out
5354
},
5455
this.dbAction.bind(this),
5556
);
@@ -88,11 +89,6 @@ class MonalisaServiceMC extends AbstractServiceSynchronizer {
8889
}
8990

9091
async dbAction(dbClient, d) {
91-
const { anchor_productions, anchor_passes } = d;
92-
if (anchor_productions.length == 0 || anchor_passes.length == 0) {
93-
// MC not anchored to any production so drop out
94-
return;
95-
}
9692
d = Utils.adjusetObjValuesToSql(d);
9793
const { period } = d;
9894
const period_insert =
@@ -108,7 +104,6 @@ class MonalisaServiceMC extends AbstractServiceSynchronizer {
108104
${anchord_prod_sql},
109105
${anchord_passes_sql},
110106
${d.jira},
111-
${null},
112107
${d.number_of_events},
113108
${d.size}
114109
); call insert_mc_details(${d.name}, ${d.runs}::integer[], ${period.name});`;
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/**
2+
* @license
3+
* Copyright CERN and copyright holders of ALICE O2. This software is
4+
* distributed under the terms of the GNU General Public License v3 (GPL
5+
* Version 3), copied verbatim in the file "COPYING".
6+
*
7+
* See http://alice-o2.web.cern.ch/license for full licensing information.
8+
*
9+
* In applying this license CERN does not waive the privileges and immunities
10+
* granted to it by virtue of its status as an Intergovernmental Organization
11+
* or submit itself to any jurisdiction.
12+
*/
13+
14+
/** @type {import('sequelize-cli').Migration} */
15+
module.exports = {
16+
async up(queryInterface, Sequelize) {
17+
await queryInterface.createTable('beams_dictionary', {
18+
id: {
19+
type: Sequelize.INTEGER,
20+
allowNull: false,
21+
primaryKey: true,
22+
autoIncrement: true,
23+
},
24+
beam_type: {
25+
type: Sequelize.STRING,
26+
unique: true,
27+
},
28+
},
29+
)
30+
},
31+
async down(queryInterface, Sequelize) {
32+
await queryInterface.dropTable('beams_dictionary');
33+
}
34+
};
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/**
2+
* @license
3+
* Copyright CERN and copyright holders of ALICE O2. This software is
4+
* distributed under the terms of the GNU General Public License v3 (GPL
5+
* Version 3), copied verbatim in the file "COPYING".
6+
*
7+
* See http://alice-o2.web.cern.ch/license for full licensing information.
8+
*
9+
* In applying this license CERN does not waive the privileges and immunities
10+
* granted to it by virtue of its status as an Intergovernmental Organization
11+
* or submit itself to any jurisdiction.
12+
*/
13+
14+
/** @type {import('sequelize-cli').Migration} */
15+
module.exports = {
16+
async up(queryInterface, Sequelize) {
17+
await queryInterface.createTable('periods', {
18+
id: {
19+
type: Sequelize.INTEGER,
20+
allowNull: false,
21+
primaryKey: true,
22+
autoIncrement: true,
23+
},
24+
name: {
25+
type: Sequelize.STRING,
26+
unique: true,
27+
},
28+
year: {
29+
type: Sequelize.INTEGER,
30+
},
31+
beam_type_id: {
32+
type: Sequelize.INTEGER,
33+
allowNull: true,
34+
references: {
35+
model: 'beams_dictionary',
36+
key: 'id',
37+
},
38+
},
39+
},
40+
)
41+
},
42+
async down(queryInterface, Sequelize) {
43+
await queryInterface.dropTable('periods');
44+
}
45+
};
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
/**
2+
* @license
3+
* Copyright CERN and copyright holders of ALICE O2. This software is
4+
* distributed under the terms of the GNU General Public License v3 (GPL
5+
* Version 3), copied verbatim in the file "COPYING".
6+
*
7+
* See http://alice-o2.web.cern.ch/license for full licensing information.
8+
*
9+
* In applying this license CERN does not waive the privileges and immunities
10+
* granted to it by virtue of its status as an Intergovernmental Organization
11+
* or submit itself to any jurisdiction.
12+
*/
13+
14+
/** @type {import('sequelize-cli').Migration} */
15+
module.exports = {
16+
async up(queryInterface, Sequelize) {
17+
await queryInterface.createTable('runs', {
18+
run_number: {
19+
type: Sequelize.INTEGER,
20+
primaryKey: true,
21+
},
22+
time_start: {
23+
type: Sequelize.BIGINT,
24+
},
25+
time_end: {
26+
type: Sequelize.BIGINT,
27+
},
28+
time_trg_start: {
29+
type: Sequelize.BIGINT,
30+
},
31+
time_trg_end: {
32+
type: Sequelize.BIGINT,
33+
},
34+
energy_per_beam: {
35+
type: Sequelize.FLOAT,
36+
},
37+
l3_current: {
38+
type: Sequelize.FLOAT,
39+
},
40+
dipole_current: {
41+
type: Sequelize.FLOAT,
42+
},
43+
fill_number: {
44+
type: Sequelize.INTEGER,
45+
},
46+
run_type: {
47+
type: Sequelize.STRING,
48+
},
49+
period_id: {
50+
type: Sequelize.INTEGER,
51+
allowNull: true,
52+
references: {
53+
model: 'periods',
54+
key: 'id',
55+
},
56+
},
57+
},
58+
)
59+
},
60+
async down(queryInterface, Sequelize) {
61+
await queryInterface.dropTable('runs');
62+
}
63+
};
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/**
2+
* @license
3+
* Copyright CERN and copyright holders of ALICE O2. This software is
4+
* distributed under the terms of the GNU General Public License v3 (GPL
5+
* Version 3), copied verbatim in the file "COPYING".
6+
*
7+
* See http://alice-o2.web.cern.ch/license for full licensing information.
8+
*
9+
* In applying this license CERN does not waive the privileges and immunities
10+
* granted to it by virtue of its status as an Intergovernmental Organization
11+
* or submit itself to any jurisdiction.
12+
*/
13+
14+
/** @type {import('sequelize-cli').Migration} */
15+
module.exports = {
16+
async up(queryInterface, Sequelize) {
17+
await queryInterface.createTable('detectors_subsystems', {
18+
id: {
19+
type: Sequelize.INTEGER,
20+
allowNull: false,
21+
primaryKey: true,
22+
autoIncrement: true,
23+
},
24+
name: {
25+
type: Sequelize.STRING,
26+
unique: true,
27+
},
28+
},
29+
)
30+
},
31+
async down(queryInterface, Sequelize) {
32+
await queryInterface.dropTable('detectors_subsystems');
33+
}
34+
};

0 commit comments

Comments
 (0)