Skip to content

Commit bf208e8

Browse files
author
Nino van Galen
committed
feat: Added logruns and add associations migration
1 parent ea979d3 commit bf208e8

2 files changed

Lines changed: 77 additions & 0 deletions

File tree

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
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+
module.exports = {
15+
up: (queryInterface, Sequelize) => queryInterface.createTable('log_runs', {
16+
log_id: {
17+
primaryKey: true,
18+
type: Sequelize.INTEGER,
19+
allowNull: false,
20+
},
21+
run_id: {
22+
primaryKey: true,
23+
type: Sequelize.INTEGER,
24+
allowNull: false,
25+
},
26+
created_at: {
27+
allowNull: false,
28+
type: Sequelize.DATE,
29+
},
30+
updated_at: {
31+
allowNull: false,
32+
type: Sequelize.DATE,
33+
},
34+
}),
35+
36+
down: (queryInterface, _Sequelize) => queryInterface.dropTable('log_runs'),
37+
};
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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+
module.exports = {
15+
up: (queryInterface, Sequelize) => queryInterface.addColumn('logs', 'user_id', {
16+
type: Sequelize.INTEGER,
17+
references: {
18+
model: 'users',
19+
key: 'id',
20+
},
21+
allowNull: false,
22+
}).then(() => queryInterface.addColumn('logs', 'root_log_id', {
23+
type: Sequelize.INTEGER,
24+
references: {
25+
model: 'logs',
26+
key: 'id',
27+
},
28+
})).then(() => queryInterface.addColumn('logs', 'parent_log_id', {
29+
type: Sequelize.INTEGER,
30+
references: {
31+
model: 'logs',
32+
key: 'id',
33+
},
34+
})),
35+
36+
down: (queryInterface, _Sequelize) => queryInterface.removeColumn('logs', 'user_id')
37+
.then(() => queryInterface.removeColumn('logs', 'root_log_id'))
38+
.then(() => queryInterface.removeColumn('logs', 'parent_log_id')),
39+
40+
};

0 commit comments

Comments
 (0)