Merge branch 'dev'
# Conflicts: # backend/src/app.ts # backend/src/db/schema.ts # backend/src/queues/adoptionReportQueue.ts # backend/src/reports/adoptionReport.ts # backend/src/reports/adoptionReportJob.ts # backend/src/repositories/birdRepository.ts # backend/src/types.ts # frontend/src/App.tsx # frontend/src/index.css
This commit is contained in:
commit
3ba6410972
19 files changed
+2150
-992
No files matched your search
@@ -215,6 +215,8 @@ export const ensureSchema = async (database: DatabaseClient = db) => {
|
||||
motivators VARCHAR(1000),
|
||||
demotivators VARCHAR(1000),
|
||||
favorite_snack VARCHAR(160),
|
||||
location_label VARCHAR(160),
|
||||
location_details JSONB,
|
||||
vet_clinic_name VARCHAR(160),
|
||||
vet_clinic_address VARCHAR(500),
|
||||
vet_account_number VARCHAR(120),
|
||||
@@ -243,6 +245,8 @@ export const ensureSchema = async (database: DatabaseClient = db) => {
|
||||
ADD COLUMN IF NOT EXISTS motivators VARCHAR(1000),
|
||||
ADD COLUMN IF NOT EXISTS demotivators VARCHAR(1000),
|
||||
ADD COLUMN IF NOT EXISTS favorite_snack VARCHAR(160),
|
||||
ADD COLUMN IF NOT EXISTS location_label VARCHAR(160),
|
||||
ADD COLUMN IF NOT EXISTS location_details JSONB,
|
||||
ADD COLUMN IF NOT EXISTS vet_clinic_name VARCHAR(160),
|
||||
ADD COLUMN IF NOT EXISTS vet_clinic_address VARCHAR(500),
|
||||
ADD COLUMN IF NOT EXISTS vet_account_number VARCHAR(120),
|
||||
@@ -342,9 +346,9 @@ export const ensureSchema = async (database: DatabaseClient = db) => {
|
||||
ON pending_bird_transfers (LOWER(destination_owner_email), created_at DESC)
|
||||
WHERE completed_at IS NULL;
|
||||
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS idx_pending_bird_transfers_open_bird
|
||||
ON pending_bird_transfers (bird_id)
|
||||
WHERE completed_at IS NULL;
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS idx_pending_bird_transfers_open_bird
|
||||
ON pending_bird_transfers (bird_id)
|
||||
WHERE completed_at IS NULL;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS bird_transfer_codes (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
@@ -368,9 +372,35 @@ export const ensureSchema = async (database: DatabaseClient = db) => {
|
||||
WHERE completed_at IS NULL
|
||||
AND revoked_at IS NULL;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS flock_notes (
|
||||
CREATE TABLE IF NOT EXISTS bird_timeline_events (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
workspace_id INTEGER NOT NULL REFERENCES workspaces(id) ON DELETE CASCADE,
|
||||
bird_id UUID NOT NULL REFERENCES birds(id) ON DELETE CASCADE,
|
||||
event_type VARCHAR(40) NOT NULL,
|
||||
from_workspace_id INTEGER REFERENCES workspaces(id) ON DELETE SET NULL,
|
||||
to_workspace_id INTEGER REFERENCES workspaces(id) ON DELETE SET NULL,
|
||||
from_workspace_name VARCHAR(160),
|
||||
to_workspace_name VARCHAR(160),
|
||||
from_owner_email VARCHAR(255),
|
||||
to_owner_email VARCHAR(255),
|
||||
location_label VARCHAR(160),
|
||||
location_details JSONB,
|
||||
note TEXT,
|
||||
event_date DATE NOT NULL DEFAULT CURRENT_DATE,
|
||||
created_by_user_id UUID REFERENCES users(id) ON DELETE SET NULL,
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
ALTER TABLE bird_timeline_events
|
||||
ADD COLUMN IF NOT EXISTS note TEXT,
|
||||
ADD COLUMN IF NOT EXISTS location_details JSONB,
|
||||
ADD COLUMN IF NOT EXISTS event_date DATE NOT NULL DEFAULT CURRENT_DATE;
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_bird_timeline_events_bird_created
|
||||
ON bird_timeline_events (bird_id, event_date DESC, created_at DESC);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS flock_notes (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
workspace_id INTEGER NOT NULL REFERENCES workspaces(id) ON DELETE CASCADE,
|
||||
bird_id UUID REFERENCES birds(id) ON DELETE SET NULL,
|
||||
title VARCHAR(160) NOT NULL,
|
||||
body TEXT NOT NULL,
|
||||
|
||||
Reference in new issue
Block a user