<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: aminah</title>
    <description>The latest articles on DEV Community by aminah (@aminahio).</description>
    <link>https://dev.to/aminahio</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F400016%2Fd90bdcfa-f0c3-43d9-8a99-b742a63fb978.png</url>
      <title>DEV Community: aminah</title>
      <link>https://dev.to/aminahio</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/aminahio"/>
    <language>en</language>
    <item>
      <title>Playing Around with Prisma</title>
      <dc:creator>aminah</dc:creator>
      <pubDate>Fri, 17 Mar 2023 10:55:47 +0000</pubDate>
      <link>https://dev.to/aminahio/playing-around-with-prisma-3b41</link>
      <guid>https://dev.to/aminahio/playing-around-with-prisma-3b41</guid>
      <description>&lt;p&gt;&lt;strong&gt;tl;dr&lt;/strong&gt;&lt;br&gt;
I'm using &lt;a href="https://create.t3.gg" rel="noopener noreferrer"&gt;Create T3 App&lt;/a&gt; to build my personal professional website, which includes a blog, to get familiar with all of the tech stack. I was able to easily find out that I couldn't use multiple databases for different environments, and the &lt;a href="https://www.prisma.io/" rel="noopener noreferrer"&gt;Prisma&lt;/a&gt; documentation was really helpful in find out that information.&lt;/p&gt;

&lt;p&gt;So I'm building a &lt;a href="https://create.t3.gg" rel="noopener noreferrer"&gt;Create T3 App&lt;/a&gt; to renovate my personal professional website, and I'm trying to set up a local database to build out my schema and test out the APIs for my personal professional website/blog and I come across an issue.&lt;/p&gt;

&lt;p&gt;I wanted to use sqlite3 locally and PostgreSQL in production, but the Prisma schema no longer allows for multiple datasources.&lt;/p&gt;

&lt;p&gt;First I tried adding an environment variable for the provider like so:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;datasource db {
  provider = env("DATABASE_PROVIDER")
  url      = env("DATABASE_URL")
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;but was met with the following error: &lt;code&gt;A datasource must not use the env() function in the provider argument.&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;That knocked one potential path out of the game. So then I tried adding multiple providers using an array.&lt;/p&gt;

&lt;p&gt;Previously, if you wanted to use a different database locally than in production, you could do something like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;datasource db {
  provider = ["postgresql", sqlite"]
  url      = env("DATABASE_URL")
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;but when I entered that, I was met with this error: &lt;code&gt;Error validating datasource 'postgresql': You defined more than one datasource. This is not allowed yet because support for multiple databases has not been implemented yet.&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Luckily the team over at Prisma made sure we knew what the deal was, so they gave us a heads up &lt;a href="https://www.prisma.io/docs/concepts/components/prisma-schema/data-sources" rel="noopener noreferrer"&gt;in the docs&lt;/a&gt;:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv40c8gild615ag2op3gl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv40c8gild615ag2op3gl.png" alt="Prisma documentation detailing only one datasource allowed"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;as well as linked us to the &lt;a href="https://github.com/prisma/prisma/issues/3834" rel="noopener noreferrer"&gt;GitHub deprecation issue&lt;/a&gt;, which outlined the implications of this deprecation:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzywkxjwyzebjqk58z1jb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzywkxjwyzebjqk58z1jb.png" alt="GitHub issue detailing implications of removal of multiplr datasources"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I ended up setting up PostgreSQL locally as well, which they provided &lt;a href="https://www.prisma.io/dataguide/postgresql/setting-up-a-local-postgresql-database#setting-up-postgresql-on-macos" rel="noopener noreferrer"&gt;instructions on how to do&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;All in all, I'm having a great time building this project because of the great documentation by the Prisma team.&lt;/p&gt;

</description>
      <category>prisma</category>
      <category>ct3a</category>
      <category>environmentsetup</category>
      <category>typescript</category>
    </item>
  </channel>
</rss>
