mirror of
https://github.com/launchbadge/sqlx.git
synced 2025-10-02 15:25:32 +00:00

* support ltree * add default and push to PgLTree * add more derived for ltree * fix copy/paste * Update sqlx-core/src/error.rs Co-authored-by: Paolo Barbolini <paolo@paolo565.org> * PR fixes * ltree with name instead of OID * custom ltree errors * add pop ot PgLTree * do not hide ltree behind feature flag * bytes() instead of chars() * apply extend_display suggestion * add more functions to PgLTree * fix IntoIter * resolve PR annotation * add tests * remove code from arguments * fix array * fix setup isse * fix(postgres): disable `ltree` tests on Postgres 9.6 Co-authored-by: Bastian Schubert <bastian.schubert@crosscard.com> Co-authored-by: Paolo Barbolini <paolo@paolo565.org> Co-authored-by: Austin Bonander <austin@launchbadge.com>
35 lines
856 B
SQL
35 lines
856 B
SQL
-- https://www.postgresql.org/docs/current/ltree.html
|
|
CREATE EXTENSION IF NOT EXISTS ltree;
|
|
|
|
-- https://www.postgresql.org/docs/current/sql-createtype.html
|
|
CREATE TYPE status AS ENUM ('new', 'open', 'closed');
|
|
|
|
-- https://www.postgresql.org/docs/current/rowtypes.html#ROWTYPES-DECLARING
|
|
CREATE TYPE inventory_item AS
|
|
(
|
|
name TEXT,
|
|
supplier_id INT,
|
|
price BIGINT
|
|
);
|
|
|
|
-- https://github.com/prisma/database-schema-examples/tree/master/postgres/basic-twitter#basic-twitter
|
|
CREATE TABLE tweet
|
|
(
|
|
id BIGSERIAL PRIMARY KEY,
|
|
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
|
text TEXT NOT NULL,
|
|
owner_id BIGINT
|
|
);
|
|
|
|
CREATE TYPE float_range AS RANGE
|
|
(
|
|
subtype = float8,
|
|
subtype_diff = float8mi
|
|
);
|
|
|
|
CREATE TABLE products (
|
|
product_no INTEGER,
|
|
name TEXT,
|
|
price NUMERIC CHECK (price > 0)
|
|
);
|