title,body,link,tags,view_count,is_answered,score,answer_count
Gcloud SQL - Error creating POSTGRES 11 DB,"<p>When I try create a POSTGRES 11 db, I have the error below:</p>
<p>gcloud beta  sql instances create db-testing --database-version=&quot;POSTGRES_11&quot; --storage-size=&quot;10GB&quot; --storage-auto-increase --storage-type=&quot;SSD&quot; --region=&quot;us-central1&quot;
ERROR: (gcloud.beta.sql.instances.create) argument --database-version: Invalid choice: 'POSTGRES_11'.</p>
<p>Valid choices are [MYSQL_5_5, MYSQL_5_6, MYSQL_5_7, POSTGRES_9_6].</p>
",https://stackoverflow.com/questions/65457493/gcloud-sql-error-creating-postgres-11-db,"['sql', 'gcloud']",92,False,0,0
Nested writes in Prisma,"<p>My schema looks like this:</p>
<pre><code>model User {
  id             Int       @default(autoincrement()) @id
  createdAt      DateTime  @default(now())
  email          String    @unique
  role           String    @default(&quot;user&quot;)
  sessions       Session[]
  profile        Profile?
  goalBoard      GoalBoard[]
  team           Team[]
  ...
}

model GoalBoard {
  id          Int         @default(autoincrement()) @id
  active      Boolean    // Whether an active goalBoard
  owner       User        @relation(fields: [ownerId], references: [id])
  ownerId     Int
  createdAt   DateTime    @default(now())
  goal        Goal[]
  ...
}

model Goal {
  id               Int         @default(autoincrement()) @id
  status           String
  createdAt        DateTime    @default(now())
  owner            User        @relation(fields: [ownerId], references: [id])
  ownerId          Int
  goalBoard        GoalBoard   @relation(fields: [goalBoardId], references: [id])
  goalBoardId      Int
  content          String
  goalFrequency    GoalFrequency[]
  task             Task[]
}

model Task {
  id          Int         @default(autoincrement()) @id
  status      String     // incomplete, complete
  createdAt   DateTime    @default(now())
  content     String
  goal        Goal        @relation(fields: [goalId], references: [id])
  goalId      Int
}
</code></pre>
<p>I am writing a mutation function which takes an array of <code>goal</code> objects. These <code>goal</code> objects have nested array of <code>task</code> objects. It looks like this:</p>
<pre><code>const goals = [
  {
    title: 'string',
    ...
    tasks: [
      {
        deadline: &quot;2020/10/10&quot;,
        ...
      }
    ]
  },
  ...
]
</code></pre>
<p>How would I handle such structure using Prisma2? There are multiple writes &amp; <code>connectOrCreate</code> logic required.</p>
<p>Here is my failed attempt to write an insertion in the Db. Testing with just one insertion &amp; connection.</p>
<pre><code>  const returnGoals = await db.goal.create({
    data: {
      content: &quot;test goal&quot;,
      owner: {
        connect: {
          id: ctx.session!.userId,
        },
      },
      goalBoard: {
        create: { // warns that create is incorrectly used here
          active: true,
          owner: {
            connect: {
              id: ctx.session!.userId,
            },
          },
        },
      },
    },
  });
</code></pre>
",https://stackoverflow.com/questions/64192413/nested-writes-in-prisma,"['javascript', 'database', 'prisma', 'prisma2']",9660,True,3,1
Cannot get MySQL assembly to load in powershell,"<p>I cannot get a connection to a linux mysql container running ubuntu on my local machine. I'm using powershell to create a mysql connection. Brand new to working with databases and putting in data so really no idea what I'm doing.</p>

<p>In the container, I've created a DB</p>

<pre><code>mysql&gt; CREATE DATABASE mydb;
Query OK, 1 row affected (0.04 sec)

