-
Notifications
You must be signed in to change notification settings - Fork 0
Task/sean/str 385 #100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Task/sean/str 385 #100
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
df28fc5
adding platform DB stuff
03424df
move admin api entities into admin api
9ae4940
deprecate old 'platform'
53d4dff
alter platform table instead of dropping it
4373877
change tabs to 2 spaces in migrations 5
1970863
Updated this_to_that naming convention in entities, repos
6f7e924
fixed some spacing, renamed many-to-many relationships as table-to-table
ocasta181 f63b69b
fix order, IF EXISTS, and missing commas
ocasta181 58e7788
fix race condition in docker
ocasta181 0b11424
fixed some things and broke some other things
4d8cef4
remove mocks since we're not using it anymore
ocasta181 c0f9bef
make goose happy
cb16928
rename to match many-to-many table names
ocasta181 e801cc3
Merge branch 'develop' into task/sean/str-385
f6fbc96
Update pkg/repository/platform.go
auroter 64571d1
Update pkg/repository/platform.go
auroter 5b9896f
Update pkg/service/platform.go
auroter a113ec3
Update pkg/service/platform.go
auroter File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
94 changes: 94 additions & 0 deletions
94
migrations/0005_user-to-platform_contact-to-platform_device-to-instrument_platform.sql
This file contains hidden or 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,94 @@ | ||
------------------------------------------------------------------------- | ||
-- +goose Up | ||
|
||
------------------------------------------------------------------------- | ||
-- USER_TO_PLATFORM ----------------------------------------------------- | ||
ALTER TABLE user_platform | ||
RENAME TO user_to_platform; | ||
|
||
DROP INDEX IF EXISTS user_platform_user_id_platform_id_idx; | ||
|
||
CREATE UNIQUE INDEX user_to_platform_user_id_platform_id_idx ON user_to_platform(user_id, platform_id); | ||
|
||
|
||
------------------------------------------------------------------------- | ||
-- CONTACT_TO_PLATFORM -------------------------------------------------- | ||
ALTER TABLE contact_platform | ||
RENAME TO contact_to_platform; | ||
|
||
DROP INDEX IF EXISTS contact_platform_contact_id_platform_id_idx; | ||
|
||
CREATE UNIQUE INDEX contact_to_platform_contact_id_platform_id_idx ON contact_to_platform(contact_id, platform_id); | ||
|
||
|
||
------------------------------------------------------------------------- | ||
-- DEVICE_TO_INSTRUMENT ------------------------------------------------- | ||
ALTER TABLE device_instrument | ||
RENAME TO device_to_instrument; | ||
|
||
DROP INDEX IF EXISTS device_instrument_device_id_instrument_id_idx; | ||
|
||
CREATE UNIQUE INDEX device_to_instrument_device_id_instrument_id_idx ON device_to_instrument(device_id, instrument_id); | ||
|
||
|
||
------------------------------------------------------------------------- | ||
-- PLATFORM ------------------------------------------------------------- | ||
ALTER TABLE platform | ||
DROP COLUMN IF EXISTS type, | ||
DROP COLUMN IF EXISTS status, | ||
DROP COLUMN IF EXISTS name, | ||
DROP COLUMN IF EXISTS api_key, | ||
DROP COLUMN IF EXISTS authentication, | ||
ADD COLUMN activated_at TIMESTAMP WITH TIME ZONE DEFAULT NULL, -- for activating prod users | ||
ADD COLUMN name TEXT NOT NULL, | ||
ADD COLUMN description TEXT NOT NULL, | ||
ADD COLUMN domains TEXT[] DEFAULT NULL, -- define which domains can make calls to API (web-to-API) | ||
ADD COLUMN ip_addresses TEXT[] DEFAULT NULL; -- define which API ips can make calls (API-to-API) | ||
|
||
|
||
------------------------------------------------------------------------- | ||
-- +goose Down | ||
|
||
------------------------------------------------------------------------- | ||
-- PLATFORM ------------------------------------------------------------- | ||
ALTER TABLE platform | ||
DROP COLUMN IF EXISTS activated_at, | ||
DROP COLUMN IF EXISTS name, | ||
DROP COLUMN IF EXISTS description, | ||
DROP COLUMN IF EXISTS domains, | ||
DROP COLUMN IF EXISTS ip_addresses, | ||
ADD COLUMN type TEXT DEFAULT '', -- enum: to be defined at struct level in Go | ||
ADD COLUMN status TEXT DEFAULT '', -- enum: to be defined at struct level in Go | ||
ADD COLUMN name TEXT DEFAULT '', | ||
ADD COLUMN api_key TEXT DEFAULT '', | ||
ADD COLUMN authentication TEXT DEFAULT ''; --enum [email, phone, wallet] | ||
|
||
|
||
------------------------------------------------------------------------- | ||
-- USER_PLATFORM ----------------------------------------------------- | ||
ALTER TABLE user_to_platform | ||
RENAME TO user_platform; | ||
|
||
DROP INDEX IF EXISTS user_to_platform_user_id_platform_id_idx; | ||
|
||
CREATE UNIQUE INDEX user_platform_user_id_platform_id_idx ON user_platform(user_id, platform_id); | ||
|
||
|
||
------------------------------------------------------------------------- | ||
-- CONTACT_PLATFORM -------------------------------------------------- | ||
ALTER TABLE contact_to_platform | ||
RENAME TO contact_platform; | ||
|
||
DROP INDEX IF EXISTS contact_to_platform_contact_id_platform_id_idx; | ||
|
||
CREATE UNIQUE INDEX contact_platform_contact_id_platform_id_idx ON contact_platform(contact_id, platform_id); | ||
|
||
|
||
------------------------------------------------------------------------- | ||
-- DEVICE_INSTRUMENT ------------------------------------------------- | ||
ALTER TABLE device_to_instrument | ||
RENAME TO device_instrument; | ||
|
||
DROP INDEX IF EXISTS device_to_instrument_device_id_instrument_id_idx; | ||
|
||
CREATE UNIQUE INDEX device_instrument_device_id_instrument_id_idx ON device_instrument(device_id, instrument_id); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.