-- CreateTable
CREATE TABLE "subscription_feature" (
    "id" SERIAL NOT NULL,
    "status" INTEGER NOT NULL DEFAULT 1,
    "user_id" INTEGER NOT NULL,
    "subscription_id" INTEGER NOT NULL,
    "permission_id" INTEGER NOT NULL,
    "limit" INTEGER NOT NULL DEFAULT 5,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "subscription_feature_pkey" PRIMARY KEY ("id")
);

-- AddForeignKey
ALTER TABLE "subscription_feature" ADD CONSTRAINT "subscription_feature_subscription_id_fkey" FOREIGN KEY ("subscription_id") REFERENCES "subscription"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "subscription_feature" ADD CONSTRAINT "subscription_feature_permission_id_fkey" FOREIGN KEY ("permission_id") REFERENCES "permissions_list"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
