CREATE SEQUENCE "public"."artista_virtual_codigo_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START WITH 1 CACHE 1;--> statement-breakpoint ALTER TABLE "artista" DROP CONSTRAINT "artista_tipo_conocido";--> statement-breakpoint ALTER TABLE "artista" ADD COLUMN "secciones" jsonb DEFAULT '[]'::jsonb NOT NULL;--> statement-breakpoint UPDATE "artista" SET "secciones" = jsonb_build_array( jsonb_build_object( 'id', 'biografia-principal', 'tipo', 'texto', 'texto', "biografia" ) ) WHERE btrim("biografia") <> '';--> statement-breakpoint SELECT setval( 'artista_virtual_codigo_seq', coalesce(max(substring("codigo" from '^AV-([0-9]+)$')::bigint), 1), count(*) FILTER (WHERE "codigo" ~ '^AV-[0-9]+$') > 0 ) FROM "artista";--> statement-breakpoint ALTER TABLE "artista" ADD CONSTRAINT "artista_secciones_array" CHECK (jsonb_typeof("artista"."secciones") = 'array');--> statement-breakpoint ALTER TABLE "artista" ADD CONSTRAINT "artista_tipo_conocido" CHECK ("artista"."tipo" in ('persona', 'grupo', 'proyecto', 'virtual'));