This commit is contained in:
parent
1037f37be2
commit
334d841d57
@ -1,5 +1,6 @@
|
|||||||
# v0.9.3
|
# v0.9.3
|
||||||
- Update dependencies
|
- Update dependencies
|
||||||
|
- Add pack lot number to search
|
||||||
|
|
||||||
# v0.9.2
|
# v0.9.2
|
||||||
- Add lot number to packs
|
- Add lot number to packs
|
||||||
|
@ -0,0 +1,34 @@
|
|||||||
|
defmodule Cannery.Repo.Migrations.AddPackLotNumberToSearch do
|
||||||
|
use Ecto.Migration
|
||||||
|
|
||||||
|
def up do
|
||||||
|
execute "ALTER TABLE packs DROP COLUMN search"
|
||||||
|
|
||||||
|
execute """
|
||||||
|
ALTER TABLE packs
|
||||||
|
ADD COLUMN search tsvector
|
||||||
|
GENERATED ALWAYS AS (
|
||||||
|
setweight(to_tsvector('english', coalesce("notes", '')), 'A') ||
|
||||||
|
setweight(to_tsvector('english', coalesce("lot_number", '')), 'A') ||
|
||||||
|
setweight(to_tsvector('english', immutable_to_string("price_paid", '')), 'B') ||
|
||||||
|
setweight(to_tsvector('english', immutable_to_string("purchased_on", '')), 'B') ||
|
||||||
|
setweight(to_tsvector('english', immutable_to_string("count", '')), 'C')
|
||||||
|
) STORED
|
||||||
|
"""
|
||||||
|
end
|
||||||
|
|
||||||
|
def down do
|
||||||
|
execute "ALTER TABLE packs DROP COLUMN search"
|
||||||
|
|
||||||
|
execute """
|
||||||
|
ALTER TABLE packs
|
||||||
|
ADD COLUMN search tsvector
|
||||||
|
GENERATED ALWAYS AS (
|
||||||
|
setweight(to_tsvector('english', coalesce("notes", '')), 'A') ||
|
||||||
|
setweight(to_tsvector('english', immutable_to_string("price_paid", '')), 'B') ||
|
||||||
|
setweight(to_tsvector('english', immutable_to_string("purchased_on", '')), 'B') ||
|
||||||
|
setweight(to_tsvector('english', immutable_to_string("count", '')), 'C')
|
||||||
|
) STORED
|
||||||
|
"""
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue
Block a user