-
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.
Add private and onlyOwn flags to expense groupings
- Loading branch information
Showing
7 changed files
with
107 additions
and
22 deletions.
There are no files selected for viewing
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,21 @@ | ||
'use strict'; | ||
|
||
/* eslint-disable no-undef */ | ||
|
||
exports.up = knex => | ||
knex.raw(/*sql*/ ` | ||
ALTER TABLE expense_groupings | ||
ADD COLUMN user_id INTEGER REFERENCES users(id), | ||
ADD COLUMN private BOOLEAN NOT NULL DEFAULT FALSE, | ||
ADD COLUMN only_own BOOLEAN NOT NULL DEFAULT FALSE; | ||
UPDATE expense_groupings eg SET user_id = (SELECT user_id FROM group_users gu WHERE gu.group_id = eg.group_id LIMIT 1); | ||
ALTER TABLE expense_groupings ALTER COLUMN user_id SET NOT NULL; | ||
`); | ||
|
||
exports.down = knex => | ||
knex.raw(/*sql*/ ` | ||
ALTER TABLE expense_groupings | ||
DROP COLUMN user_id, | ||
DROP COLUMN private, | ||
DROP COLUMN only_own; | ||
`); |
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
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
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
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
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
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