Skip to content

Commit b0de895

Browse files
authored
Merge pull request #460 from OlhaD/122-customize-wallet
122 customize wallet
2 parents fda9c03 + 1c6e69d commit b0de895

18 files changed

+18514
-13130
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
'use strict';
2+
3+
var dbm;
4+
var type;
5+
var seed;
6+
var fs = require('fs');
7+
var path = require('path');
8+
var Promise;
9+
10+
/**
11+
* We receive the dbmigrate dependency from dbmigrate initially.
12+
* This enables us to not have to rely on NODE_PATH.
13+
*/
14+
exports.setup = function (options, seedLink) {
15+
dbm = options.dbmigrate;
16+
type = dbm.dataType;
17+
seed = seedLink;
18+
Promise = options.Promise;
19+
};
20+
21+
exports.up = function (db) {
22+
var filePath = path.join(
23+
__dirname,
24+
'sqls',
25+
'20240412001733-AddCoverUrl-up.sql',
26+
);
27+
return new Promise(function (resolve, reject) {
28+
fs.readFile(filePath, { encoding: 'utf-8' }, function (err, data) {
29+
if (err) return reject(err);
30+
console.log('received data: ' + data);
31+
32+
resolve(data);
33+
});
34+
}).then(function (data) {
35+
return db.runSql(data);
36+
});
37+
};
38+
39+
exports.down = function (db) {
40+
var filePath = path.join(
41+
__dirname,
42+
'sqls',
43+
'20240412001733-AddCoverUrl-down.sql',
44+
);
45+
return new Promise(function (resolve, reject) {
46+
fs.readFile(filePath, { encoding: 'utf-8' }, function (err, data) {
47+
if (err) return reject(err);
48+
console.log('received data: ' + data);
49+
50+
resolve(data);
51+
});
52+
}).then(function (data) {
53+
return db.runSql(data);
54+
});
55+
};
56+
57+
exports._meta = {
58+
version: 1,
59+
};
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
'use strict';
2+
3+
var dbm;
4+
var type;
5+
var seed;
6+
var fs = require('fs');
7+
var path = require('path');
8+
var Promise;
9+
10+
/**
11+
* We receive the dbmigrate dependency from dbmigrate initially.
12+
* This enables us to not have to rely on NODE_PATH.
13+
*/
14+
exports.setup = function(options, seedLink) {
15+
dbm = options.dbmigrate;
16+
type = dbm.dataType;
17+
seed = seedLink;
18+
Promise = options.Promise;
19+
};
20+
21+
exports.up = function(db) {
22+
var filePath = path.join(__dirname, 'sqls', '20240422141722-add-display-name-up.sql');
23+
return new Promise( function( resolve, reject ) {
24+
fs.readFile(filePath, {encoding: 'utf-8'}, function(err,data){
25+
if (err) return reject(err);
26+
console.log('received data: ' + data);
27+
28+
resolve(data);
29+
});
30+
})
31+
.then(function(data) {
32+
return db.runSql(data);
33+
});
34+
};
35+
36+
exports.down = function(db) {
37+
var filePath = path.join(__dirname, 'sqls', '20240422141722-add-display-name-down.sql');
38+
return new Promise( function( resolve, reject ) {
39+
fs.readFile(filePath, {encoding: 'utf-8'}, function(err,data){
40+
if (err) return reject(err);
41+
console.log('received data: ' + data);
42+
43+
resolve(data);
44+
});
45+
})
46+
.then(function(data) {
47+
return db.runSql(data);
48+
});
49+
};
50+
51+
exports._meta = {
52+
"version": 1
53+
};
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ALTER TABLE wallet DROP COLUMN cover_url;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ALTER TABLE wallet ADD COLUMN cover_url varchar;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ALTER TABLE wallet DROP COLUMN display_name;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ALTER TABLE wallet ADD COLUMN display_name varchar;

0 commit comments

Comments
 (0)