Highly ambitious ATProtocol AppView service and sdks
at main 894 B view raw
1-- Add slice_uri column to actor table to associate actors with specific slices 2ALTER TABLE "actor" ADD COLUMN "slice_uri" TEXT; 3 4-- Create a new primary key that includes both did and slice_uri 5-- First drop the existing primary key 6ALTER TABLE "actor" DROP CONSTRAINT "actor_pkey"; 7 8-- Add the new composite primary key 9ALTER TABLE "actor" ADD PRIMARY KEY ("did", "slice_uri"); 10 11-- Create new indexes for slice-based queries 12CREATE INDEX IF NOT EXISTS idx_actor_slice_uri ON "actor"("slice_uri"); 13CREATE INDEX IF NOT EXISTS idx_actor_slice_handle ON "actor"("slice_uri", "handle"); 14CREATE INDEX IF NOT EXISTS idx_actor_slice_indexed_at ON "actor"("slice_uri", "indexed_at"); 15 16-- Update existing records to have a default slice_uri (if any exist) 17-- This will need to be handled manually or with a data migration 18-- For now, we'll leave existing records as-is since they'll have NULL slice_uri