CREATE TABLE "devices" ( "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, "user_id" uuid NOT NULL, "token_hash" text NOT NULL, "platform" text NOT NULL, "name" varchar(100) NOT NULL, "last_seen_at" timestamp with time zone, "created_at" timestamp with time zone DEFAULT now() NOT NULL, CONSTRAINT "devices_token_hash_unique" UNIQUE("token_hash") ); --> statement-breakpoint ALTER TABLE "now_playing" ADD COLUMN "source_app" text;--> statement-breakpoint ALTER TABLE "devices" ADD CONSTRAINT "devices_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint CREATE INDEX "devices_user_idx" ON "devices" USING btree ("user_id");