Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent foreign key data types #433

Open
tomitheninja opened this issue Apr 7, 2024 · 0 comments
Open

Inconsistent foreign key data types #433

tomitheninja opened this issue Apr 7, 2024 · 0 comments
Assignees

Comments

@tomitheninja
Copy link

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.

-- 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;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants