Skip to content

Commit 428dd22

Browse files
committed
chore: codegen & fix preferred_envs
1 parent 7145b58 commit 428dd22

File tree

3 files changed

+121
-11
lines changed

3 files changed

+121
-11
lines changed

mix.exs

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,7 @@ defmodule AshSqlite.MixProject do
2020
deps: deps(),
2121
description: @description,
2222
elixirc_paths: elixirc_paths(Mix.env()),
23-
preferred_cli_env: [
24-
coveralls: :test,
25-
"coveralls.github": :test,
26-
"test.create": :test,
27-
"test.migrate": :test,
28-
"test.rollback": :test,
29-
"test.check_migrations": :test,
30-
"test.drop": :test,
31-
"test.generate_migrations": :test,
32-
"test.reset": :test
33-
],
23+
cli: cli(),
3424
dialyzer: [
3525
plt_add_apps: [:ecto, :ash, :mix]
3626
],
@@ -43,6 +33,22 @@ defmodule AshSqlite.MixProject do
4333
]
4434
end
4535

36+
defp cli do
37+
[
38+
preferred_envs: [
39+
coveralls: :test,
40+
"coveralls.github": :test,
41+
"test.create": :test,
42+
"test.migrate": :test,
43+
"test.rollback": :test,
44+
"test.check_migrations": :test,
45+
"test.drop": :test,
46+
"test.generate_migrations": :test,
47+
"test.reset": :test
48+
]
49+
]
50+
end
51+
4652
if Mix.env() == :test do
4753
def application() do
4854
[
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
{
2+
"attributes": [
3+
{
4+
"default": "nil",
5+
"size": null,
6+
"type": "text",
7+
"source": "id",
8+
"references": null,
9+
"allow_nil?": false,
10+
"generated?": false,
11+
"primary_key?": true
12+
},
13+
{
14+
"default": "nil",
15+
"size": null,
16+
"type": "text",
17+
"source": "name",
18+
"references": null,
19+
"allow_nil?": false,
20+
"generated?": false,
21+
"primary_key?": false
22+
},
23+
{
24+
"default": "nil",
25+
"size": null,
26+
"type": "map",
27+
"source": "entity",
28+
"references": null,
29+
"allow_nil?": false,
30+
"generated?": false,
31+
"primary_key?": false
32+
},
33+
{
34+
"default": "nil",
35+
"size": null,
36+
"type": "utc_datetime_usec",
37+
"source": "inserted_at",
38+
"references": null,
39+
"allow_nil?": false,
40+
"generated?": false,
41+
"primary_key?": false
42+
},
43+
{
44+
"default": "nil",
45+
"size": null,
46+
"type": "utc_datetime_usec",
47+
"source": "updated_at",
48+
"references": null,
49+
"allow_nil?": false,
50+
"generated?": false,
51+
"primary_key?": false
52+
}
53+
],
54+
"table": "devices",
55+
"hash": "847DA3D88B90EC7DA08843D0D79EFF346DABDE8DAC6090F2B1E0A3C904D50DF3",
56+
"strict?": false,
57+
"repo": "Elixir.AshSqlite.TestRepo",
58+
"identities": [
59+
{
60+
"name": "unique_id",
61+
"keys": [
62+
"id"
63+
],
64+
"base_filter": null,
65+
"index_name": "devices_unique_id_index"
66+
}
67+
],
68+
"base_filter": null,
69+
"multitenancy": {
70+
"global": null,
71+
"attribute": null,
72+
"strategy": null
73+
},
74+
"custom_indexes": [],
75+
"custom_statements": [],
76+
"has_create_action": true
77+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
defmodule AshSqlite.TestRepo.Migrations.TestCodegen do
2+
@moduledoc """
3+
Updates resources based on their most recent snapshots.
4+
5+
This file was autogenerated with `mix ash_sqlite.generate_migrations`
6+
"""
7+
8+
use Ecto.Migration
9+
10+
def up do
11+
create table(:devices, primary_key: false) do
12+
add :updated_at, :utc_datetime_usec, null: false
13+
add :inserted_at, :utc_datetime_usec, null: false
14+
add :entity, :map, null: false
15+
add :name, :text, null: false
16+
add :id, :text, null: false, primary_key: true
17+
end
18+
19+
create unique_index(:devices, [:id], name: "devices_unique_id_index")
20+
end
21+
22+
def down do
23+
drop_if_exists unique_index(:devices, [:id], name: "devices_unique_id_index")
24+
25+
drop table(:devices)
26+
end
27+
end

0 commit comments

Comments
 (0)