Compare commits

...

1 Commits

Author SHA1 Message Date
Kayne Ruse 3bb0b2aa29 Fixed revisions table losing originalIndex when article was deleted
I've also included a migration file in the tools directory
2021-11-17 06:16:33 +00:00
4 changed files with 14 additions and 5 deletions
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "news-server",
"version": "1.2.2",
"version": "1.3.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "news-server",
"version": "1.2.2",
"version": "1.3.0",
"license": "ISC",
"dependencies": {
"cors": "^2.8.5",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "news-server",
"version": "1.2.3",
"version": "1.3.0",
"description": "An API centric news server. Uses Sequelize and mariaDB by default.",
"main": "server/server.js",
"scripts": {
+5 -2
View File
@@ -17,12 +17,15 @@ const revisions = sequelize.define('revisions', {
body: {
type: Sequelize.TEXT,
defaultValue: ''
},
originalIndex: {
type: Sequelize.INTEGER(11),
default: null
}
});
//relationships
articles.hasOne(revisions, { as: 'original' });
sequelize.sync();
module.exports = revisions;
+6
View File
@@ -0,0 +1,6 @@
use news;
ALTER TABLE revisions CHANGE COLUMN id `index` INTEGER(11) UNIQUE NOT NULL AUTO_INCREMENT;
ALTER TABLE revisions DROP FOREIGN KEY revisions_ibfk_1;
ALTER TABLE revisions CHANGE COLUMN originalIndex originalIndex INTEGER(11);