initial commit

This commit is contained in:
m.zare
2026-04-10 18:25:21 +03:30
commit 77ca6c34a3
263 changed files with 34470 additions and 0 deletions

View File

@@ -0,0 +1,57 @@
-- Create "users" table
CREATE TABLE "public"."users" (
"id" uuid NOT NULL,
"first_name" text NOT NULL,
"last_name" text NOT NULL,
"display_name" text NOT NULL,
"email" text NOT NULL,
"created_at" timestamptz NOT NULL DEFAULT now(),
"updated_at" timestamptz NULL DEFAULT now(),
"deleted_at" timestamptz NULL,
PRIMARY KEY ("id"),
CONSTRAINT "users_email_unique" UNIQUE ("email")
);
-- Create "accounts" table
CREATE TABLE "public"."accounts" (
"id" uuid NOT NULL,
"user_id" uuid NOT NULL,
"password" text NULL,
"access_token" text NULL,
"refresh_token" text NULL,
"scope" text NULL,
"meta" jsonb NULL,
"created_at" timestamptz NOT NULL DEFAULT now(),
"updated_at" timestamptz NULL DEFAULT now(),
"deleted_at" timestamptz NULL,
PRIMARY KEY ("id"),
CONSTRAINT "accounts_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users" ("id") ON UPDATE CASCADE ON DELETE CASCADE
);
-- Create index "accounts_user_id_idx" to table: "accounts"
CREATE INDEX "accounts_user_id_idx" ON "public"."accounts" ("user_id");
-- Create "roles" table
CREATE TABLE "public"."roles" (
"id" uuid NOT NULL,
"name" text NOT NULL,
"description" text NULL,
"created_at" timestamptz NOT NULL DEFAULT now(),
"updated_at" timestamptz NULL DEFAULT now(),
"deleted_at" timestamptz NULL,
PRIMARY KEY ("id"),
CONSTRAINT "roles_name_unique" UNIQUE ("name")
);
-- Create "user_roles" table
CREATE TABLE "public"."user_roles" (
"id" uuid NOT NULL,
"user_id" uuid NOT NULL,
"role_id" uuid NOT NULL,
"created_at" timestamptz NOT NULL DEFAULT now(),
"updated_at" timestamptz NULL DEFAULT now(),
"deleted_at" timestamptz NULL,
PRIMARY KEY ("id"),
CONSTRAINT "user_roles_role_id_fk" FOREIGN KEY ("role_id") REFERENCES "public"."roles" ("id") ON UPDATE CASCADE ON DELETE CASCADE,
CONSTRAINT "user_roles_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users" ("id") ON UPDATE CASCADE ON DELETE CASCADE
);
-- Create index "user_roles_role_id_idx" to table: "user_roles"
CREATE INDEX "user_roles_role_id_idx" ON "public"."user_roles" ("role_id");
-- Create index "user_roles_user_id_idx" to table: "user_roles"
CREATE INDEX "user_roles_user_id_idx" ON "public"."user_roles" ("user_id");

View File

@@ -0,0 +1,21 @@
-- Create "cache_hash" table
CREATE TABLE "public"."cache_hash" (
"key" text NOT NULL,
"field" text NOT NULL,
"value" jsonb NOT NULL,
"created_at" timestamptz NOT NULL DEFAULT now(),
"expires_at" timestamptz NULL,
PRIMARY KEY ("key", "field")
);
-- Create index "idx_cache_hash_expires_at" to table: "cache_hash"
CREATE INDEX "idx_cache_hash_expires_at" ON "public"."cache_hash" ("expires_at");
-- Create "cache_kv" table
CREATE TABLE "public"."cache_kv" (
"key" text NOT NULL,
"value" jsonb NOT NULL,
"created_at" timestamptz NOT NULL DEFAULT now(),
"expires_at" timestamptz NULL,
PRIMARY KEY ("key")
);
-- Create index "idx_cache_kv_expires_at" to table: "cache_kv"
CREATE INDEX "idx_cache_kv_expires_at" ON "public"."cache_kv" ("expires_at");

