mirror of
https://github.com/launchbadge/sqlx.git
synced 2026-01-20 15:46:30 +00:00
**General**
* Moves `examples/postgres/realworld` to `examples/realworld`
* The app is now architected to support multiple DBs
* Adds feature flags for `sqlite` and `postgres` to allow user to choose
which backend to use
*NOTE* Currently it is not possible to compile with `postgres` and `sqlite`
enabled as we are using the `query!` and `query_as!` macros and they
seem to get unhappy.
* Adds CLI flags for picking the DB backend to use at runtime
* Adds schema file and implementation for SQLite for `/api/user` routes
* Adds stub routes and trait for articles and Articles entity
**Changes**
* We now use i32 instead of i64 as the user_id to get around some quirks
w/ the SQLite driver.
* Reimplements existing route handlers w/ an error handling shim so we can use
Try inside the biz logic
* *FIX* Adds a `user` key to the register user body to conform w/ realworld's
API specs
APIs were functionally tested using realworld's API test script
(https://github.com/gothinkster/realworld/tree/master/api#authentication)
12 lines
262 B
SQL
12 lines
262 B
SQL
CREATE TABLE IF NOT EXISTS users (
|
|
id INT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
|
|
|
|
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
|
updated_at TIMESTAMPTZ,
|
|
|
|
email TEXT UNIQUE NOT NULL,
|
|
username TEXT UNIQUE NOT NULL,
|
|
|
|
password TEXT
|
|
);
|