-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
auth group user: added "props" column (#73)
Co-authored-by: Stefano Ricci <[email protected]>
- Loading branch information
Showing
3 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
51 changes: 51 additions & 0 deletions
51
...dbMigrator/migration/public/migrations/20241009091444-add-column-auth-group-user-props.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
'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', '20241009091444-add-column-auth-group-user-props-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', '20241009091444-add-column-auth-group-user-props-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: 1 addition & 0 deletions
1
...migration/public/migrations/sqls/20241009091444-add-column-auth-group-user-props-down.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/* Replace with your SQL commands */ |
2 changes: 2 additions & 0 deletions
2
...r/migration/public/migrations/sqls/20241009091444-add-column-auth-group-user-props-up.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
ALTER TABLE auth_group_user | ||
ADD COLUMN props jsonb NULL; |