Skip to content

Commit 3403a4f

Browse files
author
Nino van Galen
committed
feat: Added user model and migration
1 parent f03a595 commit 3403a4f

2 files changed

Lines changed: 64 additions & 0 deletions

File tree

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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('Users', {
16+
id: {
17+
allowNull: false,
18+
autoIncrement: true,
19+
primaryKey: true,
20+
type: Sequelize.INTEGER,
21+
},
22+
external_id: {
23+
allowNull: false,
24+
type: Sequelize.INTEGER,
25+
},
26+
token: {
27+
type: Sequelize.STRING,
28+
},
29+
token_valid_until: {
30+
type: Sequelize.DATE,
31+
},
32+
created_at: {
33+
allowNull: false,
34+
type: Sequelize.DATE,
35+
},
36+
updated_at: {
37+
allowNull: false,
38+
type: Sequelize.DATE,
39+
},
40+
}),
41+
down: (queryInterface, _Sequelize) => queryInterface.dropTable('Users'),
42+
};

lib/database/models/user.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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 = (sequelize, Sequelize) => {
15+
const User = sequelize.define('User', {
16+
id: Sequelize.INTEGER,
17+
externalId: Sequelize.INTEGER,
18+
token: Sequelize.STRING,
19+
tokenValidUntil: Sequelize.DATE,
20+
}, {});
21+
return User;
22+
};

0 commit comments

Comments
 (0)