Last active
January 30, 2021 06:39
-
-
Save wk-j/0347a7d51ab2651da21c17310c7cea57 to your computer and use it in GitHub Desktop.
Create table
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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