Skip to content

Commit

Permalink
feat: add cover URL to wallet table
Browse files Browse the repository at this point in the history
  • Loading branch information
OlhaD committed Apr 16, 2024
1 parent c1ae9be commit 3ae0efa
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 0 deletions.
59 changes: 59 additions & 0 deletions database/migrations/20240412001733-AddCoverUrl.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
'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',
'20240412001733-AddCoverUrl-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',
'20240412001733-AddCoverUrl-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,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE wallet DROP COLUMN cover_url;
1 change: 1 addition & 0 deletions database/migrations/sqls/20240412001733-AddCoverUrl-up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE wallet ADD COLUMN cover_url varchar;

0 comments on commit 3ae0efa

Please sign in to comment.