chore(test): set up integration test framework with postgres
- Generate Drizzle migrations (databases/migrations/) - Add databases/schema.kit.ts for drizzle-kit (Node-compatible imports) - Update drizzle.config.ts to use schema.kit.ts - Add deno tasks: test:unit, test:integration, migrate - Add tests/helpers/db_integration.ts: testDb, truncateAll, seed helpers - Add .gitea/workflows/test.yml: CI with postgres service container - Update lint.yml: run test:unit only (no DB needed) - Update deploy.yml: add check-code job, gate deploy on it
This commit is contained in:
@@ -0,0 +1,100 @@
|
||||
CREATE TABLE "ajustements" (
|
||||
"numEtud" integer NOT NULL,
|
||||
"idUE" integer NOT NULL,
|
||||
"valeur" double precision NOT NULL,
|
||||
CONSTRAINT "ajustements_numEtud_idUE_pk" PRIMARY KEY("numEtud","idUE")
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "enseignements" (
|
||||
"idProf" text NOT NULL,
|
||||
"idModule" text NOT NULL,
|
||||
"idPromo" text NOT NULL,
|
||||
CONSTRAINT "enseignements_idProf_idModule_idPromo_pk" PRIMARY KEY("idProf","idModule","idPromo")
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "mobility" (
|
||||
"id" serial PRIMARY KEY NOT NULL,
|
||||
"studentId" integer,
|
||||
"startDate" date,
|
||||
"endDate" date,
|
||||
"weeksCount" integer,
|
||||
"destinationCountry" text,
|
||||
"destinationName" text,
|
||||
"mobilityStatus" text DEFAULT 'N/A'
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "modules" (
|
||||
"id" text PRIMARY KEY NOT NULL,
|
||||
"nom" text NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "notes" (
|
||||
"numEtud" integer NOT NULL,
|
||||
"idModule" text NOT NULL,
|
||||
"note" double precision NOT NULL,
|
||||
CONSTRAINT "notes_numEtud_idModule_pk" PRIMARY KEY("numEtud","idModule")
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "permissions" (
|
||||
"id" text PRIMARY KEY NOT NULL,
|
||||
"nom" text NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "promotions" (
|
||||
"idPromo" text PRIMARY KEY NOT NULL,
|
||||
"annee" text
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "role_permissions" (
|
||||
"idRole" integer NOT NULL,
|
||||
"idPermission" text NOT NULL,
|
||||
CONSTRAINT "role_permissions_idRole_idPermission_pk" PRIMARY KEY("idRole","idPermission")
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "roles" (
|
||||
"id" serial PRIMARY KEY NOT NULL,
|
||||
"nom" text NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "students" (
|
||||
"numEtud" serial PRIMARY KEY NOT NULL,
|
||||
"nom" text NOT NULL,
|
||||
"prenom" text NOT NULL,
|
||||
"idPromo" text
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "ue_modules" (
|
||||
"idModule" text NOT NULL,
|
||||
"idUE" integer NOT NULL,
|
||||
"idPromo" text NOT NULL,
|
||||
"coeff" double precision NOT NULL,
|
||||
CONSTRAINT "ue_modules_idModule_idUE_idPromo_pk" PRIMARY KEY("idModule","idUE","idPromo")
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "ues" (
|
||||
"id" serial PRIMARY KEY NOT NULL,
|
||||
"nom" text NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "users" (
|
||||
"id" text PRIMARY KEY NOT NULL,
|
||||
"nom" text NOT NULL,
|
||||
"prenom" text NOT NULL,
|
||||
"idRole" integer
|
||||
);
|
||||
--> statement-breakpoint
|
||||
ALTER TABLE "ajustements" ADD CONSTRAINT "ajustements_numEtud_students_numEtud_fk" FOREIGN KEY ("numEtud") REFERENCES "public"."students"("numEtud") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "ajustements" ADD CONSTRAINT "ajustements_idUE_ues_id_fk" FOREIGN KEY ("idUE") REFERENCES "public"."ues"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "enseignements" ADD CONSTRAINT "enseignements_idProf_users_id_fk" FOREIGN KEY ("idProf") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "enseignements" ADD CONSTRAINT "enseignements_idModule_modules_id_fk" FOREIGN KEY ("idModule") REFERENCES "public"."modules"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "enseignements" ADD CONSTRAINT "enseignements_idPromo_promotions_idPromo_fk" FOREIGN KEY ("idPromo") REFERENCES "public"."promotions"("idPromo") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "mobility" ADD CONSTRAINT "mobility_studentId_students_numEtud_fk" FOREIGN KEY ("studentId") REFERENCES "public"."students"("numEtud") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "notes" ADD CONSTRAINT "notes_numEtud_students_numEtud_fk" FOREIGN KEY ("numEtud") REFERENCES "public"."students"("numEtud") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "notes" ADD CONSTRAINT "notes_idModule_modules_id_fk" FOREIGN KEY ("idModule") REFERENCES "public"."modules"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "role_permissions" ADD CONSTRAINT "role_permissions_idRole_roles_id_fk" FOREIGN KEY ("idRole") REFERENCES "public"."roles"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "role_permissions" ADD CONSTRAINT "role_permissions_idPermission_permissions_id_fk" FOREIGN KEY ("idPermission") REFERENCES "public"."permissions"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "students" ADD CONSTRAINT "students_idPromo_promotions_idPromo_fk" FOREIGN KEY ("idPromo") REFERENCES "public"."promotions"("idPromo") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "ue_modules" ADD CONSTRAINT "ue_modules_idModule_modules_id_fk" FOREIGN KEY ("idModule") REFERENCES "public"."modules"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "ue_modules" ADD CONSTRAINT "ue_modules_idUE_ues_id_fk" FOREIGN KEY ("idUE") REFERENCES "public"."ues"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "ue_modules" ADD CONSTRAINT "ue_modules_idPromo_promotions_idPromo_fk" FOREIGN KEY ("idPromo") REFERENCES "public"."promotions"("idPromo") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "users" ADD CONSTRAINT "users_idRole_roles_id_fk" FOREIGN KEY ("idRole") REFERENCES "public"."roles"("id") ON DELETE no action ON UPDATE no action;
|
||||
Reference in New Issue
Block a user