-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improvement: track actor tenant, use it for fetching actor
- Loading branch information
1 parent
9ea3075
commit 34e7077
Showing
18 changed files
with
808 additions
and
9,012 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
107 changes: 107 additions & 0 deletions
107
dev/repo/migrations/20240405104516_migrate_resources5.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,107 @@ | ||
defmodule Demo.Repo.Migrations.MigrateResources5 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(:users) do | ||
modify(:updated_at, :utc_datetime_usec, default: fragment("(now() AT TIME ZONE 'utc')")) | ||
modify(:inserted_at, :utc_datetime_usec, default: fragment("(now() AT TIME ZONE 'utc')")) | ||
modify(:id, :uuid, default: fragment("gen_random_uuid()")) | ||
add(:org, :text) | ||
end | ||
|
||
alter table(:tickets) do | ||
modify(:updated_at, :utc_datetime_usec, default: fragment("(now() AT TIME ZONE 'utc')")) | ||
modify(:inserted_at, :utc_datetime_usec, default: fragment("(now() AT TIME ZONE 'utc')")) | ||
modify(:id, :uuid, default: fragment("gen_random_uuid()")) | ||
end | ||
|
||
drop(constraint(:ticket_comments, "ticket_comments_resource_id_fkey")) | ||
|
||
alter table(:ticket_comments) do | ||
modify(:id, :uuid, default: fragment("gen_random_uuid()")) | ||
|
||
modify( | ||
:resource_id, | ||
references(:tickets, column: :id, name: "ticket_comments_resource_id_fkey", type: :uuid) | ||
) | ||
end | ||
|
||
drop(constraint(:representative_comments, "representative_comments_resource_id_fkey")) | ||
|
||
alter table(:representative_comments) do | ||
modify(:id, :uuid, default: fragment("gen_random_uuid()")) | ||
|
||
modify( | ||
:resource_id, | ||
references(:users, | ||
column: :id, | ||
name: "representative_comments_resource_id_fkey", | ||
type: :uuid | ||
) | ||
) | ||
end | ||
|
||
alter table(:organizations) do | ||
modify(:id, :uuid, default: fragment("gen_random_uuid()")) | ||
end | ||
|
||
execute( | ||
"ALTER TABLE representative_comments alter CONSTRAINT representative_comments_resource_id_fkey NOT DEFERRABLE" | ||
) | ||
|
||
execute( | ||
"ALTER TABLE ticket_comments alter CONSTRAINT ticket_comments_resource_id_fkey NOT DEFERRABLE" | ||
) | ||
end | ||
|
||
def down do | ||
alter table(:organizations) do | ||
modify(:id, :uuid, default: fragment("uuid_generate_v4()")) | ||
end | ||
|
||
drop(constraint(:representative_comments, "representative_comments_resource_id_fkey")) | ||
|
||
alter table(:representative_comments) do | ||
modify( | ||
:resource_id, | ||
references(:users, | ||
column: :id, | ||
name: "representative_comments_resource_id_fkey", | ||
type: :uuid | ||
) | ||
) | ||
|
||
modify(:id, :uuid, default: fragment("uuid_generate_v4()")) | ||
end | ||
|
||
drop(constraint(:ticket_comments, "ticket_comments_resource_id_fkey")) | ||
|
||
alter table(:ticket_comments) do | ||
modify( | ||
:resource_id, | ||
references(:tickets, column: :id, name: "ticket_comments_resource_id_fkey", type: :uuid) | ||
) | ||
|
||
modify(:id, :uuid, default: fragment("uuid_generate_v4()")) | ||
end | ||
|
||
alter table(:tickets) do | ||
modify(:id, :uuid, default: fragment("uuid_generate_v4()")) | ||
modify(:inserted_at, :utc_datetime_usec, default: fragment("now()")) | ||
modify(:updated_at, :utc_datetime_usec, default: fragment("now()")) | ||
end | ||
|
||
alter table(:users) do | ||
remove(:org) | ||
modify(:id, :uuid, default: fragment("uuid_generate_v4()")) | ||
modify(:inserted_at, :utc_datetime_usec, default: fragment("now()")) | ||
modify(:updated_at, :utc_datetime_usec, default: fragment("now()")) | ||
end | ||
end | ||
end |
39 changes: 39 additions & 0 deletions
39
dev/resource_snapshots/repo/organizations/20240405104516.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,39 @@ | ||
{ | ||
"attributes": [ | ||
{ | ||
"default": "fragment(\"gen_random_uuid()\")", | ||
"size": null, | ||
"type": "uuid", | ||
"source": "id", | ||
"references": null, | ||
"allow_nil?": false, | ||
"generated?": false, | ||
"primary_key?": true | ||
}, | ||
{ | ||
"default": "nil", | ||
"size": null, | ||
"type": "text", | ||
"source": "name", | ||
"references": null, | ||
"allow_nil?": true, | ||
"generated?": false, | ||
"primary_key?": false | ||
} | ||
], | ||
"table": "organizations", | ||
"hash": "FE04FAC17C7D0EDB0064F5735F42026A0C533C14D8F66C9E8B2E6C5A9831A041", | ||
"repo": "Elixir.Demo.Repo", | ||
"schema": null, | ||
"identities": [], | ||
"multitenancy": { | ||
"global": null, | ||
"attribute": null, | ||
"strategy": null | ||
}, | ||
"base_filter": null, | ||
"check_constraints": [], | ||
"custom_indexes": [], | ||
"custom_statements": [], | ||
"has_create_action": true | ||
} |
123 changes: 123 additions & 0 deletions
123
dev/resource_snapshots/repo/representative_comments/20240405104516.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,123 @@ | ||
{ | ||
"attributes": [ | ||
{ | ||
"default": "fragment(\"gen_random_uuid()\")", | ||
"size": null, | ||
"type": "uuid", | ||
"source": "id", | ||
"references": null, | ||
"allow_nil?": false, | ||
"generated?": false, | ||
"primary_key?": true | ||
}, | ||
{ | ||
"default": "nil", | ||
"size": null, | ||
"type": "text", | ||
"source": "comment", | ||
"references": null, | ||
"allow_nil?": true, | ||
"generated?": false, | ||
"primary_key?": false | ||
}, | ||
{ | ||
"default": "nil", | ||
"size": null, | ||
"type": "uuid", | ||
"source": "resource_id", | ||
"references": { | ||
"name": "representative_comments_resource_id_fkey", | ||
"table": "users", | ||
"schema": null, | ||
"multitenancy": { | ||
"global": null, | ||
"attribute": null, | ||
"strategy": null | ||
}, | ||
"on_update": null, | ||
"primary_key?": true, | ||
"on_delete": null, | ||
"destination_attribute": "id", | ||
"deferrable": false, | ||
"match_type": null, | ||
"match_with": null, | ||
"destination_attribute_default": "fragment(\"gen_random_uuid()\")", | ||
"destination_attribute_generated": false | ||
}, | ||
"allow_nil?": false, | ||
"generated?": false, | ||
"primary_key?": false | ||
}, | ||
{ | ||
"default": "nil", | ||
"size": null, | ||
"type": "uuid", | ||
"source": "commenting_customer_id", | ||
"references": { | ||
"name": "representative_comments_commenting_customer_id_fkey", | ||
"table": "users", | ||
"schema": "public", | ||
"multitenancy": { | ||
"global": null, | ||
"attribute": null, | ||
"strategy": null | ||
}, | ||
"on_update": null, | ||
"primary_key?": true, | ||
"on_delete": null, | ||
"destination_attribute": "id", | ||
"deferrable": false, | ||
"match_type": null, | ||
"match_with": null, | ||
"destination_attribute_default": null, | ||
"destination_attribute_generated": null | ||
}, | ||
"allow_nil?": true, | ||
"generated?": false, | ||
"primary_key?": false | ||
}, | ||
{ | ||
"default": "nil", | ||
"size": null, | ||
"type": "uuid", | ||
"source": "commenting_representative_id", | ||
"references": { | ||
"name": "representative_comments_commenting_representative_id_fkey", | ||
"table": "users", | ||
"schema": "public", | ||
"multitenancy": { | ||
"global": null, | ||
"attribute": null, | ||
"strategy": null | ||
}, | ||
"on_update": null, | ||
"primary_key?": true, | ||
"on_delete": null, | ||
"destination_attribute": "id", | ||
"deferrable": false, | ||
"match_type": null, | ||
"match_with": null, | ||
"destination_attribute_default": null, | ||
"destination_attribute_generated": null | ||
}, | ||
"allow_nil?": true, | ||
"generated?": false, | ||
"primary_key?": false | ||
} | ||
], | ||
"table": "representative_comments", | ||
"hash": "9FAEADC51CF57CA679CC932FC19C5204ED427748F5EB5A692669D6186E28A6C7", | ||
"repo": "Elixir.Demo.Repo", | ||
"schema": null, | ||
"identities": [], | ||
"multitenancy": { | ||
"global": null, | ||
"attribute": null, | ||
"strategy": null | ||
}, | ||
"base_filter": null, | ||
"check_constraints": [], | ||
"custom_indexes": [], | ||
"custom_statements": [], | ||
"has_create_action": true | ||
} |
Oops, something went wrong.