diff --git a/.env.example b/.env.example
index d7d28540de266ec9504e7a11be240fafd116965e..f806a3fc5395d6925926a9eb2a24e2adebe3bdaa 100644
--- a/.env.example
+++ b/.env.example
@@ -40,3 +40,12 @@ ELASTIC_INDEX_PREFIX=
 ELASTIC_INDEX_RESOURCES=${ELASTIC_INDEX_PREFIX}_resources
 ELASTIC_INDEX_COLLECTIONS=${ELASTIC_INDEX_PREFIX}_collections
 ELASTIC_INDEX_USERS=${ELASTIC_INDEX_PREFIX}_users
+
+# govbr
+GOVBR_CLIENT_ID=
+GOVBR_SECRET=
+GOVBR_AUTHORIZE_URL=
+GOVBR_TOKEN_URL=
+GOVBR_PUBLIC_KEY_URL=
+
+FRONT_END_RETURN_URL=
diff --git a/package.json b/package.json
index b0c9784abaccc0bdc3367c974ba029da977beec6..fe9262e491868543cf85292f797cfbf5aa117c18 100644
--- a/package.json
+++ b/package.json
@@ -24,8 +24,10 @@
     "file-type": "^20.1.0",
     "hono": "^4.4.8",
     "hono-openapi": "^0.4.6",
+    "jose": "^6.0.11",
     "jwt-simple": "^0.5.6",
     "nodemailer": "^6.10.0",
+    "openid-client": "^6.4.2",
     "postgres": "^3.4.4",
     "reflect-metadata": "^0.2.2",
     "typedi": "^0.10.0",
