diff --git a/lib/database/migrations/20200506003500-create-tag.js b/lib/database/migrations/20200506003500-create-tag.js new file mode 100644 index 0000000000..a1dd2b893a --- /dev/null +++ b/lib/database/migrations/20200506003500-create-tag.js @@ -0,0 +1,37 @@ +/** + * @license + * Copyright CERN and copyright holders of ALICE O2. This software is + * distributed under the terms of the GNU General Public License v3 (GPL + * Version 3), copied verbatim in the file "COPYING". + * + * See http://alice-o2.web.cern.ch/license for full licensing information. + * + * In applying this license CERN does not waive the privileges and immunities + * granted to it by virtue of its status as an Intergovernmental Organization + * or submit itself to any jurisdiction. + */ + +module.exports = { + up: (queryInterface, Sequelize) => queryInterface.createTable('Tags', { + id: { + allowNull: false, + autoIncrement: true, + primaryKey: true, + type: Sequelize.INTEGER, + }, + text: { + allowNull: false, + type: Sequelize.STRING, + }, + created_at: { + allowNull: false, + type: Sequelize.DATE, + }, + updated_at: { + allowNull: false, + type: Sequelize.DATE, + }, + }), + + down: (queryInterface, _Sequelize) => queryInterface.dropTable('Tags'), +}; diff --git a/lib/database/models/tag.js b/lib/database/models/tag.js new file mode 100644 index 0000000000..4f4e573684 --- /dev/null +++ b/lib/database/models/tag.js @@ -0,0 +1,19 @@ +/** + * @license + * Copyright CERN and copyright holders of ALICE O2. This software is + * distributed under the terms of the GNU General Public License v3 (GPL + * Version 3), copied verbatim in the file "COPYING". + * + * See http://alice-o2.web.cern.ch/license for full licensing information. + * + * In applying this license CERN does not waive the privileges and immunities + * granted to it by virtue of its status as an Intergovernmental Organization + * or submit itself to any jurisdiction. + */ + +module.exports = (sequelize, Sequelize) => { + const Tag = sequelize.define('Tag', { + text: Sequelize.STRING, + }, {}); + return Tag; +};