View File

@@ -0,0 +1,6 @@
-- Set comment to schema: "public"
COMMENT ON SCHEMA "public" IS 'Standard public schema';
-- Add new schema named "platform"
CREATE SCHEMA "platform";
-- Set comment to schema: "platform"
COMMENT ON SCHEMA "platform" IS 'Platform schema for cache tables';

View File

@@ -0,0 +1,34 @@
-- 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");

View File

@@ -0,0 +1,13 @@
-- Create "profile_roles" table (profiles.role_id references this)
CREATE TABLE "public"."profile_roles" (
"id" uuid NOT NULL DEFAULT gen_random_uuid(),
"title" text NOT NULL,
"status" text NOT NULL DEFAULT 'active',
"created_at" timestamptz NOT NULL DEFAULT now(),
"updated_at" timestamptz NOT NULL DEFAULT now(),
"deleted_at" timestamptz NULL,
PRIMARY KEY ("id")
);
CREATE INDEX "profile_roles_status_idx" ON "public"."profile_roles" ("status");
CREATE INDEX "profile_roles_deleted_at_idx" ON "public"."profile_roles" ("deleted_at");

View File

@@ -0,0 +1,35 @@
-- Seed profile_roles with initial data
INSERT INTO "public"."profile_roles" ("id", "title", "status") VALUES
('0199b964-5dc0-7657-9178-2a844e23e5b5', 'Data Scientist', 'featured'),
('0199b964-5dc0-7a1a-94c7-d68daf420e50', 'Machine Learning Engineer', 'featured'),
('0199b964-5dc0-7759-8221-71f57f5b2b57', 'AI Engineer', 'featured'),
('0199b964-5dc0-7b79-a268-331f39c35366', 'Data Engineer', 'featured'),
('0199b964-5dc0-7062-b219-11733a1ab94b', 'Data Analyst', 'featured'),
('0199b964-5dc0-7434-b105-f2ff49573fe2', 'Business Intelligence Developer', 'featured'),
('0199b964-5dc0-77f8-be02-f76937f60ba6', 'MLOps Engineer', 'featured'),
('0199b964-5dc0-7107-907c-6c013cbc08b9', 'AI Product Manager', 'active'),
('0199b964-5dc0-72f9-8e0f-dfa2950a8182', 'AI Research Scientist', 'active'),
('0199b964-5dc0-7177-829b-f3d05081201e', 'Computer Vision Engineer', 'active'),
('0199b964-5dc0-74b7-b427-a500ddb9f435', 'NLP Engineer', 'active'),
('0199b964-5dc0-780d-876f-a7b4d15b0ef5', 'Data Architect', 'active'),
('0199b964-5dc0-7d3f-af44-19dc33f50b21', 'Big Data Engineer', 'active'),
('0199b964-5dc0-7600-9a16-74f17be7ce4b', 'Cloud AI/ML Specialist', 'active'),
('0199b964-5dc0-73c2-b9a0-78347ae945d7', 'Generative AI Specialist', 'active'),
('0199b964-5dc0-70a8-b710-1f424a776083', 'AI Ethics Officer', 'active'),
('0199b964-5dc0-7c87-91c0-348e6f8b43d6', 'AI Governance Manager', 'active'),
('0199b964-5dc0-7441-b306-bc2e3d4e4152', 'Data Privacy Engineer', 'active'),
('0199b964-5dc0-747f-97b4-c4d98a257dee', 'AI Solutions Architect', 'active'),
('0199b964-5dc0-7fa5-8fe0-9eb7831554ed', 'Chief Data & AI Officer', 'active'),
('0199b964-5dc0-7447-8785-f246ff9ec309', 'AI Developer Advocate', 'active'),
('0199b964-5dc0-7b24-9b1b-c7ca8f08527f', 'AI/ML Educator & Trainer', 'active'),
('0199b964-5dc0-756f-ab44-48169ecfbb5e', 'Technical Content Creator (AI/ML)', 'active'),
('0199b964-5dc0-79d1-9086-c809d8989cac', 'Open Source AI Contributor', 'active'),
('0199b964-5dc0-774e-9011-b9fe6c29f52f', 'AI Course Instructor (Udemy, Coursera, etc.)', 'active'),
('0199b964-5dc0-7f1d-80a4-96810af9f9ac', 'AI Community Manager', 'active'),
('0199b964-5dc0-7352-8553-edd37324ffd9', 'AI Evangelist', 'active'),
('0199b964-5dc0-7864-a2b5-473cfd8f7aa0', 'Research Engineer (applied AI research, publishing GitHub repos)', 'active'),
('0199b964-5dc0-762e-9a40-0cc112578498', 'Kaggle Competitor / Data Science Challenger', 'active'),
('0199b964-5dc0-7e13-a1f4-b4ae76bb0b62', 'AI Startup Founder / Indie Hacker (building projects, sharing repos)', 'active'),
('0199b964-5dc0-7035-bf9b-deb415d852fd', 'Freelancer', 'active'),
('0199b964-5dc0-7702-b533-72f7c93e19d3', 'Other', 'active')
ON CONFLICT (id) DO NOTHING;