mysql&gt; CREATE TABLE test (id INT, text varchar(50), date_val date, date_time datetime);
mysql&gt; USE mydb;
Database changed
mysql&gt; CREATE TABLE test (id INT, text varchar(50), date_val date, date_time datetime);
Query OK, 0 rows affected (0.12 sec)
</code></pre>

<p>Testing the connection to the port the container was configured for from my local host</p>

<pre><code>PS C:\Users\me&gt; Test-NetConnection 127.0.0.1 -Port 3306



ComputerName     : 127.0.0.1
RemoteAddress    : 127.0.0.1
RemotePort       : 3306
InterfaceAlias   : Loopback Pseudo-Interface 1
SourceAddress    : 127.0.0.1
TcpTestSucceeded : True
</code></pre>

<p>Here's my powershell script</p>

<pre><code>[void][System.Reflection.Assembly]::LoadWithPartialName(""MySql.Data"")
$constr = ""server=127.0.0.1:3306;port=3306;database=mydb;user id=root;password=P@ssw0rd""
$con = New-Object MySql.Data.MySqlclient.MySqlConnection
$con.ConnectionString = $constr
$con.Open()
$cmd = New-Object MySql.Data.MySqlClient.MySqlCommand
$cmd.CommandText = ""INSERT INTO test VALUES(@id, @text, @date, @datetime)""
$cmd.Connection = $con
$cmd.Prepare()
$today = get-date
$cmd.Parameters(""@id"").Value = 1
$cmd.Parameters(""@text"").Value = ""Text Value""
$cmd.Parameters(""@date"").Value = $today
$cmd.Parameters(""@datetime"").Value = $today
$cmd.ExecuteNonQuery()
$con.close()
</code></pre>

<p>This is the error that I get</p>

<pre><code>Exception calling ""Open"" with ""0"" argument(s): ""Unable to connect to any of the specified MySQL hosts.""
At \\file\Tech\Dietrich\powershell scripts\VMware\Horizonview_session_count.ps1:24 char:1
+ $con.Open()
+ ~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : MySqlException

Exception calling ""Prepare"" with ""0"" argument(s): ""The connection is not open.""
At \\file\Tech\me\powershell scripts\VMware\Horizonview_session_count.ps1:28 char:1
+ $cmd.Prepare()
+ ~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : InvalidOperationException

Method invocation failed because [MySql.Data.MySqlClient.MySqlCommand] does not contain a method named 'Parameters'.
At \\file\Tech\me\powershell scripts\VMware\Horizonview_session_count.ps1:30 char:1
+ $cmd.Parameters(""@id"").Value = 1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : MethodNotFound

Method invocation failed because [MySql.Data.MySqlClient.MySqlCommand] does not contain a method named 'Parameters'.
At \\file\Tech\me\powershell scripts\VMware\Horizonview_session_count.ps1:31 char:1
+ $cmd.Parameters(""@text"").Value = ""Text Value""
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : MethodNotFound

Method invocation failed because [MySql.Data.MySqlClient.MySqlCommand] does not contain a method named 'Parameters'.
At \\file\Tech\me\powershell scripts\VMware\Horizonview_session_count.ps1:32 char:1
+ $cmd.Parameters(""@date"").Value = $today
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : MethodNotFound

Method invocation failed because [MySql.Data.MySqlClient.MySqlCommand] does not contain a method named 'Parameters'.
At \\file\Tech\me\powershell scripts\VMware\Horizonview_session_count.ps1:33 char:1
+ $cmd.Parameters(""@datetime"").Value = $today
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : MethodNotFound

Exception calling ""ExecuteNonQuery"" with ""0"" argument(s): ""Connection must be valid and open.""
At \\file\Tech\me\powershell scripts\VMware\Horizonview_session_count.ps1:34 char:1
+ $cmd.ExecuteNonQuery()
+ ~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : InvalidOperationException
</code></pre>
",https://stackoverflow.com/questions/61351574/cannot-get-mysql-assembly-to-load-in-powershell,"['mysql', 'powershell', 'containers']",917,True,1,1
