-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: fix calculate when exprs aren't dynamics
test: add test for datetimes
- Loading branch information
1 parent
65f9356
commit 56f3a5e
Showing
5 changed files
with
398 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
352 changes: 352 additions & 0 deletions
352
priv/resource_snapshots/test_repo/posts/20240503012410.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,352 @@ | ||
{ | ||
"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": "title_column", | ||
"references": null, | ||
"allow_nil?": true, | ||
"generated?": false, | ||
"primary_key?": false | ||
}, | ||
{ | ||
"default": "nil", | ||
"size": null, | ||
"type": "utc_datetime_usec", | ||
"source": "datetime", | ||
"references": null, | ||
"allow_nil?": true, | ||
"generated?": false, | ||
"primary_key?": false | ||
}, | ||
{ | ||
"default": "nil", | ||
"size": null, | ||
"type": "bigint", | ||
"source": "score", | ||
"references": null, | ||
"allow_nil?": true, | ||
"generated?": false, | ||
"primary_key?": false | ||
}, | ||
{ | ||
"default": "nil", | ||
"size": null, | ||
"type": "boolean", | ||
"source": "public", | ||
"references": null, | ||
"allow_nil?": true, | ||
"generated?": false, | ||
"primary_key?": false | ||
}, | ||
{ | ||
"default": "nil", | ||
"size": null, | ||
"type": "citext", | ||
"source": "category", | ||
"references": null, | ||
"allow_nil?": true, | ||
"generated?": false, | ||
"primary_key?": false | ||
}, | ||
{ | ||
"default": "\"sponsored\"", | ||
"size": null, | ||
"type": "text", | ||
"source": "type", | ||
"references": null, | ||
"allow_nil?": true, | ||
"generated?": false, | ||
"primary_key?": false | ||
}, | ||
{ | ||
"default": "nil", | ||
"size": null, | ||
"type": "bigint", | ||
"source": "price", | ||
"references": null, | ||
"allow_nil?": true, | ||
"generated?": false, | ||
"primary_key?": false | ||
}, | ||
{ | ||
"default": "\"0\"", | ||
"size": null, | ||
"type": "decimal", | ||
"source": "decimal", | ||
"references": null, | ||
"allow_nil?": true, | ||
"generated?": false, | ||
"primary_key?": false | ||
}, | ||
{ | ||
"default": "nil", | ||
"size": null, | ||
"type": "text", | ||
"source": "status", | ||
"references": null, | ||
"allow_nil?": true, | ||
"generated?": false, | ||
"primary_key?": false | ||
}, | ||
{ | ||
"default": "nil", | ||
"size": null, | ||
"type": "status", | ||
"source": "status_enum", | ||
"references": null, | ||
"allow_nil?": true, | ||
"generated?": false, | ||
"primary_key?": false | ||
}, | ||
{ | ||
"default": "nil", | ||
"size": null, | ||
"type": [ | ||
"array", | ||
"float" | ||
], | ||
"source": "point", | ||
"references": null, | ||
"allow_nil?": true, | ||
"generated?": false, | ||
"primary_key?": false | ||
}, | ||
{ | ||
"default": "nil", | ||
"size": null, | ||
"type": "custom_point", | ||
"source": "composite_point", | ||
"references": null, | ||
"allow_nil?": true, | ||
"generated?": false, | ||
"primary_key?": false | ||
}, | ||
{ | ||
"default": "nil", | ||
"size": null, | ||
"type": "map", | ||
"source": "stuff", | ||
"references": null, | ||
"allow_nil?": true, | ||
"generated?": false, | ||
"primary_key?": false | ||
}, | ||
{ | ||
"default": "nil", | ||
"size": null, | ||
"type": [ | ||
"array", | ||
"map" | ||
], | ||
"source": "list_of_stuff", | ||
"references": null, | ||
"allow_nil?": true, | ||
"generated?": false, | ||
"primary_key?": false | ||
}, | ||
{ | ||
"default": "nil", | ||
"size": null, | ||
"type": "text", | ||
"source": "uniq_one", | ||
"references": null, | ||
"allow_nil?": true, | ||
"generated?": false, | ||
"primary_key?": false | ||
}, | ||
{ | ||
"default": "nil", | ||
"size": null, | ||
"type": "text", | ||
"source": "uniq_two", | ||
"references": null, | ||
"allow_nil?": true, | ||
"generated?": false, | ||
"primary_key?": false | ||
}, | ||
{ | ||
"default": "nil", | ||
"size": null, | ||
"type": "text", | ||
"source": "uniq_custom_one", | ||
"references": null, | ||
"allow_nil?": true, | ||
"generated?": false, | ||
"primary_key?": false | ||
}, | ||
{ | ||
"default": "nil", | ||
"size": null, | ||
"type": "text", | ||
"source": "uniq_custom_two", | ||
"references": null, | ||
"allow_nil?": true, | ||
"generated?": false, | ||
"primary_key?": false | ||
}, | ||
{ | ||
"default": "nil", | ||
"size": null, | ||
"type": [ | ||
"array", | ||
"text" | ||
], | ||
"source": "list_containing_nils", | ||
"references": null, | ||
"allow_nil?": true, | ||
"generated?": false, | ||
"primary_key?": false | ||
}, | ||
{ | ||
"default": "fragment(\"(now() AT TIME ZONE 'utc')\")", | ||
"size": null, | ||
"type": "utc_datetime_usec", | ||
"source": "created_at", | ||
"references": null, | ||
"allow_nil?": false, | ||
"generated?": false, | ||
"primary_key?": false | ||
}, | ||
{ | ||
"default": "fragment(\"(now() AT TIME ZONE 'utc')\")", | ||
"size": null, | ||
"type": "utc_datetime_usec", | ||
"source": "updated_at", | ||
"references": null, | ||
"allow_nil?": false, | ||
"generated?": false, | ||
"primary_key?": false | ||
}, | ||
{ | ||
"default": "nil", | ||
"size": null, | ||
"type": "uuid", | ||
"source": "organization_id", | ||
"references": { | ||
"name": "posts_organization_id_fkey", | ||
"table": "orgs", | ||
"schema": "public", | ||
"on_delete": null, | ||
"multitenancy": { | ||
"global": null, | ||
"attribute": null, | ||
"strategy": null | ||
}, | ||
"primary_key?": true, | ||
"destination_attribute": "id", | ||
"on_update": null, | ||
"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": "author_id", | ||
"references": { | ||
"name": "posts_author_id_fkey", | ||
"table": "authors", | ||
"schema": "public", | ||
"on_delete": null, | ||
"multitenancy": { | ||
"global": null, | ||
"attribute": null, | ||
"strategy": null | ||
}, | ||
"primary_key?": true, | ||
"destination_attribute": "id", | ||
"on_update": null, | ||
"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": "posts", | ||
"hash": "CAD4281EFCDF0328EEC1C473F0041F4DCD0DB6431C3DF44540EA67F4FA4511FE", | ||
"repo": "Elixir.AshPostgres.TestRepo", | ||
"identities": [ | ||
{ | ||
"name": "uniq_one_and_two", | ||
"keys": [ | ||
"uniq_one", | ||
"uniq_two" | ||
], | ||
"base_filter": "type = 'sponsored'", | ||
"all_tenants?": false, | ||
"index_name": "posts_uniq_one_and_two_index" | ||
} | ||
], | ||
"schema": null, | ||
"check_constraints": [ | ||
{ | ||
"name": "price_must_be_positive", | ||
"check": "price > 0", | ||
"attribute": [ | ||
"price" | ||
], | ||
"base_filter": "type = 'sponsored'" | ||
} | ||
], | ||
"custom_indexes": [ | ||
{ | ||
"message": "dude what the heck", | ||
"name": null, | ||
"table": null, | ||
"include": null, | ||
"prefix": null, | ||
"fields": [ | ||
{ | ||
"type": "atom", | ||
"value": "uniq_custom_one" | ||
}, | ||
{ | ||
"type": "atom", | ||
"value": "uniq_custom_two" | ||
} | ||
], | ||
"where": null, | ||
"unique": true, | ||
"all_tenants?": false, | ||
"concurrently": true, | ||
"error_fields": [ | ||
"uniq_custom_one", | ||
"uniq_custom_two" | ||
], | ||
"nulls_distinct": true, | ||
"using": null | ||
} | ||
], | ||
"base_filter": "type = 'sponsored'", | ||
"multitenancy": { | ||
"global": null, | ||
"attribute": null, | ||
"strategy": null | ||
}, | ||
"custom_statements": [], | ||
"has_create_action": true | ||
} |
21 changes: 21 additions & 0 deletions
21
priv/test_repo/migrations/20240503012410_migrate_resources21.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,21 @@ | ||
defmodule AshPostgres.TestRepo.Migrations.MigrateResources21 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(:posts) do | ||
add(:datetime, :utc_datetime_usec) | ||
end | ||
end | ||
|
||
def down do | ||
alter table(:posts) do | ||
remove(:datetime) | ||
end | ||
end | ||
end |
Oops, something went wrong.