View File

@@ -0,0 +1,54 @@
-- Create asset_categories table
CREATE TABLE "public"."asset_categories" (
"id" uuid NOT NULL DEFAULT gen_random_uuid(),
"name" text NOT NULL,
"icon" text,
"color" text,
"card_type" text,
"featured" boolean NOT NULL DEFAULT false,
"description" text,
"created_at" timestamptz NOT NULL DEFAULT now(),
"updated_at" timestamptz NOT NULL DEFAULT now(),
"deleted_at" timestamptz,
PRIMARY KEY ("id")
);
CREATE INDEX "asset_categories_deleted_at_idx" ON "public"."asset_categories" ("deleted_at");
-- Create assets table (references profiles and asset_categories)
CREATE TABLE "public"."assets" (
"id" uuid NOT NULL DEFAULT gen_random_uuid(),
"profile_id" uuid NOT NULL,
"status" integer NOT NULL DEFAULT 0,
"asset_category_id" uuid NOT NULL,
"title" text NOT NULL,
"description" text,
"link" text,
"analytics" jsonb,
"created_at" timestamptz NOT NULL DEFAULT now(),
"updated_at" timestamptz NOT NULL DEFAULT now(),
"deleted_at" timestamptz,
PRIMARY KEY ("id"),
CONSTRAINT "assets_profile_id_fk" FOREIGN KEY ("profile_id") REFERENCES "public"."profiles" ("id") ON UPDATE CASCADE ON DELETE CASCADE,
CONSTRAINT "assets_asset_category_id_fk" FOREIGN KEY ("asset_category_id") REFERENCES "public"."asset_categories" ("id") ON UPDATE CASCADE ON DELETE CASCADE
);
CREATE INDEX "assets_profile_id_idx" ON "public"."assets" ("profile_id");
CREATE INDEX "assets_category_id_idx" ON "public"."assets" ("asset_category_id");
CREATE INDEX "assets_deleted_at_idx" ON "public"."assets" ("deleted_at");
-- Create asset_artifacts table
CREATE TABLE "public"."asset_artifacts" (
"id" uuid NOT NULL DEFAULT gen_random_uuid(),
"asset_id" uuid NOT NULL,
"type" text NOT NULL,
"download_url" text,
"price" integer NOT NULL DEFAULT 0,
"title" text,
"description" text,
"created_at" timestamptz NOT NULL DEFAULT now(),
"updated_at" timestamptz NOT NULL DEFAULT now(),
"deleted_at" timestamptz,
PRIMARY KEY ("id"),
CONSTRAINT "asset_artifacts_asset_id_fk" FOREIGN KEY ("asset_id") REFERENCES "public"."assets" ("id") ON UPDATE CASCADE ON DELETE CASCADE
);
CREATE INDEX "asset_artifacts_asset_id_idx" ON "public"."asset_artifacts" ("asset_id");
CREATE INDEX "asset_artifacts_deleted_at_idx" ON "public"."asset_artifacts" ("deleted_at");

