2023-02-02 05:08:40 +13:00
|
|
|
defmodule AshHq.Repo.Migrations.MigrateResources46 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
|
|
|
|
execute("""
|
|
|
|
ALTER TABLE discord_messages
|
|
|
|
DROP COLUMN searchable
|
|
|
|
""")
|
|
|
|
|
|
|
|
execute("""
|
|
|
|
ALTER TABLE dsls
|
|
|
|
DROP COLUMN searchable
|
|
|
|
""")
|
|
|
|
|
|
|
|
execute("""
|
|
|
|
ALTER TABLE extensions
|
|
|
|
DROP COLUMN searchable
|
|
|
|
""")
|
|
|
|
|
|
|
|
execute("""
|
|
|
|
ALTER TABLE functions
|
|
|
|
DROP COLUMN searchable
|
|
|
|
""")
|
|
|
|
|
|
|
|
execute("""
|
|
|
|
ALTER TABLE guides
|
|
|
|
DROP COLUMN searchable
|
|
|
|
""")
|
|
|
|
|
|
|
|
execute("""
|
|
|
|
ALTER TABLE mix_tasks
|
|
|
|
DROP COLUMN searchable
|
|
|
|
""")
|
|
|
|
|
|
|
|
execute("""
|
|
|
|
ALTER TABLE modules
|
|
|
|
DROP COLUMN searchable
|
|
|
|
""")
|
|
|
|
|
|
|
|
execute("""
|
|
|
|
ALTER TABLE options
|
|
|
|
DROP COLUMN searchable
|
|
|
|
""")
|
|
|
|
|
|
|
|
execute("""
|
|
|
|
ALTER TABLE discord_messages
|
|
|
|
ADD COLUMN searchable tsvector
|
|
|
|
GENERATED ALWAYS AS (
|
|
|
|
setweight(to_tsvector('english', content), 'D')
|
|
|
|
) STORED;
|
|
|
|
""")
|
|
|
|
|
|
|
|
execute("""
|
|
|
|
ALTER TABLE dsls
|
|
|
|
ADD COLUMN searchable tsvector
|
|
|
|
GENERATED ALWAYS AS (
|
|
|
|
setweight(to_tsvector('english', name), 'A') ||
|
|
|
|
setweight(to_tsvector('english', doc), 'D')
|
|
|
|
) STORED;
|
|
|
|
""")
|
|
|
|
|
|
|
|
execute("""
|
|
|
|
ALTER TABLE extensions
|
|
|
|
ADD COLUMN searchable tsvector
|
|
|
|
GENERATED ALWAYS AS (
|
|
|
|
setweight(to_tsvector('english', name), 'A') ||
|
|
|
|
setweight(to_tsvector('english', doc), 'D')
|
|
|
|
) STORED;
|
|
|
|
""")
|
|
|
|
|
|
|
|
execute("""
|
|
|
|
ALTER TABLE functions
|
|
|
|
ADD COLUMN searchable tsvector
|
|
|
|
GENERATED ALWAYS AS (
|
|
|
|
setweight(to_tsvector('english', name), 'A') ||
|
|
|
|
setweight(to_tsvector('english', doc), 'D')
|
|
|
|
) STORED;
|
|
|
|
""")
|
|
|
|
|
|
|
|
execute("""
|
|
|
|
ALTER TABLE guides
|
|
|
|
ADD COLUMN searchable tsvector
|
|
|
|
GENERATED ALWAYS AS (
|
|
|
|
setweight(to_tsvector('english', name), 'A') ||
|
|
|
|
setweight(to_tsvector('english', text), 'D')
|
|
|
|
) STORED;
|
|
|
|
""")
|
|
|
|
|
|
|
|
execute("""
|
|
|
|
ALTER TABLE mix_tasks
|
|
|
|
ADD COLUMN searchable tsvector
|
|
|
|
GENERATED ALWAYS AS (
|
|
|
|
setweight(to_tsvector('english', name), 'A') ||
|
|
|
|
setweight(to_tsvector('english', doc), 'D')
|
|
|
|
) STORED;
|
|
|
|
""")
|
|
|
|
|
|
|
|
execute("""
|
|
|
|
ALTER TABLE modules
|
|
|
|
ADD COLUMN searchable tsvector
|
|
|
|
GENERATED ALWAYS AS (
|
|
|
|
setweight(to_tsvector('english', name), 'A') ||
|
|
|
|
setweight(to_tsvector('english', doc), 'D')
|
|
|
|
) STORED;
|
|
|
|
""")
|
|
|
|
|
|
|
|
execute("""
|
|
|
|
ALTER TABLE options
|
|
|
|
ADD COLUMN searchable tsvector
|
|
|
|
GENERATED ALWAYS AS (
|
|
|
|
setweight(to_tsvector('english', name), 'A') ||
|
|
|
|
setweight(to_tsvector('english', doc), 'D')
|
|
|
|
) STORED;
|
|
|
|
""")
|
|
|
|
end
|
|
|
|
|
|
|
|
def down do
|
|
|
|
execute("""
|
|
|
|
ALTER TABLE options
|
|
|
|
DROP COLUMN searchable
|
|
|
|
""")
|
|
|
|
|
|
|
|
execute("""
|
|
|
|
ALTER TABLE modules
|
|
|
|
DROP COLUMN searchable
|
|
|
|
""")
|
|
|
|
|
|
|
|
execute("""
|
|
|
|
ALTER TABLE mix_tasks
|
|
|
|
DROP COLUMN searchable
|
|
|
|
""")
|
|
|
|
|
|
|
|
execute("""
|
|
|
|
ALTER TABLE guides
|
|
|
|
DROP COLUMN searchable
|
|
|
|
""")
|
|
|
|
|
|
|
|
execute("""
|
|
|
|
ALTER TABLE functions
|
|
|
|
DROP COLUMN searchable
|
|
|
|
""")
|
|
|
|
|
|
|
|
execute("""
|
|
|
|
ALTER TABLE extensions
|
|
|
|
DROP COLUMN searchable
|
|
|
|
""")
|
|
|
|
|
|
|
|
execute("""
|
|
|
|
ALTER TABLE dsls
|
|
|
|
DROP COLUMN searchable
|
|
|
|
""")
|
|
|
|
|
|
|
|
execute("""
|
|
|
|
ALTER TABLE discord_messages
|
|
|
|
DROP COLUMN searchable
|
|
|
|
""")
|
|
|
|
|
|
|
|
execute("""
|
|
|
|
ALTER TABLE options
|
|
|
|
ADD COLUMN searchable tsvector
|
|
|
|
GENERATED ALWAYS AS (
|
|
|
|
setweight(to_tsvector('english', name), 'A') ||
|
|
|
|
setweight(to_tsvector('english', doc), 'B')
|
|
|
|
) STORED;
|
|
|
|
""")
|
|
|
|
|
|
|
|
execute("""
|
|
|
|
ALTER TABLE modules
|
|
|
|
ADD COLUMN searchable tsvector
|
|
|
|
GENERATED ALWAYS AS (
|
|
|
|
setweight(to_tsvector('english', name), 'A') ||
|
|
|
|
setweight(to_tsvector('english', doc), 'B')
|
|
|
|
) STORED;
|
|
|
|
""")
|
|
|
|
|
|
|
|
execute("""
|
|
|
|
ALTER TABLE mix_tasks
|
|
|
|
ADD COLUMN searchable tsvector
|
|
|
|
GENERATED ALWAYS AS (
|
|
|
|
setweight(to_tsvector('english', name), 'A') ||
|
|
|
|
setweight(to_tsvector('english', doc), 'B')
|
|
|
|
) STORED;
|
|
|
|
""")
|
|
|
|
|
|
|
|
execute("""
|
|
|
|
ALTER TABLE guides
|
|
|
|
ADD COLUMN searchable tsvector
|
|
|
|
GENERATED ALWAYS AS (
|
|
|
|
setweight(to_tsvector('english', name), 'A') ||
|
|
|
|
setweight(to_tsvector('english', text), 'B')
|
|
|
|
) STORED;
|
|
|
|
""")
|
|
|
|
|
|
|
|
execute("""
|
|
|
|
ALTER TABLE functions
|
|
|
|
ADD COLUMN searchable tsvector
|
|
|
|
GENERATED ALWAYS AS (
|
|
|
|
setweight(to_tsvector('english', name), 'A') ||
|
|
|
|
setweight(to_tsvector('english', doc), 'B')
|
|
|
|
) STORED;
|
|
|
|
""")
|
|
|
|
|
|
|
|
execute("""
|
|
|
|
ALTER TABLE extensions
|
|
|
|
ADD COLUMN searchable tsvector
|
|
|
|
GENERATED ALWAYS AS (
|
|
|
|
setweight(to_tsvector('english', name), 'A') ||
|
|
|
|
setweight(to_tsvector('english', doc), 'B')
|
|
|
|
) STORED;
|
|
|
|
""")
|
|
|
|
|
|
|
|
execute("""
|
|
|
|
ALTER TABLE dsls
|
|
|
|
ADD COLUMN searchable tsvector
|
|
|
|
GENERATED ALWAYS AS (
|
|
|
|
setweight(to_tsvector('english', name), 'A') ||
|
|
|
|
setweight(to_tsvector('english', doc), 'B')
|
|
|
|
) STORED;
|
|
|
|
""")
|
|
|
|
|
|
|
|
execute("""
|
|
|
|
ALTER TABLE discord_messages
|
|
|
|
ADD COLUMN searchable tsvector
|
|
|
|
GENERATED ALWAYS AS (
|
|
|
|
setweight(to_tsvector('english', content), 'A')
|
|
|
|
) STORED;
|
|
|
|
""")
|
|
|
|
end
|
2023-02-02 15:21:50 +13:00
|
|
|
end
|