Repository: ariga/atlas
Pull request #1135 (2022-09-08 09:30:24)

sql/mysql: ensure parseTime is always set
Should have been done in https://github.com/ariga/atlas/pull/1109, but that PR forgot to set the changed values on the URL.




Patch:
diff --git a/doc/md/getting-started/getting-started.mdx b/doc/md/getting-started/getting-started.mdx
index 9a068ced..bd9232c0 100644
--- a/doc/md/getting-started/getting-started.mdx
+++ b/doc/md/getting-started/getting-started.mdx
@@ -5,6 +5,7 @@ sidebar_label: Quick Introduction
 ---
 import Tabs from '@theme/Tabs';
 import TabItem from '@theme/TabItem';
+import Discord from '../../website/src/assets/icons/discord-white.svg'
 
 Atlas CLI is an open-source tool designed to help software engineers, DBAs and DevOps
 practitioners to manage their database schemas.  Atlas users can use the [Atlas DDL](../atlas-schema/sql-resources)
@@ -265,3 +266,20 @@ Atlas.
 In this short tutorial we learned how to use Atlas to inspect databases, as well as use declarative and versioned
 migrations. Read more about the use-cases for the two approaches [here](/concepts/declarative-vs-versioned) to help you
 decide which workflow works best for you.
+
+:::info Need help getting started?
+
+We have a super friendly [#getting-started](https://discord.gg/8mvDUG22) channel on our community
+chat on Discord.
+
+
+For web-based, free, and fun (GIFs included) support:
+
+<a href={"https://discord.gg/8mvDUG22"} className={"join-discord"}>
+    <Discord />
+    <span>
+        Join our Discord server
+    </span>
+</a>
+
+:::
\ No newline at end of file
diff --git a/doc/website/src/assets/icons/discord-white.svg b/doc/website/src/assets/icons/discord-white.svg
new file mode 100644
index 00000000..b5d89bd7
--- /dev/null
+++ b/doc/website/src/assets/icons/discord-white.svg
@@ -0,0 +1,3 @@
+<svg width="29" height="22" viewBox="0 0 29 22" fill="none" xmlns="http://www.w3.org/2000/svg">
+    <path d="M24.3355 1.82368C22.5032 0.979578 20.5385 0.357681 18.4841 0.00149416C18.4467 -0.00538013 18.4094 0.0117991 18.3901 0.0461583C18.1374 0.497402 17.8575 1.08609 17.6615 1.54879C15.4519 1.21666 13.2537 1.21666 11.0895 1.54879C10.8935 1.0758 10.6034 0.497402 10.3496 0.0461583C10.3303 0.0129455 10.2929 -0.00423374 10.2555 0.00149416C8.20234 0.356542 6.23755 0.978439 4.40419 1.82368C4.38832 1.83055 4.37471 1.84201 4.36568 1.85689C0.63889 7.44714 -0.382035 12.9 0.118797 18.2852C0.121063 18.3116 0.135793 18.3368 0.156189 18.3528C2.61502 20.1658 4.99682 21.2664 7.33439 21.996C7.3718 22.0075 7.41144 21.9937 7.43525 21.9628C7.9882 21.2046 8.48111 20.4052 8.90373 19.5645C8.92867 19.5153 8.90486 19.4569 8.85388 19.4374C8.07205 19.1396 7.32759 18.7765 6.61146 18.3642C6.55482 18.331 6.55029 18.2497 6.6024 18.2107C6.75309 18.0974 6.90383 17.9794 7.04773 17.8603C7.07376 17.8385 7.11004 17.8339 7.14065 17.8477C11.8453 20.0043 16.9386 20.0043 21.5877 17.8477C21.6183 17.8328 21.6546 17.8374 21.6817 17.8591C21.8257 17.9783 21.9764 18.0974 22.1282 18.2107C22.1803 18.2497 22.1769 18.331 22.1203 18.3642C21.4041 18.7845 20.6597 19.1396 19.8767 19.4362C19.8257 19.4557 19.8031 19.5153 19.828 19.5645C20.2597 20.404 20.7526 21.2034 21.2953 21.9616C21.318 21.9937 21.3588 22.0075 21.3962 21.996C23.7451 21.2664 26.1269 20.1658 28.5857 18.3528C28.6073 18.3368 28.6209 18.3127 28.6231 18.2864C29.2225 12.0604 27.6192 6.65231 24.3728 1.85803C24.3649 1.84201 24.3513 1.83055 24.3355 1.82368ZM9.60629 15.0062C8.18987 15.0062 7.02279 13.7005 7.02279 12.0971C7.02279 10.4937 8.16724 9.18803 9.60629 9.18803C11.0566 9.18803 12.2124 10.5051 12.1897 12.0971C12.1897 13.7005 11.0453 15.0062 9.60629 15.0062ZM19.1583 15.0062C17.7419 15.0062 16.5749 13.7005 16.5749 12.0971C16.5749 10.4937 17.7193 9.18803 19.1583 9.18803C20.6087 9.18803 21.7644 10.5051 21.7418 12.0971C21.7418 13.7005 20.6087 15.0062 19.1583 15.0062Z" fill="#ffffff"/>
+</svg>
diff --git a/doc/website/src/css/custom.css b/doc/website/src/css/custom.css
index 40ea5799..e006c210 100644
--- a/doc/website/src/css/custom.css
+++ b/doc/website/src/css/custom.css
@@ -207,4 +207,32 @@ div[class^='announcementBar_'] {
 .docs-doc-id-lint\/analyzers table {
   display:table;
   width:100%;
+}
+
+.join-discord {
+  background-color:#5C4AEC;
+  border-radius:6px;
+  border:1px solid #5D4BED;
+  display:inline-block;
+  cursor:pointer;
+  color:#ffffff;
+  font-family:Arial;
+  font-size:17px;
+  padding:16px 31px;
+  text-decoration:none;
+  margin: 1em 0;
+}
+
+.join-discord svg {
+  margin-bottom: -6px;
+  margin-left: -6px;
+}
+
+.join-discord span {
+  padding-left: 6px;
+}
+
+.join-discord:hover  {
+  color: white;
+  text-decoration: none;
 }
\ No newline at end of file
diff --git a/sql/mysql/driver.go b/sql/mysql/driver.go
index 8791d04a..53d50316 100644
--- a/sql/mysql/driver.go
+++ b/sql/mysql/driver.go
@@ -228,7 +228,9 @@ type parser struct{}
 
 // ParseURL implements the sqlclient.URLParser interface.
 func (parser) ParseURL(u *url.URL) *sqlclient.URL {
-	u.Query().Set("parseTime", "true")
+	v := u.Query()
+	v.Set("parseTime", "true")
+	u.RawQuery = v.Encode()
 	return &sqlclient.URL{URL: u, DSN: dsn(u), Schema: strings.TrimPrefix(u.Path, "/")}
 }
 


Test patch:
diff --git a/sql/mysql/driver_test.go b/sql/mysql/driver_test.go
index dd212ab1..610ad873 100644
--- a/sql/mysql/driver_test.go
+++ b/sql/mysql/driver_test.go
@@ -7,6 +7,7 @@ package mysql
 import (
 	"context"
 	"database/sql"
+	"net/url"
 	"testing"
 	"time"
 
@@ -18,6 +19,13 @@ import (
 	"github.com/stretchr/testify/require"
 )
 
+func TestParser_ParseURLParseTime(t *testing.T) {
+	u, err := url.Parse("mysql://user:pass@localhost:3306/my_db?foo=bar")
+	require.NoError(t, err)
+	ac := parser{}.ParseURL(u)
+	require.Equal(t, "true", ac.Query().Get("parseTime"))
+}
+
 func TestDriver_LockAcquired(t *testing.T) {
 	db, m, err := sqlmock.New()
 	require.NoError(t, err)