()
| 396 | }); |
| 397 | |
| 398 | export function tests() { |
| 399 | describe('common', () => { |
| 400 | beforeEach(async (ctx) => { |
| 401 | const { db } = ctx.pg; |
| 402 | await db.execute(sql`drop schema if exists public cascade`); |
| 403 | await db.execute(sql`drop schema if exists ${mySchema} cascade`); |
| 404 | await db.execute(sql`create schema public`); |
| 405 | await db.execute(sql`create schema if not exists custom_migrations`); |
| 406 | await db.execute(sql`create schema ${mySchema}`); |
| 407 | // public users |
| 408 | await db.execute( |
| 409 | sql` |
| 410 | create table users ( |
| 411 | id serial primary key, |
| 412 | name text not null, |
| 413 | verified boolean not null default false, |
| 414 | jsonb jsonb, |
| 415 | created_at timestamptz not null default now() |
| 416 | ) |
| 417 | `, |
| 418 | ); |
| 419 | // public cities |
| 420 | await db.execute( |
| 421 | sql` |
| 422 | create table cities ( |
| 423 | id serial primary key, |
| 424 | name text not null, |
| 425 | state char(2) |
| 426 | ) |
| 427 | `, |
| 428 | ); |
| 429 | // public users2 |
| 430 | await db.execute( |
| 431 | sql` |
| 432 | create table users2 ( |
| 433 | id serial primary key, |
| 434 | name text not null, |
| 435 | city_id integer references cities(id) |
| 436 | ) |
| 437 | `, |
| 438 | ); |
| 439 | await db.execute( |
| 440 | sql` |
| 441 | create table course_categories ( |
| 442 | id serial primary key, |
| 443 | name text not null |
| 444 | ) |
| 445 | `, |
| 446 | ); |
| 447 | await db.execute( |
| 448 | sql` |
| 449 | create table courses ( |
| 450 | id serial primary key, |
| 451 | name text not null, |
| 452 | category_id integer references course_categories(id) |
| 453 | ) |
| 454 | `, |
| 455 | ); |
no test coverage detected