extended editor

This commit is contained in:
Torsten Schulz
2024-06-21 18:06:17 +02:00
parent dcfd478464
commit 97c72540cf
20 changed files with 754 additions and 35 deletions

View File

@@ -0,0 +1,39 @@
'use strict';
module.exports = {
up: async (queryInterface, Sequelize) => {
await queryInterface.createTable('files', {
id: {
allowNull: false,
autoIncrement: true,
primaryKey: true,
type: Sequelize.INTEGER
},
hash: {
type: Sequelize.STRING,
unique: true,
allowNull: false
},
title: {
type: Sequelize.STRING,
allowNull: false
},
originalName: {
type: Sequelize.STRING,
allowNull: false
},
createdAt: {
allowNull: false,
type: Sequelize.DATE
},
updatedAt: {
allowNull: false,
type: Sequelize.DATE
}
});
},
down: async (queryInterface, Sequelize) => {
await queryInterface.dropTable('files');
}
};

View File

@@ -0,0 +1,38 @@
'use strict';
module.exports = {
up: async (queryInterface, Sequelize) => {
await queryInterface.createTable('page_files', {
pageId: {
type: Sequelize.INTEGER,
references: {
model: 'pages',
key: 'id'
},
onUpdate: 'CASCADE',
onDelete: 'CASCADE'
},
fileId: {
type: Sequelize.INTEGER,
references: {
model: 'files',
key: 'id'
},
onUpdate: 'CASCADE',
onDelete: 'CASCADE'
},
createdAt: {
allowNull: false,
type: Sequelize.DATE
},
updatedAt: {
allowNull: false,
type: Sequelize.DATE
}
});
},
down: async (queryInterface, Sequelize) => {
await queryInterface.dropTable('page_files');
}
};

View File

@@ -0,0 +1,14 @@
'use strict';
module.exports = {
up: async (queryInterface, Sequelize) => {
await queryInterface.addColumn('Files', 'originalName', {
type: Sequelize.STRING,
allowNull: false,
after: 'title' // optional: to place the column after 'title'
});
},
down: async (queryInterface, Sequelize) => {
await queryInterface.removeColumn('Files', 'originalName');
}
};