Skip to content

Commit

Permalink
fix(loopback4-starter): revive loopback4-starter (#126)
Browse files Browse the repository at this point in the history
  • Loading branch information
arpit1503khanna authored Nov 9, 2023
1 parent 7af9308 commit 95e47bc
Show file tree
Hide file tree
Showing 9 changed files with 10,936 additions and 6,978 deletions.
53 changes: 53 additions & 0 deletions migrations/20231031101641-alter-user-tenant.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', '20231031101641-alter-user-tenant-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', '20231031101641-alter-user-tenant-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
};
1 change: 0 additions & 1 deletion migrations/sqls/20190508102441-authentication-up.sql
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ CREATE TABLE lbstarter.auth_clients (
deleted bool DEFAULT false NOT NULL ,
deleted_on timestamptz DEFAULT current_timestamp ,
deleted_by varchar(200),
user_ids integer[],
CONSTRAINT pk_auth_clients_id PRIMARY KEY ( id )
);

Expand Down
1 change: 1 addition & 0 deletions migrations/sqls/20231031101641-alter-user-tenant-down.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE lbstarter.user_tenants DROP COLUMN deleted_by,deleted_on;
5 changes: 5 additions & 0 deletions migrations/sqls/20231031101641-alter-user-tenant-up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ALTER TABLE lbstarter.user_tenants
ADD deleted_by varchar(200);

ALTER TABLE lbstarter.user_tenants
ADD deleted_on timestamptz;
Loading

0 comments on commit 95e47bc

Please sign in to comment.