Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/npm_and_yarn/db-migrate-mysql-3.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ptrumpis authored Jan 30, 2025
2 parents 745a5ea + 725dc0a commit ba0ae65
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 1 deletion.
53 changes: 53 additions & 0 deletions migrations/20240826134401-v3.3.1.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
'use strict';

var dbm;
var type;
var seed;
var fs = require('fs');
var path = require('path');
var Promise;

/**
* We receive the dbmigrate dependency from dbmigrate initially.
* This enables us to not have to rely on NODE_PATH.
*/
exports.setup = function(options, seedLink) {
dbm = options.dbmigrate;
type = dbm.dataType;
seed = seedLink;
Promise = options.Promise;
};

exports.up = function(db) {
var filePath = path.join(__dirname, 'sqls', '20240826134401-v3.3.1-up.sql');
return new Promise( function( resolve, reject ) {
fs.readFile(filePath, {encoding: 'utf-8'}, function(err,data){
if (err) return reject(err);
console.log('received data: ' + data);

resolve(data);
});
})
.then(function(data) {
return db.runSql(data);
});
};

exports.down = function(db) {
var filePath = path.join(__dirname, 'sqls', '20240826134401-v3.3.1-down.sql');
return new Promise( function( resolve, reject ) {
fs.readFile(filePath, {encoding: 'utf-8'}, function(err,data){
if (err) return reject(err);
console.log('received data: ' + data);

resolve(data);
});
})
.then(function(data) {
return db.runSql(data);
});
};

exports._meta = {
"version": 1
};
6 changes: 6 additions & 0 deletions migrations/sqls/20240826134401-v3.3.1-down.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/*
Downgrading from version 3.0.0
https://github.com/ptrumpis/snap-camera-server/releases/tag/v3.0.0
*/
ALTER TABLE `lenses` DROP COLUMN `custom_import`;
ALTER TABLE `unlocks` DROP COLUMN `custom_import`;
6 changes: 6 additions & 0 deletions migrations/sqls/20240826134401-v3.3.1-up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/*
Upgrading to version 3.0.0
https://github.com/ptrumpis/snap-camera-server/releases/tag/v3.0.0
*/
ALTER TABLE `lenses` ADD COLUMN `custom_import` tinyint(1) unsigned NOT NULL DEFAULT 0;
ALTER TABLE `unlocks` ADD COLUMN `custom_import` tinyint(1) unsigned NOT NULL DEFAULT 0;
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
"license": "MIT",
"dependencies": {
"cheerio": "^1.0.0-rc.12",
"db-migrate": "1.0.0-beta.27",
"db-migrate-mysql": "^3.0.0",
"db-migrate": "1.0.0-beta.29",
"dotenv": "^16.4.5",
"express": "^4.18.3",
"formidable": "^3.5.1",
Expand Down

0 comments on commit ba0ae65

Please sign in to comment.