kir-dev / kir-dev/pek-next

Inconsistent foreign key data types

Open
#433 0 comments 0 reactions 1 assignee Claimed by @SepsiLaszlo View on GitHub
Dominant language
Ruby
Stars
11
Forks
7
PR merge metrics
No merged PRs in 30d

Description

# Problem

Some of the database fields in pek-v3 have inconsistent data types `{local(int) -> foreign(bigint)}`.

## Proposed solution

This .sql migration fixes the data types of the fields to be consistent with the foreign key fields.

```sql
-- auto generated with prisma ORM

-- DropForeignKey
ALTER TABLE "point_detail_comments" DROP CONSTRAINT "fk_rails_fd72f0d605";

-- DropForeignKey
ALTER TABLE "point_details" DROP CONSTRAINT "fk_rails_6ef8df1bae";

-- DropForeignKey
ALTER TABLE "principles" DROP CONSTRAINT "fk_rails_84e8865fd0";

-- DropForeignKey
ALTER TABLE "svie_post_requests" DROP CONSTRAINT "fk_rails_a0009aa5e4";

-- DropForeignKey
ALTER TABLE "view_settings" DROP CONSTRAINT "fk_rails_2450b9d422";

-- AlterTable
ALTER TABLE "point_detail_comments" ALTER COLUMN "user_id" SET DATA TYPE BIGINT;

-- AlterTable
ALTER TABLE "point_details" ALTER COLUMN "point_request_id" SET DATA TYPE BIGINT;

-- AlterTable
ALTER TABLE "principles" ALTER COLUMN "evaluation_id" SET DATA TYPE BIGINT;

-- AlterTable
ALTER TABLE "svie_post_requests" ALTER COLUMN "user_id" SET DATA TYPE BIGINT;

-- AlterTable
ALTER TABLE "view_settings" ALTER COLUMN "user_id" SET DATA TYPE BIGINT;

-- AddForeignKey
ALTER TABLE "point_detail_comments" ADD CONSTRAINT "fk_rails_fd72f0d605" FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE NO ACTION ON UPDATE NO ACTION;

-- AddForeignKey
ALTER TABLE "point_details" ADD CONSTRAINT "fk_rails_6ef8df1bae" FOREIGN KEY ("point_request_id") REFERENCES "point_requests"("id") ON DELETE NO ACTION ON UPDATE NO ACTION;

-- AddForeignKey
ALTER TABLE "principles" ADD CONSTRAINT "fk_rails_84e8865fd0" FOREIGN KEY ("evaluation_id") REFERENCES "evaluations"("id") ON DELETE NO ACTION ON UPDATE NO ACTION;

-- AddForeignKey
ALTER TABLE "svie_post_requests" ADD CONSTRAINT "fk_rails_a0009aa5e4" FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE NO ACTION ON UPDATE NO ACTION;

-- AddForeignKey
ALTER TABLE "view_settings" ADD CONSTRAINT "fk_rails_2450b9d422" FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.