From f42a41fa1c55737ea417adbb762a3d3f018c379b Mon Sep 17 00:00:00 2001 From: Drew Bednar Date: Sat, 20 Jul 2024 18:46:18 -0400 Subject: [PATCH] Finally making progress --- go-sql-database/README.md | 0 go-sql-database/try-sqlite/README.md | 23 ++++ go-sql-database/try-sqlite/data/trysqlite.db | Bin 0 -> 20480 bytes .../try-sqlite/data/trysqlite.db-shm | Bin 0 -> 32768 bytes .../try-sqlite/data/trysqlite.db-wal | 0 go-sql-database/try-sqlite/go.mod | 5 + go-sql-database/try-sqlite/go.sum | 2 + go-sql-database/try-sqlite/main.go | 114 ++++++++++++++++++ .../try-sqlite/migrations/10_todos.down.sql | 0 .../try-sqlite/migrations/10_todos.up.sql | 2 + .../20_alter_todos_completed.down.sql | 1 + .../20_alter_todos_completed.up.sql | 1 + go-web-app/gowiki/go.mod | 7 ++ go-web-app/gowiki/go.sum | 8 ++ 14 files changed, 163 insertions(+) create mode 100644 go-sql-database/README.md create mode 100644 go-sql-database/try-sqlite/README.md create mode 100644 go-sql-database/try-sqlite/data/trysqlite.db create mode 100644 go-sql-database/try-sqlite/data/trysqlite.db-shm create mode 100644 go-sql-database/try-sqlite/data/trysqlite.db-wal create mode 100644 go-sql-database/try-sqlite/go.mod create mode 100644 go-sql-database/try-sqlite/go.sum create mode 100644 go-sql-database/try-sqlite/main.go create mode 100644 go-sql-database/try-sqlite/migrations/10_todos.down.sql create mode 100644 go-sql-database/try-sqlite/migrations/10_todos.up.sql create mode 100644 go-sql-database/try-sqlite/migrations/20_alter_todos_completed.down.sql create mode 100644 go-sql-database/try-sqlite/migrations/20_alter_todos_completed.up.sql create mode 100644 go-web-app/gowiki/go.sum diff --git a/go-sql-database/README.md b/go-sql-database/README.md new file mode 100644 index 0000000..e69de29 diff --git a/go-sql-database/try-sqlite/README.md b/go-sql-database/try-sqlite/README.md new file mode 100644 index 0000000..ebed68b --- /dev/null +++ b/go-sql-database/try-sqlite/README.md @@ -0,0 +1,23 @@ +# Regular SQLite in Go + +## Install the Migrations Tool + +This will in stall the migrate tool for our system. + +``` +go install -tags 'sqlite3' github.com/golang-migrate/migrate/v4/cmd/migrate@latest +``` + +You could also use golang-migrate as a library and migrate your DB in code. For that you would need to install that package as part of your module dependencies. + +``` +go get github.com/mattn/go-sqlite3 +``` + +## Running Migrations + +### Using the CLI + +``` +migrate -database sqlite3://./data/trysqlite.db -path ./migrations +``` \ No newline at end of file diff --git a/go-sql-database/try-sqlite/data/trysqlite.db b/go-sql-database/try-sqlite/data/trysqlite.db new file mode 100644 index 0000000000000000000000000000000000000000..51730b81f1e1b6a42c3507598b1eaea8dae00fc6 GIT binary patch literal 20480 zcmeI)O>f#T7zc10(m_|z>`*D!N0qh_m97-nru8&h(h8Ng(jXOS5(>m+*$AN|nYP`! zeTIFPeujOZ9=6NOTP5gJX{QPFw_!kl1|3l*Beuf2hwA+nbLc7>`R3fB*y_009U<00Izz z00jP{z_p0RG)?2*^}uTPMBv$;KmJgT>PFr)$jl#>3>tS)(y^&nF^vyQ;X|ppFRv_$_+=~_D+-9+CP{BCPH%cZQ zHR^R4-5PbCoB47rMd85ym*E}H9mouXO^4NL>2BgntLF>7raaPic6f7~rGM3v+rpMF zu0ql8h=tR&xy%t4`k*pFfGA?|A)I*moq4 z-+3=wtK~Y~p%ut(KRVTERElQ}Lp}}#}6(j6Yt_T=sOWGxnNa4#}4 zzaER@?9Wn~k43w(Zft>3j?aCmwZ0KxJ##^@2<~liN+d z-ravgne;&}bMP|zm#)eF|CXt@%PxZ74*>{300Izz00bZa0SG_<0uX?}yg-~swe|5o GR{Q~!8xjKm literal 0 HcmV?d00001 diff --git a/go-sql-database/try-sqlite/data/trysqlite.db-shm b/go-sql-database/try-sqlite/data/trysqlite.db-shm new file mode 100644 index 0000000000000000000000000000000000000000..fe9ac2845eca6fe6da8a63cd096d9cf9e24ece10 GIT binary patch literal 32768 zcmeIuAr62r3