{"id":3299,"date":"2022-05-23T12:34:31","date_gmt":"2022-05-23T15:34:31","guid":{"rendered":"https:\/\/www.ufsm.br\/pet\/sistemas-de-informacao\/?p=3299"},"modified":"2025-09-02T15:07:07","modified_gmt":"2025-09-02T18:07:07","slug":"orm","status":"publish","type":"post","link":"https:\/\/www.ufsm.br\/pet\/sistemas-de-informacao\/2022\/05\/23\/orm","title":{"rendered":"ORM"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"3299\" class=\"elementor elementor-3299\">\n\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-427be91 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"427be91\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-2703ccc\" data-id=\"2703ccc\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-31332aa elementor-widget elementor-widget-text-editor\" data-id=\"31332aa\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<h2 style=\"line-height: 1.38;margin-top: 18pt;margin-bottom: 6pt;text-align: left\"><b><span style=\"font-size: 16pt;font-family: Arial;color: #000000;background-color: transparent;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">O<\/span><span style=\"font-size: 16pt;font-family: Arial;background-color: transparent;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\"> que \u00e9 e para que serve um ORM?<\/span><\/b><\/h2>\n<p style=\"text-align: left\"><b style=\"font-weight: normal\">&nbsp;<\/b><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;margin-top: 0pt;margin-bottom: 0pt;text-align: left\"><span style=\"font-size: 12.499999999999998pt;font-family: Arial;color: #000000;background-color: #ffffff;font-weight: bold;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">&nbsp;&nbsp;&nbsp;<\/span><span style=\"font-size: 12pt;font-family: Arial;color: #000000;background-color: #ffffff;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">&nbsp;Object-Relational Mapping (ORM), em portugu\u00eas, mapeamento objeto-relacional, \u00e9 uma t\u00e9cnica para aproximar o paradigma de desenvolvimento de aplica\u00e7\u00f5es orientadas a objetos ao paradigma do banco de dados relacional. O uso da t\u00e9cnica de mapeamento objeto-relacional \u00e9 realizado atrav\u00e9s de um mapeador objeto-relacional que geralmente \u00e9 a biblioteca ou framework que ajuda no mapeamento e uso do banco de dados.<\/span><\/p>\n<h3 style=\"line-height: 1.38;margin-top: 16pt;margin-bottom: 4pt;text-align: left\"><strong><span style=\"font-size: 14pt;font-family: Arial;color: #000000;background-color: transparent;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">Por que usar um ORM?<\/span><\/strong><\/h3>\n<p dir=\"ltr\" style=\"line-height: 1.38;margin-top: 0pt;margin-bottom: 0pt;text-align: left\"><span style=\"font-size: 12pt;font-family: Arial;color: #000000;background-color: #ffffff;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">&nbsp;&nbsp;&nbsp;&nbsp;Quando usamos o paradigma orientado a objetos trabalhamos principalmente com classes e \u00e9 claro objetos, que por sua vez representam algo do mundo real, seja algo concreto ou abstrato, como por exemplo:<\/span><\/p>\n<p style=\"text-align: left\"><b style=\"font-weight: normal\">&nbsp;<\/b><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;margin-top: 0pt;margin-bottom: 0pt;text-align: left\"><span style=\"font-size: 12pt;font-family: Arial;color: #000000;background-color: #ffffff;font-weight: 400;font-style: italic;font-variant: normal;text-decoration: none;vertical-align: baseline\">const produto = {<\/span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;margin-top: 0pt;margin-bottom: 0pt;text-align: left\"><span style=\"font-size: 12pt;font-family: Arial;color: #000000;background-color: #ffffff;font-weight: 400;font-style: italic;font-variant: normal;text-decoration: none;vertical-align: baseline\">&nbsp;&nbsp;&nbsp;&nbsp;id: 1,<\/span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;margin-top: 0pt;margin-bottom: 0pt;text-align: left\"><span style=\"font-size: 12pt;font-family: Arial;color: #000000;background-color: #ffffff;font-weight: 400;font-style: italic;font-variant: normal;text-decoration: none;vertical-align: baseline\">&nbsp;&nbsp;&nbsp;&nbsp;nome: &#8216;bicicleta&#8217;,<\/span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;margin-top: 0pt;margin-bottom: 0pt;text-align: left\"><span style=\"font-size: 12pt;font-family: Arial;color: #000000;background-color: #ffffff;font-weight: 400;font-style: italic;font-variant: normal;text-decoration: none;vertical-align: baseline\">&nbsp;&nbsp;&nbsp;&nbsp;preco: 800,<\/span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;margin-top: 0pt;margin-bottom: 0pt;text-align: left\"><span style=\"font-size: 12pt;font-family: Arial;color: #000000;background-color: #ffffff;font-weight: 400;font-style: italic;font-variant: normal;text-decoration: none;vertical-align: baseline\">&nbsp;&nbsp;&nbsp;&nbsp;descricao: &#8216;engrenagem fixa, azul, r\u00e1pida&#8217;,<\/span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;margin-top: 0pt;margin-bottom: 0pt;text-align: left\"><span style=\"font-size: 12pt;font-family: Arial;color: #000000;background-color: #ffffff;font-weight: 400;font-style: italic;font-variant: normal;text-decoration: none;vertical-align: baseline\">}<\/span><\/p>\n<p style=\"text-align: left\"><b style=\"font-weight: normal\">&nbsp;<\/b><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;margin-top: 0pt;margin-bottom: 0pt;text-align: left\"><span style=\"font-size: 12pt;font-family: Arial;color: #000000;background-color: #ffffff;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">&nbsp;&nbsp;&nbsp;&nbsp;O banco de dados relacional trabalha com tabelas e rela\u00e7\u00f5es entre elas para representar modelos da vida real. Dentro das tabelas temos v\u00e1rias colunas e a unidade que temos para representa\u00e7\u00e3o no modelo relacional \u00e9 uma linha:<\/span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;margin-top: 0pt;margin-bottom: 0pt;text-align: left\"><span style=\"font-size: 12pt;font-family: Arial;color: #000000;background-color: #ffffff;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">&nbsp;&nbsp;<\/span><\/p>\n<div dir=\"ltr\" style=\"margin-left: 0pt;text-align: left\" align=\"left\">\n<table style=\"border: none;border-collapse: collapse;width: 451.27559055118115pt\">\n<colgroup>\n<col>\n<col>\n<col>\n<col><\/colgroup>\n<tbody>\n<tr style=\"height: 0pt\">\n<td style=\"vertical-align: top;padding: 5pt 5pt 5pt 5pt;overflow: hidden;border: solid #000000 1pt\">\n<p dir=\"ltr\" style=\"line-height: 1.2;text-align: center;margin-top: 0pt;margin-bottom: 0pt\"><span style=\"font-size: 12pt;font-family: Arial;color: #000000;background-color: #ffffff;font-weight: 400;font-style: italic;font-variant: normal;text-decoration: none;vertical-align: baseline\">id<\/span><\/p>\n<\/td>\n<td style=\"vertical-align: top;padding: 5pt 5pt 5pt 5pt;overflow: hidden;border: solid #000000 1pt\">\n<p dir=\"ltr\" style=\"line-height: 1.2;text-align: center;margin-top: 0pt;margin-bottom: 0pt\"><span style=\"font-size: 12pt;font-family: Arial;color: #000000;background-color: #ffffff;font-weight: 400;font-style: italic;font-variant: normal;text-decoration: none;vertical-align: baseline\">nome<\/span><\/p>\n<\/td>\n<td style=\"vertical-align: top;padding: 5pt 5pt 5pt 5pt;overflow: hidden;border: solid #000000 1pt\">\n<p dir=\"ltr\" style=\"line-height: 1.2;text-align: center;margin-top: 0pt;margin-bottom: 0pt\"><span style=\"font-size: 12pt;font-family: Arial;color: #000000;background-color: #ffffff;font-weight: 400;font-style: italic;font-variant: normal;text-decoration: none;vertical-align: baseline\">preco<\/span><\/p>\n<\/td>\n<td style=\"vertical-align: top;padding: 5pt 5pt 5pt 5pt;overflow: hidden;border: solid #000000 1pt\">\n<p dir=\"ltr\" style=\"line-height: 1.2;text-align: center;margin-top: 0pt;margin-bottom: 0pt\"><span style=\"font-size: 12pt;font-family: Arial;color: #000000;background-color: #ffffff;font-weight: 400;font-style: italic;font-variant: normal;text-decoration: none;vertical-align: baseline\">descricao<\/span><\/p>\n<\/td>\n<\/tr>\n<tr style=\"height: 0pt\">\n<td style=\"vertical-align: top;padding: 5pt 5pt 5pt 5pt;overflow: hidden;border: solid #000000 1pt\">\n<p dir=\"ltr\" style=\"line-height: 1.2;text-align: center;margin-top: 0pt;margin-bottom: 0pt\"><span style=\"font-size: 12pt;font-family: Arial;color: #000000;background-color: #ffffff;font-weight: 400;font-style: italic;font-variant: normal;text-decoration: none;vertical-align: baseline\">1<\/span><\/p>\n<\/td>\n<td style=\"vertical-align: top;padding: 5pt 5pt 5pt 5pt;overflow: hidden;border: solid #000000 1pt\">\n<p dir=\"ltr\" style=\"line-height: 1.2;text-align: center;margin-top: 0pt;margin-bottom: 0pt\"><span style=\"font-size: 12pt;font-family: Arial;color: #000000;background-color: #ffffff;font-weight: 400;font-style: italic;font-variant: normal;text-decoration: none;vertical-align: baseline\">bicicleta<\/span><\/p>\n<\/td>\n<td style=\"vertical-align: top;padding: 5pt 5pt 5pt 5pt;overflow: hidden;border: solid #000000 1pt\">\n<p dir=\"ltr\" style=\"line-height: 1.2;text-align: center;margin-top: 0pt;margin-bottom: 0pt\"><span style=\"font-size: 12pt;font-family: Arial;color: #000000;background-color: #ffffff;font-weight: 400;font-style: italic;font-variant: normal;text-decoration: none;vertical-align: baseline\">800<\/span><\/p>\n<\/td>\n<td style=\"vertical-align: top;padding: 5pt 5pt 5pt 5pt;overflow: hidden;border: solid #000000 1pt\">\n<p dir=\"ltr\" style=\"line-height: 1.2;text-align: center;margin-top: 0pt;margin-bottom: 0pt\"><span style=\"font-size: 12pt;font-family: Arial;color: #000000;background-color: #ffffff;font-weight: 400;font-style: italic;font-variant: normal;text-decoration: none;vertical-align: baseline\">engrenagem fixa, azul, r\u00e1pida<\/span><\/p>\n<\/td>\n<\/tr>\n<tr style=\"height: 0pt\">\n<td style=\"vertical-align: top;padding: 5pt 5pt 5pt 5pt;overflow: hidden;border: solid #000000 1pt\">\n<p dir=\"ltr\" style=\"line-height: 1.2;text-align: center;margin-top: 0pt;margin-bottom: 0pt\"><span style=\"font-size: 12pt;font-family: Arial;color: #000000;background-color: #ffffff;font-weight: 400;font-style: italic;font-variant: normal;text-decoration: none;vertical-align: baseline\">2<\/span><\/p>\n<\/td>\n<td style=\"vertical-align: top;padding: 5pt 5pt 5pt 5pt;overflow: hidden;border: solid #000000 1pt\">\n<p dir=\"ltr\" style=\"line-height: 1.2;text-align: center;margin-top: 0pt;margin-bottom: 0pt\"><span style=\"font-size: 12pt;font-family: Arial;color: #000000;background-color: #ffffff;font-weight: 400;font-style: italic;font-variant: normal;text-decoration: none;vertical-align: baseline\">capacete<\/span><\/p>\n<\/td>\n<td style=\"vertical-align: top;padding: 5pt 5pt 5pt 5pt;overflow: hidden;border: solid #000000 1pt\">\n<p dir=\"ltr\" style=\"line-height: 1.2;text-align: center;margin-top: 0pt;margin-bottom: 0pt\"><span style=\"font-size: 12pt;font-family: Arial;color: #000000;background-color: #ffffff;font-weight: 400;font-style: italic;font-variant: normal;text-decoration: none;vertical-align: baseline\">20.5<\/span><\/p>\n<\/td>\n<td style=\"vertical-align: top;padding: 5pt 5pt 5pt 5pt;overflow: hidden;border: solid #000000 1pt\">\n<p dir=\"ltr\" style=\"line-height: 1.2;text-align: center;margin-top: 0pt;margin-bottom: 0pt\"><span style=\"font-size: 12pt;font-family: Arial;color: #000000;background-color: #ffffff;font-weight: 400;font-style: italic;font-variant: normal;text-decoration: none;vertical-align: baseline\">preto, ajust\u00e1vel<\/span><\/p>\n<\/td>\n<\/tr>\n<tr style=\"height: 0pt\">\n<td style=\"vertical-align: top;padding: 5pt 5pt 5pt 5pt;overflow: hidden;border: solid #000000 1pt\">\n<p dir=\"ltr\" style=\"line-height: 1.2;text-align: center;margin-top: 0pt;margin-bottom: 0pt\"><span style=\"font-size: 12pt;font-family: Arial;color: #000000;background-color: #ffffff;font-weight: 400;font-style: italic;font-variant: normal;text-decoration: none;vertical-align: baseline\">3<\/span><\/p>\n<\/td>\n<td style=\"vertical-align: top;padding: 5pt 5pt 5pt 5pt;overflow: hidden;border: solid #000000 1pt\">\n<p dir=\"ltr\" style=\"line-height: 1.2;text-align: center;margin-top: 0pt;margin-bottom: 0pt\"><span style=\"font-size: 12pt;font-family: Arial;color: #000000;background-color: #ffffff;font-weight: 400;font-style: italic;font-variant: normal;text-decoration: none;vertical-align: baseline\">uniforme<\/span><\/p>\n<\/td>\n<td style=\"vertical-align: top;padding: 5pt 5pt 5pt 5pt;overflow: hidden;border: solid #000000 1pt\">\n<p dir=\"ltr\" style=\"line-height: 1.2;text-align: center;margin-top: 0pt;margin-bottom: 0pt\"><span style=\"font-size: 12pt;font-family: Arial;color: #000000;background-color: #ffffff;font-weight: 400;font-style: italic;font-variant: normal;text-decoration: none;vertical-align: baseline\">35<\/span><\/p>\n<\/td>\n<td style=\"vertical-align: top;padding: 5pt 5pt 5pt 5pt;overflow: hidden;border: solid #000000 1pt\">\n<p dir=\"ltr\" style=\"line-height: 1.2;text-align: center;margin-top: 0pt;margin-bottom: 0pt\"><span style=\"font-size: 12pt;font-family: Arial;color: #000000;background-color: #ffffff;font-weight: 400;font-style: italic;font-variant: normal;text-decoration: none;vertical-align: baseline\">pequeno, verde e branco<\/span><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p style=\"text-align: left\">\n<\/p><p dir=\"ltr\" style=\"line-height: 2.016;background-color: #ffffff;margin-top: 0pt;margin-bottom: 15pt;text-align: left\"><span style=\"font-size: 12pt;font-family: Arial;color: #000000;background-color: #ffffff;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\"> As principais dificuldades que essas diferen\u00e7as entre paradigmas causa:<\/span><\/p>\n<ul style=\"margin-top: 0px;margin-bottom: 0px;text-align: left\">\n<li style=\"list-style-type: disc;font-size: 12pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline;margin-left: 23pt\">\n<p dir=\"ltr\" style=\"line-height: 1.38;text-align: justify;background-color: #ffffff;margin-top: 42pt;margin-bottom: 0pt\" role=\"presentation\"><span style=\"font-size: 12pt;font-family: Arial;color: #000000;background-color: #ffffff;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">Representa\u00e7\u00e3o dos dados e do modelo, j\u00e1 que as estruturas s\u00e3o distintas;<\/span><\/p>\n<\/li>\n<li style=\"list-style-type: disc;font-size: 12pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline;margin-left: 23pt\">\n<p dir=\"ltr\" style=\"line-height: 1.38;text-align: justify;background-color: #ffffff;margin-top: 0pt;margin-bottom: 0pt\" role=\"presentation\"><span style=\"font-size: 12pt;font-family: Arial;color: #000000;background-color: #ffffff;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">Mapeamento entre os tipos de dados da linguagem de programa\u00e7\u00e3o e do banco de dados;<\/span><\/p>\n<\/li>\n<li style=\"list-style-type: disc;font-size: 12pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline;margin-left: 23pt\">\n<p dir=\"ltr\" style=\"line-height: 1.38;text-align: justify;background-color: #ffffff;margin-top: 0pt;margin-bottom: 52pt\" role=\"presentation\"><span style=\"font-size: 12pt;font-family: Arial;color: #000000;background-color: #ffffff;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">Modelo de integridade relacional do banco relacional;<\/span><\/p>\n<\/li>\n<\/ul>\n<p dir=\"ltr\" style=\"line-height: 1.38;background-color: #ffffff;margin-top: 42pt;margin-bottom: 0pt;padding: 0pt 0pt 52pt;text-align: left\"><span style=\"font-size: 12pt;font-family: Arial;color: #000000;background-color: #ffffff;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\"> Outra grande vantagem em utilizar um ORM para representar esta rela\u00e7\u00e3o entre banco de dados e objetos \u00e9 que bons ORMs implementam v\u00e1rias quest\u00f5es de seguran\u00e7a buscando evitar ataques comuns, como SQL Injection, CSRF, Session Hijacking, Replay Attack, entre outros. Na pr\u00e1tica o que o ORM faz \u00e9 uma &#8220;sanitiza\u00e7\u00e3o&#8221; dos dados enviados ao banco de dados, o que consequentemente resulta em um ganho de tempo pelos programadores.<\/span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;background-color: #ffffff;margin-top: 42pt;margin-bottom: 0pt;padding: 0pt 0pt 52pt;text-align: left\"><span style=\"background-color: transparent;color: #000000;font-family: Arial;font-size: 14pt\"><b>Padr\u00f5es usados no mercado<\/b><\/span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;margin-top: 0pt;margin-bottom: 0pt;text-align: left\"><span style=\"font-size: 12pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">&nbsp;&nbsp;&nbsp;&nbsp;Martin Fowler em seu livro &#8220;<\/span><span style=\"font-size: 12pt;font-family: Arial;color: #000000;background-color: #ffffff;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">Padr\u00f5es de Arquitetura de Aplica\u00e7\u00f5es Corporativas&#8221; relata dois principais padr\u00f5es utilizados pela ind\u00fastrias, sendo eles:<\/span><\/p>\n<p style=\"text-align: left\"><b style=\"font-weight: normal\">&nbsp;<\/b><\/p>\n<ul style=\"margin-top: 0px;margin-bottom: 0px;text-align: left\">\n<li style=\"list-style-type: disc;font-size: 12pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">\n<p dir=\"ltr\" style=\"line-height: 1.38;text-align: justify;margin-top: 0pt;margin-bottom: 0pt\" role=\"presentation\"><span style=\"font-size: 12pt;font-family: Arial;color: #000000;background-color: #ffffff;font-weight: bold;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">Data Mapper:<\/span><span style=\"font-size: 12pt;font-family: Arial;color: #000000;background-color: #ffffff;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\"> Neste padr\u00e3o a classe que representa a entidade (tabela) no banco de dados n\u00e3o deve conhecer os m\u00e9todos de inser\u00e7\u00e3o, busca, atualiza\u00e7\u00e3o e exclus\u00e3o, estas opera\u00e7\u00f5es s\u00e3o feitas atrav\u00e9s de uma classe pr\u00f3pria do ORM, deste modo garantindo que as classes que representam as tabelas tenham uma \u00fanica responsabilidade, este \u00e9 o padr\u00e3o mais usado e ser\u00e1 demonstrado em um exemplo logo mais.<\/span><\/p>\n<\/li>\n<li style=\"list-style-type: disc;font-size: 12pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">\n<p dir=\"ltr\" style=\"line-height: 1.38;text-align: justify;margin-top: 0pt;margin-bottom: 0pt\" role=\"presentation\"><span style=\"font-size: 12pt;font-family: Arial;color: #000000;background-color: #ffffff;font-weight: bold;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">Active Record: <\/span><span style=\"font-size: 12pt;font-family: Arial;color: #000000;background-color: #ffffff;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">Neste caso a classe conhece os m\u00e9todos b\u00e1sicos para se relacionar com o banco de dados, estes m\u00e9todos s\u00e3o herdados de uma classe do ORM, na pr\u00e1tica \u00e9 feito apenas uma nova inst\u00e2ncia do objeto desejado e eles j\u00e1 possuem todos os m\u00e9todos por heran\u00e7a.&nbsp;<\/span><\/p>\n<\/li>\n<\/ul>\n<p style=\"text-align: left\">\n<\/p><p style=\"text-align: left\">\n<\/p><h3 style=\"line-height: 1.38;margin-top: 16pt;margin-bottom: 4pt;text-align: left\"><strong><span style=\"font-size: 14pt;font-family: Arial;color: #000000;background-color: transparent;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">Exemplo usando Prisma ORM<\/span><\/strong><\/h3>\n<p style=\"text-align: left\"><b style=\"font-weight: normal\">&nbsp;<\/b><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;margin-top: 0pt;margin-bottom: 0pt;text-align: left\"><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">&nbsp;&nbsp;&nbsp;&nbsp;O Prisma \u00e9 um ORM NodeJS que consiste em tr\u00eas ferramentas principais:<\/span><\/p>\n<p style=\"text-align: left\"><b style=\"font-weight: normal\">&nbsp;<\/b><\/p>\n<ul style=\"margin-top: 0px;margin-bottom: 0px;text-align: left\">\n<li style=\"list-style-type: disc;font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">\n<p dir=\"ltr\" style=\"line-height: 1.38;text-align: justify;margin-top: 0pt;margin-bottom: 0pt\" role=\"presentation\"><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">Prisma Client: um construtor de consultas gerado automaticamente e fortemente tipado para o Node.js e o TypeScript.<\/span><\/p>\n<\/li>\n<li style=\"list-style-type: disc;font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">\n<p dir=\"ltr\" style=\"line-height: 1.38;text-align: justify;margin-top: 0pt;margin-bottom: 0pt\" role=\"presentation\"><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">Prisma Migrate: um sistema declarativo de modelagem e migra\u00e7\u00e3o de dados.<\/span><\/p>\n<\/li>\n<li style=\"list-style-type: disc;font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">\n<p dir=\"ltr\" style=\"line-height: 1.38;text-align: justify;margin-top: 0pt;margin-bottom: 0pt\" role=\"presentation\"><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">Prisma Studio: uma GUI para visualizar e editar dados em seu banco de dados.<\/span><\/p>\n<\/li>\n<\/ul>\n<p dir=\"ltr\" style=\"line-height: 1.38;margin-top: 0pt;margin-bottom: 0pt;text-align: left\"><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">&nbsp;&nbsp;&nbsp;&nbsp;Embora o Prisma tenha muitas funcionalidades legais, como uma integra\u00e7\u00e3o com Typescript autom\u00e1tica, gera\u00e7\u00e3o de migrations autom\u00e1tica e um SGBD pr\u00f3prio, o objetivo principal desta reda\u00e7\u00e3o \u00e9 us\u00e1-lo para exemplificar alguns conceitos comuns que muitos ORMs possuem e n\u00e3o ser um tutorial de Prisma em si.<\/span><\/p>\n<h3 style=\"line-height: 1.38;margin-top: 16pt;margin-bottom: 4pt;text-align: left\"><strong><span style=\"font-size: 14pt;font-family: Arial;color: #000000;background-color: transparent;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">Mapeamento de dados<\/span><\/strong><\/h3>\n<p dir=\"ltr\" style=\"line-height: 1.38;margin-top: 0pt;margin-bottom: 0pt;text-align: left\"><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">&nbsp;&nbsp;&nbsp;&nbsp;<\/span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;margin-top: 0pt;margin-bottom: 0pt;text-align: left\"><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"font-size: 12pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">No exemplo abaixo, <\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #00009f;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">datasource<\/span><span style=\"font-size: 12pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\"> e <\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #00009f;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">generator <\/span><span style=\"font-size: 12pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">s\u00e3o entidades de configura\u00e7\u00e3o, al\u00e9m disso criamos dois models, <\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #1a202c;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">Post<\/span><span style=\"font-size: 12pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\"> e <\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #1a202c;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">User<\/span><span style=\"font-size: 12pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\"> que representam entidades do nosso banco de dados, note que as rela\u00e7\u00f5es entre tabelas s\u00e3o criadas no pr\u00f3prio model, como no campo <\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #1a202c;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">posts <\/span><span style=\"font-size: 12pt;font-family: Arial;color: #222222;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">do model<\/span> <span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #1a202c;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">User<\/span><span style=\"font-size: 12pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">, campos obrigat\u00f3rios ou n\u00e3o s\u00e3o definidos pelo marcados &#8220;?&#8221;, este \u00e9 s\u00f3 um exemplo de como os ORMs mapeam as entidades do banco de dados em objetos na aplica\u00e7\u00e3o.<\/span><\/p>\n<h3 style=\"line-height: 1.38;background-color: #f6f8fa;margin-top: 0pt;margin-bottom: 0pt;padding: 16pt 0pt 4pt;text-align: left\"><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #00009f;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">datasource<\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #1a202c;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\"> db <\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #393a34;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">{<\/span><\/h3>\n<h3 style=\"line-height: 1.38;background-color: #f6f8fa;margin-top: 0pt;margin-bottom: 0pt;padding: 12pt 0pt 4pt;text-align: left\"><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #1a202c;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">&nbsp; provider <\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #393a34;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">=<\/span> <span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #e3116c;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">&#8220;postgresql&#8221;<\/span><\/h3>\n<h3 style=\"line-height: 1.38;background-color: #f6f8fa;margin-top: 0pt;margin-bottom: 0pt;padding: 12pt 0pt 4pt;text-align: left\"><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #1a202c;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">&nbsp; url&nbsp; &nbsp; &nbsp; <\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #393a34;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">=<\/span> <span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #d73a49;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">env<\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #393a34;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">(<\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #e3116c;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">&#8220;DATABASE_URL&#8221;<\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #393a34;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">)<\/span><\/h3>\n<h3 style=\"line-height: 1.38;background-color: #f6f8fa;margin-top: 0pt;margin-bottom: 0pt;padding: 12pt 0pt 4pt;text-align: left\"><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #393a34;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">}<\/span><\/h3>\n<h3 style=\"line-height: 1.38;background-color: #f6f8fa;margin-top: 0pt;margin-bottom: 0pt;padding: 12pt 0pt 4pt;text-align: left\"><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #00009f;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">generator<\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #1a202c;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\"> client <\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #393a34;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">{<\/span><\/h3>\n<h3 style=\"line-height: 1.38;background-color: #f6f8fa;margin-top: 0pt;margin-bottom: 0pt;padding: 12pt 0pt 4pt;text-align: left\"><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #1a202c;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">&nbsp; provider <\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #393a34;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">=<\/span> <span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #e3116c;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">&#8220;prisma-client-js&#8221;<\/span><\/h3>\n<h3 style=\"line-height: 1.38;background-color: #f6f8fa;margin-top: 0pt;margin-bottom: 0pt;padding: 12pt 0pt 4pt;text-align: left\"><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #393a34;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">}<\/span><\/h3>\n<h3 style=\"line-height: 1.38;background-color: #f6f8fa;margin-top: 0pt;margin-bottom: 0pt;padding: 12pt 0pt 4pt;text-align: left\"><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #00009f;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">model<\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #1a202c;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\"> Post <\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #393a34;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">{<\/span><\/h3>\n<h3 style=\"line-height: 1.38;background-color: #f6f8fa;margin-top: 0pt;margin-bottom: 0pt;padding: 12pt 0pt 4pt;text-align: left\"><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #1a202c;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">&nbsp; id&nbsp; &nbsp; &nbsp; &nbsp; Int &nbsp; &nbsp; <\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #393a34;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">@id<\/span> <span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #393a34;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">@default(<\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #d73a49;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">autoincrement<\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #393a34;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">())<\/span><\/h3>\n<h3 style=\"line-height: 1.38;background-color: #f6f8fa;margin-top: 0pt;margin-bottom: 0pt;padding: 12pt 0pt 4pt;text-align: left\"><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #1a202c;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">&nbsp; title &nbsp; &nbsp; String<\/span><\/h3>\n<h3 style=\"line-height: 1.38;background-color: #f6f8fa;margin-top: 0pt;margin-bottom: 0pt;padding: 12pt 0pt 4pt;text-align: left\"><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #1a202c;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">&nbsp; content &nbsp; String<\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #393a34;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">?<\/span><\/h3>\n<h3 style=\"line-height: 1.38;background-color: #f6f8fa;margin-top: 0pt;margin-bottom: 0pt;padding: 12pt 0pt 4pt;text-align: left\"><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #1a202c;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">&nbsp; published Boolean <\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #393a34;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">@default(<\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #36acaa;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">false<\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #393a34;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">)<\/span><\/h3>\n<h3 style=\"line-height: 1.38;background-color: #f6f8fa;margin-top: 0pt;margin-bottom: 0pt;padding: 12pt 0pt 4pt;text-align: left\"><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #1a202c;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">&nbsp; author&nbsp; &nbsp; User<\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #393a34;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">?<\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #1a202c;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\"> &nbsp; <\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #393a34;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">@relation(<\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #1a202c;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">fields: <\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #393a34;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">[<\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #1a202c;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">authorId<\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #393a34;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">],<\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #1a202c;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\"> references: <\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #393a34;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">[<\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #1a202c;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">id<\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #393a34;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">])<\/span><\/h3>\n<h3 style=\"line-height: 1.38;background-color: #f6f8fa;margin-top: 0pt;margin-bottom: 0pt;padding: 12pt 0pt 4pt;text-align: left\"><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #1a202c;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">&nbsp; authorId&nbsp; Int<\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #393a34;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">?<\/span><\/h3>\n<h3 style=\"line-height: 1.38;background-color: #f6f8fa;margin-top: 0pt;margin-bottom: 0pt;padding: 12pt 0pt 4pt;text-align: left\"><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #393a34;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">}<\/span><\/h3>\n<h3 style=\"line-height: 1.38;background-color: #f6f8fa;margin-top: 0pt;margin-bottom: 0pt;padding: 12pt 0pt 4pt;text-align: left\"><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #00009f;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">model<\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #1a202c;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\"> User <\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #393a34;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">{<\/span><\/h3>\n<h3 style=\"line-height: 1.38;background-color: #f6f8fa;margin-top: 0pt;margin-bottom: 0pt;padding: 12pt 0pt 4pt;text-align: left\"><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #1a202c;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">&nbsp; id&nbsp; &nbsp; Int &nbsp; &nbsp; <\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #393a34;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">@id<\/span> <span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #393a34;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">@default(<\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #d73a49;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">autoincrement<\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #393a34;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">())<\/span><\/h3>\n<h3 style=\"line-height: 1.38;background-color: #f6f8fa;margin-top: 0pt;margin-bottom: 0pt;padding: 12pt 0pt 4pt;text-align: left\"><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #1a202c;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">&nbsp; email String&nbsp; <\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #393a34;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">@unique<\/span><\/h3>\n<h3 style=\"line-height: 1.38;background-color: #f6f8fa;margin-top: 0pt;margin-bottom: 0pt;padding: 12pt 0pt 4pt;text-align: left\"><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #1a202c;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">&nbsp; name&nbsp; String<\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #393a34;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">?<\/span><\/h3>\n<h3 style=\"line-height: 1.38;background-color: #f6f8fa;margin-top: 0pt;margin-bottom: 0pt;padding: 12pt 0pt 4pt;text-align: left\"><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #1a202c;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">&nbsp; posts Post<\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #393a34;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">[]<\/span><\/h3>\n<h3 style=\"line-height: 1.38;background-color: #f6f8fa;margin-top: 0pt;margin-bottom: 0pt;padding: 12pt 0pt 4pt;text-align: left\"><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #393a34;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">}<\/span><\/h3>\n<h3 style=\"line-height: 1.38;margin-top: 16pt;margin-bottom: 4pt;text-align: left\"><span style=\"font-size: 12pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">&nbsp;<\/span><\/h3>\n<p dir=\"ltr\" style=\"line-height: 1.38;margin-top: 0pt;margin-bottom: 0pt;text-align: left\"><span style=\"font-size: 12pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">&nbsp;&nbsp;&nbsp;&nbsp;Para manipular os dados, normalmente usamos algo como:&nbsp;<\/span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;background-color: #f6f8fa;margin-top: 0pt;margin-bottom: 0pt;text-align: left\"><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #00009f;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\"><br><\/span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;background-color: #f6f8fa;margin-top: 0pt;margin-bottom: 0pt;text-align: left\"><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #00009f;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">import<\/span> <span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #393a34;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">{<\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #1a202c;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\"> PrismaClient <\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #393a34;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">}<\/span> <span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #00009f;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">from<\/span> <span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #e3116c;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">&#8216;@prisma\/client&#8217;<\/span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;background-color: #f6f8fa;margin-top: 0pt;margin-bottom: 0pt;text-align: left\"><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #00009f;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">const<\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #1a202c;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\"> prisma <\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #393a34;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">=<\/span> <span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #00009f;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">new<\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #1a202c;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\"> PrismaClient<\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #393a34;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">()<\/span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;background-color: #f6f8fa;margin-top: 0pt;margin-bottom: 0pt;text-align: left\"><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #393a34;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">\/\/ busca todos os usu\u00e1rios com posts<\/span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;background-color: #f6f8fa;margin-top: 0pt;margin-bottom: 0pt;text-align: left\"><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #00009f;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">const<\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #1a202c;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\"> allUsers <\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #393a34;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">=<\/span> <span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #00009f;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">await<\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #1a202c;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\"> prisma<\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #393a34;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">.<\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #1a202c;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">user<\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #393a34;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">.<\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #d73a49;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">findMany<\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #393a34;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">({<\/span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;background-color: #f6f8fa;margin-top: 0pt;margin-bottom: 0pt;text-align: left\"><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #1a202c;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">&nbsp; include<\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #393a34;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">:<\/span> <span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #393a34;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">{<\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #1a202c;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\"> posts<\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #393a34;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">:<\/span> <span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #36acaa;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">true<\/span> <span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #393a34;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">},<\/span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;background-color: #f6f8fa;margin-top: 0pt;margin-bottom: 0pt;text-align: left\"><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #393a34;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">})<\/span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;background-color: #f6f8fa;margin-top: 0pt;margin-bottom: 0pt;text-align: left\"><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #393a34;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">\/\/ cria um usu\u00e1rio e um post juntos<\/span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;background-color: #f6f8fa;margin-top: 0pt;margin-bottom: 0pt;text-align: left\"><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #00009f;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">const<\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #1a202c;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\"> user <\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #393a34;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">=<\/span> <span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #00009f;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">await<\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #1a202c;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\"> prisma<\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #393a34;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">.<\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #1a202c;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">user<\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #393a34;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">.<\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #d73a49;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">create<\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #393a34;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">({<\/span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;background-color: #f6f8fa;margin-top: 0pt;margin-bottom: 0pt;text-align: left\"><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #1a202c;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">&nbsp;data<\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #393a34;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">:<\/span> <span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #393a34;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">{<\/span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;background-color: #f6f8fa;margin-top: 0pt;margin-bottom: 0pt;text-align: left\"><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #1a202c;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">&nbsp;&nbsp;&nbsp;name<\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #393a34;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">:<\/span> <span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #e3116c;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">&#8216;Alice&#8217;<\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #393a34;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">,<\/span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;background-color: #f6f8fa;margin-top: 0pt;margin-bottom: 0pt;text-align: left\"><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #1a202c;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">&nbsp;&nbsp;&nbsp;email<\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #393a34;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">:<\/span> <span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #e3116c;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">&#8216;alice@prisma.io&#8217;<\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #393a34;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">,<\/span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;background-color: #f6f8fa;margin-top: 0pt;margin-bottom: 0pt;text-align: left\"><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #1a202c;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">&nbsp;&nbsp;&nbsp;posts<\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #393a34;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">:<\/span> <span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #393a34;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">{<\/span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;background-color: #f6f8fa;margin-top: 0pt;margin-bottom: 0pt;text-align: left\"><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #1a202c;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;create<\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #393a34;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">:<\/span> <span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #393a34;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">{<\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #1a202c;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\"> title<\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #393a34;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">:<\/span> <span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #e3116c;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">&#8216;Join us for Prisma Day 2020&#8217;<\/span> <span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #393a34;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">},<\/span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;background-color: #f6f8fa;margin-top: 0pt;margin-bottom: 0pt;text-align: left\"><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #1a202c;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">&nbsp;&nbsp;&nbsp;<\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #393a34;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">},<\/span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;background-color: #f6f8fa;margin-top: 0pt;margin-bottom: 0pt;text-align: left\"><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #1a202c;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">&nbsp;<\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #393a34;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">},<\/span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;background-color: #f6f8fa;margin-top: 0pt;margin-bottom: 0pt;text-align: left\"><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #393a34;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">})<\/span><\/p>\n<p style=\"text-align: left\"><b style=\"font-weight: normal\">&nbsp;<\/b><\/p>\n<h3 style=\"line-height: 1.38;margin-top: 16pt;margin-bottom: 4pt;text-align: left\"><span style=\"font-size: 14pt;font-family: Arial;background-color: transparent;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\"><b>Migrations<\/b><\/span><\/h3>\n<p dir=\"ltr\" style=\"line-height: 1.38;margin-top: 0pt;margin-bottom: 0pt;text-align: left\"><span style=\"font-size: 12pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">&nbsp;<\/span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;margin-top: 0pt;margin-bottom: 0pt;text-align: left\"><span style=\"font-size: 12pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">&nbsp;&nbsp;&nbsp;&nbsp;No Prisma os models est\u00e3o contidos no arquivo prisma.schema, as migrations fazem a sincroniza\u00e7\u00e3o de tudo contigo neste arquivo, o processo normalmente ocorre da seguinte forma:<\/span><\/p>\n<p style=\"text-align: left\"><b style=\"font-weight: normal\">&nbsp;<\/b><\/p>\n<ol style=\"margin-top: 0px;margin-bottom: 0px;text-align: left\">\n<li style=\"list-style-type: decimal;font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">\n<p dir=\"ltr\" style=\"line-height: 1.38;margin-top: 0pt;margin-bottom: 0pt\" role=\"presentation\"><span style=\"font-size: 12pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">O comando <\/span><span style=\"font-size: 10.5pt;font-family: Consolas,sans-serif;color: #393a34;background-color: #f6f8fa;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">prisma migrate dev &#8211;name init<\/span><span style=\"font-size: 12pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\"> cria uma nova migrate, que nada mais \u00e9 que um arquivo .sql com os comandos realizados pelo ORM, neste primeiro caso alguns create table, a estrutura de pastas \u00e9 bem simples.<\/span><\/p>\n<\/li>\n<\/ol>\n<p dir=\"ltr\" style=\"line-height: 1.38;margin-left: 36pt;background-color: #f6f8fa;margin-top: 0pt;margin-bottom: 0pt;text-align: left\"><span style=\"font-size: 10.5pt;font-family: Consolas,sans-serif;color: #1a202c;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">migrations\/<\/span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;margin-left: 36pt;background-color: #f6f8fa;margin-top: 0pt;margin-bottom: 0pt;text-align: left\"><span style=\"font-size: 10.5pt;font-family: Consolas,sans-serif;color: #1a202c;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">&nbsp;\u2514\u2500 20210313140442_init\/<\/span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;margin-left: 36pt;background-color: #f6f8fa;margin-top: 0pt;margin-bottom: 0pt;text-align: left\"><span style=\"font-size: 10.5pt;font-family: Consolas,sans-serif;color: #1a202c;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">&nbsp;&nbsp;&nbsp;\u2514\u2500 migration.sql<\/span><\/p>\n<p style=\"text-align: left\"><b style=\"font-weight: normal\">&nbsp;<\/b><\/p>\n<ol style=\"margin-top: 0px;margin-bottom: 0px;text-align: left\" start=\"2\">\n<li style=\"list-style-type: decimal;font-size: 12pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">\n<p dir=\"ltr\" style=\"line-height: 1.38;margin-top: 0pt;margin-bottom: 0pt\" role=\"presentation\"><span style=\"font-size: 12pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">Agora vamos supor que o model de <\/span><span style=\"font-size: 12pt;font-family: Consolas,sans-serif;color: #1a202c;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">User<\/span><span style=\"font-size: 12pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\"> foi alterado e a coluna &#8220;<\/span><span style=\"font-size: 10.5pt;font-family: Consolas,sans-serif;color: #1a202c;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">jobTitle <\/span><span style=\"font-size: 10.5pt;font-family: Consolas,sans-serif;color: #805ad5;background-color: #d9f4e6;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">String&#8221;<\/span> <span style=\"font-size: 12pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">foi adicionada.<\/span><\/p>\n<\/li>\n<li style=\"list-style-type: decimal;font-size: 12pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">\n<p dir=\"ltr\" style=\"line-height: 1.38;margin-top: 0pt;margin-bottom: 0pt\" role=\"presentation\"><span style=\"font-size: 12pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">Deste modo \u00e9 necess\u00e1rio criar uma nova migrate usando o mesmo comando, que neste caso gera um arquivo .sql que \u00e9 um alter table.<\/span><\/p>\n<\/li>\n<\/ol>\n<p dir=\"ltr\" style=\"line-height: 1.38;margin-left: 36pt;margin-top: 0pt;margin-bottom: 0pt;text-align: left\"><span style=\"font-size: 10.5pt;font-family: Consolas,sans-serif;color: #393a34;background-color: #f6f8fa;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">prisma migrate dev &#8211;name added_job_title.<\/span><\/p>\n<ol style=\"margin-top: 0px;margin-bottom: 0px;text-align: left\" start=\"4\">\n<li style=\"list-style-type: decimal;font-size: 12pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">\n<p dir=\"ltr\" style=\"line-height: 1.38;margin-top: 0pt;margin-bottom: 0pt\" role=\"presentation\"><span style=\"font-size: 12pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">Por fim, a estrutura de pastas, que tamb\u00e9m serve com um hist\u00f3rico de altera\u00e7\u00f5es do banco de dados, fica da seguinte forma.<\/span><\/p>\n<\/li>\n<\/ol>\n<p dir=\"ltr\" style=\"line-height: 1.38;margin-left: 36pt;background-color: #f6f8fa;margin-top: 0pt;margin-bottom: 0pt;text-align: left\"><span style=\"font-size: 10.5pt;font-family: Consolas,sans-serif;color: #1a202c;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">migrations\/<\/span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;margin-left: 36pt;background-color: #f6f8fa;margin-top: 0pt;margin-bottom: 0pt;text-align: left\"><span style=\"font-size: 10.5pt;font-family: Consolas,sans-serif;color: #1a202c;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">&nbsp;\u2514\u2500 20210313140442_init\/<\/span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;margin-left: 36pt;background-color: #f6f8fa;margin-top: 0pt;margin-bottom: 0pt;text-align: left\"><span style=\"font-size: 10.5pt;font-family: Consolas,sans-serif;color: #1a202c;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">&nbsp;&nbsp;&nbsp;\u2514\u2500 migration.sql<\/span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;margin-left: 36pt;background-color: #f6f8fa;margin-top: 0pt;margin-bottom: 0pt;text-align: left\"><span style=\"font-size: 10.5pt;font-family: Consolas,sans-serif;color: #1a202c;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">&nbsp;\u2514\u2500 20210313140442_added_job_title\/<\/span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;margin-left: 36pt;background-color: #f6f8fa;margin-top: 0pt;margin-bottom: 0pt;text-align: left\"><span style=\"font-size: 10.5pt;font-family: Consolas,sans-serif;color: #1a202c;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">&nbsp;&nbsp;&nbsp;\u2514\u2500 migration.sql<\/span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;margin-top: 0pt;margin-bottom: 0pt;text-align: left\"><span style=\"font-size: 12pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">&nbsp;&nbsp;&nbsp;&nbsp;Esta ferramenta al\u00e9m de manter seu banco sincronizado de forma simples, facilita muito o processo de compartilhamento de dados entre um time com mais pessoas, toda e qualquer altera\u00e7\u00e3o no banco de dados \u00e9 bem documentada no c\u00f3digo e facilita o entendimento do mesmo.<\/span><\/p>\n<p style=\"text-align: left\"><b style=\"font-weight: normal\">&nbsp;<\/b><\/p>\n<h3 style=\"line-height: 1.38;margin-top: 16pt;margin-bottom: 4pt;text-align: left\"><span style=\"font-size: 13.999999999999998pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: bold;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">Refer\u00eancias<\/span><\/h3>\n<p dir=\"ltr\" style=\"line-height: 1.38;margin-top: 0pt;margin-bottom: 0pt;text-align: left\"><span style=\"font-size: 12pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">Para saber mais sobre o Prisma ORM, acesse: <\/span><a style=\"text-decoration: none\" href=\"https:\/\/www.prisma.io\/docs\/getting-started\"><span style=\"font-size: 12pt;font-family: Arial;color: #1155cc;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: underline;vertical-align: baseline\">https:\/\/www.prisma.io\/docs\/getting-started<\/span><\/a><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.8;background-color: #ffffff;margin-top: 0pt;margin-bottom: 0pt;text-align: left\"><span style=\"font-size: 12pt;font-family: Roboto,sans-serif;color: #111111;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">Martin Fowler. Patterns of Enterprise Application Architecture, Addison-Wesley, 2002.<\/span><\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>O que \u00e9 e para que serve um ORM? &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;Object-Relational Mapping (ORM), em portugu\u00eas, mapeamento objeto-relacional, \u00e9 uma t\u00e9cnica para aproximar o paradigma de desenvolvimento de aplica\u00e7\u00f5es orientadas a objetos ao paradigma do banco de dados relacional. O uso da t\u00e9cnica de mapeamento objeto-relacional \u00e9 realizado atrav\u00e9s de um mapeador objeto-relacional que geralmente \u00e9 [&hellip;]<\/p>\n","protected":false},"author":3802,"featured_media":3298,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[124,112],"tags":[196,203,149],"class_list":["post-3299","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-destaques","category-redacao","tag-back-end-e-bd","tag-frameworks","tag-redacao"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.ufsm.br\/pet\/sistemas-de-informacao\/wp-json\/wp\/v2\/posts\/3299","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ufsm.br\/pet\/sistemas-de-informacao\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ufsm.br\/pet\/sistemas-de-informacao\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ufsm.br\/pet\/sistemas-de-informacao\/wp-json\/wp\/v2\/users\/3802"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ufsm.br\/pet\/sistemas-de-informacao\/wp-json\/wp\/v2\/comments?post=3299"}],"version-history":[{"count":0,"href":"https:\/\/www.ufsm.br\/pet\/sistemas-de-informacao\/wp-json\/wp\/v2\/posts\/3299\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ufsm.br\/pet\/sistemas-de-informacao\/wp-json\/wp\/v2\/media\/3298"}],"wp:attachment":[{"href":"https:\/\/www.ufsm.br\/pet\/sistemas-de-informacao\/wp-json\/wp\/v2\/media?parent=3299"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ufsm.br\/pet\/sistemas-de-informacao\/wp-json\/wp\/v2\/categories?post=3299"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ufsm.br\/pet\/sistemas-de-informacao\/wp-json\/wp\/v2\/tags?post=3299"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}