View File

@@ -0,0 +1,2 @@
-- Add role_level column to profiles (e.g. Junior, Senior, Lead)
ALTER TABLE "public"."profiles" ADD COLUMN IF NOT EXISTS "role_level" text;

View File

@@ -0,0 +1,8 @@
-- Modify "accounts" table
ALTER TABLE "public"."accounts" ADD COLUMN "provider" integer NULL;
-- Create index "accounts_provider_idx" to table: "accounts"
CREATE INDEX "accounts_provider_idx" ON "public"."accounts" ("provider");
-- Modify "users" table
ALTER TABLE "public"."users" ADD COLUMN "phone_number" text NULL, ADD COLUMN "email_verified" boolean NOT NULL DEFAULT false, ADD COLUMN "status" integer NOT NULL DEFAULT 0, ADD COLUMN "invitation_code" text NULL;
-- Modify "profiles" table
ALTER TABLE "public"."profiles" ADD CONSTRAINT "profiles_role_id_profile_roles_fk" FOREIGN KEY ("role_id") REFERENCES "public"."profile_roles" ("id") ON UPDATE CASCADE ON DELETE SET NULL;

View File

@@ -0,0 +1,4 @@
-- Modify "accounts" table
ALTER TABLE "public"."accounts" DROP COLUMN "provider";
-- Modify "users" table
ALTER TABLE "public"."users" DROP COLUMN "phone_number", DROP COLUMN "email_verified", DROP COLUMN "status", DROP COLUMN "invitation_code";

View File

@@ -0,0 +1,4 @@
-- Create "skills" table
CREATE TABLE "public"."skills" ("id" uuid NOT NULL DEFAULT gen_random_uuid(), "name" text NOT NULL, "created_at" timestamptz NOT NULL DEFAULT now(), "updated_at" timestamptz NOT NULL DEFAULT now(), "deleted_at" timestamptz NULL, PRIMARY KEY ("id"));
-- Create index "skills_catalog_name_idx" to table: "skills"
CREATE INDEX "skills_catalog_name_idx" ON "public"."skills" ("name");

View File

@@ -0,0 +1,12 @@
h1:calC/k+XV88oQ++zbEbFg7avX0IvO4wXp6zMR2WkGR4=
20251228071211.sql h1:XyIbEsQgrxoGw3oyfpHCAC71FUOkg0vVWEPEB7fTDME=
20260103095921.sql h1:QxUqe3CvReDIMsCLa5DqM+RLh+cpSTJdcD3e9gRHnfw=
20260103102028.sql h1:lqVe41QhYTMxyDflXliflCsR5nZfasaGqHXKCCL6vj4=
20260108092338.sql h1:D1/hl9KLCi4qJFI80q6uAehHHhHCIRsqXEbS9bfm4OE=
20260226000000_specialist_roles.sql h1:se79NTcVHJ94KCsVsxDLOQNUFEW84u+8iE3iAJ1iByc=
20260226000001_specialist_roles_seed.sql h1:TozU48tMsL/4EL583XwU5nmvngN8EN0kXSw5WvK4Rsk=
20260226110000_asset_tables.sql h1:WzgF2uK3oG6cqiOWrNDaB9O7wOA4/RP5XjYwzSuIz80=
20260226120000_add_profile_role_level.sql h1:OyV/tGf8oQWCEiuetcOA+LNjCIjhSzn18iPhqOgXQko=
20260227101245.sql h1:vkczkkzkU3sg0QsQuAqIY7IuugXONDx9AM4AlDt4EL8=
20260227104943.sql h1:1Mb7CE7B8nF1stH/R0YcbrT8urczMr5+sfO+lMSoBPg=
20260227114150.sql h1:LFDVdKRD7qFxlADcFYEAXF+UjaUVi3tprr61yF0tb/c=