diff --git a/src/db/migrations/0000_modern_kulan_gath.sql b/src/db/migrations/0000_modern_kulan_gath.sql
deleted file mode 100644
index 6d2b9358096afc597a7f8c1b2315ebab7ce8e858..0000000000000000000000000000000000000000
--- a/src/db/migrations/0000_modern_kulan_gath.sql
+++ /dev/null
@@ -1,672 +0,0 @@
-DO $$ BEGIN
- CREATE TYPE "public"."complaints_state" AS ENUM('complained', 'rejected', 'accepted');
-EXCEPTION
- WHEN duplicate_object THEN null;
-END $$;
---> statement-breakpoint
-DO $$ BEGIN
- CREATE TYPE "public"."resource_state" AS ENUM('draft', 'submitted', 'accepted', 'reported', 'deleted');
-EXCEPTION
- WHEN duplicate_object THEN null;
-END $$;
---> statement-breakpoint
-DO $$ BEGIN
- CREATE TYPE "public"."review_state" AS ENUM('active', 'inactive', 'under_review');
-EXCEPTION
- WHEN duplicate_object THEN null;
-END $$;
---> statement-breakpoint
-CREATE TABLE IF NOT EXISTS "achievements" (
-	"id" serial PRIMARY KEY NOT NULL,
-	"name" varchar(255) NOT NULL,
-	"description" text,
-	"reward_experience" numeric,
-	"reward_points" numeric,
-	"review_state" "review_state" DEFAULT 'under_review' NOT NULL,
-	"repeatable" integer NOT NULL,
-	"is_resettable" boolean NOT NULL,
-	"created_at" timestamp DEFAULT now() NOT NULL,
-	"updated_at" timestamp DEFAULT now() NOT NULL,
-	CONSTRAINT "achievements_id_unique" UNIQUE("id")
-);
---> statement-breakpoint
-CREATE TABLE IF NOT EXISTS "actions" (
-	"id" serial PRIMARY KEY NOT NULL,
-	"name" varchar(255) NOT NULL,
-	"created_at" timestamp DEFAULT now() NOT NULL,
-	"updated_at" timestamp DEFAULT now() NOT NULL,
-	CONSTRAINT "actions_id_unique" UNIQUE("id")
-);
---> statement-breakpoint
-CREATE TABLE IF NOT EXISTS "collection_likes" (
-	"id" serial PRIMARY KEY NOT NULL,
-	"user_id" integer NOT NULL,
-	"collection_id" integer NOT NULL,
-	CONSTRAINT "collection_likes_id_unique" UNIQUE("id")
-);
---> statement-breakpoint
-CREATE TABLE IF NOT EXISTS "collection_resources" (
-	"id" serial PRIMARY KEY NOT NULL,
-	"collection_id" integer NOT NULL,
-	"resource_id" integer NOT NULL,
-	CONSTRAINT "collection_resources_id_unique" UNIQUE("id")
-);
---> statement-breakpoint
-CREATE TABLE IF NOT EXISTS "collection_stats" (
-	"id" serial PRIMARY KEY NOT NULL,
-	"views" integer DEFAULT 0 NOT NULL,
-	"downloads" integer DEFAULT 0 NOT NULL,
-	"likes" integer DEFAULT 0 NOT NULL,
-	"shares" integer DEFAULT 0 NOT NULL,
-	"score" numeric DEFAULT '0.0' NOT NULL,
-	"follows" integer DEFAULT 0 NOT NULL,
-	CONSTRAINT "collection_stats_id_unique" UNIQUE("id")
-);
---> statement-breakpoint
-CREATE TABLE IF NOT EXISTS "collections" (
-	"id" serial PRIMARY KEY NOT NULL,
-	"name" varchar(255) NOT NULL,
-	"description" text,
-	"is_private" boolean DEFAULT false,
-	"is_active" boolean,
-	"created_at" timestamp DEFAULT now() NOT NULL,
-	"updated_at" timestamp DEFAULT now() NOT NULL,
-	"deleted_at" timestamp,
-	"thumbnail" varchar(255),
-	"user_id" integer NOT NULL,
-	"collection_stats_id" integer NOT NULL,
-	CONSTRAINT "collections_id_unique" UNIQUE("id"),
-	CONSTRAINT "collections_collection_stats_id_unique" UNIQUE("collection_stats_id")
-);
---> statement-breakpoint
-CREATE TABLE IF NOT EXISTS "commentReply" (
-	"id" serial PRIMARY KEY NOT NULL,
-	"user_id" integer NOT NULL,
-	"comment_id" integer NOT NULL,
-	"text" text NOT NULL,
-	"created_at" timestamp DEFAULT now() NOT NULL,
-	"deleted_at" timestamp,
-	"update_at" timestamp DEFAULT now() NOT NULL,
-	CONSTRAINT "commentReply_id_unique" UNIQUE("id")
-);
---> statement-breakpoint
-CREATE TABLE IF NOT EXISTS "comments" (
-	"id" serial PRIMARY KEY NOT NULL,
-	"user_id" integer NOT NULL,
-	"resource_id" integer NOT NULL,
-	"text" text NOT NULL,
-	"created_at" timestamp DEFAULT now() NOT NULL,
-	"deleted_at" timestamp,
-	"updated_at" timestamp DEFAULT now() NOT NULL,
-	CONSTRAINT "comments_id_unique" UNIQUE("id")
-);
---> statement-breakpoint
-CREATE TABLE IF NOT EXISTS "complaints" (
-	"id" serial PRIMARY KEY NOT NULL,
-	"state" "complaints_state" DEFAULT 'complained' NOT NULL,
-	"description" text NOT NULL,
-	"denouncer_id" integer NOT NULL,
-	"resource_id" integer NOT NULL,
-	"collection_id" integer,
-	"user_id" integer,
-	"evaluated_at" timestamp,
-	"created_at" timestamp DEFAULT now() NOT NULL,
-	"q1" boolean,
-	"q2" boolean,
-	"q3" boolean,
-	"q4" boolean,
-	"q5" boolean,
-	"q6" boolean,
-	"q7" boolean,
-	CONSTRAINT "complaints_id_unique" UNIQUE("id")
-);
---> statement-breakpoint
-CREATE TABLE IF NOT EXISTS "educational_stages" (
-	"id" serial PRIMARY KEY NOT NULL,
-	"name" varchar(255) NOT NULL,
-	CONSTRAINT "educational_stages_id_unique" UNIQUE("id")
-);
---> statement-breakpoint
-CREATE TABLE IF NOT EXISTS "followers" (
-	"id" serial PRIMARY KEY NOT NULL,
-	"user_id" integer NOT NULL,
-	"follower_id" integer NOT NULL,
-	CONSTRAINT "followers_id_unique" UNIQUE("id")
-);
---> statement-breakpoint
-CREATE TABLE IF NOT EXISTS "institutions" (
-	"id" serial PRIMARY KEY NOT NULL,
-	"name" varchar(255) NOT NULL,
-	"uf" varchar(2),
-	"city" varchar(255),
-	"cep" varchar(10),
-	"created_at" timestamp DEFAULT now() NOT NULL,
-	"updated_at" timestamp DEFAULT now() NOT NULL,
-	CONSTRAINT "institutions_id_unique" UNIQUE("id")
-);
---> statement-breakpoint
-CREATE TABLE IF NOT EXISTS "item_achievements" (
-	"item_id" integer NOT NULL,
-	"achievement_id" integer NOT NULL,
-	CONSTRAINT "item_achievements_item_id_achievement_id_pk" PRIMARY KEY("item_id","achievement_id")
-);
---> statement-breakpoint
-CREATE TABLE IF NOT EXISTS "items" (
-	"id" serial PRIMARY KEY NOT NULL,
-	"name" varchar(255) NOT NULL,
-	"price" numeric,
-	"discount" numeric,
-	"description" text,
-	"is_active" boolean DEFAULT false,
-	"created_at" timestamp DEFAULT now() NOT NULL,
-	"updated_at" timestamp DEFAULT now() NOT NULL,
-	CONSTRAINT "items_id_unique" UNIQUE("id")
-);
---> statement-breakpoint
-CREATE TABLE IF NOT EXISTS "languages" (
-	"id" serial PRIMARY KEY NOT NULL,
-	"name" varchar(255) NOT NULL,
-	"code" varchar(10) NOT NULL,
-	CONSTRAINT "languages_id_unique" UNIQUE("id"),
-	CONSTRAINT "languages_code_unique" UNIQUE("code")
-);
---> statement-breakpoint
-CREATE TABLE IF NOT EXISTS "licenses" (
-	"id" serial PRIMARY KEY NOT NULL,
-	"name" varchar(255) NOT NULL,
-	"description" text NOT NULL,
-	"url" varchar(255) NOT NULL,
-	CONSTRAINT "licenses_id_unique" UNIQUE("id")
-);
---> statement-breakpoint
-CREATE TABLE IF NOT EXISTS "notifications" (
-	"id" serial PRIMARY KEY NOT NULL,
-	"owner_id" integer NOT NULL,
-	"action_id" integer NOT NULL,
-	"actor_user_id" integer,
-	"target_user_id" integer,
-	"target_resource_id" integer,
-	"target_collection_id" integer,
-	"viewed" boolean DEFAULT false,
-	"created_at" timestamp DEFAULT now() NOT NULL,
-	"updated_at" timestamp DEFAULT now() NOT NULL,
-	CONSTRAINT "notifications_id_unique" UNIQUE("id")
-);
---> statement-breakpoint
-CREATE TABLE IF NOT EXISTS "object_types" (
-	"id" serial PRIMARY KEY NOT NULL,
-	"name" varchar(255) NOT NULL,
-	CONSTRAINT "object_types_id_unique" UNIQUE("id")
-);
---> statement-breakpoint
-CREATE TABLE IF NOT EXISTS "resource_educational_stages" (
-	"id" serial PRIMARY KEY NOT NULL,
-	"resource_id" integer NOT NULL,
-	"educational_stage_id" integer NOT NULL,
-	CONSTRAINT "resource_educational_stages_id_unique" UNIQUE("id")
-);
---> statement-breakpoint
-CREATE TABLE IF NOT EXISTS "resource_languages" (
-	"id" serial PRIMARY KEY NOT NULL,
-	"resource_id" integer NOT NULL,
-	"language_id" integer NOT NULL,
-	CONSTRAINT "resource_languages_id_unique" UNIQUE("id")
-);
---> statement-breakpoint
-CREATE TABLE IF NOT EXISTS "resource_likes" (
-	"id" serial PRIMARY KEY NOT NULL,
-	"user_id" integer NOT NULL,
-	"resource_id" integer NOT NULL,
-	CONSTRAINT "resource_likes_id_unique" UNIQUE("id")
-);
---> statement-breakpoint
-CREATE TABLE IF NOT EXISTS "resource_stats" (
-	"id" serial PRIMARY KEY NOT NULL,
-	"views" integer DEFAULT 0 NOT NULL,
-	"downloads" integer DEFAULT 0 NOT NULL,
-	"likes" integer DEFAULT 0 NOT NULL,
-	"shares" integer DEFAULT 0 NOT NULL,
-	"score" numeric DEFAULT '0.0' NOT NULL,
-	"follows" integer DEFAULT 0 NOT NULL,
-	"comments" integer DEFAULT 0 NOT NULL,
-	CONSTRAINT "resource_stats_id_unique" UNIQUE("id")
-);
---> statement-breakpoint
-CREATE TABLE IF NOT EXISTS "resource_subjects" (
-	"id" serial PRIMARY KEY NOT NULL,
-	"resource_id" integer NOT NULL,
-	"subject_id" integer NOT NULL,
-	CONSTRAINT "resource_subjects_id_unique" UNIQUE("id")
-);
---> statement-breakpoint
-CREATE TABLE IF NOT EXISTS "resources" (
-	"id" serial PRIMARY KEY NOT NULL,
-	"resource_state" "resource_state" DEFAULT 'draft' NOT NULL,
-	"name" varchar(255) NOT NULL,
-	"author" varchar(255) NOT NULL,
-	"link" varchar(255),
-	"thumbnail" varchar(255),
-	"description" text,
-	"created_at" timestamp DEFAULT now() NOT NULL,
-	"updated_at" timestamp DEFAULT now() NOT NULL,
-	"published_at" timestamp,
-	"submitted_at" timestamp,
-	"deleted_at" timestamp,
-	"user_id" integer NOT NULL,
-	"resource_stats_id" integer NOT NULL,
-	"object_type_id" integer NOT NULL,
-	"license_id" integer NOT NULL,
-	CONSTRAINT "resources_id_unique" UNIQUE("id"),
-	CONSTRAINT "resources_resource_stats_id_unique" UNIQUE("resource_stats_id")
-);
---> statement-breakpoint
-CREATE TABLE IF NOT EXISTS "roles" (
-	"id" serial PRIMARY KEY NOT NULL,
-	"name" varchar(255) NOT NULL,
-	"description" text,
-	"created_at" timestamp DEFAULT now() NOT NULL,
-	"updated_at" timestamp DEFAULT now() NOT NULL,
-	CONSTRAINT "roles_id_unique" UNIQUE("id"),
-	CONSTRAINT "roles_name_unique" UNIQUE("name")
-);
---> statement-breakpoint
-CREATE TABLE IF NOT EXISTS "subjects" (
-	"id" serial PRIMARY KEY NOT NULL,
-	"name" varchar(255) NOT NULL,
-	CONSTRAINT "subjects_id_unique" UNIQUE("id")
-);
---> statement-breakpoint
-CREATE TABLE IF NOT EXISTS "submissions" (
-	"id" serial PRIMARY KEY NOT NULL,
-	"is_accepted" boolean DEFAULT false NOT NULL,
-	"justification" text,
-	"resource_id" integer NOT NULL,
-	"submitter_id" integer NOT NULL,
-	"curator_id" integer,
-	"created_at" timestamp DEFAULT now() NOT NULL,
-	"updated_at" timestamp DEFAULT now() NOT NULL,
-	"answered_at" timestamp,
-	"q1" boolean,
-	"q2" boolean,
-	"q3" boolean,
-	"q4" boolean,
-	CONSTRAINT "submissions_id_unique" UNIQUE("id")
-);
---> statement-breakpoint
-CREATE TABLE IF NOT EXISTS "user_achievements" (
-	"id" serial PRIMARY KEY NOT NULL,
-	"user_id" integer NOT NULL,
-	"achievement_id" integer NOT NULL,
-	CONSTRAINT "user_achievements_id_unique" UNIQUE("id")
-);
---> statement-breakpoint
-CREATE TABLE IF NOT EXISTS "user_collections" (
-	"id" serial PRIMARY KEY NOT NULL,
-	"user_id" integer NOT NULL,
-	"collection_id" integer NOT NULL,
-	CONSTRAINT "user_collections_id_unique" UNIQUE("id")
-);
---> statement-breakpoint
-CREATE TABLE IF NOT EXISTS "user_institutions" (
-	"id" serial PRIMARY KEY NOT NULL,
-	"user_id" integer NOT NULL,
-	"institution_id" integer NOT NULL,
-	CONSTRAINT "user_institutions_id_unique" UNIQUE("id")
-);
---> statement-breakpoint
-CREATE TABLE IF NOT EXISTS "user_items" (
-	"id" serial PRIMARY KEY NOT NULL,
-	"user_id" integer NOT NULL,
-	"item_id" integer NOT NULL,
-	CONSTRAINT "user_items_id_unique" UNIQUE("id")
-);
---> statement-breakpoint
-CREATE TABLE IF NOT EXISTS "user_roles" (
-	"id" serial PRIMARY KEY NOT NULL,
-	"user_id" integer NOT NULL,
-	"role_id" integer NOT NULL,
-	CONSTRAINT "user_roles_id_unique" UNIQUE("id")
-);
---> statement-breakpoint
-CREATE TABLE IF NOT EXISTS "user_stats" (
-	"id" serial PRIMARY KEY NOT NULL,
-	"score" numeric DEFAULT '0.0' NOT NULL,
-	"likes" integer DEFAULT 0 NOT NULL,
-	"likes_received" integer DEFAULT 0 NOT NULL,
-	"follows" integer DEFAULT 0 NOT NULL,
-	"followers" integer DEFAULT 0 NOT NULL,
-	"collections" integer DEFAULT 0 NOT NULL,
-	"submitted_resources" integer DEFAULT 0 NOT NULL,
-	"approved_resources" integer DEFAULT 0 NOT NULL,
-	"reviewed_resources" integer DEFAULT 0 NOT NULL,
-	"comments" integer DEFAULT 0 NOT NULL,
-	CONSTRAINT "user_stats_id_unique" UNIQUE("id")
-);
---> statement-breakpoint
-CREATE TABLE IF NOT EXISTS "users" (
-	"id" serial PRIMARY KEY NOT NULL,
-	"name" varchar(255) NOT NULL,
-	"username" varchar(255) NOT NULL,
-	"password" varchar(255) NOT NULL,
-	"email" varchar(255) NOT NULL,
-	"description" text DEFAULT 'sem descrição',
-	"birthday" timestamp NOT NULL,
-	"cpf" varchar(11) NOT NULL,
-	"created_at" timestamp DEFAULT now() NOT NULL,
-	"updated_at" timestamp DEFAULT now() NOT NULL,
-	"confirmed_at" timestamp,
-	"confirmation_sent_at" timestamp,
-	"deleted_at" timestamp,
-	"reactivated_at" timestamp,
-	"is_active" boolean DEFAULT true,
-	"user_stats_id" integer NOT NULL,
-	"level" integer DEFAULT 1,
-	"experience" integer DEFAULT 0,
-	"points" integer DEFAULT 0,
-	"level_xp" integer DEFAULT 0,
-	CONSTRAINT "users_id_unique" UNIQUE("id"),
-	CONSTRAINT "users_username_unique" UNIQUE("username"),
-	CONSTRAINT "users_email_unique" UNIQUE("email"),
-	CONSTRAINT "users_cpf_unique" UNIQUE("cpf"),
-	CONSTRAINT "users_user_stats_id_unique" UNIQUE("user_stats_id")
-);
---> statement-breakpoint
-DO $$ BEGIN
- ALTER TABLE "collection_likes" ADD CONSTRAINT "collection_likes_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;
-EXCEPTION
- WHEN duplicate_object THEN null;
-END $$;
---> statement-breakpoint
-DO $$ BEGIN
- ALTER TABLE "collection_likes" ADD CONSTRAINT "collection_likes_collection_id_collections_id_fk" FOREIGN KEY ("collection_id") REFERENCES "public"."collections"("id") ON DELETE cascade ON UPDATE no action;
-EXCEPTION
- WHEN duplicate_object THEN null;
-END $$;
---> statement-breakpoint
-DO $$ BEGIN
- ALTER TABLE "collection_resources" ADD CONSTRAINT "collection_resources_collection_id_collections_id_fk" FOREIGN KEY ("collection_id") REFERENCES "public"."collections"("id") ON DELETE cascade ON UPDATE no action;
-EXCEPTION
- WHEN duplicate_object THEN null;
-END $$;
---> statement-breakpoint
-DO $$ BEGIN
- ALTER TABLE "collection_resources" ADD CONSTRAINT "collection_resources_resource_id_resources_id_fk" FOREIGN KEY ("resource_id") REFERENCES "public"."resources"("id") ON DELETE cascade ON UPDATE no action;
-EXCEPTION
- WHEN duplicate_object THEN null;
-END $$;
---> statement-breakpoint
-DO $$ BEGIN
- ALTER TABLE "collections" ADD CONSTRAINT "collections_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;
-EXCEPTION
- WHEN duplicate_object THEN null;
-END $$;
---> statement-breakpoint
-DO $$ BEGIN
- ALTER TABLE "collections" ADD CONSTRAINT "collections_collection_stats_id_collection_stats_id_fk" FOREIGN KEY ("collection_stats_id") REFERENCES "public"."collection_stats"("id") ON DELETE cascade ON UPDATE no action;
-EXCEPTION
- WHEN duplicate_object THEN null;
-END $$;
---> statement-breakpoint
-DO $$ BEGIN
- ALTER TABLE "commentReply" ADD CONSTRAINT "commentReply_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;
-EXCEPTION
- WHEN duplicate_object THEN null;
-END $$;
---> statement-breakpoint
-DO $$ BEGIN
- ALTER TABLE "commentReply" ADD CONSTRAINT "commentReply_comment_id_comments_id_fk" FOREIGN KEY ("comment_id") REFERENCES "public"."comments"("id") ON DELETE cascade ON UPDATE no action;
-EXCEPTION
- WHEN duplicate_object THEN null;
-END $$;
---> statement-breakpoint
-DO $$ BEGIN
- ALTER TABLE "comments" ADD CONSTRAINT "comments_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;
-EXCEPTION
- WHEN duplicate_object THEN null;
-END $$;
---> statement-breakpoint
-DO $$ BEGIN
- ALTER TABLE "comments" ADD CONSTRAINT "comments_resource_id_resources_id_fk" FOREIGN KEY ("resource_id") REFERENCES "public"."resources"("id") ON DELETE cascade ON UPDATE no action;
-EXCEPTION
- WHEN duplicate_object THEN null;
-END $$;
---> statement-breakpoint
-DO $$ BEGIN
- ALTER TABLE "complaints" ADD CONSTRAINT "complaints_denouncer_id_users_id_fk" FOREIGN KEY ("denouncer_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;
-EXCEPTION
- WHEN duplicate_object THEN null;
-END $$;
---> statement-breakpoint
-DO $$ BEGIN
- ALTER TABLE "complaints" ADD CONSTRAINT "complaints_resource_id_resources_id_fk" FOREIGN KEY ("resource_id") REFERENCES "public"."resources"("id") ON DELETE cascade ON UPDATE no action;
-EXCEPTION
- WHEN duplicate_object THEN null;
-END $$;
---> statement-breakpoint
-DO $$ BEGIN
- ALTER TABLE "complaints" ADD CONSTRAINT "complaints_collection_id_collections_id_fk" FOREIGN KEY ("collection_id") REFERENCES "public"."collections"("id") ON DELETE cascade ON UPDATE no action;
-EXCEPTION
- WHEN duplicate_object THEN null;
-END $$;
---> statement-breakpoint
-DO $$ BEGIN
- ALTER TABLE "complaints" ADD CONSTRAINT "complaints_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;
-EXCEPTION
- WHEN duplicate_object THEN null;
-END $$;
---> statement-breakpoint
-DO $$ BEGIN
- ALTER TABLE "followers" ADD CONSTRAINT "followers_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;
-EXCEPTION
- WHEN duplicate_object THEN null;
-END $$;
---> statement-breakpoint
-DO $$ BEGIN
- ALTER TABLE "followers" ADD CONSTRAINT "followers_follower_id_users_id_fk" FOREIGN KEY ("follower_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;
-EXCEPTION
- WHEN duplicate_object THEN null;
-END $$;
---> statement-breakpoint
-DO $$ BEGIN
- ALTER TABLE "item_achievements" ADD CONSTRAINT "item_achievements_item_id_items_id_fk" FOREIGN KEY ("item_id") REFERENCES "public"."items"("id") ON DELETE cascade ON UPDATE no action;
-EXCEPTION
- WHEN duplicate_object THEN null;
-END $$;
---> statement-breakpoint
-DO $$ BEGIN
- ALTER TABLE "item_achievements" ADD CONSTRAINT "item_achievements_achievement_id_achievements_id_fk" FOREIGN KEY ("achievement_id") REFERENCES "public"."achievements"("id") ON DELETE cascade ON UPDATE no action;
-EXCEPTION
- WHEN duplicate_object THEN null;
-END $$;
---> statement-breakpoint
-DO $$ BEGIN
- ALTER TABLE "notifications" ADD CONSTRAINT "notifications_owner_id_users_id_fk" FOREIGN KEY ("owner_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;
-EXCEPTION
- WHEN duplicate_object THEN null;
-END $$;
---> statement-breakpoint
-DO $$ BEGIN
- ALTER TABLE "notifications" ADD CONSTRAINT "notifications_action_id_actions_id_fk" FOREIGN KEY ("action_id") REFERENCES "public"."actions"("id") ON DELETE cascade ON UPDATE no action;
-EXCEPTION
- WHEN duplicate_object THEN null;
-END $$;
---> statement-breakpoint
-DO $$ BEGIN
- ALTER TABLE "notifications" ADD CONSTRAINT "notifications_actor_user_id_users_id_fk" FOREIGN KEY ("actor_user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;
-EXCEPTION
- WHEN duplicate_object THEN null;
-END $$;
---> statement-breakpoint
-DO $$ BEGIN
- ALTER TABLE "notifications" ADD CONSTRAINT "notifications_target_user_id_users_id_fk" FOREIGN KEY ("target_user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;
-EXCEPTION
- WHEN duplicate_object THEN null;
-END $$;
---> statement-breakpoint
-DO $$ BEGIN
- ALTER TABLE "notifications" ADD CONSTRAINT "notifications_target_resource_id_resources_id_fk" FOREIGN KEY ("target_resource_id") REFERENCES "public"."resources"("id") ON DELETE cascade ON UPDATE no action;
-EXCEPTION
- WHEN duplicate_object THEN null;
-END $$;
---> statement-breakpoint
-DO $$ BEGIN
- ALTER TABLE "notifications" ADD CONSTRAINT "notifications_target_collection_id_collections_id_fk" FOREIGN KEY ("target_collection_id") REFERENCES "public"."collections"("id") ON DELETE cascade ON UPDATE no action;
-EXCEPTION
- WHEN duplicate_object THEN null;
-END $$;
---> statement-breakpoint
-DO $$ BEGIN
- ALTER TABLE "resource_educational_stages" ADD CONSTRAINT "resource_educational_stages_resource_id_resources_id_fk" FOREIGN KEY ("resource_id") REFERENCES "public"."resources"("id") ON DELETE cascade ON UPDATE no action;
-EXCEPTION
- WHEN duplicate_object THEN null;
-END $$;
---> statement-breakpoint
-DO $$ BEGIN
- ALTER TABLE "resource_educational_stages" ADD CONSTRAINT "resource_educational_stages_educational_stage_id_educational_stages_id_fk" FOREIGN KEY ("educational_stage_id") REFERENCES "public"."educational_stages"("id") ON DELETE cascade ON UPDATE no action;
-EXCEPTION
- WHEN duplicate_object THEN null;
-END $$;
---> statement-breakpoint
-DO $$ BEGIN
- ALTER TABLE "resource_languages" ADD CONSTRAINT "resource_languages_resource_id_resources_id_fk" FOREIGN KEY ("resource_id") REFERENCES "public"."resources"("id") ON DELETE cascade ON UPDATE no action;
-EXCEPTION
- WHEN duplicate_object THEN null;
-END $$;
---> statement-breakpoint
-DO $$ BEGIN
- ALTER TABLE "resource_languages" ADD CONSTRAINT "resource_languages_language_id_languages_id_fk" FOREIGN KEY ("language_id") REFERENCES "public"."languages"("id") ON DELETE cascade ON UPDATE no action;
-EXCEPTION
- WHEN duplicate_object THEN null;
-END $$;
---> statement-breakpoint
-DO $$ BEGIN
- ALTER TABLE "resource_likes" ADD CONSTRAINT "resource_likes_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;
-EXCEPTION
- WHEN duplicate_object THEN null;
-END $$;
---> statement-breakpoint
-DO $$ BEGIN
- ALTER TABLE "resource_likes" ADD CONSTRAINT "resource_likes_resource_id_resources_id_fk" FOREIGN KEY ("resource_id") REFERENCES "public"."resources"("id") ON DELETE cascade ON UPDATE no action;
-EXCEPTION
- WHEN duplicate_object THEN null;
-END $$;
---> statement-breakpoint
-DO $$ BEGIN
- ALTER TABLE "resource_subjects" ADD CONSTRAINT "resource_subjects_resource_id_resources_id_fk" FOREIGN KEY ("resource_id") REFERENCES "public"."resources"("id") ON DELETE cascade ON UPDATE no action;
-EXCEPTION
- WHEN duplicate_object THEN null;
-END $$;
---> statement-breakpoint
-DO $$ BEGIN
- ALTER TABLE "resource_subjects" ADD CONSTRAINT "resource_subjects_subject_id_subjects_id_fk" FOREIGN KEY ("subject_id") REFERENCES "public"."subjects"("id") ON DELETE cascade ON UPDATE no action;
-EXCEPTION
- WHEN duplicate_object THEN null;
-END $$;
---> statement-breakpoint
-DO $$ BEGIN
- ALTER TABLE "resources" ADD CONSTRAINT "resources_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;
-EXCEPTION
- WHEN duplicate_object THEN null;
-END $$;
---> statement-breakpoint
-DO $$ BEGIN
- ALTER TABLE "resources" ADD CONSTRAINT "resources_resource_stats_id_resource_stats_id_fk" FOREIGN KEY ("resource_stats_id") REFERENCES "public"."resource_stats"("id") ON DELETE cascade ON UPDATE no action;
-EXCEPTION
- WHEN duplicate_object THEN null;
-END $$;
---> statement-breakpoint
-DO $$ BEGIN
- ALTER TABLE "resources" ADD CONSTRAINT "resources_object_type_id_object_types_id_fk" FOREIGN KEY ("object_type_id") REFERENCES "public"."object_types"("id") ON DELETE cascade ON UPDATE no action;
-EXCEPTION
- WHEN duplicate_object THEN null;
-END $$;
---> statement-breakpoint
-DO $$ BEGIN
- ALTER TABLE "resources" ADD CONSTRAINT "resources_license_id_licenses_id_fk" FOREIGN KEY ("license_id") REFERENCES "public"."licenses"("id") ON DELETE cascade ON UPDATE no action;
-EXCEPTION
- WHEN duplicate_object THEN null;
-END $$;
---> statement-breakpoint
-DO $$ BEGIN
- ALTER TABLE "submissions" ADD CONSTRAINT "submissions_resource_id_resources_id_fk" FOREIGN KEY ("resource_id") REFERENCES "public"."resources"("id") ON DELETE cascade ON UPDATE no action;
-EXCEPTION
- WHEN duplicate_object THEN null;
-END $$;
---> statement-breakpoint
-DO $$ BEGIN
- ALTER TABLE "submissions" ADD CONSTRAINT "submissions_submitter_id_users_id_fk" FOREIGN KEY ("submitter_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;
-EXCEPTION
- WHEN duplicate_object THEN null;
-END $$;
---> statement-breakpoint
-DO $$ BEGIN
- ALTER TABLE "submissions" ADD CONSTRAINT "submissions_curator_id_users_id_fk" FOREIGN KEY ("curator_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;
-EXCEPTION
- WHEN duplicate_object THEN null;
-END $$;
---> statement-breakpoint
-DO $$ BEGIN
- ALTER TABLE "user_achievements" ADD CONSTRAINT "user_achievements_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;
-EXCEPTION
- WHEN duplicate_object THEN null;
-END $$;
---> statement-breakpoint
-DO $$ BEGIN
- ALTER TABLE "user_achievements" ADD CONSTRAINT "user_achievements_achievement_id_users_id_fk" FOREIGN KEY ("achievement_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;
-EXCEPTION
- WHEN duplicate_object THEN null;
-END $$;
---> statement-breakpoint
-DO $$ BEGIN
- ALTER TABLE "user_collections" ADD CONSTRAINT "user_collections_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;
-EXCEPTION
- WHEN duplicate_object THEN null;
-END $$;
---> statement-breakpoint
-DO $$ BEGIN
- ALTER TABLE "user_collections" ADD CONSTRAINT "user_collections_collection_id_collections_id_fk" FOREIGN KEY ("collection_id") REFERENCES "public"."collections"("id") ON DELETE cascade ON UPDATE no action;
-EXCEPTION
- WHEN duplicate_object THEN null;
-END $$;
---> statement-breakpoint
-DO $$ BEGIN
- ALTER TABLE "user_institutions" ADD CONSTRAINT "user_institutions_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;
-EXCEPTION
- WHEN duplicate_object THEN null;
-END $$;
---> statement-breakpoint
-DO $$ BEGIN
- ALTER TABLE "user_institutions" ADD CONSTRAINT "user_institutions_institution_id_institutions_id_fk" FOREIGN KEY ("institution_id") REFERENCES "public"."institutions"("id") ON DELETE cascade ON UPDATE no action;
-EXCEPTION
- WHEN duplicate_object THEN null;
-END $$;
---> statement-breakpoint
-DO $$ BEGIN
- ALTER TABLE "user_items" ADD CONSTRAINT "user_items_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;
-EXCEPTION
- WHEN duplicate_object THEN null;
-END $$;
---> statement-breakpoint
-DO $$ BEGIN
- ALTER TABLE "user_items" ADD CONSTRAINT "user_items_item_id_items_id_fk" FOREIGN KEY ("item_id") REFERENCES "public"."items"("id") ON DELETE cascade ON UPDATE no action;
-EXCEPTION
- WHEN duplicate_object THEN null;
-END $$;
---> statement-breakpoint
-DO $$ BEGIN
- ALTER TABLE "user_roles" ADD CONSTRAINT "user_roles_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;
-EXCEPTION
- WHEN duplicate_object THEN null;
-END $$;
---> statement-breakpoint
-DO $$ BEGIN
- ALTER TABLE "user_roles" ADD CONSTRAINT "user_roles_role_id_roles_id_fk" FOREIGN KEY ("role_id") REFERENCES "public"."roles"("id") ON DELETE cascade ON UPDATE no action;
-EXCEPTION
- WHEN duplicate_object THEN null;
-END $$;
---> statement-breakpoint
-DO $$ BEGIN
- ALTER TABLE "users" ADD CONSTRAINT "users_user_stats_id_user_stats_id_fk" FOREIGN KEY ("user_stats_id") REFERENCES "public"."user_stats"("id") ON DELETE no action ON UPDATE no action;
-EXCEPTION
- WHEN duplicate_object THEN null;
-END $$;
diff --git a/src/db/migrations/meta/0001_snapshot.json b/src/db/migrations/meta/0001_snapshot.json
deleted file mode 100644
index 1dbb8e6f4dad5d5e4fcdbcaac3c2277e566a3fa8..0000000000000000000000000000000000000000
--- a/src/db/migrations/meta/0001_snapshot.json
+++ /dev/null
@@ -1,2554 +0,0 @@
-{
-  "id": "5839f5ff-e09a-433f-9517-b6d374d4521f",
-  "prevId": "69415c6c-8351-4948-b467-c4c262bf063e",
-  "version": "7",
-  "dialect": "postgresql",
-  "tables": {
-    "public.achievements": {
-      "name": "achievements",
-      "schema": "",
-      "columns": {
-        "id": {
-          "name": "id",
-          "type": "serial",
-          "primaryKey": true,
-          "notNull": true
-        },
-        "name": {
-          "name": "name",
-          "type": "varchar(255)",
-          "primaryKey": false,
-          "notNull": true
-        },
-        "description": {
-          "name": "description",
-          "type": "text",
-          "primaryKey": false,
-          "notNull": false
-        },
-        "reward_experience": {
-          "name": "reward_experience",
-          "type": "numeric",
-          "primaryKey": false,
-          "notNull": false
-        },
-        "reward_points": {
-          "name": "reward_points",
-          "type": "numeric",
-          "primaryKey": false,
-          "notNull": false
-        },
-        "review_state": {
-          "name": "review_state",
-          "type": "review_state",
-          "typeSchema": "public",
-          "primaryKey": false,
-          "notNull": true,
-          "default": "'under_review'"
-        },
-        "repeatable": {
-          "name": "repeatable",
-          "type": "integer",
-          "primaryKey": false,
-          "notNull": true
-        },
-        "is_resettable": {
-          "name": "is_resettable",
-          "type": "boolean",
-          "primaryKey": false,
-          "notNull": true
-        },
-        "created_at": {
-          "name": "created_at",
-          "type": "timestamp",
-          "primaryKey": false,
-          "notNull": true,
-          "default": "now()"
-        },
-        "updated_at": {
-          "name": "updated_at",
-          "type": "timestamp",
-          "primaryKey": false,
-          "notNull": true,
-          "default": "now()"
-        }
-      },
-      "indexes": {},
-      "foreignKeys": {},
-      "compositePrimaryKeys": {},
-      "uniqueConstraints": {
-        "achievements_id_unique": {
-          "name": "achievements_id_unique",
-          "nullsNotDistinct": false,
-          "columns": [
-            "id"
-          ]
-        }
-      }
-    },
-    "public.actions": {
-      "name": "actions",
-      "schema": "",
-      "columns": {
-        "id": {
-          "name": "id",
-          "type": "serial",
-          "primaryKey": true,
-          "notNull": true
-        },
-        "name": {
-          "name": "name",
-          "type": "varchar(255)",
-          "primaryKey": false,
-          "notNull": true
-        },
-        "created_at": {
-          "name": "created_at",
-          "type": "timestamp",
-          "primaryKey": false,
-          "notNull": true,
-          "default": "now()"
-        },
-        "updated_at": {
-          "name": "updated_at",
-          "type": "timestamp",
-          "primaryKey": false,
-          "notNull": true,
-          "default": "now()"
-        }
-      },
-      "indexes": {},
-      "foreignKeys": {},
-      "compositePrimaryKeys": {},
-      "uniqueConstraints": {
-        "actions_id_unique": {
-          "name": "actions_id_unique",
-          "nullsNotDistinct": false,
-          "columns": [
-            "id"
-          ]
-        }
-      }
-    },
-    "public.collection_likes": {
-      "name": "collection_likes",
-      "schema": "",
-      "columns": {
-        "id": {
-          "name": "id",
-          "type": "serial",
-          "primaryKey": true,
-          "notNull": true
-        },
-        "user_id": {
-          "name": "user_id",
-          "type": "integer",
-          "primaryKey": false,
-          "notNull": true
-        },
-        "collection_id": {
-          "name": "collection_id",
-          "type": "integer",
-          "primaryKey": false,
-          "notNull": true
-        }
-      },
-      "indexes": {},
-      "foreignKeys": {
-        "collection_likes_user_id_users_id_fk": {
-          "name": "collection_likes_user_id_users_id_fk",
-          "tableFrom": "collection_likes",
-          "tableTo": "users",
-          "columnsFrom": [
-            "user_id"
-          ],
-          "columnsTo": [
-            "id"
-          ],
-          "onDelete": "cascade",
-          "onUpdate": "no action"
-        },
-        "collection_likes_collection_id_collections_id_fk": {
-          "name": "collection_likes_collection_id_collections_id_fk",
-          "tableFrom": "collection_likes",
-          "tableTo": "collections",
-          "columnsFrom": [
-            "collection_id"
-          ],
-          "columnsTo": [
-            "id"
-          ],
-          "onDelete": "cascade",
-          "onUpdate": "no action"
-        }
-      },
-      "compositePrimaryKeys": {},
-      "uniqueConstraints": {
-        "collection_likes_id_unique": {
-          "name": "collection_likes_id_unique",
-          "nullsNotDistinct": false,
-          "columns": [
-            "id"
-          ]
-        }
-      }
-    },
-    "public.collection_resources": {
-      "name": "collection_resources",
-      "schema": "",
-      "columns": {
-        "id": {
-          "name": "id",
-          "type": "serial",
-          "primaryKey": true,
-          "notNull": true
-        },
-        "collection_id": {
-          "name": "collection_id",
-          "type": "integer",
-          "primaryKey": false,
-          "notNull": true
-        },
-        "resource_id": {
-          "name": "resource_id",
-          "type": "integer",
-          "primaryKey": false,
-          "notNull": true
-        }
-      },
-      "indexes": {},
-      "foreignKeys": {
-        "collection_resources_collection_id_collections_id_fk": {
-          "name": "collection_resources_collection_id_collections_id_fk",
-          "tableFrom": "collection_resources",
-          "tableTo": "collections",
-          "columnsFrom": [
-            "collection_id"
-          ],
-          "columnsTo": [
-            "id"
-          ],
-          "onDelete": "cascade",
-          "onUpdate": "no action"
-        },
-        "collection_resources_resource_id_resources_id_fk": {
-          "name": "collection_resources_resource_id_resources_id_fk",
-          "tableFrom": "collection_resources",
-          "tableTo": "resources",
-          "columnsFrom": [
-            "resource_id"
-          ],
-          "columnsTo": [
-            "id"
-          ],
-          "onDelete": "cascade",
-          "onUpdate": "no action"
-        }
-      },
-      "compositePrimaryKeys": {},
-      "uniqueConstraints": {
-        "collection_resources_id_unique": {
-          "name": "collection_resources_id_unique",
-          "nullsNotDistinct": false,
-          "columns": [
-            "id"
-          ]
-        }
-      }
-    },
-    "public.collection_stats": {
-      "name": "collection_stats",
-      "schema": "",
-      "columns": {
-        "id": {
-          "name": "id",
-          "type": "serial",
-          "primaryKey": true,
-          "notNull": true
-        },
-        "views": {
-          "name": "views",
-          "type": "integer",
-          "primaryKey": false,
-          "notNull": true,
-          "default": 0
-        },
-        "downloads": {
-          "name": "downloads",
-          "type": "integer",
-          "primaryKey": false,
-          "notNull": true,
-          "default": 0
-        },
-        "likes": {
-          "name": "likes",
-          "type": "integer",
-          "primaryKey": false,
-          "notNull": true,
-          "default": 0
-        },
-        "shares": {
-          "name": "shares",
-          "type": "integer",
-          "primaryKey": false,
-          "notNull": true,
-          "default": 0
-        },
-        "score": {
-          "name": "score",
-          "type": "numeric",
-          "primaryKey": false,
-          "notNull": true,
-          "default": "'0.0'"
-        },
-        "follows": {
-          "name": "follows",
-          "type": "integer",
-          "primaryKey": false,
-          "notNull": true,
-          "default": 0
-        }
-      },
-      "indexes": {},
-      "foreignKeys": {},
-      "compositePrimaryKeys": {},
-      "uniqueConstraints": {
-        "collection_stats_id_unique": {
-          "name": "collection_stats_id_unique",
-          "nullsNotDistinct": false,
-          "columns": [
-            "id"
-          ]
-        }
-      }
-    },
-    "public.collections": {
-      "name": "collections",
-      "schema": "",
-      "columns": {
-        "id": {
-          "name": "id",
-          "type": "serial",
-          "primaryKey": true,
-          "notNull": true
-        },
-        "name": {
-          "name": "name",
-          "type": "varchar(255)",
-          "primaryKey": false,
-          "notNull": true
-        },
-        "description": {
-          "name": "description",
-          "type": "text",
-          "primaryKey": false,
-          "notNull": false
-        },
-        "is_private": {
-          "name": "is_private",
-          "type": "boolean",
-          "primaryKey": false,
-          "notNull": false,
-          "default": false
-        },
-        "is_active": {
-          "name": "is_active",
-          "type": "boolean",
-          "primaryKey": false,
-          "notNull": false
-        },
-        "created_at": {
-          "name": "created_at",
-          "type": "timestamp",
-          "primaryKey": false,
-          "notNull": true,
-          "default": "now()"
-        },
-        "updated_at": {
-          "name": "updated_at",
-          "type": "timestamp",
-          "primaryKey": false,
-          "notNull": true,
-          "default": "now()"
-        },
-        "deleted_at": {
-          "name": "deleted_at",
-          "type": "timestamp",
-          "primaryKey": false,
-          "notNull": false
-        },
-        "thumbnail": {
-          "name": "thumbnail",
-          "type": "varchar(255)",
-          "primaryKey": false,
-          "notNull": false
-        },
-        "user_id": {
-          "name": "user_id",
-          "type": "integer",
-          "primaryKey": false,
-          "notNull": true
-        },
-        "collection_stats_id": {
-          "name": "collection_stats_id",
-          "type": "integer",
-          "primaryKey": false,
-          "notNull": true
-        }
-      },
-      "indexes": {},
-      "foreignKeys": {
-        "collections_user_id_users_id_fk": {
-          "name": "collections_user_id_users_id_fk",
-          "tableFrom": "collections",
-          "tableTo": "users",
-          "columnsFrom": [
-            "user_id"
-          ],
-          "columnsTo": [
-            "id"
-          ],
-          "onDelete": "cascade",
-          "onUpdate": "no action"
-        },
-        "collections_collection_stats_id_collection_stats_id_fk": {
-          "name": "collections_collection_stats_id_collection_stats_id_fk",
-          "tableFrom": "collections",
-          "tableTo": "collection_stats",
-          "columnsFrom": [
-            "collection_stats_id"
-          ],
-          "columnsTo": [
-            "id"
-          ],
-          "onDelete": "cascade",
-          "onUpdate": "no action"
-        }
-      },
-      "compositePrimaryKeys": {},
-      "uniqueConstraints": {
-        "collections_id_unique": {
-          "name": "collections_id_unique",
-          "nullsNotDistinct": false,
-          "columns": [
-            "id"
-          ]
-        },
-        "collections_collection_stats_id_unique": {
-          "name": "collections_collection_stats_id_unique",
-          "nullsNotDistinct": false,
-          "columns": [
-            "collection_stats_id"
-          ]
-        }
-      }
-    },
-    "public.commentReply": {
-      "name": "commentReply",
-      "schema": "",
-      "columns": {
-        "id": {
-          "name": "id",
-          "type": "serial",
-          "primaryKey": true,
-          "notNull": true
-        },
-        "user_id": {
-          "name": "user_id",
-          "type": "integer",
-          "primaryKey": false,
-          "notNull": true
-        },
-        "comment_id": {
-          "name": "comment_id",
-          "type": "integer",
-          "primaryKey": false,
-          "notNull": true
-        },
-        "text": {
-          "name": "text",
-          "type": "text",
-          "primaryKey": false,
-          "notNull": true
-        },
-        "created_at": {
-          "name": "created_at",
-          "type": "timestamp",
-          "primaryKey": false,
-          "notNull": true,
-          "default": "now()"
-        },
-        "deleted_at": {
-          "name": "deleted_at",
-          "type": "timestamp",
-          "primaryKey": false,
-          "notNull": false
-        },
-        "update_at": {
-          "name": "update_at",
-          "type": "timestamp",
-          "primaryKey": false,
-          "notNull": true,
-          "default": "now()"
-        }
-      },
-      "indexes": {},
-      "foreignKeys": {
-        "commentReply_user_id_users_id_fk": {
-          "name": "commentReply_user_id_users_id_fk",
-          "tableFrom": "commentReply",
-          "tableTo": "users",
-          "columnsFrom": [
-            "user_id"
-          ],
-          "columnsTo": [
-            "id"
-          ],
-          "onDelete": "cascade",
-          "onUpdate": "no action"
-        },
-        "commentReply_comment_id_comments_id_fk": {
-          "name": "commentReply_comment_id_comments_id_fk",
-          "tableFrom": "commentReply",
-          "tableTo": "comments",
-          "columnsFrom": [
-            "comment_id"
-          ],
-          "columnsTo": [
-            "id"
-          ],
-          "onDelete": "cascade",
-          "onUpdate": "no action"
-        }
-      },
-      "compositePrimaryKeys": {},
-      "uniqueConstraints": {
-        "commentReply_id_unique": {
-          "name": "commentReply_id_unique",
-          "nullsNotDistinct": false,
-          "columns": [
-            "id"
-          ]
-        }
-      }
-    },
-    "public.comments": {
-      "name": "comments",
-      "schema": "",
-      "columns": {
-        "id": {
-          "name": "id",
-          "type": "serial",
-          "primaryKey": true,
-          "notNull": true
-        },
-        "user_id": {
-          "name": "user_id",
-          "type": "integer",
-          "primaryKey": false,
-          "notNull": true
-        },
-        "resource_id": {
-          "name": "resource_id",
-          "type": "integer",
-          "primaryKey": false,
-          "notNull": true
-        },
-        "text": {
-          "name": "text",
-          "type": "text",
-          "primaryKey": false,
-          "notNull": true
-        },
-        "created_at": {
-          "name": "created_at",
-          "type": "timestamp",
-          "primaryKey": false,
-          "notNull": true,
-          "default": "now()"
-        },
-        "deleted_at": {
-          "name": "deleted_at",
-          "type": "timestamp",
-          "primaryKey": false,
-          "notNull": false
-        },
-        "updated_at": {
-          "name": "updated_at",
-          "type": "timestamp",
-          "primaryKey": false,
-          "notNull": true,
-          "default": "now()"
-        }
-      },
-      "indexes": {},
-      "foreignKeys": {
-        "comments_user_id_users_id_fk": {
-          "name": "comments_user_id_users_id_fk",
-          "tableFrom": "comments",
-          "tableTo": "users",
-          "columnsFrom": [
-            "user_id"
-          ],
-          "columnsTo": [
-            "id"
-          ],
-          "onDelete": "cascade",
-          "onUpdate": "no action"
-        },
-        "comments_resource_id_resources_id_fk": {
-          "name": "comments_resource_id_resources_id_fk",
-          "tableFrom": "comments",
-          "tableTo": "resources",
-          "columnsFrom": [
-            "resource_id"
-          ],
-          "columnsTo": [
-            "id"
-          ],
-          "onDelete": "cascade",
-          "onUpdate": "no action"
-        }
-      },
-      "compositePrimaryKeys": {},
-      "uniqueConstraints": {
-        "comments_id_unique": {
-          "name": "comments_id_unique",
-          "nullsNotDistinct": false,
-          "columns": [
-            "id"
-          ]
-        }
-      }
-    },
-    "public.complaints": {
-      "name": "complaints",
-      "schema": "",
-      "columns": {
-        "id": {
-          "name": "id",
-          "type": "serial",
-          "primaryKey": true,
-          "notNull": true
-        },
-        "state": {
-          "name": "state",
-          "type": "complaints_state",
-          "typeSchema": "public",
-          "primaryKey": false,
-          "notNull": true,
-          "default": "'complained'"
-        },
-        "description": {
-          "name": "description",
-          "type": "text",
-          "primaryKey": false,
-          "notNull": true
-        },
-        "denouncer_id": {
-          "name": "denouncer_id",
-          "type": "integer",
-          "primaryKey": false,
-          "notNull": true
-        },
-        "resource_id": {
-          "name": "resource_id",
-          "type": "integer",
-          "primaryKey": false,
-          "notNull": true
-        },
-        "collection_id": {
-          "name": "collection_id",
-          "type": "integer",
-          "primaryKey": false,
-          "notNull": false
-        },
-        "user_id": {
-          "name": "user_id",
-          "type": "integer",
-          "primaryKey": false,
-          "notNull": false
-        },
-        "evaluated_at": {
-          "name": "evaluated_at",
-          "type": "timestamp",
-          "primaryKey": false,
-          "notNull": false
-        },
-        "created_at": {
-          "name": "created_at",
-          "type": "timestamp",
-          "primaryKey": false,
-          "notNull": true,
-          "default": "now()"
-        },
-        "q1": {
-          "name": "q1",
-          "type": "boolean",
-          "primaryKey": false,
-          "notNull": false
-        },
-        "q2": {
-          "name": "q2",
-          "type": "boolean",
-          "primaryKey": false,
-          "notNull": false
-        },
-        "q3": {
-          "name": "q3",
-          "type": "boolean",
-          "primaryKey": false,
-          "notNull": false
-        },
-        "q4": {
-          "name": "q4",
-          "type": "boolean",
-          "primaryKey": false,
-          "notNull": false
-        },
-        "q5": {
-          "name": "q5",
-          "type": "boolean",
-          "primaryKey": false,
-          "notNull": false
-        },
-        "q6": {
-          "name": "q6",
-          "type": "boolean",
-          "primaryKey": false,
-          "notNull": false
-        },
-        "q7": {
-          "name": "q7",
-          "type": "boolean",
-          "primaryKey": false,
-          "notNull": false
-        }
-      },
-      "indexes": {},
-      "foreignKeys": {
-        "complaints_denouncer_id_users_id_fk": {
-          "name": "complaints_denouncer_id_users_id_fk",
-          "tableFrom": "complaints",
-          "tableTo": "users",
-          "columnsFrom": [
-            "denouncer_id"
-          ],
-          "columnsTo": [
-            "id"
-          ],
-          "onDelete": "cascade",
-          "onUpdate": "no action"
-        },
-        "complaints_resource_id_resources_id_fk": {
-          "name": "complaints_resource_id_resources_id_fk",
-          "tableFrom": "complaints",
-          "tableTo": "resources",
-          "columnsFrom": [
-            "resource_id"
-          ],
-          "columnsTo": [
-            "id"
-          ],
-          "onDelete": "cascade",
-          "onUpdate": "no action"
-        },
-        "complaints_collection_id_collections_id_fk": {
-          "name": "complaints_collection_id_collections_id_fk",
-          "tableFrom": "complaints",
-          "tableTo": "collections",
-          "columnsFrom": [
-            "collection_id"
-          ],
-          "columnsTo": [
-            "id"
-          ],
-          "onDelete": "cascade",
-          "onUpdate": "no action"
-        },
-        "complaints_user_id_users_id_fk": {
-          "name": "complaints_user_id_users_id_fk",
-          "tableFrom": "complaints",
-          "tableTo": "users",
-          "columnsFrom": [
-            "user_id"
-          ],
-          "columnsTo": [
-            "id"
-          ],
-          "onDelete": "cascade",
-          "onUpdate": "no action"
-        }
-      },
-      "compositePrimaryKeys": {},
-      "uniqueConstraints": {
-        "complaints_id_unique": {
-          "name": "complaints_id_unique",
-          "nullsNotDistinct": false,
-          "columns": [
-            "id"
-          ]
-        }
-      }
-    },
-    "public.educational_stages": {
-      "name": "educational_stages",
-      "schema": "",
-      "columns": {
-        "id": {
-          "name": "id",
-          "type": "serial",
-          "primaryKey": true,
-          "notNull": true
-        },
-        "name": {
-          "name": "name",
-          "type": "varchar(255)",
-          "primaryKey": false,
-          "notNull": true
-        }
-      },
-      "indexes": {},
-      "foreignKeys": {},
-      "compositePrimaryKeys": {},
-      "uniqueConstraints": {
-        "educational_stages_id_unique": {
-          "name": "educational_stages_id_unique",
-          "nullsNotDistinct": false,
-          "columns": [
-            "id"
-          ]
-        }
-      }
-    },
-    "public.followers": {
-      "name": "followers",
-      "schema": "",
-      "columns": {
-        "id": {
-          "name": "id",
-          "type": "serial",
-          "primaryKey": true,
-          "notNull": true
-        },
-        "user_id": {
-          "name": "user_id",
-          "type": "integer",
-          "primaryKey": false,
-          "notNull": true
-        },
-        "follower_id": {
-          "name": "follower_id",
-          "type": "integer",
-          "primaryKey": false,
-          "notNull": true
-        }
-      },
-      "indexes": {},
-      "foreignKeys": {
-        "followers_user_id_users_id_fk": {
-          "name": "followers_user_id_users_id_fk",
-          "tableFrom": "followers",
-          "tableTo": "users",
-          "columnsFrom": [
-            "user_id"
-          ],
-          "columnsTo": [
-            "id"
-          ],
-          "onDelete": "cascade",
-          "onUpdate": "no action"
-        },
-        "followers_follower_id_users_id_fk": {
-          "name": "followers_follower_id_users_id_fk",
-          "tableFrom": "followers",
-          "tableTo": "users",
-          "columnsFrom": [
-            "follower_id"
-          ],
-          "columnsTo": [
-            "id"
-          ],
-          "onDelete": "cascade",
-          "onUpdate": "no action"
-        }
-      },
-      "compositePrimaryKeys": {},
-      "uniqueConstraints": {
-        "followers_id_unique": {
-          "name": "followers_id_unique",
-          "nullsNotDistinct": false,
-          "columns": [
-            "id"
-          ]
-        }
-      }
-    },
-    "public.institutions": {
-      "name": "institutions",
-      "schema": "",
-      "columns": {
-        "id": {
-          "name": "id",
-          "type": "serial",
-          "primaryKey": true,
-          "notNull": true
-        },
-        "name": {
-          "name": "name",
-          "type": "varchar(255)",
-          "primaryKey": false,
-          "notNull": true
-        },
-        "uf": {
-          "name": "uf",
-          "type": "varchar(2)",
-          "primaryKey": false,
-          "notNull": false
-        },
-        "city": {
-          "name": "city",
-          "type": "varchar(255)",
-          "primaryKey": false,
-          "notNull": false
-        },
-        "cep": {
-          "name": "cep",
-          "type": "varchar(10)",
-          "primaryKey": false,
-          "notNull": false
-        },
-        "created_at": {
-          "name": "created_at",
-          "type": "timestamp",
-          "primaryKey": false,
-          "notNull": true,
-          "default": "now()"
-        },
-        "updated_at": {
-          "name": "updated_at",
-          "type": "timestamp",
-          "primaryKey": false,
-          "notNull": true,
-          "default": "now()"
-        }
-      },
-      "indexes": {},
-      "foreignKeys": {},
-      "compositePrimaryKeys": {},
-      "uniqueConstraints": {
-        "institutions_id_unique": {
-          "name": "institutions_id_unique",
-          "nullsNotDistinct": false,
-          "columns": [
-            "id"
-          ]
-        }
-      }
-    },
-    "public.item_achievements": {
-      "name": "item_achievements",
-      "schema": "",
-      "columns": {
-        "item_id": {
-          "name": "item_id",
-          "type": "integer",
-          "primaryKey": false,
-          "notNull": true
-        },
-        "achievement_id": {
-          "name": "achievement_id",
-          "type": "integer",
-          "primaryKey": false,
-          "notNull": true
-        }
-      },
-      "indexes": {},
-      "foreignKeys": {
-        "item_achievements_item_id_items_id_fk": {
-          "name": "item_achievements_item_id_items_id_fk",
-          "tableFrom": "item_achievements",
-          "tableTo": "items",
-          "columnsFrom": [
-            "item_id"
-          ],
-          "columnsTo": [
-            "id"
-          ],
-          "onDelete": "cascade",
-          "onUpdate": "no action"
-        },
-        "item_achievements_achievement_id_achievements_id_fk": {
-          "name": "item_achievements_achievement_id_achievements_id_fk",
-          "tableFrom": "item_achievements",
-          "tableTo": "achievements",
-          "columnsFrom": [
-            "achievement_id"
-          ],
-          "columnsTo": [
-            "id"
-          ],
-          "onDelete": "cascade",
-          "onUpdate": "no action"
-        }
-      },
-      "compositePrimaryKeys": {
-        "item_achievements_item_id_achievement_id_pk": {
-          "name": "item_achievements_item_id_achievement_id_pk",
-          "columns": [
-            "item_id",
-            "achievement_id"
-          ]
-        }
-      },
-      "uniqueConstraints": {}
-    },
-    "public.items": {
-      "name": "items",
-      "schema": "",
-      "columns": {
-        "id": {
-          "name": "id",
-          "type": "serial",
-          "primaryKey": true,
-          "notNull": true
-        },
-        "name": {
-          "name": "name",
-          "type": "varchar(255)",
-          "primaryKey": false,
-          "notNull": true
-        },
-        "price": {
-          "name": "price",
-          "type": "numeric",
-          "primaryKey": false,
-          "notNull": false
-        },
-        "discount": {
-          "name": "discount",
-          "type": "numeric",
-          "primaryKey": false,
-          "notNull": false
-        },
-        "description": {
-          "name": "description",
-          "type": "text",
-          "primaryKey": false,
-          "notNull": false
-        },
-        "is_active": {
-          "name": "is_active",
-          "type": "boolean",
-          "primaryKey": false,
-          "notNull": false,
-          "default": false
-        },
-        "created_at": {
-          "name": "created_at",
-          "type": "timestamp",
-          "primaryKey": false,
-          "notNull": true,
-          "default": "now()"
-        },
-        "updated_at": {
-          "name": "updated_at",
-          "type": "timestamp",
-          "primaryKey": false,
-          "notNull": true,
-          "default": "now()"
-        }
-      },
-      "indexes": {},
-      "foreignKeys": {},
-      "compositePrimaryKeys": {},
-      "uniqueConstraints": {
-        "items_id_unique": {
-          "name": "items_id_unique",
-          "nullsNotDistinct": false,
-          "columns": [
-            "id"
-          ]
-        }
-      }
-    },
-    "public.languages": {
-      "name": "languages",
-      "schema": "",
-      "columns": {
-        "id": {
-          "name": "id",
-          "type": "serial",
-          "primaryKey": true,
-          "notNull": true
-        },
-        "name": {
-          "name": "name",
-          "type": "varchar(255)",
-          "primaryKey": false,
-          "notNull": true
-        },
-        "code": {
-          "name": "code",
-          "type": "varchar(10)",
-          "primaryKey": false,
-          "notNull": true
-        }
-      },
-      "indexes": {},
-      "foreignKeys": {},
-      "compositePrimaryKeys": {},
-      "uniqueConstraints": {
-        "languages_id_unique": {
-          "name": "languages_id_unique",
-          "nullsNotDistinct": false,
-          "columns": [
-            "id"
-          ]
-        },
-        "languages_code_unique": {
-          "name": "languages_code_unique",
-          "nullsNotDistinct": false,
-          "columns": [
-            "code"
-          ]
-        }
-      }
-    },
-    "public.licenses": {
-      "name": "licenses",
-      "schema": "",
-      "columns": {
-        "id": {
-          "name": "id",
-          "type": "serial",
-          "primaryKey": true,
-          "notNull": true
-        },
-        "name": {
-          "name": "name",
-          "type": "varchar(255)",
-          "primaryKey": false,
-          "notNull": true
-        },
-        "description": {
-          "name": "description",
-          "type": "text",
-          "primaryKey": false,
-          "notNull": true
-        },
-        "url": {
-          "name": "url",
-          "type": "varchar(255)",
-          "primaryKey": false,
-          "notNull": true
-        }
-      },
-      "indexes": {},
-      "foreignKeys": {},
-      "compositePrimaryKeys": {},
-      "uniqueConstraints": {
-        "licenses_id_unique": {
-          "name": "licenses_id_unique",
-          "nullsNotDistinct": false,
-          "columns": [
-            "id"
-          ]
-        }
-      }
-    },
-    "public.object_types": {
-      "name": "object_types",
-      "schema": "",
-      "columns": {
-        "id": {
-          "name": "id",
-          "type": "serial",
-          "primaryKey": true,
-          "notNull": true
-        },
-        "name": {
-          "name": "name",
-          "type": "varchar(255)",
-          "primaryKey": false,
-          "notNull": true
-        }
-      },
-      "indexes": {},
-      "foreignKeys": {},
-      "compositePrimaryKeys": {},
-      "uniqueConstraints": {
-        "object_types_id_unique": {
-          "name": "object_types_id_unique",
-          "nullsNotDistinct": false,
-          "columns": [
-            "id"
-          ]
-        }
-      }
-    },
-    "public.resource_educational_stages": {
-      "name": "resource_educational_stages",
-      "schema": "",
-      "columns": {
-        "id": {
-          "name": "id",
-          "type": "serial",
-          "primaryKey": true,
-          "notNull": true
-        },
-        "resource_id": {
-          "name": "resource_id",
-          "type": "integer",
-          "primaryKey": false,
-          "notNull": true
-        },
-        "educational_stage_id": {
-          "name": "educational_stage_id",
-          "type": "integer",
-          "primaryKey": false,
-          "notNull": true
-        }
-      },
-      "indexes": {},
-      "foreignKeys": {
-        "resource_educational_stages_resource_id_resources_id_fk": {
-          "name": "resource_educational_stages_resource_id_resources_id_fk",
-          "tableFrom": "resource_educational_stages",
-          "tableTo": "resources",
-          "columnsFrom": [
-            "resource_id"
-          ],
-          "columnsTo": [
-            "id"
-          ],
-          "onDelete": "cascade",
-          "onUpdate": "no action"
-        },
-        "resource_educational_stages_educational_stage_id_educational_stages_id_fk": {
-          "name": "resource_educational_stages_educational_stage_id_educational_stages_id_fk",
-          "tableFrom": "resource_educational_stages",
-          "tableTo": "educational_stages",
-          "columnsFrom": [
-            "educational_stage_id"
-          ],
-          "columnsTo": [
-            "id"
-          ],
-          "onDelete": "cascade",
-          "onUpdate": "no action"
-        }
-      },
-      "compositePrimaryKeys": {},
-      "uniqueConstraints": {
-        "resource_educational_stages_id_unique": {
-          "name": "resource_educational_stages_id_unique",
-          "nullsNotDistinct": false,
-          "columns": [
-            "id"
-          ]
-        }
-      }
-    },
-    "public.resource_languages": {
-      "name": "resource_languages",
-      "schema": "",
-      "columns": {
-        "id": {
-          "name": "id",
-          "type": "serial",
-          "primaryKey": true,
-          "notNull": true
-        },
-        "resource_id": {
-          "name": "resource_id",
-          "type": "integer",
-          "primaryKey": false,
-          "notNull": true
-        },
-        "language_id": {
-          "name": "language_id",
-          "type": "integer",
-          "primaryKey": false,
-          "notNull": true
-        }
-      },
-      "indexes": {},
-      "foreignKeys": {
-        "resource_languages_resource_id_resources_id_fk": {
-          "name": "resource_languages_resource_id_resources_id_fk",
-          "tableFrom": "resource_languages",
-          "tableTo": "resources",
-          "columnsFrom": [
-            "resource_id"
-          ],
-          "columnsTo": [
-            "id"
-          ],
-          "onDelete": "cascade",
-          "onUpdate": "no action"
-        },
-        "resource_languages_language_id_languages_id_fk": {
-          "name": "resource_languages_language_id_languages_id_fk",
-          "tableFrom": "resource_languages",
-          "tableTo": "languages",
-          "columnsFrom": [
-            "language_id"
-          ],
-          "columnsTo": [
-            "id"
-          ],
-          "onDelete": "cascade",
-          "onUpdate": "no action"
-        }
-      },
-      "compositePrimaryKeys": {},
-      "uniqueConstraints": {
-        "resource_languages_id_unique": {
-          "name": "resource_languages_id_unique",
-          "nullsNotDistinct": false,
-          "columns": [
-            "id"
-          ]
-        }
-      }
-    },
-    "public.resource_likes": {
-      "name": "resource_likes",
-      "schema": "",
-      "columns": {
-        "id": {
-          "name": "id",
-          "type": "serial",
-          "primaryKey": true,
-          "notNull": true
-        },
-        "user_id": {
-          "name": "user_id",
-          "type": "integer",
-          "primaryKey": false,
-          "notNull": true
-        },
-        "resource_id": {
-          "name": "resource_id",
-          "type": "integer",
-          "primaryKey": false,
-          "notNull": true
-        }
-      },
-      "indexes": {},
-      "foreignKeys": {
-        "resource_likes_user_id_users_id_fk": {
-          "name": "resource_likes_user_id_users_id_fk",
-          "tableFrom": "resource_likes",
-          "tableTo": "users",
-          "columnsFrom": [
-            "user_id"
-          ],
-          "columnsTo": [
-            "id"
-          ],
-          "onDelete": "cascade",
-          "onUpdate": "no action"
-        },
-        "resource_likes_resource_id_resources_id_fk": {
-          "name": "resource_likes_resource_id_resources_id_fk",
-          "tableFrom": "resource_likes",
-          "tableTo": "resources",
-          "columnsFrom": [
-            "resource_id"
-          ],
-          "columnsTo": [
-            "id"
-          ],
-          "onDelete": "cascade",
-          "onUpdate": "no action"
-        }
-      },
-      "compositePrimaryKeys": {},
-      "uniqueConstraints": {
-        "resource_likes_id_unique": {
-          "name": "resource_likes_id_unique",
-          "nullsNotDistinct": false,
-          "columns": [
-            "id"
-          ]
-        }
-      }
-    },
-    "public.resource_stats": {
-      "name": "resource_stats",
-      "schema": "",
-      "columns": {
-        "id": {
-          "name": "id",
-          "type": "serial",
-          "primaryKey": true,
-          "notNull": true
-        },
-        "views": {
-          "name": "views",
-          "type": "integer",
-          "primaryKey": false,
-          "notNull": true,
-          "default": 0
-        },
-        "downloads": {
-          "name": "downloads",
-          "type": "integer",
-          "primaryKey": false,
-          "notNull": true,
-          "default": 0
-        },
-        "likes": {
-          "name": "likes",
-          "type": "integer",
-          "primaryKey": false,
-          "notNull": true,
-          "default": 0
-        },
-        "shares": {
-          "name": "shares",
-          "type": "integer",
-          "primaryKey": false,
-          "notNull": true,
-          "default": 0
-        },
-        "score": {
-          "name": "score",
-          "type": "numeric",
-          "primaryKey": false,
-          "notNull": true,
-          "default": "'0.0'"
-        },
-        "follows": {
-          "name": "follows",
-          "type": "integer",
-          "primaryKey": false,
-          "notNull": true,
-          "default": 0
-        },
-        "comments": {
-          "name": "comments",
-          "type": "integer",
-          "primaryKey": false,
-          "notNull": true,
-          "default": 0
-        }
-      },
-      "indexes": {},
-      "foreignKeys": {},
-      "compositePrimaryKeys": {},
-      "uniqueConstraints": {
-        "resource_stats_id_unique": {
-          "name": "resource_stats_id_unique",
-          "nullsNotDistinct": false,
-          "columns": [
-            "id"
-          ]
-        }
-      }
-    },
-    "public.resource_subjects": {
-      "name": "resource_subjects",
-      "schema": "",
-      "columns": {
-        "id": {
-          "name": "id",
-          "type": "serial",
-          "primaryKey": true,
-          "notNull": true
-        },
-        "resource_id": {
-          "name": "resource_id",
-          "type": "integer",
-          "primaryKey": false,
-          "notNull": true
-        },
-        "subject_id": {
-          "name": "subject_id",
-          "type": "integer",
-          "primaryKey": false,
-          "notNull": true
-        }
-      },
-      "indexes": {},
-      "foreignKeys": {
-        "resource_subjects_resource_id_resources_id_fk": {
-          "name": "resource_subjects_resource_id_resources_id_fk",
-          "tableFrom": "resource_subjects",
-          "tableTo": "resources",
-          "columnsFrom": [
-            "resource_id"
-          ],
-          "columnsTo": [
-            "id"
-          ],
-          "onDelete": "cascade",
-          "onUpdate": "no action"
-        },
-        "resource_subjects_subject_id_subjects_id_fk": {
-          "name": "resource_subjects_subject_id_subjects_id_fk",
-          "tableFrom": "resource_subjects",
-          "tableTo": "subjects",
-          "columnsFrom": [
-            "subject_id"
-          ],
-          "columnsTo": [
-            "id"
-          ],
-          "onDelete": "cascade",
-          "onUpdate": "no action"
-        }
-      },
-      "compositePrimaryKeys": {},
-      "uniqueConstraints": {
-        "resource_subjects_id_unique": {
-          "name": "resource_subjects_id_unique",
-          "nullsNotDistinct": false,
-          "columns": [
-            "id"
-          ]
-        }
-      }
-    },
-    "public.resources": {
-      "name": "resources",
-      "schema": "",
-      "columns": {
-        "id": {
-          "name": "id",
-          "type": "serial",
-          "primaryKey": true,
-          "notNull": true
-        },
-        "resource_state": {
-          "name": "resource_state",
-          "type": "resource_state",
-          "typeSchema": "public",
-          "primaryKey": false,
-          "notNull": true,
-          "default": "'draft'"
-        },
-        "name": {
-          "name": "name",
-          "type": "varchar(255)",
-          "primaryKey": false,
-          "notNull": true
-        },
-        "author": {
-          "name": "author",
-          "type": "varchar(255)",
-          "primaryKey": false,
-          "notNull": true
-        },
-        "link": {
-          "name": "link",
-          "type": "varchar(255)",
-          "primaryKey": false,
-          "notNull": false
-        },
-        "thumbnail": {
-          "name": "thumbnail",
-          "type": "varchar(255)",
-          "primaryKey": false,
-          "notNull": false
-        },
-        "description": {
-          "name": "description",
-          "type": "text",
-          "primaryKey": false,
-          "notNull": false
-        },
-        "created_at": {
-          "name": "created_at",
-          "type": "timestamp",
-          "primaryKey": false,
-          "notNull": true,
-          "default": "now()"
-        },
-        "updated_at": {
-          "name": "updated_at",
-          "type": "timestamp",
-          "primaryKey": false,
-          "notNull": true,
-          "default": "now()"
-        },
-        "published_at": {
-          "name": "published_at",
-          "type": "timestamp",
-          "primaryKey": false,
-          "notNull": false
-        },
-        "submitted_at": {
-          "name": "submitted_at",
-          "type": "timestamp",
-          "primaryKey": false,
-          "notNull": false
-        },
-        "deleted_at": {
-          "name": "deleted_at",
-          "type": "timestamp",
-          "primaryKey": false,
-          "notNull": false
-        },
-        "user_id": {
-          "name": "user_id",
-          "type": "integer",
-          "primaryKey": false,
-          "notNull": true
-        },
-        "resource_stats_id": {
-          "name": "resource_stats_id",
-          "type": "integer",
-          "primaryKey": false,
-          "notNull": true
-        },
-        "object_type_id": {
-          "name": "object_type_id",
-          "type": "integer",
-          "primaryKey": false,
-          "notNull": true
-        },
-        "license_id": {
-          "name": "license_id",
-          "type": "integer",
-          "primaryKey": false,
-          "notNull": true
-        }
-      },
-      "indexes": {},
-      "foreignKeys": {
-        "resources_user_id_users_id_fk": {
-          "name": "resources_user_id_users_id_fk",
-          "tableFrom": "resources",
-          "tableTo": "users",
-          "columnsFrom": [
-            "user_id"
-          ],
-          "columnsTo": [
-            "id"
-          ],
-          "onDelete": "cascade",
-          "onUpdate": "no action"
-        },
-        "resources_resource_stats_id_resource_stats_id_fk": {
-          "name": "resources_resource_stats_id_resource_stats_id_fk",
-          "tableFrom": "resources",
-          "tableTo": "resource_stats",
-          "columnsFrom": [
-            "resource_stats_id"
-          ],
-          "columnsTo": [
-            "id"
-          ],
-          "onDelete": "cascade",
-          "onUpdate": "no action"
-        },
-        "resources_object_type_id_object_types_id_fk": {
-          "name": "resources_object_type_id_object_types_id_fk",
-          "tableFrom": "resources",
-          "tableTo": "object_types",
-          "columnsFrom": [
-            "object_type_id"
-          ],
-          "columnsTo": [
-            "id"
-          ],
-          "onDelete": "cascade",
-          "onUpdate": "no action"
-        },
-        "resources_license_id_licenses_id_fk": {
-          "name": "resources_license_id_licenses_id_fk",
-          "tableFrom": "resources",
-          "tableTo": "licenses",
-          "columnsFrom": [
-            "license_id"
-          ],
-          "columnsTo": [
-            "id"
-          ],
-          "onDelete": "cascade",
-          "onUpdate": "no action"
-        }
-      },
-      "compositePrimaryKeys": {},
-      "uniqueConstraints": {
-        "resources_id_unique": {
-          "name": "resources_id_unique",
-          "nullsNotDistinct": false,
-          "columns": [
-            "id"
-          ]
-        },
-        "resources_resource_stats_id_unique": {
-          "name": "resources_resource_stats_id_unique",
-          "nullsNotDistinct": false,
-          "columns": [
-            "resource_stats_id"
-          ]
-        }
-      }
-    },
-    "public.roles": {
-      "name": "roles",
-      "schema": "",
-      "columns": {
-        "id": {
-          "name": "id",
-          "type": "serial",
-          "primaryKey": true,
-          "notNull": true
-        },
-        "name": {
-          "name": "name",
-          "type": "varchar(255)",
-          "primaryKey": false,
-          "notNull": true
-        },
-        "description": {
-          "name": "description",
-          "type": "text",
-          "primaryKey": false,
-          "notNull": false
-        },
-        "created_at": {
-          "name": "created_at",
-          "type": "timestamp",
-          "primaryKey": false,
-          "notNull": true,
-          "default": "now()"
-        },
-        "updated_at": {
-          "name": "updated_at",
-          "type": "timestamp",
-          "primaryKey": false,
-          "notNull": true,
-          "default": "now()"
-        }
-      },
-      "indexes": {},
-      "foreignKeys": {},
-      "compositePrimaryKeys": {},
-      "uniqueConstraints": {
-        "roles_id_unique": {
-          "name": "roles_id_unique",
-          "nullsNotDistinct": false,
-          "columns": [
-            "id"
-          ]
-        },
-        "roles_name_unique": {
-          "name": "roles_name_unique",
-          "nullsNotDistinct": false,
-          "columns": [
-            "name"
-          ]
-        }
-      }
-    },
-    "public.subjects": {
-      "name": "subjects",
-      "schema": "",
-      "columns": {
-        "id": {
-          "name": "id",
-          "type": "serial",
-          "primaryKey": true,
-          "notNull": true
-        },
-        "name": {
-          "name": "name",
-          "type": "varchar(255)",
-          "primaryKey": false,
-          "notNull": true
-        }
-      },
-      "indexes": {},
-      "foreignKeys": {},
-      "compositePrimaryKeys": {},
-      "uniqueConstraints": {
-        "subjects_id_unique": {
-          "name": "subjects_id_unique",
-          "nullsNotDistinct": false,
-          "columns": [
-            "id"
-          ]
-        }
-      }
-    },
-    "public.submissions": {
-      "name": "submissions",
-      "schema": "",
-      "columns": {
-        "id": {
-          "name": "id",
-          "type": "serial",
-          "primaryKey": true,
-          "notNull": true
-        },
-        "is_accepted": {
-          "name": "is_accepted",
-          "type": "boolean",
-          "primaryKey": false,
-          "notNull": true,
-          "default": false
-        },
-        "justification": {
-          "name": "justification",
-          "type": "text",
-          "primaryKey": false,
-          "notNull": false
-        },
-        "resource_id": {
-          "name": "resource_id",
-          "type": "integer",
-          "primaryKey": false,
-          "notNull": true
-        },
-        "submitter_id": {
-          "name": "submitter_id",
-          "type": "integer",
-          "primaryKey": false,
-          "notNull": true
-        },
-        "curator_id": {
-          "name": "curator_id",
-          "type": "integer",
-          "primaryKey": false,
-          "notNull": false
-        },
-        "created_at": {
-          "name": "created_at",
-          "type": "timestamp",
-          "primaryKey": false,
-          "notNull": true,
-          "default": "now()"
-        },
-        "updated_at": {
-          "name": "updated_at",
-          "type": "timestamp",
-          "primaryKey": false,
-          "notNull": true,
-          "default": "now()"
-        },
-        "answered_at": {
-          "name": "answered_at",
-          "type": "timestamp",
-          "primaryKey": false,
-          "notNull": false
-        },
-        "q1": {
-          "name": "q1",
-          "type": "boolean",
-          "primaryKey": false,
-          "notNull": false
-        },
-        "q2": {
-          "name": "q2",
-          "type": "boolean",
-          "primaryKey": false,
-          "notNull": false
-        },
-        "q3": {
-          "name": "q3",
-          "type": "boolean",
-          "primaryKey": false,
-          "notNull": false
-        },
-        "q4": {
-          "name": "q4",
-          "type": "boolean",
-          "primaryKey": false,
-          "notNull": false
-        }
-      },
-      "indexes": {},
-      "foreignKeys": {
-        "submissions_resource_id_resources_id_fk": {
-          "name": "submissions_resource_id_resources_id_fk",
-          "tableFrom": "submissions",
-          "tableTo": "resources",
-          "columnsFrom": [
-            "resource_id"
-          ],
-          "columnsTo": [
-            "id"
-          ],
-          "onDelete": "cascade",
-          "onUpdate": "no action"
-        },
-        "submissions_submitter_id_users_id_fk": {
-          "name": "submissions_submitter_id_users_id_fk",
-          "tableFrom": "submissions",
-          "tableTo": "users",
-          "columnsFrom": [
-            "submitter_id"
-          ],
-          "columnsTo": [
-            "id"
-          ],
-          "onDelete": "cascade",
-          "onUpdate": "no action"
-        },
-        "submissions_curator_id_users_id_fk": {
-          "name": "submissions_curator_id_users_id_fk",
-          "tableFrom": "submissions",
-          "tableTo": "users",
-          "columnsFrom": [
-            "curator_id"
-          ],
-          "columnsTo": [
-            "id"
-          ],
-          "onDelete": "cascade",
-          "onUpdate": "no action"
-        }
-      },
-      "compositePrimaryKeys": {},
-      "uniqueConstraints": {
-        "submissions_id_unique": {
-          "name": "submissions_id_unique",
-          "nullsNotDistinct": false,
-          "columns": [
-            "id"
-          ]
-        }
-      }
-    },
-    "public.user_achievements": {
-      "name": "user_achievements",
-      "schema": "",
-      "columns": {
-        "id": {
-          "name": "id",
-          "type": "serial",
-          "primaryKey": true,
-          "notNull": true
-        },
-        "user_id": {
-          "name": "user_id",
-          "type": "integer",
-          "primaryKey": false,
-          "notNull": true
-        },
-        "achievement_id": {
-          "name": "achievement_id",
-          "type": "integer",
-          "primaryKey": false,
-          "notNull": true
-        }
-      },
-      "indexes": {},
-      "foreignKeys": {
-        "user_achievements_user_id_users_id_fk": {
-          "name": "user_achievements_user_id_users_id_fk",
-          "tableFrom": "user_achievements",
-          "tableTo": "users",
-          "columnsFrom": [
-            "user_id"
-          ],
-          "columnsTo": [
-            "id"
-          ],
-          "onDelete": "cascade",
-          "onUpdate": "no action"
-        },
-        "user_achievements_achievement_id_users_id_fk": {
-          "name": "user_achievements_achievement_id_users_id_fk",
-          "tableFrom": "user_achievements",
-          "tableTo": "users",
-          "columnsFrom": [
-            "achievement_id"
-          ],
-          "columnsTo": [
-            "id"
-          ],
-          "onDelete": "cascade",
-          "onUpdate": "no action"
-        }
-      },
-      "compositePrimaryKeys": {},
-      "uniqueConstraints": {
-        "user_achievements_id_unique": {
-          "name": "user_achievements_id_unique",
-          "nullsNotDistinct": false,
-          "columns": [
-            "id"
-          ]
-        }
-      }
-    },
-    "public.user_collections": {
-      "name": "user_collections",
-      "schema": "",
-      "columns": {
-        "id": {
-          "name": "id",
-          "type": "serial",
-          "primaryKey": true,
-          "notNull": true
-        },
-        "user_id": {
-          "name": "user_id",
-          "type": "integer",
-          "primaryKey": false,
-          "notNull": true
-        },
-        "collection_id": {
-          "name": "collection_id",
-          "type": "integer",
-          "primaryKey": false,
-          "notNull": true
-        }
-      },
-      "indexes": {},
-      "foreignKeys": {
-        "user_collections_user_id_users_id_fk": {
-          "name": "user_collections_user_id_users_id_fk",
-          "tableFrom": "user_collections",
-          "tableTo": "users",
-          "columnsFrom": [
-            "user_id"
-          ],
-          "columnsTo": [
-            "id"
-          ],
-          "onDelete": "cascade",
-          "onUpdate": "no action"
-        },
-        "user_collections_collection_id_collections_id_fk": {
-          "name": "user_collections_collection_id_collections_id_fk",
-          "tableFrom": "user_collections",
-          "tableTo": "collections",
-          "columnsFrom": [
-            "collection_id"
-          ],
-          "columnsTo": [
-            "id"
-          ],
-          "onDelete": "cascade",
-          "onUpdate": "no action"
-        }
-      },
-      "compositePrimaryKeys": {},
-      "uniqueConstraints": {
-        "user_collections_id_unique": {
-          "name": "user_collections_id_unique",
-          "nullsNotDistinct": false,
-          "columns": [
-            "id"
-          ]
-        }
-      }
-    },
-    "public.user_institutions": {
-      "name": "user_institutions",
-      "schema": "",
-      "columns": {
-        "id": {
-          "name": "id",
-          "type": "serial",
-          "primaryKey": true,
-          "notNull": true
-        },
-        "user_id": {
-          "name": "user_id",
-          "type": "integer",
-          "primaryKey": false,
-          "notNull": true
-        },
-        "institution_id": {
-          "name": "institution_id",
-          "type": "integer",
-          "primaryKey": false,
-          "notNull": true
-        }
-      },
-      "indexes": {},
-      "foreignKeys": {
-        "user_institutions_user_id_users_id_fk": {
-          "name": "user_institutions_user_id_users_id_fk",
-          "tableFrom": "user_institutions",
-          "tableTo": "users",
-          "columnsFrom": [
-            "user_id"
-          ],
-          "columnsTo": [
-            "id"
-          ],
-          "onDelete": "cascade",
-          "onUpdate": "no action"
-        },
-        "user_institutions_institution_id_institutions_id_fk": {
-          "name": "user_institutions_institution_id_institutions_id_fk",
-          "tableFrom": "user_institutions",
-          "tableTo": "institutions",
-          "columnsFrom": [
-            "institution_id"
-          ],
-          "columnsTo": [
-            "id"
-          ],
-          "onDelete": "cascade",
-          "onUpdate": "no action"
-        }
-      },
-      "compositePrimaryKeys": {},
-      "uniqueConstraints": {
-        "user_institutions_id_unique": {
-          "name": "user_institutions_id_unique",
-          "nullsNotDistinct": false,
-          "columns": [
-            "id"
-          ]
-        }
-      }
-    },
-    "public.user_items": {
-      "name": "user_items",
-      "schema": "",
-      "columns": {
-        "id": {
-          "name": "id",
-          "type": "serial",
-          "primaryKey": true,
-          "notNull": true
-        },
-        "user_id": {
-          "name": "user_id",
-          "type": "integer",
-          "primaryKey": false,
-          "notNull": true
-        },
-        "item_id": {
-          "name": "item_id",
-          "type": "integer",
-          "primaryKey": false,
-          "notNull": true
-        }
-      },
-      "indexes": {},
-      "foreignKeys": {
-        "user_items_user_id_users_id_fk": {
-          "name": "user_items_user_id_users_id_fk",
-          "tableFrom": "user_items",
-          "tableTo": "users",
-          "columnsFrom": [
-            "user_id"
-          ],
-          "columnsTo": [
-            "id"
-          ],
-          "onDelete": "cascade",
-          "onUpdate": "no action"
-        },
-        "user_items_item_id_items_id_fk": {
-          "name": "user_items_item_id_items_id_fk",
-          "tableFrom": "user_items",
-          "tableTo": "items",
-          "columnsFrom": [
-            "item_id"
-          ],
-          "columnsTo": [
-            "id"
-          ],
-          "onDelete": "cascade",
-          "onUpdate": "no action"
-        }
-      },
-      "compositePrimaryKeys": {},
-      "uniqueConstraints": {
-        "user_items_id_unique": {
-          "name": "user_items_id_unique",
-          "nullsNotDistinct": false,
-          "columns": [
-            "id"
-          ]
-        }
-      }
-    },
-    "public.user_roles": {
-      "name": "user_roles",
-      "schema": "",
-      "columns": {
-        "id": {
-          "name": "id",
-          "type": "serial",
-          "primaryKey": true,
-          "notNull": true
-        },
-        "user_id": {
-          "name": "user_id",
-          "type": "integer",
-          "primaryKey": false,
-          "notNull": true
-        },
-        "role_id": {
-          "name": "role_id",
-          "type": "integer",
-          "primaryKey": false,
-          "notNull": true
-        }
-      },
-      "indexes": {},
-      "foreignKeys": {
-        "user_roles_user_id_users_id_fk": {
-          "name": "user_roles_user_id_users_id_fk",
-          "tableFrom": "user_roles",
-          "tableTo": "users",
-          "columnsFrom": [
-            "user_id"
-          ],
-          "columnsTo": [
-            "id"
-          ],
-          "onDelete": "cascade",
-          "onUpdate": "no action"
-        },
-        "user_roles_role_id_roles_id_fk": {
-          "name": "user_roles_role_id_roles_id_fk",
-          "tableFrom": "user_roles",
-          "tableTo": "roles",
-          "columnsFrom": [
-            "role_id"
-          ],
-          "columnsTo": [
-            "id"
-          ],
-          "onDelete": "cascade",
-          "onUpdate": "no action"
-        }
-      },
-      "compositePrimaryKeys": {},
-      "uniqueConstraints": {
-        "user_roles_id_unique": {
-          "name": "user_roles_id_unique",
-          "nullsNotDistinct": false,
-          "columns": [
-            "id"
-          ]
-        }
-      }
-    },
-    "public.user_stats": {
-      "name": "user_stats",
-      "schema": "",
-      "columns": {
-        "id": {
-          "name": "id",
-          "type": "serial",
-          "primaryKey": true,
-          "notNull": true
-        },
-        "score": {
-          "name": "score",
-          "type": "numeric",
-          "primaryKey": false,
-          "notNull": true,
-          "default": "'0.0'"
-        },
-        "likes": {
-          "name": "likes",
-          "type": "integer",
-          "primaryKey": false,
-          "notNull": true,
-          "default": 0
-        },
-        "likes_received": {
-          "name": "likes_received",
-          "type": "integer",
-          "primaryKey": false,
-          "notNull": true,
-          "default": 0
-        },
-        "follows": {
-          "name": "follows",
-          "type": "integer",
-          "primaryKey": false,
-          "notNull": true,
-          "default": 0
-        },
-        "followers": {
-          "name": "followers",
-          "type": "integer",
-          "primaryKey": false,
-          "notNull": true,
-          "default": 0
-        },
-        "collections": {
-          "name": "collections",
-          "type": "integer",
-          "primaryKey": false,
-          "notNull": true,
-          "default": 0
-        },
-        "submitted_resources": {
-          "name": "submitted_resources",
-          "type": "integer",
-          "primaryKey": false,
-          "notNull": true,
-          "default": 0
-        },
-        "approved_resources": {
-          "name": "approved_resources",
-          "type": "integer",
-          "primaryKey": false,
-          "notNull": true,
-          "default": 0
-        },
-        "reviewed_resources": {
-          "name": "reviewed_resources",
-          "type": "integer",
-          "primaryKey": false,
-          "notNull": true,
-          "default": 0
-        },
-        "comments": {
-          "name": "comments",
-          "type": "integer",
-          "primaryKey": false,
-          "notNull": true,
-          "default": 0
-        }
-      },
-      "indexes": {},
-      "foreignKeys": {},
-      "compositePrimaryKeys": {},
-      "uniqueConstraints": {
-        "user_stats_id_unique": {
-          "name": "user_stats_id_unique",
-          "nullsNotDistinct": false,
-          "columns": [
-            "id"
-          ]
-        }
-      }
-    },
-    "public.users": {
-      "name": "users",
-      "schema": "",
-      "columns": {
-        "id": {
-          "name": "id",
-          "type": "serial",
-          "primaryKey": true,
-          "notNull": true
-        },
-        "name": {
-          "name": "name",
-          "type": "varchar(255)",
-          "primaryKey": false,
-          "notNull": true
-        },
-        "username": {
-          "name": "username",
-          "type": "varchar(255)",
-          "primaryKey": false,
-          "notNull": true
-        },
-        "password": {
-          "name": "password",
-          "type": "varchar(255)",
-          "primaryKey": false,
-          "notNull": true
-        },
-        "email": {
-          "name": "email",
-          "type": "varchar(255)",
-          "primaryKey": false,
-          "notNull": true
-        },
-        "description": {
-          "name": "description",
-          "type": "text",
-          "primaryKey": false,
-          "notNull": false,
-          "default": "'sem descrição'"
-        },
-        "birthday": {
-          "name": "birthday",
-          "type": "timestamp",
-          "primaryKey": false,
-          "notNull": true
-        },
-        "cpf": {
-          "name": "cpf",
-          "type": "varchar(11)",
-          "primaryKey": false,
-          "notNull": true
-        },
-        "created_at": {
-          "name": "created_at",
-          "type": "timestamp",
-          "primaryKey": false,
-          "notNull": true,
-          "default": "now()"
-        },
-        "updated_at": {
-          "name": "updated_at",
-          "type": "timestamp",
-          "primaryKey": false,
-          "notNull": true,
-          "default": "now()"
-        },
-        "confirmed_at": {
-          "name": "confirmed_at",
-          "type": "timestamp",
-          "primaryKey": false,
-          "notNull": false
-        },
-        "confirmation_sent_at": {
-          "name": "confirmation_sent_at",
-          "type": "timestamp",
-          "primaryKey": false,
-          "notNull": false
-        },
-        "deleted_at": {
-          "name": "deleted_at",
-          "type": "timestamp",
-          "primaryKey": false,
-          "notNull": false
-        },
-        "reactivated_at": {
-          "name": "reactivated_at",
-          "type": "timestamp",
-          "primaryKey": false,
-          "notNull": false
-        },
-        "is_active": {
-          "name": "is_active",
-          "type": "boolean",
-          "primaryKey": false,
-          "notNull": false,
-          "default": true
-        },
-        "user_stats_id": {
-          "name": "user_stats_id",
-          "type": "integer",
-          "primaryKey": false,
-          "notNull": true
-        },
-        "level": {
-          "name": "level",
-          "type": "integer",
-          "primaryKey": false,
-          "notNull": false,
-          "default": 1
-        },
-        "experience": {
-          "name": "experience",
-          "type": "integer",
-          "primaryKey": false,
-          "notNull": false,
-          "default": 0
-        },
-        "points": {
-          "name": "points",
-          "type": "integer",
-          "primaryKey": false,
-          "notNull": false,
-          "default": 0
-        },
-        "level_xp": {
-          "name": "level_xp",
-          "type": "integer",
-          "primaryKey": false,
-          "notNull": false,
-          "default": 0
-        }
-      },
-      "indexes": {},
-      "foreignKeys": {
-        "users_user_stats_id_user_stats_id_fk": {
-          "name": "users_user_stats_id_user_stats_id_fk",
-          "tableFrom": "users",
-          "tableTo": "user_stats",
-          "columnsFrom": [
-            "user_stats_id"
-          ],
-          "columnsTo": [
-            "id"
-          ],
-          "onDelete": "no action",
-          "onUpdate": "no action"
-        }
-      },
-      "compositePrimaryKeys": {},
-      "uniqueConstraints": {
-        "users_id_unique": {
-          "name": "users_id_unique",
-          "nullsNotDistinct": false,
-          "columns": [
-            "id"
-          ]
-        },
-        "users_username_unique": {
-          "name": "users_username_unique",
-          "nullsNotDistinct": false,
-          "columns": [
-            "username"
-          ]
-        },
-        "users_email_unique": {
-          "name": "users_email_unique",
-          "nullsNotDistinct": false,
-          "columns": [
-            "email"
-          ]
-        },
-        "users_cpf_unique": {
-          "name": "users_cpf_unique",
-          "nullsNotDistinct": false,
-          "columns": [
-            "cpf"
-          ]
-        },
-        "users_user_stats_id_unique": {
-          "name": "users_user_stats_id_unique",
-          "nullsNotDistinct": false,
-          "columns": [
-            "user_stats_id"
-          ]
-        }
-      }
-    }
-  },
-  "enums": {
-    "public.complaints_state": {
-      "name": "complaints_state",
-      "schema": "public",
-      "values": [
-        "complained",
-        "rejected",
-        "accepted"
-      ]
-    },
-    "public.resource_state": {
-      "name": "resource_state",
-      "schema": "public",
-      "values": [
-        "draft",
-        "submitted",
-        "accepted",
-        "reported",
-        "deleted"
-      ]
-    },
-    "public.review_state": {
-      "name": "review_state",
-      "schema": "public",
-      "values": [
-        "active",
-        "inactive",
-        "under_review"
-      ]
-    }
-  },
-  "schemas": {},
-  "_meta": {
-    "columns": {},
-    "schemas": {},
-    "tables": {}
-  }
-}
\ No newline at end of file
diff --git a/src/db/migrations/meta/_journal.json b/src/db/migrations/meta/_journal.json
index ea8173f8ac96198c3ec1f7f037a72eb2289f2c59..a7e0211fea0fead86736c8fea9cb47098889ecc9 100644
--- a/src/db/migrations/meta/_journal.json
+++ b/src/db/migrations/meta/_journal.json
@@ -1,7 +1,5 @@
 {
   "version": "7",
   "dialect": "postgresql",
-  "entries": [
-    
-  ]
-}
\ No newline at end of file
+  "entries": []
+}
diff --git a/src/db/repo/auth.repo.ts b/src/db/repo/auth.repo.ts
index 4e5cb944a81b4856c2fa50b15b89ee373fac273d..d15a85bd17fee07ba6ca76b5ede8369241369d55 100644
--- a/src/db/repo/auth.repo.ts
+++ b/src/db/repo/auth.repo.ts
@@ -2,11 +2,14 @@ import type { z } from 'zod'
 import { userSchemas, type UserModel } from '../schema/user.schema'
 
 export function hashPassword(pass: UserModel['password']) {
-  return Bun.password.hashSync(pass, {
-    memoryCost: 4,
-    timeCost: 3,
-    algorithm: 'argon2id',
-  })
+  if (pass !== null)
+    return Bun.password.hashSync(pass, {
+      memoryCost: 4,
+      timeCost: 3,
+      algorithm: 'argon2id',
+    })
+  else
+    return null;
 }
 
 export function verifyPassword(
diff --git a/src/db/schema/user.schema.ts b/src/db/schema/user.schema.ts
index 5ea328cbb58c3d4e4403e275b9b58ed433ecc25c..a8ed8be5cfa8d4ba495551c74ccbf88916d1e505 100644
--- a/src/db/schema/user.schema.ts
+++ b/src/db/schema/user.schema.ts
@@ -11,17 +11,14 @@ const userTable = pgTable('users', {
   name: varchar('name', { length: 255 })
     .notNull(),
   username: varchar('username', { length: 255 })
-    .unique()
-    .notNull(),
-  password: varchar('password', { length: 255 })
-    .notNull(),
+    .unique(),
+  password: varchar('password', { length: 255 }),
   email: varchar('email', { length: 255 })
     .unique()
     .notNull(),
   description: text('description')
     .default("sem descrição"),
-  birthday: timestamp('birthday', { mode: 'string' })
-    .notNull(),
+  birthday: timestamp('birthday', { mode: 'string' }),
   cpf: varchar('cpf', { length: 11 })
     .unique()
     .notNull(),
diff --git a/src/env.ts b/src/env.ts
index a8f1e670144fd6b95fd9bcab9c6fdf73691e856e..b998d39250b1ec842c85b069212bfe8ef7fb93ef 100644
--- a/src/env.ts
+++ b/src/env.ts
@@ -25,6 +25,12 @@ const EnvSchema = z.object({
   AWS_SECRET_ACCESS_KEY: z.string(),
   AWS_REGION: z.string(),
   S3_BUCKET: z.string(),
+  GOVBR_CLIENT_ID: z.string(),
+  GOVBR_SECRET: z.string(),
+  GOVBR_SERVER_URL: z.string(),
+  GOVBR_TOKEN_URL: z.string(),
+  GOVBR_PUBLIC_KEY_URL: z.string(),
+  FRONT_END_RETURN_URL: z.string(),
   URL: z.string(),
 
   ELASTICSEARCH_USER: z.string(),
diff --git a/src/index.ts b/src/index.ts
index 0bd00ca0658ad8f44579181bd286310420c74ff1..449f98597b0e7dcba787aa15a26ef61ef48db717 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -48,8 +48,6 @@ import { homologationRouter } from './routes/homologation.route'
 import { contactRoute } from './routes/contact.route'
 import { searchRouter } from './routes/search.route'
 
-
-
 const app = new Hono();
 
 app.use('*', logger())
diff --git a/src/routes/auth.route.ts b/src/routes/auth.route.ts
index 7e6fb78fddf6d7eca32edb2fa82d3ba7b24fdd61..722e64c15c429c0458c3343378ae724aeacfcadc 100644
--- a/src/routes/auth.route.ts
+++ b/src/routes/auth.route.ts
@@ -8,6 +8,7 @@ import { UserService } from '@/services/user.service'
 import { zValidator } from '@hono/zod-validator'
 import { Hono } from 'hono'
 import { SearchService } from "@/services/search.service";
+import { deleteCookie, getCookie, setCookie } from 'hono/cookie';
 import Container from 'typedi'
 import jwt from 'jwt-simple';
 import {
@@ -16,9 +17,11 @@ import {
   requestPasswordResetRoute,
   resetPasswordRoute,
   confirmEmailRoute
-} from "../documentation/authDescribers"
-import env from '@/env'
-
+} from "../documentation/authDescribers";
+import env from '@/env';
+import * as client from 'openid-client';
+import { createRemoteJWKSet, jwtVerify } from 'jose';
+import { z } from 'zod'
 
 const authService = Container.get(AuthService)
 const userService = Container.get(UserService)
@@ -50,33 +53,166 @@ export const authRouter = new Hono().post(
     }
   }
 )
-.post('/signup', signupRoute,
-  zValidator('json', userSchemas.userInputSchema),
-  async (c) => {
-    try {
-      const input = await c.req.valid('json');
-      console.log("Dados recebidos:", input);
+  .get(
+    '/signingovbr', signinRoute,
+    async (c) => {
+      const config = authService.getGovbrOpenIDConfig();
+      const code_challenge_method = 'S256'
 
-      // Criando userStats
-      console.log("Criando userStats...");
-      const userStats = userStatsSchemas.dto.parse(await userStatsService.create());
-      console.log("UserStats criado:", userStats);
+      const code_verifier = client.randomPKCECodeVerifier()
+      const code_challenge = await client.calculatePKCECodeChallenge(code_verifier)
+      const nonce = client.randomNonce();
+      const state = client.randomState();
 
-      input.user_stats_id = userStats.id;
+      const redirect_uri = 'http://mecred.mec.gov.br/public/auth/signingovbr_callback';
 
-      const user = userSchemas.userDtoSchema.parse(await userService.create(input));
+      const parameters: Record<string, string> = {
+        scope: 'openid+email+profile+govbr_confiabilidades',
+        nonce,
+        redirect_uri,
+        code_challenge,
+        code_challenge_method,
+      }
 
-      await searchService.indexUser(user.id)
+      const redirectTo = client.buildAuthorizationUrl(config, parameters);
 
-      await authService.sendConfirmationEmail(user.email, "Confirmação de email", user.name, user.email);
+      deleteCookie(c, "code_verifier");
 
-      return c.json({ user, userStats });
-    } catch (e) {
-      console.error("Erro no cadastro:", e);
-      return c.text('could not create', 500);
+      setCookie(c, "code_verifier", code_verifier, {
+        httpOnly: true,
+        sameSite: "Lax",
+        path: '/public/auth/signingovbr_callback'
+      });
+      setCookie(c, "code_challenge", code_challenge, { httpOnly: true });
+      setCookie(c, "nonce", nonce, { httpOnly: true });
+      setCookie(c, "state", state, { httpOnly: true });
+
+      const test = getCookie(c, "code_verifier");
+      console.log("test", test);
+
+      return c.redirect(redirectTo.href);
+    }
+  )
+  .get('/signingovbr_callback', signinRoute, async (c) => {
+    const config = authService.getGovbrOpenIDConfig();
+
+    const url = new URL(c.req.raw.url);
+
+    //console.log("BBBBBBBBBBBBBBBBBBBBBBbb");
+    const code_verifier = getCookie(c, "code_verifier");
+    const code_challenge = getCookie(c, "code_challenge");
+    const nonce = getCookie(c, "nonce");
+    const state = getCookie(c, "state");
+
+    console.log("code_verifier", code_verifier);
+
+    //console.log("CCCCCCCCCCCCCCCCCCCCCCCcc", config.serverMetadata(), config.clientMetadata());
+    //console.log("URL", fullUrl);
+    const tokens = await client.authorizationCodeGrant(config, url, {
+      pkceCodeVerifier: code_verifier,
+      expectedNonce: nonce,
+      idTokenExpected: true,
+    });
+
+    console.log("TOKENS: ", tokens);
+    const keys = createRemoteJWKSet(new URL(env.GOVBR_SERVER_URL + "/jwk"));
+    await jwtVerify(tokens.id_token!, keys)
+      .catch(() => {
+        return c.text('Failed GovBR public keys verification.', 500);
+      });
+
+    const claimsSchema = z.object({
+      sub: z.string(),
+      social_name: z.string(),
+      email_verified: z.string(),
+      amr: z.string().array(),
+      profile: z.string(),
+      kid: z.string(),
+      iss: z.string(),
+      preferred_username: z.string(),
+      nonce: z.string(),
+      picture: z.string(),
+      aud: z.string(),
+      auth_time: z.number(),
+      scope: z.string().array(),
+      name: z.string(),
+      exp: z.number(),
+      iat: z.number(),
+      jti: z.string(),
+      email: z.string(),
+    })
+
+    const claims = claimsSchema.parse(tokens.claims());
+    console.log('Token Claims', claims);
+
+    if (!claims)
+      return c.text('Error getting token claims.', 500);
+
+    let user = await userService.findByEmail(claims.email);
+
+    if (!user) {
+      // User não existe, então vamos criar um novo.
+      try {
+        const newUserInput = {
+          name: claims.social_name ?? claims.name,
+          username: null,
+          password: null,
+          email: claims.email,
+          birthday: null,
+          cpf: claims.sub,
+          user_stats_id: -1
+        };
+
+        const userStats = userStatsSchemas.dto.parse(await userStatsService.create());
+        newUserInput.user_stats_id = userStats.id;
+
+        // Setamos o user para o recém criado.
+        user = await userService.create(newUserInput);
+      } catch (e) {
+        console.log(e);
+        // TODO: Talvez aqui o mais certo seria redirecionar para uma página de erro do front
+        return c.text('Failed to create user from GovBr.', 500);
+      }
     }
+    
+    // Logamos com ele e obtemos o token.
+    const token = await authService.loginGovBr(user);
+
+    const params = new URLSearchParams();
+
+    params.set('token', token);
+
+    // Redirecionamos para página do front que vai salvar o token
+    return c.redirect(env.FRONT_END_RETURN_URL + '?' + params.toString());
   }
-)
+  )
+  .post('/signup', signupRoute,
+    zValidator('json', userSchemas.userInputSchema),
+    async (c) => {
+      try {
+        const input = await c.req.valid('json');
+        console.log("Dados recebidos:", input);
+
+        // Criando userStats
+        console.log("Criando userStats...");
+        const userStats = userStatsSchemas.dto.parse(await userStatsService.create());
+        console.log("UserStats criado:", userStats);
+
+        input.user_stats_id = userStats.id;
+
+        const user = userSchemas.userDtoSchema.parse(await userService.create(input));
+
+        await authService.sendConfirmationEmail(user.email, "Confirmação de email", user.name, user.email);
+        await searchService.indexUser(user.id);
+
+
+        return c.json({ user, userStats });
+      } catch (e) {
+        console.error("Erro no cadastro:", e);
+        return c.text('could not create', 500);
+      }
+    }
+  )
   .post('/recoveryPassword/:id', requestPasswordResetRoute,
     async (c) => {
       try {
@@ -97,12 +233,15 @@ export const authRouter = new Hono().post(
           )
         }
 
-        var payload = {
+        const payload = {
           id: id,
           email: user.email
         };
 
-        var token = jwt.encode(payload, env.APP_SECRET);
+        const secret = user.password + '-' + user.createdAt;
+        //const resetTicket = await recoveryService.create(user)
+
+        const token = jwt.encode(payload, secret);
 
         await authService.passwordRecoveryEmail(token, user.email, "Recuperação de senha", user.email)
         return c.json({ message: 'E-mail de recuperação enviado com sucesso!' })
@@ -174,7 +313,7 @@ export const authRouter = new Hono().post(
     try {
       const emailArray = c.req.queries("email");
 
-      if ( !emailArray?.[0]) {
+      if (!emailArray?.[0]) {
         throw new Error("Invalid request: missing email or token");
       }
 
@@ -186,7 +325,7 @@ export const authRouter = new Hono().post(
       }
 
       await authService.updateConfirmedAt(email);
-   
+
       return c.redirect("http://mecred.mec.gov.br");
     } catch (e) {
       return c.json(
diff --git a/src/services/auth.service.ts b/src/services/auth.service.ts
index 30d51df64e15d0ec469f22fd496f7d5895c5eb68..8280f2bec11528124c7f24e47e56aecb887a7b1f 100644
--- a/src/services/auth.service.ts
+++ b/src/services/auth.service.ts
@@ -9,15 +9,36 @@ import {
   type AuthPayload,
 } from '@/db/repo/auth.repo'
 import transporter from "@/mailer";
+import * as client from 'openid-client';
+import { URL } from 'node:url';
+import type { UserModel } from '@/db/schema/user.schema.ts';
 
 @Service()
 export class AuthService {
   @Inject()
-  private readonly userService: UserService
+  private readonly userService: UserService;
+  private govbrOpenIDConfig: client.Configuration;
+
+  constructor() {
+    const server = env.GOVBR_SERVER_URL;
+    const clientId = env.GOVBR_CLIENT_ID;
+    const clientSecret = env.GOVBR_SECRET;
+
+    // Esse erro de tipagem não sei arrumar, problema é que a função aceita URL do Node mas o construtor é a do Bun.
+    // Ou vice versa.
+    client.discovery(new URL(server), clientId, clientSecret).then(config => {
+      this.govbrOpenIDConfig = config;
+    }
+    );
+  }
+
+  getGovbrOpenIDConfig(): client.Configuration {
+    return this.govbrOpenIDConfig;
+  }
 
   async login(input: AuthInput): Promise<string> {
     const user = await this.userService.findByEmail(input.email)
-   
+
     if (!user) throw new Error('User not found')
 
     if (!verifyPassword(input.password, user.password))
@@ -30,27 +51,36 @@ export class AuthService {
 
     const token = await sign(payload, env.APP_SECRET)
 
-    return token
+    return token;
+  }
+
+  async loginGovBr(user: UserModel): Promise<string> {
+    const payload: AuthPayload = authPayload.parse({
+      id: user.id,
+      email: user.email,
+    })
+
+    const token = await sign(payload, env.APP_SECRET)
+
+    return token;
   }
 
-  async updateConfirmedAt(userEmail: string) { 
+  async updateConfirmedAt(userEmail: string) {
     const user = await this.userService.findByEmail(userEmail);
-    
+
     if (!user) {
       throw new Error("Usuário não encontrado");
     }
-  
+
     if (user.confirmed_at !== null) {
       throw new Error("Usuário já foi confirmado");
     }
-  
+
     user.confirmed_at = new Date().toISOString();
     return await this.userService.update(user);
   }
-  
 
-
-  async sendConfirmationEmail(receiver: string, subject: string,  userName: string, userEmail: string) {
+  async sendConfirmationEmail(receiver: string, subject: string, userName: string, userEmail: string) {
     const link: string = `${env.URL}/entrar`;
     const text = `
     <head>
@@ -199,5 +229,4 @@ export class AuthService {
       console.error("Erro ao enviar e-mail:", error);
     }
   }
-
-}
+}
\ No newline at end of file