-- Create "profiles" table
CREATE TABLE "public"."profiles" ("id" uuid NOT NULL DEFAULT gen_random_uuid(), "user_id" uuid NULL, "handle" text NOT NULL, "role_id" uuid NULL, "role_name" character varying(100) NULL, "first_name" text NULL, "last_name" text NULL, "company" text NULL, "short_description" text NULL, "resume_link" text NULL, "cta_enabled" boolean NOT NULL DEFAULT false, "avatar" text NULL, "profile_picture" text NULL, "about" text NULL, "email" text NULL, "phone" text NULL, "visibility_level" text NOT NULL DEFAULT 'public', "page_section_order" jsonb NULL, "created_at" timestamptz NOT NULL DEFAULT now(), "updated_at" timestamptz NOT NULL DEFAULT now(), "deleted_at" timestamptz NULL, PRIMARY KEY ("id"), CONSTRAINT "profiles_handle_unique" UNIQUE ("handle"));
-- Create index "profiles_company_idx" to table: "profiles"
CREATE INDEX "profiles_company_idx" ON "public"."profiles" ("company");
-- Create index "profiles_deleted_at_idx" to table: "profiles"
CREATE INDEX "profiles_deleted_at_idx" ON "public"."profiles" ("deleted_at");
-- Create index "profiles_email_idx" to table: "profiles"
CREATE INDEX "profiles_email_idx" ON "public"."profiles" ("email");
-- Create index "profiles_name_idx" to table: "profiles"
CREATE INDEX "profiles_name_idx" ON "public"."profiles" ("first_name", "last_name");
-- Create index "profiles_role_id_idx" to table: "profiles"
CREATE INDEX "profiles_role_id_idx" ON "public"."profiles" ("role_id");
-- Create index "profiles_user_id_idx" to table: "profiles"
CREATE INDEX "profiles_user_id_idx" ON "public"."profiles" ("user_id");
-- Create "profile_achievements" table
CREATE TABLE "public"."profile_achievements" ("id" uuid NOT NULL DEFAULT gen_random_uuid(), "profile_id" uuid NOT NULL, "title" text NOT NULL, "value" text NOT NULL, "enabled" boolean NOT NULL DEFAULT true, "created_at" timestamptz NOT NULL DEFAULT now(), "updated_at" timestamptz NOT NULL DEFAULT now(), "deleted_at" timestamptz NULL, PRIMARY KEY ("id"), CONSTRAINT "profile_achievements_profile_id_fk" FOREIGN KEY ("profile_id") REFERENCES "public"."profiles" ("id") ON UPDATE CASCADE ON DELETE CASCADE);
-- Create index "achievements_profile_id_idx" to table: "profile_achievements"
CREATE INDEX "achievements_profile_id_idx" ON "public"."profile_achievements" ("profile_id");
-- Create index "profile_achievements_deleted_at_idx" to table: "profile_achievements"
CREATE INDEX "profile_achievements_deleted_at_idx" ON "public"."profile_achievements" ("deleted_at");
-- Create "profile_skills" table
CREATE TABLE "public"."profile_skills" ("id" uuid NOT NULL DEFAULT gen_random_uuid(), "profile_id" uuid NOT NULL, "skill_name" text NOT NULL, "level" text NOT NULL, "created_at" timestamptz NOT NULL DEFAULT now(), "updated_at" timestamptz NOT NULL DEFAULT now(), "deleted_at" timestamptz NULL, PRIMARY KEY ("id"), CONSTRAINT "profile_skills_profile_id_fk" FOREIGN KEY ("profile_id") REFERENCES "public"."profiles" ("id") ON UPDATE CASCADE ON DELETE CASCADE);
-- Create index "profile_skills_deleted_at_idx" to table: "profile_skills"
CREATE INDEX "profile_skills_deleted_at_idx" ON "public"."profile_skills" ("deleted_at");
-- Create index "skills_name_idx" to table: "profile_skills"
CREATE INDEX "skills_name_idx" ON "public"."profile_skills" ("skill_name");
-- Create index "skills_profile_id_idx" to table: "profile_skills"
CREATE INDEX "skills_profile_id_idx" ON "public"."profile_skills" ("profile_id");
-- Create "profile_social_links" table
CREATE TABLE "public"."profile_social_links" ("id" uuid NOT NULL DEFAULT gen_random_uuid(), "profile_id" uuid NOT NULL, "link_type" text NOT NULL, "link" text NOT NULL, "created_at" timestamptz NOT NULL DEFAULT now(), "updated_at" timestamptz NOT NULL DEFAULT now(), "deleted_at" timestamptz NULL, PRIMARY KEY ("id"), CONSTRAINT "profile_social_links_profile_id_fk" FOREIGN KEY ("profile_id") REFERENCES "public"."profiles" ("id") ON UPDATE CASCADE ON DELETE CASCADE);
-- Create index "profile_social_links_deleted_at_idx" to table: "profile_social_links"
CREATE INDEX "profile_social_links_deleted_at_idx" ON "public"."profile_social_links" ("deleted_at");
-- Create index "social_links_profile_id_idx" to table: "profile_social_links"
CREATE INDEX "social_links_profile_id_idx" ON "public"."profile_social_links" ("profile_id");
