Comments (7)
Congratulations, incidentally, on opening the very first issue to be officially assigned to Fluent 5!
from fluent-mysql-driver.
But they aren't "wrong", they're just in binary form.
As gwynne already mentioned, if you want to prettify it, you could use the HEX or even the BIN_TO_UUID function in your SQL queries in DBeaver. Your application will still behave correctly with them if you use UUID in your Swift code.
from fluent-mysql-driver.
It's also worth noting that with any of the SQL drivers (PostgreSQL, MySQL, SQLite), you're usually much better off using Int
for your IDs rather than UUID
- it's much smaller, much, MUCH faster, and has no meaningful drawbacks unless you expect to interoperate with a system which does use UUIDs for its identifiers. Fluent only defaults to using UUIDs because of MongoDB support, which Fluent 5 Will Not Have™. You can switch over by changing your @ID var id: UUID?
(or @ID(key: .id)
etc.) properties to @ID(custom: .id) var id: Int?
in your models and using .field(.id, .int, .identifier(auto: true))
instead of .id()
in your migrations (this also gives you the use of auto-increment primary keys, which is another minor speed win).
from fluent-mysql-driver.
This is normal behavior for the MySQL driver, unfortunately - UUIDs are stored as raw bytes, and the MySQL driver maps the .uuid
type to VARBINARY(16)
, but the MySQL commandline and most other MySQL tools will attempt to read this as if it were just text with binary charset/collation (i.e. none); the result is the gibberish you're seeing. You can see results more like what you were expecting with a query of the form SELECT HEX(id) FROM table
.
It is worth noting that the most recent versions of the mysql
commandline monitor (8.3.0 or later) will display such data in a readable format without additional intervention.
(Worth noting, this behavior will be fixed in Fluent 5, but in the meantime, it's normal and expected, and nothing is wrong with your setup.)
from fluent-mysql-driver.
Well, as a workaround I can create UUID, convert it into the String, and store it in the DB as String but not the UUID type. I need it in both directions - store and get from the table inside the app. Sounds like a plan?:)
from fluent-mysql-driver.
I'm not sure I follow - are you encountering an issue on the Fluent side, something beyond the inarguably annoying fact that the UUIDs don't usually display properly if you look at the database directly?
from fluent-mysql-driver.
I'm not sure I follow - are you encountering an issue on the Fluent side, something beyond the inarguably annoying fact that the UUIDs don't usually display properly if you look at the database directly?
UDIDs are saving wrong; they are wrong when I open the DB in DBeaver (DB viewer). Even in the _fluent_migrations table which I don't even know how to touch by myself: all added rows in it (my migrations) have wrong IDs. The UUIDs are stably wrong everywhere :).
from fluent-mysql-driver.
Related Issues (20)
- MySQL & MAMP/Docker HOT 5
- References and Foreign Key Constraints not being applied HOT 2
- `.string` migrations results in a 256 length varchar HOT 1
- Mysql LAST_INSERT_ID HOT 2
- Error related to SwiftPackage HOT 1
- It can't be decoded if value is null HOT 1
- QueryBuilder.all() is 30 times slower than java code HOT 13
- Not able to store special characters and emojis properly HOT 1
- How to query raw SQL with local variables?
- Convenience APIs for configuring character set for database, tables, and columns
- Trying to connect to a database without password HOT 1
- error: extra argument 'requestTimeout' in call requestTimeout: self.connectionPoolTimeout, HOT 18
- Make LastInsertIDInitializable public HOT 2
- Investigate flaky CI
- Make `MySQLConfiguration` non-constant HOT 6
- Could not convert MySQL data to Date HOT 1
- FluentMySQLConfiguration's memberwise initializer takes a minute to typecheck HOT 1
- Connection refused (errno: 61) when trying to connect to a remote Database HOT 2
- Could not convert MySQL data to Date on time field HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fluent-mysql-driver.