Docs
Database

Database

How to config your Neon database.

var Component=(()=>{var u=Object.create;var o=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var f=Object.getPrototypeOf,b=Object.prototype.hasOwnProperty;var y=(a,e)=>()=>(e||a((e={exports:{}}).exports,e),e.exports),k=(a,e)=>{for(var t in e)o(a,t,{get:e[t],enumerable:!0})},s=(a,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of m(e))!b.call(a,i)&&i!==t&&o(a,i,{get:()=>e[i],enumerable:!(r=g(e,i))||r.enumerable});return a};var _=(a,e,t)=>(t=a!=null?u(f(a)):{},s(e||!a||!a.__esModule?o(t,"default",{value:a,enumerable:!0}):t,a)),x=a=>s(o({},"__esModule",{value:!0}),a);var l=y((E,c)=>{c.exports=jsx_runtime});var C={};k(C,{default:()=>p,frontmatter:()=>w});var n=(l()),w={title:"Database",description:"How to config your Neon database."};function d(a){let e={a:"a",code:"code",figure:"figure",h2:"h2",h3:"h3",p:"p",pre:"pre",span:"span",strong:"strong",...a.components},{Callout:t,Steps:r}=e;return t||h("Callout",!0),r||h("Steps",!0),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(e.p,{children:"The project was start with PlanetScale like database. But the free tier has been recently removed."}), ,(0,n.jsxs)(e.p,{children:["Currently this project use ",(0,n.jsx)(e.strong,{children:"Neon"})," on the free plan. Check their ",(0,n.jsx)(e.a,{href:"https://neon.tech/pricing",children:"pricing page"})," for more informations."]}), ,(0,n.jsxs)(e.h2,{id:"steps",children:[(0,n.jsx)(e.a,{className:"subheading-anchor","aria-label":"Link to section",href:"#steps",children:(0,n.jsx)(e.span,{className:"icon icon-link"})}),"Steps"]}), ,(0,n.jsxs)(r,{children:[(0,n.jsxs)(e.h3,{id:"create-neon-account",children:[(0,n.jsx)(e.a,{className:"subheading-anchor","aria-label":"Link to section",href:"#create-neon-account",children:(0,n.jsx)(e.span,{className:"icon icon-link"})}),"Create Neon account"]}),(0,n.jsxs)(e.p,{children:["If don't have an account on Neon, just follow their steps ",(0,n.jsx)(e.a,{href:"https://neon.tech/docs/get-started-with-neon/signing-up",children:"here"})," for create one."]}),(0,n.jsxs)(e.h3,{id:"copy-database-url",children:[(0,n.jsx)(e.a,{className:"subheading-anchor","aria-label":"Link to section",href:"#copy-database-url",children:(0,n.jsx)(e.span,{className:"icon icon-link"})}),"Copy database url"]}),(0,n.jsxs)(e.p,{children:["After create a project on Neon, you can copy the database url. Select ",(0,n.jsx)(e.code,{children:"Prisma"})," from the list then the ",(0,n.jsx)(e.code,{children:"env"})," tab."]}),(0,n.jsx)(t,{type:"warning",children:(0,n.jsxs)(e.p,{children:[(0,n.jsx)("b",{children:"Don't forget"}), to reveal the information hidden behind the stars using the eye icon. It's not very visible in dark mode.]})}),(0,n.jsxs)(e.p,{children:["Paste in your ",(0,n.jsx)(e.code,{children:".env"})," file."]}),(0,n.jsx)(e.figure,{"data-rehype-pretty-code-figure":"",children:(0,n.jsx)(e.pre,{tabIndex:"0","data-language":"js","data-theme":"github-dark",rawString:DATABASE_URL = "postgres://alex:AbC123dEf@ep-cool-darkness-123456.us-east-2.aws.neon.tech/dbname"; ,children:(0,n.jsx)(e.code,{"data-language":"js","data-theme":"github-dark",style:{display:"grid"},children:(0,n.jsxs)(e.span,{"data-line":"",children:[(0,n.jsx)(e.span,{style:{color:"#79B8FF"},children:"DATABASE_URL"}),(0,n.jsx)(e.span,{style:{color:"#F97583"},children:" ="}),(0,n.jsx)(e.span,{style:{color:"#9ECBFF"},children:' "postgres://alex:AbC123dEf@ep-cool-darkness-123456.us-east-2.aws.neon.tech/dbname"'}),(0,n.jsx)(e.span,{style:{color:"#E1E4E8"},children:";"})]})})})}),(0,n.jsxs)(e.h3,{id:"push-migrations",children:[(0,n.jsx)(e.a,{className:"subheading-anchor","aria-label":"Link to section",href:"#push-migrations",children:(0,n.jsx)(e.span,{className:"icon icon-link"})}),"Push migrations"]}),(0,n.jsx)(e.p,{children:"You can push the migrations on your database with the cli."}),(0,n.jsx)(e.figure,{"data-rehype-pretty-code-figure":"",children:(0,n.jsx)(e.pre,{tabIndex:"0","data-language":"bash","data-theme":"github-dark",rawString:npx prisma db push ,children:(0,n.jsx)(e.code,{"data-language":"bash","data-theme":"github-dark",style:{display:"grid"},children:(0,n.jsxs)(e.span,{"data-line":"",children:[(0,n.jsx)(e.span,{style:{color:"#B392F0"},children:"npx"}),(0,n.jsx)(e.span,{style:{color:"#9ECBFF"},children:" prisma"}),(0,n.jsx)(e.span,{style:{color:"#9ECBFF"},children:" db"}),(0,n.jsx)(e.span,{style:{color:"#9ECBFF"},children:" push"})]})})})})]})]})}function p(a={}){let{wrapper:e}=a.components||{};return e?(0,n.jsx)(e,{...a,children:(0,n.jsx)(d,{...a})}):d(a)}function h(a,e){throw new Error("Expected "+(e?"component":"object")+" "+a+" to be defined: you likely forgot to import, pass, or provide it.")}return x(C);})(); ;return Component;