-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Record user provenance for detections when logged in
- Loading branch information
Showing
3 changed files
with
325 additions
and
0 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
23 changes: 23 additions & 0 deletions
23
server/priv/repo/migrations/20240227225620_add_user_to_detections.exs
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,23 @@ | ||
defmodule Orcasite.Repo.Migrations.AddUserToDetections do | ||
@moduledoc """ | ||
Updates resources based on their most recent snapshots. | ||
This file was autogenerated with `mix ash_postgres.generate_migrations` | ||
""" | ||
|
||
use Ecto.Migration | ||
|
||
def up do | ||
alter table(:detections) do | ||
add :user_id, references(:users, column: :id, name: "detections_user_id_fkey", type: :uuid) | ||
end | ||
end | ||
|
||
def down do | ||
drop constraint(:detections, "detections_user_id_fkey") | ||
|
||
alter table(:detections) do | ||
remove :user_id | ||
end | ||
end | ||
end |
284 changes: 284 additions & 0 deletions
284
server/priv/resource_snapshots/repo/detections/20240227225620.json
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,284 @@ | ||
{ | ||
"attributes": [ | ||
{ | ||
"default": "fragment(\"uuid_generate_v7()\")", | ||
"size": null, | ||
"type": "uuid", | ||
"source": "id", | ||
"references": null, | ||
"allow_nil?": false, | ||
"primary_key?": true, | ||
"generated?": false | ||
}, | ||
{ | ||
"default": "nil", | ||
"size": null, | ||
"type": "text", | ||
"source": "source_ip", | ||
"references": null, | ||
"allow_nil?": true, | ||
"primary_key?": false, | ||
"generated?": false | ||
}, | ||
{ | ||
"default": "nil", | ||
"size": null, | ||
"type": "bigint", | ||
"source": "playlist_timestamp", | ||
"references": null, | ||
"allow_nil?": false, | ||
"primary_key?": false, | ||
"generated?": false | ||
}, | ||
{ | ||
"default": "nil", | ||
"size": null, | ||
"type": "decimal", | ||
"source": "player_offset", | ||
"references": null, | ||
"allow_nil?": false, | ||
"primary_key?": false, | ||
"generated?": false | ||
}, | ||
{ | ||
"default": "nil", | ||
"size": null, | ||
"type": "bigint", | ||
"source": "listener_count", | ||
"references": null, | ||
"allow_nil?": true, | ||
"primary_key?": false, | ||
"generated?": false | ||
}, | ||
{ | ||
"default": "nil", | ||
"size": null, | ||
"type": "utc_datetime_usec", | ||
"source": "timestamp", | ||
"references": null, | ||
"allow_nil?": false, | ||
"primary_key?": false, | ||
"generated?": false | ||
}, | ||
{ | ||
"default": "nil", | ||
"size": null, | ||
"type": "text", | ||
"source": "description", | ||
"references": null, | ||
"allow_nil?": true, | ||
"primary_key?": false, | ||
"generated?": false | ||
}, | ||
{ | ||
"default": "true", | ||
"size": null, | ||
"type": "boolean", | ||
"source": "visible", | ||
"references": null, | ||
"allow_nil?": true, | ||
"primary_key?": false, | ||
"generated?": false | ||
}, | ||
{ | ||
"default": "nil", | ||
"size": null, | ||
"type": "text", | ||
"source": "category", | ||
"references": null, | ||
"allow_nil?": true, | ||
"primary_key?": false, | ||
"generated?": false | ||
}, | ||
{ | ||
"default": "fragment(\"now()\")", | ||
"size": null, | ||
"type": "utc_datetime_usec", | ||
"source": "inserted_at", | ||
"references": null, | ||
"allow_nil?": false, | ||
"primary_key?": false, | ||
"generated?": false | ||
}, | ||
{ | ||
"default": "fragment(\"now()\")", | ||
"size": null, | ||
"type": "utc_datetime_usec", | ||
"source": "updated_at", | ||
"references": null, | ||
"allow_nil?": false, | ||
"primary_key?": false, | ||
"generated?": false | ||
}, | ||
{ | ||
"default": "nil", | ||
"size": null, | ||
"type": "uuid", | ||
"source": "candidate_id", | ||
"references": { | ||
"name": "detections_candidate_id_fkey", | ||
"table": "candidates", | ||
"schema": null, | ||
"primary_key?": true, | ||
"multitenancy": { | ||
"global": null, | ||
"attribute": null, | ||
"strategy": null | ||
}, | ||
"destination_attribute": "id", | ||
"on_delete": null, | ||
"on_update": null, | ||
"deferrable": false, | ||
"match_with": null, | ||
"match_type": null, | ||
"destination_attribute_default": null, | ||
"destination_attribute_generated": null | ||
}, | ||
"allow_nil?": true, | ||
"primary_key?": false, | ||
"generated?": false | ||
}, | ||
{ | ||
"default": "nil", | ||
"size": null, | ||
"type": "uuid", | ||
"source": "feed_id", | ||
"references": { | ||
"name": "detections_feed_id_fkey", | ||
"table": "feeds", | ||
"schema": null, | ||
"primary_key?": true, | ||
"multitenancy": { | ||
"global": null, | ||
"attribute": null, | ||
"strategy": null | ||
}, | ||
"destination_attribute": "id", | ||
"on_delete": null, | ||
"on_update": null, | ||
"deferrable": false, | ||
"match_with": null, | ||
"match_type": null, | ||
"destination_attribute_default": null, | ||
"destination_attribute_generated": null | ||
}, | ||
"allow_nil?": true, | ||
"primary_key?": false, | ||
"generated?": false | ||
}, | ||
{ | ||
"default": "nil", | ||
"size": null, | ||
"type": "uuid", | ||
"source": "user_id", | ||
"references": { | ||
"name": "detections_user_id_fkey", | ||
"table": "users", | ||
"schema": null, | ||
"primary_key?": true, | ||
"multitenancy": { | ||
"global": null, | ||
"attribute": null, | ||
"strategy": null | ||
}, | ||
"destination_attribute": "id", | ||
"on_delete": null, | ||
"on_update": null, | ||
"deferrable": false, | ||
"match_with": null, | ||
"match_type": null, | ||
"destination_attribute_default": null, | ||
"destination_attribute_generated": null | ||
}, | ||
"allow_nil?": true, | ||
"primary_key?": false, | ||
"generated?": false | ||
} | ||
], | ||
"table": "detections", | ||
"hash": "40C8652202741F8E4AC96390303B2EAA7866054BDBE70BA81E5C67044821F33C", | ||
"repo": "Elixir.Orcasite.Repo", | ||
"identities": [], | ||
"custom_indexes": [ | ||
{ | ||
"message": null, | ||
"name": null, | ||
"table": null, | ||
"include": null, | ||
"prefix": null, | ||
"fields": [ | ||
"playlist_timestamp" | ||
], | ||
"where": null, | ||
"unique": false, | ||
"using": null, | ||
"concurrently": false | ||
}, | ||
{ | ||
"message": null, | ||
"name": null, | ||
"table": null, | ||
"include": null, | ||
"prefix": null, | ||
"fields": [ | ||
"player_offset" | ||
], | ||
"where": null, | ||
"unique": false, | ||
"using": null, | ||
"concurrently": false | ||
}, | ||
{ | ||
"message": null, | ||
"name": null, | ||
"table": null, | ||
"include": null, | ||
"prefix": null, | ||
"fields": [ | ||
"timestamp" | ||
], | ||
"where": null, | ||
"unique": false, | ||
"using": null, | ||
"concurrently": false | ||
}, | ||
{ | ||
"message": null, | ||
"name": null, | ||
"table": null, | ||
"include": null, | ||
"prefix": null, | ||
"fields": [ | ||
"description" | ||
], | ||
"where": null, | ||
"unique": false, | ||
"using": null, | ||
"concurrently": false | ||
}, | ||
{ | ||
"message": null, | ||
"name": null, | ||
"table": null, | ||
"include": null, | ||
"prefix": null, | ||
"fields": [ | ||
"inserted_at" | ||
], | ||
"where": null, | ||
"unique": false, | ||
"using": null, | ||
"concurrently": false | ||
} | ||
], | ||
"schema": null, | ||
"check_constraints": [], | ||
"multitenancy": { | ||
"global": null, | ||
"attribute": null, | ||
"strategy": null | ||
}, | ||
"base_filter": null, | ||
"custom_statements": [], | ||
"has_create_action": true | ||
} |