mirror of https://github.com/buster-so/buster.git
seed
This commit is contained in:
parent
f12e524b82
commit
7c4be7883c
File diff suppressed because one or more lines are too long
|
@ -0,0 +1 @@
|
||||||
|
select vault.create_secret('cc3ef3bc-44ec-4a43-8dc4-681cae5c996a', '{"type":"postgres","host":"aws-0-us-east-1.pooler.supabase.com","port":5432,"username":"postgres.fjbidcbjvmpesoonimhl","password":"S8Jrts05EqxsfA3q","database":"postgres","schema":"sem","jump_host":null,"ssh_username":null,"ssh_private_key":null}')
|
|
@ -115,7 +115,7 @@ pub async fn create_collection_handler(
|
||||||
};
|
};
|
||||||
|
|
||||||
let query = diesel::sql_query(
|
let query = diesel::sql_query(
|
||||||
"INSERT INTO asset_search (asset_id, asset_type, content, organization_id)
|
"insert into public.asset_search (asset_id, asset_type, content, organization_id)
|
||||||
VALUES ($1, 'collection', $2, $3)
|
VALUES ($1, 'collection', $2, $3)
|
||||||
ON CONFLICT (asset_id, asset_type)
|
ON CONFLICT (asset_id, asset_type)
|
||||||
DO UPDATE SET
|
DO UPDATE SET
|
||||||
|
|
|
@ -4,6 +4,7 @@ dev:
|
||||||
supabase db reset
|
supabase db reset
|
||||||
export DATABASE_URL=postgres://postgres:postgres@127.0.0.1:54322/postgres && \
|
export DATABASE_URL=postgres://postgres:postgres@127.0.0.1:54322/postgres && \
|
||||||
diesel migration run && \
|
diesel migration run && \
|
||||||
|
PGPASSWORD=postgres psql -h 127.0.0.1 -p 54322 -d postgres -U postgres -f libs/database/setup.sql && \
|
||||||
PGPASSWORD=postgres psql -h 127.0.0.1 -p 54322 -d postgres -U postgres -f libs/database/seed.sql && \
|
PGPASSWORD=postgres psql -h 127.0.0.1 -p 54322 -d postgres -U postgres -f libs/database/seed.sql && \
|
||||||
export RUST_LOG=debug
|
export RUST_LOG=debug
|
||||||
export CARGO_INCREMENTAL=1
|
export CARGO_INCREMENTAL=1
|
||||||
|
|
|
@ -3,7 +3,7 @@ CREATE OR REPLACE FUNCTION sync_metric_files_to_search()
|
||||||
RETURNS TRIGGER AS $$
|
RETURNS TRIGGER AS $$
|
||||||
BEGIN
|
BEGIN
|
||||||
IF TG_OP = 'INSERT' OR TG_OP = 'UPDATE' THEN
|
IF TG_OP = 'INSERT' OR TG_OP = 'UPDATE' THEN
|
||||||
INSERT INTO asset_search (
|
insert into public.asset_search (
|
||||||
asset_id, asset_type, content, organization_id,
|
asset_id, asset_type, content, organization_id,
|
||||||
created_at, updated_at, deleted_at
|
created_at, updated_at, deleted_at
|
||||||
)
|
)
|
||||||
|
@ -30,7 +30,7 @@ CREATE OR REPLACE FUNCTION sync_dashboard_files_to_search()
|
||||||
RETURNS TRIGGER AS $$
|
RETURNS TRIGGER AS $$
|
||||||
BEGIN
|
BEGIN
|
||||||
IF TG_OP = 'INSERT' OR TG_OP = 'UPDATE' THEN
|
IF TG_OP = 'INSERT' OR TG_OP = 'UPDATE' THEN
|
||||||
INSERT INTO asset_search (
|
insert into public.asset_search (
|
||||||
asset_id, asset_type, content, organization_id,
|
asset_id, asset_type, content, organization_id,
|
||||||
created_at, updated_at, deleted_at
|
created_at, updated_at, deleted_at
|
||||||
)
|
)
|
||||||
|
@ -57,7 +57,7 @@ CREATE OR REPLACE FUNCTION sync_collections_to_search()
|
||||||
RETURNS TRIGGER AS $$
|
RETURNS TRIGGER AS $$
|
||||||
BEGIN
|
BEGIN
|
||||||
IF TG_OP = 'INSERT' OR TG_OP = 'UPDATE' THEN
|
IF TG_OP = 'INSERT' OR TG_OP = 'UPDATE' THEN
|
||||||
INSERT INTO asset_search (
|
insert into public.asset_search (
|
||||||
asset_id, asset_type, content, organization_id,
|
asset_id, asset_type, content, organization_id,
|
||||||
created_at, updated_at, deleted_at
|
created_at, updated_at, deleted_at
|
||||||
)
|
)
|
||||||
|
@ -99,7 +99,7 @@ AFTER INSERT OR UPDATE OR DELETE ON collections
|
||||||
FOR EACH ROW EXECUTE FUNCTION sync_collections_to_search();
|
FOR EACH ROW EXECUTE FUNCTION sync_collections_to_search();
|
||||||
|
|
||||||
-- Populate existing data
|
-- Populate existing data
|
||||||
INSERT INTO asset_search (
|
insert into public.asset_search (
|
||||||
asset_id, asset_type, content, organization_id,
|
asset_id, asset_type, content, organization_id,
|
||||||
created_at, updated_at, deleted_at
|
created_at, updated_at, deleted_at
|
||||||
)
|
)
|
||||||
|
@ -111,7 +111,7 @@ FROM metric_files
|
||||||
WHERE deleted_at IS NULL
|
WHERE deleted_at IS NULL
|
||||||
ON CONFLICT (asset_id, asset_type) DO NOTHING;
|
ON CONFLICT (asset_id, asset_type) DO NOTHING;
|
||||||
|
|
||||||
INSERT INTO asset_search (
|
insert into public.asset_search (
|
||||||
asset_id, asset_type, content, organization_id,
|
asset_id, asset_type, content, organization_id,
|
||||||
created_at, updated_at, deleted_at
|
created_at, updated_at, deleted_at
|
||||||
)
|
)
|
||||||
|
@ -123,7 +123,7 @@ FROM dashboard_files
|
||||||
WHERE deleted_at IS NULL
|
WHERE deleted_at IS NULL
|
||||||
ON CONFLICT (asset_id, asset_type) DO NOTHING;
|
ON CONFLICT (asset_id, asset_type) DO NOTHING;
|
||||||
|
|
||||||
INSERT INTO asset_search (
|
insert into public.asset_search (
|
||||||
asset_id, asset_type, content, organization_id,
|
asset_id, asset_type, content, organization_id,
|
||||||
created_at, updated_at, deleted_at
|
created_at, updated_at, deleted_at
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue