Skip to content

Instantly share code, notes, and snippets.

@wk-j
Last active January 30, 2021 06:39
Show Gist options
  • Save wk-j/0347a7d51ab2651da21c17310c7cea57 to your computer and use it in GitHub Desktop.
Save wk-j/0347a7d51ab2651da21c17310c7cea57 to your computer and use it in GitHub Desktop.
Create table
#r "nuget: RepoDb.MySQL"
#load "ConnectionString.fsx"
open MySql.Data.MySqlClient
open RepoDb
open RepoDb.Attributes
open System.Linq
type Create = {
Table: string
[<Map("Create Table")>]
CreateTable: string
}
RepoDb.MySqlBootstrap.Initialize()
let showCreate(db: string, table: string) =
let connection = new MySqlConnection(ConnectionString.MyConnection)
let output =
let cmd = $"show create table {db}.{table}"
connection.ExecuteQuery<Create>(cmd).First()
printfn "%s" output.CreateTable
showCreate("alfresco", "alf_child_assoc")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment