Skip to content

Commit

Permalink
Switch to typeorm session store
Browse files Browse the repository at this point in the history
  • Loading branch information
florimondmanca committed Dec 22, 2023
1 parent a214404 commit 6d5f217
Show file tree
Hide file tree
Showing 7 changed files with 160 additions and 241 deletions.
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ database-test-init: up ## Initialize test database
make database-seed DATABASE_NAME=permacoop_hotwire_test

database-migration: ## Generate a database migration
npm run migration:create -- migrations/$(NAME)
npm run migration:generate -- migrations/$(NAME)

database-seed: ## Seed database
npm run seed:run
Expand All @@ -99,3 +99,7 @@ ci: up ## Run CI checks
make linter
make test-cov
make test-e2e CI=1 DATABASE_NAME=permacoop_hotwire

scalingo-postbuild:
make build
make database-migrate
16 changes: 16 additions & 0 deletions migrations/1703240232765-addSession.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { MigrationInterface, QueryRunner } from "typeorm";

export class AddSession1703240232765 implements MigrationInterface {
name = 'AddSession1703240232765'

public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`CREATE TABLE "session" ("expiredAt" bigint NOT NULL, "id" character varying(255) NOT NULL, "json" text NOT NULL, "destroyedAt" TIMESTAMP, CONSTRAINT "PK_f55da76ac1c3ac420f444d2ff11" PRIMARY KEY ("id"))`);
await queryRunner.query(`CREATE INDEX "IDX_28c5d1d16da7908c97c9bc2f74" ON "session" ("expiredAt") `);
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`DROP INDEX "public"."IDX_28c5d1d16da7908c97c9bc2f74"`);
await queryRunner.query(`DROP TABLE "session"`);
}

}
Loading

0 comments on commit 6d5f217

Please sign in to comment.