chore: clean up old search code, generate migrations

This commit is contained in:
Zach Daniel 2023-10-12 18:18:09 -04:00
parent 4a37edd47e
commit bea48bfe09
23 changed files with 1884 additions and 130 deletions

View file

@ -9,12 +9,20 @@ defmodule AshHq.Discord.Listener do
@user_id 1_066_406_803_769_933_834
@server_id 711_271_361_523_351_632
def start_link() do
def start_link do
Consumer.start_link(__MODULE__)
end
def search_results!(interaction) do
item_list = AshHq.Docs.Indexer.search!(search)
search =
interaction.data.options
|> Enum.find_value(fn option ->
if option.name == "search" do
option.value
end
end)
item_list = AshHq.Docs.Indexer.search(search)
item_list = Enum.take(item_list, 10)
@ -99,7 +107,7 @@ defmodule AshHq.Discord.Listener do
end
end
defp build_search_action() do
defp build_search_action do
command = %{
name: "ash_hq_search",
description: "Search AshHq Documentation",

View file

@ -1 +0,0 @@

View file

@ -1,61 +0,0 @@
defmodule AshHq.Docs.Search do
@moduledoc false
@search [
AshHq.Docs.Option,
AshHq.Docs.MixTask,
AshHq.Docs.Module,
AshHq.Docs.Function,
AshHq.Docs.Extension,
AshHq.Docs.LibraryVersion,
AshHq.Docs.Guide,
AshHq.Docs.Dsl
]
use Ash.Flow, otp_app: :ash_hq
flow do
api AshHq.Docs
description """
Runs a search over all searchable items.
"""
argument :query, :string do
allow_nil? false
constraints trim?: false, allow_empty?: true
end
argument :types, {:array, :string}
returns :build_results
end
steps do
map :search_results, @search do
custom :should_search, AshHq.Docs.Search.Steps.ShouldSearch do
input %{
resource: element(:search_results),
types: arg(:types)
}
end
branch :maybe_search, result(:should_search) do
output :search
read :search, element(:search_results), :search do
input %{
query: arg(:query)
}
end
end
end
custom :build_results, AshHq.Docs.Search.Steps.BuildResults do
input %{
results: result(:search_results),
query: arg(:query)
}
end
end
end

View file

@ -1,15 +0,0 @@
defmodule AshHq.Docs.Search.Steps.BuildResults do
@moduledoc """
Sorts the results of search.
"""
use Ash.Flow.Step
def run(input, _opts, _context) do
{:ok,
input[:results]
|> Kernel.||([])
|> List.flatten()
|> Enum.reject(&is_nil/1)
|> Enum.sort_by(&(-&1.match_rank))}
end
end

View file

@ -1,31 +0,0 @@
defmodule AshHq.Docs.Search.Steps.SearchResource do
@moduledoc """
Runs the search action of a given resource, or skips it if it should not be included in the results.
"""
use Ash.Flow.Step
def run(input, _opts, _context) do
resource = input[:resource]
types = input[:types]
library_versions = input[:library_versions]
query = input[:query]
if is_nil(types) || AshHq.Docs.Extensions.Search.type(resource) in types do
query =
resource
|> Ash.Query.for_read(:search, %{
library_versions: library_versions,
query: query
})
query.resource
|> AshHq.Docs.Extensions.RenderMarkdown.render_attributes()
|> Enum.reduce(query, fn {source, target}, query ->
Ash.Query.deselect(query, [source, target])
end)
|> AshHq.Docs.read()
else
{:ok, []}
end
end
end

View file

@ -1,13 +0,0 @@
defmodule AshHq.Docs.Search.Steps.ShouldSearch do
@moduledoc """
Determines if the type of the resource is in the types being searched
"""
use Ash.Flow.Step
def run(input, _opts, _context) do
resource = input[:resource]
types = input[:types]
{:ok, is_nil(types) || AshHq.Docs.Extensions.Search.type(resource) in types}
end
end

View file

@ -1,4 +1,5 @@
defmodule AshHq.Docs.Indexer do
@moduledoc "Indexes content and serves up a search interface"
use GenServer
require Ash.Query

View file

@ -27,10 +27,6 @@ defmodule AshHq.Release do
Application.fetch_env!(@app, :ecto_repos)
end
defp apis do
Application.fetch_env!(@app, :ash_apis)
end
defp load_app do
Application.load(@app)
end

View file

@ -1,4 +1,5 @@
defmodule AshHq.SqliteRepo do
@moduledoc "Ecto repo for interacting with Sqlite"
use AshSqlite.Repo,
otp_app: :ash_hq
end

View file

@ -68,7 +68,6 @@
"haystack": {:hex, :haystack, "0.1.0", "6cb9c72caf40ed4a5f9a094e6b09993c68c3fda0e01280c60c331a19860c504c", [:mix], [{:jason, "~> 1.4", [hex: :jason, repo: "hexpm", optional: false]}, {:stemmer, "~> 1.1", [hex: :stemmer, repo: "hexpm", optional: false]}], "hexpm", "27a582513ef933c1b11345b96f8d41ee137d03b25312bd85068ffe8fec503635"},
"hpax": {:hex, :hpax, "0.1.2", "09a75600d9d8bbd064cdd741f21fc06fc1f4cf3d0fcc335e5aa19be1a7235c84", [:mix], [], "hexpm", "2c87843d5a23f5f16748ebe77969880e29809580efdaccd615cd3bed628a8c13"},
"html_entities": {:hex, :html_entities, "0.5.2", "9e47e70598da7de2a9ff6af8758399251db6dbb7eebe2b013f2bbd2515895c3c", [:mix], [], "hexpm", "c53ba390403485615623b9531e97696f076ed415e8d8058b1dbaa28181f4fdcc"},
"httpoison": {:hex, :httpoison, "1.8.2", "9eb9c63ae289296a544842ef816a85d881d4a31f518a0fec089aaa744beae290", [:mix], [{:hackney, "~> 1.17", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm", "2bb350d26972e30c96e2ca74a1aaf8293d61d0742ff17f01e0279fef11599921"},
"idna": {:hex, :idna, "6.1.1", "8a63070e9f7d0c62eb9d9fcb360a7de382448200fbbd1b106cc96d3d8099df8d", [:rebar3], [{:unicode_util_compat, "~>0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "92376eb7894412ed19ac475e4a86f7b413c1b9fbb5bd16dccd57934157944cea"},
"jason": {:hex, :jason, "1.4.1", "af1504e35f629ddcdd6addb3513c3853991f694921b1b9368b0bd32beb9f1b63", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "fbb01ecdfd565b56261302f7e1fcc27c4fb8f32d56eab74db621fc154604a7a1"},
"joken": {:hex, :joken, "2.6.0", "b9dd9b6d52e3e6fcb6c65e151ad38bf4bc286382b5b6f97079c47ade6b1bcc6a", [:mix], [{:jose, "~> 1.11.5", [hex: :jose, repo: "hexpm", optional: false]}], "hexpm", "5a95b05a71cd0b54abd35378aeb1d487a23a52c324fa7efdffc512b655b5aaa7"},
@ -84,7 +83,6 @@
"makeup_html": {:hex, :makeup_html, "0.1.0", "b0228fda985e311d8f0d25bed58f8280826633a38d7448cabdd723e116165bcf", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "0ca44e7dcb8d933e010740324470dd8ec947243b51304bd34b8165ef3281edc2"},
"makeup_js": {:hex, :makeup_js, "0.1.0", "ffa8ce9db95d14dcd09045334539d5992d540d63598c592d4805b7674bdd6675", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "3f0c1a5eb52c9737b1679c926574e83bb260ccdedf08b58ee96cca7c685dea75"},
"makeup_sql": {:hex, :makeup_sql, "0.1.0", "197a8a0a38e83885f73767530739bb8f990aecf7fd1597d3141608c14f5f233e", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.1", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "556e23ff88ad2fb8c44e393467cfba0c4f980cbe90316deaf48a1362f58cd118"},
"meilisearch": {:hex, :meilisearch, "0.20.0", "3606a7dc9c51b8e7d890761a9614dd56812da8bfcbf4e86934ae42233b257b18", [:mix], [{:httpoison, "~> 1.8", [hex: :httpoison, repo: "hexpm", optional: false]}, {:jason, "~> 1.2", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "50faca2a72128bc93e6771bc66dadc347357c0a2d619e743e620ce131c7798fd"},
"metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [:rebar3], [], "hexpm", "69b09adddc4f74a40716ae54d140f93beb0fb8978d8636eaded0c31b6f099f16"},
"mime": {:hex, :mime, "2.0.5", "dc34c8efd439abe6ae0343edbb8556f4d63f178594894720607772a041b04b02", [:mix], [], "hexpm", "da0d64a365c45bc9935cc5c8a7fc5e49a0e0f9932a761c55d6c52b142780a05c"},
"mimerl": {:hex, :mimerl, "1.2.0", "67e2d3f571088d5cfd3e550c383094b47159f3eee8ffa08e64106cdf5e981be3", [:rebar3], [], "hexpm", "f278585650aa581986264638ebf698f8bb19df297f66ad91b18910dfc6e19323"},

View file

@ -0,0 +1,21 @@
defmodule AshHq.Repo.Migrations.MigrateResources59 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
remove(:ashley_access)
end
end
def down do
alter table(:users) do
add(:ashley_access, :boolean, default: false)
end
end
end

View file

@ -0,0 +1,128 @@
{
"attributes": [
{
"default": "nil",
"size": null,
"type": "utc_datetime_usec",
"source": "confirmed_at",
"references": null,
"primary_key?": false,
"allow_nil?": true,
"generated?": false
},
{
"default": "fragment(\"uuid_generate_v4()\")",
"size": null,
"type": "uuid",
"source": "id",
"references": null,
"primary_key?": true,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "citext",
"source": "email",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "text",
"source": "hashed_password",
"references": null,
"primary_key?": false,
"allow_nil?": true,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "text",
"source": "encrypted_name",
"references": null,
"primary_key?": false,
"allow_nil?": true,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "text",
"source": "encrypted_address",
"references": null,
"primary_key?": false,
"allow_nil?": true,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "text",
"source": "shirt_size",
"references": null,
"primary_key?": false,
"allow_nil?": true,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "map",
"source": "github_info",
"references": null,
"primary_key?": false,
"allow_nil?": true,
"generated?": false
},
{
"default": "fragment(\"now()\")",
"size": null,
"type": "utc_datetime_usec",
"source": "created_at",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
},
{
"default": "fragment(\"now()\")",
"size": null,
"type": "utc_datetime_usec",
"source": "updated_at",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
}
],
"table": "users",
"hash": "73825998BF52DC0D54C385CAD698898654F4564DB62682D46AADA399AFACFE8E",
"repo": "Elixir.AshHq.Repo",
"multitenancy": {
"global": null,
"attribute": null,
"strategy": null
},
"base_filter": null,
"schema": null,
"identities": [
{
"name": "unique_email",
"keys": [
"email"
],
"index_name": "users_unique_email_index",
"base_filter": null
}
],
"custom_indexes": [],
"custom_statements": [],
"has_create_action": true,
"check_constraints": []
}

View file

@ -0,0 +1,277 @@
{
"attributes": [
{
"default": "nil",
"size": null,
"type": "text",
"source": "sanitized_path",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "uuid",
"source": "id",
"references": null,
"primary_key?": true,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "text",
"source": "name",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "text",
"source": "requires_extension",
"references": null,
"primary_key?": false,
"allow_nil?": true,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "text",
"source": "doc",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "text",
"source": "doc_html",
"references": null,
"primary_key?": false,
"allow_nil?": true,
"generated?": false
},
{
"default": "[]",
"size": null,
"type": [
"array",
"text"
],
"source": "imports",
"references": null,
"primary_key?": false,
"allow_nil?": true,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": [
"array",
"text"
],
"source": "examples",
"references": null,
"primary_key?": false,
"allow_nil?": true,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": [
"array",
"text"
],
"source": "args",
"references": null,
"primary_key?": false,
"allow_nil?": true,
"generated?": false
},
{
"default": "[]",
"size": null,
"type": [
"array",
"text"
],
"source": "optional_args",
"references": null,
"primary_key?": false,
"allow_nil?": true,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "map",
"source": "arg_defaults",
"references": null,
"primary_key?": false,
"allow_nil?": true,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": [
"array",
"text"
],
"source": "path",
"references": null,
"primary_key?": false,
"allow_nil?": true,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "text",
"source": "recursive_as",
"references": null,
"primary_key?": false,
"allow_nil?": true,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "bigint",
"source": "order",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "text",
"source": "type",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "utc_datetime_usec",
"source": "inserted_at",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "utc_datetime_usec",
"source": "updated_at",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "uuid",
"source": "library_version_id",
"references": {
"name": "dsls_library_version_id_fkey",
"table": "library_versions",
"multitenancy": {
"global": null,
"attribute": null,
"strategy": null
},
"on_delete": "delete",
"on_update": null,
"deferrable": false,
"destination_attribute": "id",
"primary_key?": true,
"destination_attribute_default": null,
"destination_attribute_generated": null
},
"primary_key?": false,
"allow_nil?": true,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "uuid",
"source": "extension_id",
"references": {
"name": "dsls_extension_id_fkey",
"table": "extensions",
"multitenancy": {
"global": null,
"attribute": null,
"strategy": null
},
"on_delete": null,
"on_update": null,
"deferrable": false,
"destination_attribute": "id",
"primary_key?": true,
"destination_attribute_default": null,
"destination_attribute_generated": null
},
"primary_key?": false,
"allow_nil?": true,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "uuid",
"source": "dsl_id",
"references": {
"name": "dsls_dsl_id_fkey",
"table": "dsls",
"multitenancy": {
"global": null,
"attribute": null,
"strategy": null
},
"on_delete": "delete",
"on_update": null,
"deferrable": false,
"destination_attribute": "id",
"primary_key?": true,
"destination_attribute_default": null,
"destination_attribute_generated": null
},
"primary_key?": false,
"allow_nil?": true,
"generated?": false
}
],
"table": "dsls",
"hash": "48AE588FFC6527FCB577BAF5BED1D2BC77DDFB5F77DDE0530068B2C551A0D8DE",
"repo": "Elixir.AshHq.SqliteRepo",
"multitenancy": {
"global": null,
"attribute": null,
"strategy": null
},
"base_filter": null,
"identities": [],
"custom_indexes": [],
"custom_statements": [],
"has_create_action": true
}

View file

@ -0,0 +1,172 @@
{
"attributes": [
{
"default": "nil",
"size": null,
"type": "text",
"source": "sanitized_name",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "uuid",
"source": "id",
"references": null,
"primary_key?": true,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "text",
"source": "name",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "text",
"source": "target",
"references": null,
"primary_key?": false,
"allow_nil?": true,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "boolean",
"source": "default_for_target",
"references": null,
"primary_key?": false,
"allow_nil?": true,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "text",
"source": "doc",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "text",
"source": "doc_html",
"references": null,
"primary_key?": false,
"allow_nil?": true,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "text",
"source": "type",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "bigint",
"source": "order",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "text",
"source": "module",
"references": null,
"primary_key?": false,
"allow_nil?": true,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "utc_datetime_usec",
"source": "inserted_at",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "utc_datetime_usec",
"source": "updated_at",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "uuid",
"source": "library_version_id",
"references": {
"name": "extensions_library_version_id_fkey",
"table": "library_versions",
"multitenancy": {
"global": null,
"attribute": null,
"strategy": null
},
"on_delete": "delete",
"on_update": null,
"deferrable": false,
"destination_attribute": "id",
"primary_key?": true,
"destination_attribute_default": null,
"destination_attribute_generated": null
},
"primary_key?": false,
"allow_nil?": true,
"generated?": false
}
],
"table": "extensions",
"hash": "B7E48389399B495B626A3B5DA3BD8DFB84020D6110AFC74C98282963D47532E1",
"repo": "Elixir.AshHq.SqliteRepo",
"multitenancy": {
"global": null,
"attribute": null,
"strategy": null
},
"base_filter": null,
"identities": [
{
"name": "unique_name_by_library_version",
"keys": [
"name",
"library_version_id"
],
"index_name": "extensions_unique_name_by_library_version_index",
"base_filter": null
}
],
"custom_indexes": [],
"custom_statements": [],
"has_create_action": true
}

View file

@ -0,0 +1,223 @@
{
"attributes": [
{
"default": "nil",
"size": null,
"type": "text",
"source": "sanitized_name",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "uuid",
"source": "id",
"references": null,
"primary_key?": true,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "text",
"source": "name",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "text",
"source": "file",
"references": null,
"primary_key?": false,
"allow_nil?": true,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "bigint",
"source": "line",
"references": null,
"primary_key?": false,
"allow_nil?": true,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "bigint",
"source": "arity",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "text",
"source": "type",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
},
{
"default": "[]",
"size": null,
"type": [
"array",
"text"
],
"source": "heads",
"references": null,
"primary_key?": false,
"allow_nil?": true,
"generated?": false
},
{
"default": "[]",
"size": null,
"type": [
"array",
"text"
],
"source": "heads_html",
"references": null,
"primary_key?": false,
"allow_nil?": true,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "text",
"source": "doc",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "text",
"source": "doc_html",
"references": null,
"primary_key?": false,
"allow_nil?": true,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "bigint",
"source": "order",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "text",
"source": "deprecated",
"references": null,
"primary_key?": false,
"allow_nil?": true,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "utc_datetime_usec",
"source": "inserted_at",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "utc_datetime_usec",
"source": "updated_at",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "uuid",
"source": "library_version_id",
"references": {
"name": "functions_library_version_id_fkey",
"table": "library_versions",
"multitenancy": {
"global": null,
"attribute": null,
"strategy": null
},
"on_delete": "delete",
"on_update": null,
"deferrable": false,
"destination_attribute": "id",
"primary_key?": true,
"destination_attribute_default": null,
"destination_attribute_generated": null
},
"primary_key?": false,
"allow_nil?": true,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "uuid",
"source": "module_id",
"references": {
"name": "functions_module_id_fkey",
"table": "modules",
"multitenancy": {
"global": null,
"attribute": null,
"strategy": null
},
"on_delete": null,
"on_update": null,
"deferrable": false,
"destination_attribute": "id",
"primary_key?": true,
"destination_attribute_default": null,
"destination_attribute_generated": null
},
"primary_key?": false,
"allow_nil?": true,
"generated?": false
}
],
"table": "functions",
"hash": "19BEF85ED8D07D786EB4686B1920B0532A09E604A80F436BDFC314DF9DF87E1A",
"repo": "Elixir.AshHq.SqliteRepo",
"multitenancy": {
"global": null,
"attribute": null,
"strategy": null
},
"base_filter": null,
"identities": [],
"custom_indexes": [],
"custom_statements": [],
"has_create_action": true
}

View file

@ -0,0 +1,162 @@
{
"attributes": [
{
"default": "nil",
"size": null,
"type": "text",
"source": "sanitized_name",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "uuid",
"source": "id",
"references": null,
"primary_key?": true,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "bigint",
"source": "order",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "text",
"source": "name",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "text",
"source": "text",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "text",
"source": "text_html",
"references": null,
"primary_key?": false,
"allow_nil?": true,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "text",
"source": "category",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "text",
"source": "route",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "text",
"source": "sanitized_route",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "boolean",
"source": "default",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "utc_datetime_usec",
"source": "inserted_at",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "utc_datetime_usec",
"source": "updated_at",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "uuid",
"source": "library_version_id",
"references": {
"name": "guides_library_version_id_fkey",
"table": "library_versions",
"multitenancy": {
"global": null,
"attribute": null,
"strategy": null
},
"on_delete": "delete",
"on_update": null,
"deferrable": false,
"destination_attribute": "id",
"primary_key?": true,
"destination_attribute_default": null,
"destination_attribute_generated": null
},
"primary_key?": false,
"allow_nil?": true,
"generated?": false
}
],
"table": "guides",
"hash": "D1E405AB450572FE202B233DF061DD74A52A4512692A321CDF57BF22736B6D7B",
"repo": "Elixir.AshHq.SqliteRepo",
"multitenancy": {
"global": null,
"attribute": null,
"strategy": null
},
"base_filter": null,
"identities": [],
"custom_indexes": [],
"custom_statements": [],
"has_create_action": true
}

View file

@ -0,0 +1,150 @@
{
"attributes": [
{
"default": "nil",
"size": null,
"type": "uuid",
"source": "id",
"references": null,
"primary_key?": true,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "text",
"source": "name",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "text",
"source": "display_name",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "bigint",
"source": "order",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "text",
"source": "description",
"references": null,
"primary_key?": false,
"allow_nil?": true,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "text",
"source": "repo_org",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
},
{
"default": "[]",
"size": null,
"type": [
"array",
"text"
],
"source": "module_prefixes",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "text",
"source": "mix_project",
"references": null,
"primary_key?": false,
"allow_nil?": true,
"generated?": false
},
{
"default": "[]",
"size": null,
"type": [
"array",
"text"
],
"source": "skip_versions",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "utc_datetime_usec",
"source": "inserted_at",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "utc_datetime_usec",
"source": "updated_at",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
}
],
"table": "libraries",
"hash": "E15F5D47277F5D12F1F2B4F5FC7F3E94B76D5423833044A6D18FD34FF6B2382A",
"repo": "Elixir.AshHq.SqliteRepo",
"multitenancy": {
"global": null,
"attribute": null,
"strategy": null
},
"base_filter": null,
"identities": [
{
"name": "unique_name",
"keys": [
"name"
],
"index_name": "libraries_unique_name_index",
"base_filter": null
},
{
"name": "unique_order",
"keys": [
"order"
],
"index_name": "libraries_unique_order_index",
"base_filter": null
}
],
"custom_indexes": [],
"custom_statements": [],
"has_create_action": true
}

View file

@ -0,0 +1,112 @@
{
"attributes": [
{
"default": "nil",
"size": null,
"type": "text",
"source": "sanitized_version",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "uuid",
"source": "id",
"references": null,
"primary_key?": true,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "text",
"source": "version",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "boolean",
"source": "hydrated",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "utc_datetime_usec",
"source": "inserted_at",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "utc_datetime_usec",
"source": "updated_at",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "uuid",
"source": "library_id",
"references": {
"name": "library_versions_library_id_fkey",
"table": "libraries",
"multitenancy": {
"global": null,
"attribute": null,
"strategy": null
},
"on_delete": null,
"on_update": null,
"deferrable": false,
"destination_attribute": "id",
"primary_key?": true,
"destination_attribute_default": null,
"destination_attribute_generated": null
},
"primary_key?": false,
"allow_nil?": true,
"generated?": false
}
],
"table": "library_versions",
"hash": "9D3B7DCCFD6D9DBE0CA3B5D44A9BD06741EDEBC133CFD67D979D50A248C3488D",
"repo": "Elixir.AshHq.SqliteRepo",
"multitenancy": {
"global": null,
"attribute": null,
"strategy": null
},
"base_filter": null,
"identities": [
{
"name": "unique_version_for_library",
"keys": [
"version",
"library_id"
],
"index_name": "library_versions_unique_version_for_library_index",
"base_filter": null
}
],
"custom_indexes": [],
"custom_statements": [],
"has_create_action": true
}

View file

@ -0,0 +1,152 @@
{
"attributes": [
{
"default": "nil",
"size": null,
"type": "text",
"source": "sanitized_name",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "uuid",
"source": "id",
"references": null,
"primary_key?": true,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "text",
"source": "name",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "text",
"source": "category",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "text",
"source": "file",
"references": null,
"primary_key?": false,
"allow_nil?": true,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "text",
"source": "module_name",
"references": null,
"primary_key?": false,
"allow_nil?": true,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "text",
"source": "doc",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "text",
"source": "doc_html",
"references": null,
"primary_key?": false,
"allow_nil?": true,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "bigint",
"source": "order",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "utc_datetime_usec",
"source": "inserted_at",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "utc_datetime_usec",
"source": "updated_at",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "uuid",
"source": "library_version_id",
"references": {
"name": "mix_tasks_library_version_id_fkey",
"table": "library_versions",
"multitenancy": {
"global": null,
"attribute": null,
"strategy": null
},
"on_delete": "delete",
"on_update": null,
"deferrable": false,
"destination_attribute": "id",
"primary_key?": true,
"destination_attribute_default": null,
"destination_attribute_generated": null
},
"primary_key?": false,
"allow_nil?": true,
"generated?": false
}
],
"table": "mix_tasks",
"hash": "B015AAFD4B61EA96B5305765B2F485F68013A330169D84AA079BBC20BAABA29C",
"repo": "Elixir.AshHq.SqliteRepo",
"multitenancy": {
"global": null,
"attribute": null,
"strategy": null
},
"base_filter": null,
"identities": [],
"custom_indexes": [],
"custom_statements": [],
"has_create_action": true
}

View file

@ -0,0 +1,142 @@
{
"attributes": [
{
"default": "nil",
"size": null,
"type": "text",
"source": "sanitized_name",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "uuid",
"source": "id",
"references": null,
"primary_key?": true,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "text",
"source": "name",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "text",
"source": "category",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "text",
"source": "file",
"references": null,
"primary_key?": false,
"allow_nil?": true,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "text",
"source": "doc",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "text",
"source": "doc_html",
"references": null,
"primary_key?": false,
"allow_nil?": true,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "bigint",
"source": "order",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "utc_datetime_usec",
"source": "inserted_at",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "utc_datetime_usec",
"source": "updated_at",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "uuid",
"source": "library_version_id",
"references": {
"name": "modules_library_version_id_fkey",
"table": "library_versions",
"multitenancy": {
"global": null,
"attribute": null,
"strategy": null
},
"on_delete": "delete",
"on_update": null,
"deferrable": false,
"destination_attribute": "id",
"primary_key?": true,
"destination_attribute_default": null,
"destination_attribute_generated": null
},
"primary_key?": false,
"allow_nil?": true,
"generated?": false
}
],
"table": "modules",
"hash": "309E8CCA77F8E197373E7B87C09BF24DD1FC3E7E8C5ED8553E4899A5E7688399",
"repo": "Elixir.AshHq.SqliteRepo",
"multitenancy": {
"global": null,
"attribute": null,
"strategy": null
},
"base_filter": null,
"identities": [],
"custom_indexes": [],
"custom_statements": [],
"has_create_action": true
}

View file

@ -0,0 +1,235 @@
{
"attributes": [
{
"default": "nil",
"size": null,
"type": "text",
"source": "sanitized_path",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "uuid",
"source": "id",
"references": null,
"primary_key?": true,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "text",
"source": "name",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "text",
"source": "type",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "text",
"source": "doc",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "text",
"source": "doc_html",
"references": null,
"primary_key?": false,
"allow_nil?": true,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "boolean",
"source": "required",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "bigint",
"source": "argument_index",
"references": null,
"primary_key?": false,
"allow_nil?": true,
"generated?": false
},
{
"default": "%{}",
"size": null,
"type": "map",
"source": "links",
"references": null,
"primary_key?": false,
"allow_nil?": true,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "text",
"source": "default",
"references": null,
"primary_key?": false,
"allow_nil?": true,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": [
"array",
"text"
],
"source": "path",
"references": null,
"primary_key?": false,
"allow_nil?": true,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "bigint",
"source": "order",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "utc_datetime_usec",
"source": "inserted_at",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "utc_datetime_usec",
"source": "updated_at",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "uuid",
"source": "dsl_id",
"references": {
"name": "options_dsl_id_fkey",
"table": "dsls",
"multitenancy": {
"global": null,
"attribute": null,
"strategy": null
},
"on_delete": "delete",
"on_update": null,
"deferrable": false,
"destination_attribute": "id",
"primary_key?": true,
"destination_attribute_default": null,
"destination_attribute_generated": null
},
"primary_key?": false,
"allow_nil?": true,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "uuid",
"source": "library_version_id",
"references": {
"name": "options_library_version_id_fkey",
"table": "library_versions",
"multitenancy": {
"global": null,
"attribute": null,
"strategy": null
},
"on_delete": "delete",
"on_update": null,
"deferrable": false,
"destination_attribute": "id",
"primary_key?": true,
"destination_attribute_default": null,
"destination_attribute_generated": null
},
"primary_key?": false,
"allow_nil?": true,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "uuid",
"source": "extension_id",
"references": {
"name": "options_extension_id_fkey",
"table": "extensions",
"multitenancy": {
"global": null,
"attribute": null,
"strategy": null
},
"on_delete": null,
"on_update": null,
"deferrable": false,
"destination_attribute": "id",
"primary_key?": true,
"destination_attribute_default": null,
"destination_attribute_generated": null
},
"primary_key?": false,
"allow_nil?": true,
"generated?": false
}
],
"table": "options",
"hash": "72E5DAC306E485BE95931E83762B6BE8F7E6C2220AA3444803504ABF1ADA6E8D",
"repo": "Elixir.AshHq.SqliteRepo",
"multitenancy": {
"global": null,
"attribute": null,
"strategy": null
},
"base_filter": null,
"identities": [],
"custom_indexes": [],
"custom_statements": [],
"has_create_action": true
}

View file

@ -0,0 +1,97 @@
defmodule AshHq.SqliteRepo.Migrations.MigrateResources2 do
@moduledoc """
Updates resources based on their most recent snapshots.
This file was autogenerated with `mix ash_sqlite.generate_migrations`
"""
use Ecto.Migration
def up do
alter table(:options) do
modify :required, :boolean, default: nil
modify :doc, :text, default: nil
end
alter table(:modules) do
modify :doc, :text, default: nil
modify :category, :text, default: nil
end
alter table(:mix_tasks) do
modify :doc, :text, default: nil
modify :category, :text, default: nil
end
alter table(:library_versions) do
modify :hydrated, :boolean, default: nil
end
alter table(:libraries) do
modify :repo_org, :text, default: nil
end
alter table(:guides) do
modify :default, :boolean, default: nil
modify :category, :text, default: nil
modify :text, :text, default: nil
end
alter table(:functions) do
modify :doc, :text, default: nil
end
alter table(:extensions) do
modify :doc, :text, default: nil
modify :default_for_target, :boolean, default: nil
end
alter table(:dsls) do
modify :doc, :text, default: nil
end
end
def down do
alter table(:dsls) do
modify :doc, :text, default: ""
end
alter table(:extensions) do
modify :default_for_target, :boolean, default: false
modify :doc, :text, default: ""
end
alter table(:functions) do
modify :doc, :text, default: ""
end
alter table(:guides) do
modify :text, :text, default: ""
modify :category, :text, default: "Topics"
modify :default, :boolean, default: false
end
alter table(:libraries) do
modify :repo_org, :text, default: "ash-project"
end
alter table(:library_versions) do
modify :hydrated, :boolean, default: false
end
alter table(:mix_tasks) do
modify :category, :text, default: "Misc"
modify :doc, :text, default: ""
end
alter table(:modules) do
modify :category, :text, default: "Misc"
modify :doc, :text, default: ""
end
alter table(:options) do
modify :doc, :text, default: ""
modify :required, :boolean, default: false
end
end
end