tududi/backend/migrations/20250621223000-create-calendar-tokens.js
Chris 03f38f05dc
Setup intelligence (#84)
* Add next suggestions and remove console logs

* Add pomodoro timer

* Add pomodoro switch in settings

* Fix pomodoro setting

* Add timezones to settings

* Fix an issue with password reset

* Cleanup

* Sort tags alphabetically

* Clean up today's view

* Add an indicator for repeatedly added to today

* Refactor tags

* Add due date today item

* Move recurrence to the subtitle area

* Fix today layout

* Add a badge to Inbox items

* Move inbox badge to sidebar

* Add quotes and progress bar

* Add translations for quotes

* Fix test issues

* Add helper script for docker local

* Set up overdue tasks

* Add  linux/arm/v7 build to deploy script

* Add  linux/arm/v7 build to deploy script pt2

* Fix an issue with helmet and SSL

* Add volume db persistence

* Fix cog icon issues
2025-06-27 14:02:18 +03:00

79 lines
No EOL
1.9 KiB
JavaScript

'use strict';
module.exports = {
up: async (queryInterface, Sequelize) => {
await queryInterface.createTable('calendar_tokens', {
id: {
type: Sequelize.INTEGER,
primaryKey: true,
autoIncrement: true,
allowNull: false
},
user_id: {
type: Sequelize.INTEGER,
allowNull: false,
references: {
model: 'users',
key: 'id'
},
onDelete: 'CASCADE'
},
provider: {
type: Sequelize.STRING,
allowNull: false,
defaultValue: 'google'
},
access_token: {
type: Sequelize.TEXT,
allowNull: false
},
refresh_token: {
type: Sequelize.TEXT,
allowNull: true
},
token_type: {
type: Sequelize.STRING,
defaultValue: 'Bearer'
},
expires_at: {
type: Sequelize.DATE,
allowNull: true
},
scope: {
type: Sequelize.TEXT,
allowNull: true
},
connected_email: {
type: Sequelize.STRING,
allowNull: true
},
created_at: {
type: Sequelize.DATE,
allowNull: false,
defaultValue: Sequelize.literal('CURRENT_TIMESTAMP')
},
updated_at: {
type: Sequelize.DATE,
allowNull: false,
defaultValue: Sequelize.literal('CURRENT_TIMESTAMP')
}
});
// Add unique index for user_id + provider combination
await queryInterface.addIndex('calendar_tokens', {
fields: ['user_id', 'provider'],
unique: true,
name: 'calendar_tokens_user_provider_unique'
});
// Add index for faster lookups by user_id
await queryInterface.addIndex('calendar_tokens', {
fields: ['user_id'],
name: 'calendar_tokens_user_id_index'
});
},
down: async (queryInterface, Sequelize) => {
await queryInterface.dropTable('calendar_tokens');
}
};