dart-backend / angel

A polished, production-ready backend framework in Dart for the VM, AOT, and Flutter.
https://github.com/dukefirehawk/angel
BSD 3-Clause "New" or "Revised" License
173 stars 21 forks source link

MySQL supported? #51

Closed komkomh closed 2 years ago

komkomh commented 2 years ago

Hi!

I found 'MySQL 8.0 or later' supported here. https://pub.dev/packages/angel3_orm

And I tried mysql8.0 insert.

  final todo = Todo(id: null, title: 'title!', text: 'text!', status: 'New');
  final insertQuery = TodoQuery()..values.copyFrom(todo);
  await insertQuery.insert(executor).then((s) => s.orElseThrow(() => Exception('insert error.: ${todo.toJson()}')));

I got error message.

Unhandled exception:
MySqlException 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INSERT INTO todo (id, title, text, status) VALUES (?, ?, ?, ?) RETURNING todo.id' at line 1

Is it supported mysql or autoincrement?

dukefirehawk commented 2 years ago

angel_orm package itself is pretty database agnostic as it uses standard SQL queries under the hood. We set the min to version 8 as WITH SQL support is only available starting with it. MySQL auto increment should be transparently supported. The package that handles MySQL specific connections, transactions etc is angel_orm_mysql. However, there are some issues with the MySQL driver that is used by this package. We are exploring alternative driver such as mysql1 package to see if it can address the problems.

Silentdoer commented 2 years ago

may be can use mysql_client

dukefirehawk commented 2 years ago

Will look into that. We have switched to mysql1 on development branch and make very good progress with MariaDB 10.2.x so far. 28 out of 39 unit tests have passed. The remaining 11 are issues related to blob and datetime sql data type mapping. On the other hand, with MySQL 8.x.x, the driver runs into connection issues. My hunch is some additional parameters may need to be changed on the installed MySQL for driver to work. Once we iron out these issues, angel_orm_mysql should be ready for general use.

dukefirehawk commented 2 years ago

Resolved in angel3_orm_mysql 6.0.0

komkomh commented 2 years ago

great!