Files
relspecgo/tests/assets/yaml/complex_database.yaml
Hein bed4f5d3bd
Some checks are pending
CI / Test (1.23) (push) Waiting to run
CI / Test (1.24) (push) Waiting to run
CI / Test (1.25) (push) Waiting to run
CI / Lint (push) Waiting to run
CI / Build (push) Waiting to run
better tests
2025-12-17 23:05:36 +02:00

613 lines
16 KiB
YAML

name: complex_test_db
description: Complex test database with relationships and indexes
database_type: pgsql
schemas:
- name: public
tables:
- name: users
schema: public
description: User accounts table
columns:
id:
name: id
table: users
schema: public
type: bigint
not_null: true
auto_increment: true
is_primary_key: true
sequence: 1
email:
name: email
table: users
schema: public
type: varchar
length: 255
not_null: true
comment: User email address
sequence: 2
username:
name: username
table: users
schema: public
type: varchar
length: 100
not_null: true
sequence: 3
name:
name: name
table: users
schema: public
type: varchar
length: 100
not_null: false
sequence: 4
bio:
name: bio
table: users
schema: public
type: text
not_null: false
sequence: 5
avatar_url:
name: avatar_url
table: users
schema: public
type: varchar
length: 500
not_null: false
sequence: 6
is_active:
name: is_active
table: users
schema: public
type: boolean
not_null: true
default: true
sequence: 7
created_at:
name: created_at
table: users
schema: public
type: timestamp
not_null: true
default: CURRENT_TIMESTAMP
sequence: 8
updated_at:
name: updated_at
table: users
schema: public
type: timestamp
not_null: false
sequence: 9
indexes:
idx_users_email:
name: idx_users_email
table: users
schema: public
columns:
- email
unique: true
type: btree
idx_users_username:
name: idx_users_username
table: users
schema: public
columns:
- username
unique: true
type: btree
idx_users_created_at:
name: idx_users_created_at
table: users
schema: public
columns:
- created_at
unique: false
type: btree
constraints: {}
relationships: {}
- name: categories
schema: public
description: Post categories
columns:
id:
name: id
table: categories
schema: public
type: bigint
not_null: true
auto_increment: true
is_primary_key: true
sequence: 1
name:
name: name
table: categories
schema: public
type: varchar
length: 100
not_null: true
sequence: 2
slug:
name: slug
table: categories
schema: public
type: varchar
length: 100
not_null: true
sequence: 3
description:
name: description
table: categories
schema: public
type: text
not_null: false
sequence: 4
indexes:
idx_categories_slug:
name: idx_categories_slug
table: categories
schema: public
columns:
- slug
unique: true
type: btree
constraints: {}
relationships: {}
- name: posts
schema: public
description: Blog posts
columns:
id:
name: id
table: posts
schema: public
type: bigint
not_null: true
auto_increment: true
is_primary_key: true
sequence: 1
user_id:
name: user_id
table: posts
schema: public
type: bigint
not_null: true
comment: Foreign key to users table
sequence: 2
title:
name: title
table: posts
schema: public
type: varchar
length: 200
not_null: true
sequence: 3
slug:
name: slug
table: posts
schema: public
type: varchar
length: 200
not_null: true
sequence: 4
content:
name: content
table: posts
schema: public
type: text
not_null: false
sequence: 5
excerpt:
name: excerpt
table: posts
schema: public
type: varchar
length: 500
not_null: false
sequence: 6
status:
name: status
table: posts
schema: public
type: varchar
length: 20
not_null: true
default: draft
sequence: 7
view_count:
name: view_count
table: posts
schema: public
type: integer
not_null: true
default: 0
sequence: 8
published_at:
name: published_at
table: posts
schema: public
type: timestamp
not_null: false
sequence: 9
created_at:
name: created_at
table: posts
schema: public
type: timestamp
not_null: true
default: CURRENT_TIMESTAMP
sequence: 10
updated_at:
name: updated_at
table: posts
schema: public
type: timestamp
not_null: false
sequence: 11
indexes:
idx_posts_user_id:
name: idx_posts_user_id
table: posts
schema: public
columns:
- user_id
unique: false
type: btree
idx_posts_slug:
name: idx_posts_slug
table: posts
schema: public
columns:
- slug
unique: true
type: btree
idx_posts_status:
name: idx_posts_status
table: posts
schema: public
columns:
- status
unique: false
type: btree
idx_posts_published_at:
name: idx_posts_published_at
table: posts
schema: public
columns:
- published_at
unique: false
type: btree
constraints:
fk_posts_user:
name: fk_posts_user
type: foreign_key
table: posts
schema: public
columns:
- user_id
referenced_table: users
referenced_schema: public
referenced_columns:
- id
on_delete: CASCADE
on_update: CASCADE
relationships: {}
- name: comments
schema: public
description: Post comments
columns:
id:
name: id
table: comments
schema: public
type: bigint
not_null: true
auto_increment: true
is_primary_key: true
sequence: 1
post_id:
name: post_id
table: comments
schema: public
type: bigint
not_null: true
comment: Foreign key to posts table
sequence: 2
user_id:
name: user_id
table: comments
schema: public
type: bigint
not_null: true
comment: Foreign key to users table
sequence: 3
parent_id:
name: parent_id
table: comments
schema: public
type: bigint
not_null: false
comment: Self-referencing foreign key for nested comments
sequence: 4
content:
name: content
table: comments
schema: public
type: text
not_null: true
sequence: 5
is_approved:
name: is_approved
table: comments
schema: public
type: boolean
not_null: true
default: false
sequence: 6
created_at:
name: created_at
table: comments
schema: public
type: timestamp
not_null: true
default: CURRENT_TIMESTAMP
sequence: 7
updated_at:
name: updated_at
table: comments
schema: public
type: timestamp
not_null: false
sequence: 8
indexes:
idx_comments_post_id:
name: idx_comments_post_id
table: comments
schema: public
columns:
- post_id
unique: false
type: btree
idx_comments_user_id:
name: idx_comments_user_id
table: comments
schema: public
columns:
- user_id
unique: false
type: btree
idx_comments_parent_id:
name: idx_comments_parent_id
table: comments
schema: public
columns:
- parent_id
unique: false
type: btree
constraints:
fk_comments_post:
name: fk_comments_post
type: foreign_key
table: comments
schema: public
columns:
- post_id
referenced_table: posts
referenced_schema: public
referenced_columns:
- id
on_delete: CASCADE
on_update: CASCADE
fk_comments_user:
name: fk_comments_user
type: foreign_key
table: comments
schema: public
columns:
- user_id
referenced_table: users
referenced_schema: public
referenced_columns:
- id
on_delete: CASCADE
on_update: CASCADE
fk_comments_parent:
name: fk_comments_parent
type: foreign_key
table: comments
schema: public
columns:
- parent_id
referenced_table: comments
referenced_schema: public
referenced_columns:
- id
on_delete: CASCADE
on_update: CASCADE
relationships: {}
- name: post_categories
schema: public
description: Many-to-many relationship between posts and categories
columns:
id:
name: id
table: post_categories
schema: public
type: bigint
not_null: true
auto_increment: true
is_primary_key: true
sequence: 1
post_id:
name: post_id
table: post_categories
schema: public
type: bigint
not_null: true
sequence: 2
category_id:
name: category_id
table: post_categories
schema: public
type: bigint
not_null: true
sequence: 3
created_at:
name: created_at
table: post_categories
schema: public
type: timestamp
not_null: true
default: CURRENT_TIMESTAMP
sequence: 4
indexes:
idx_post_categories_unique:
name: idx_post_categories_unique
table: post_categories
schema: public
columns:
- post_id
- category_id
unique: true
type: btree
idx_post_categories_category:
name: idx_post_categories_category
table: post_categories
schema: public
columns:
- category_id
unique: false
type: btree
constraints:
fk_post_categories_post:
name: fk_post_categories_post
type: foreign_key
table: post_categories
schema: public
columns:
- post_id
referenced_table: posts
referenced_schema: public
referenced_columns:
- id
on_delete: CASCADE
on_update: CASCADE
fk_post_categories_category:
name: fk_post_categories_category
type: foreign_key
table: post_categories
schema: public
columns:
- category_id
referenced_table: categories
referenced_schema: public
referenced_columns:
- id
on_delete: CASCADE
on_update: CASCADE
relationships: {}
- name: tags
schema: public
description: Tags for posts
columns:
id:
name: id
table: tags
schema: public
type: bigint
not_null: true
auto_increment: true
is_primary_key: true
sequence: 1
name:
name: name
table: tags
schema: public
type: varchar
length: 50
not_null: true
sequence: 2
slug:
name: slug
table: tags
schema: public
type: varchar
length: 50
not_null: true
sequence: 3
indexes:
idx_tags_slug:
name: idx_tags_slug
table: tags
schema: public
columns:
- slug
unique: true
type: btree
constraints: {}
relationships: {}
- name: post_tags
schema: public
description: Many-to-many relationship between posts and tags
columns:
post_id:
name: post_id
table: post_tags
schema: public
type: bigint
not_null: true
is_primary_key: true
sequence: 1
tag_id:
name: tag_id
table: post_tags
schema: public
type: bigint
not_null: true
is_primary_key: true
sequence: 2
indexes:
idx_post_tags_tag:
name: idx_post_tags_tag
table: post_tags
schema: public
columns:
- tag_id
unique: false
type: btree
constraints:
fk_post_tags_post:
name: fk_post_tags_post
type: foreign_key
table: post_tags
schema: public
columns:
- post_id
referenced_table: posts
referenced_schema: public
referenced_columns:
- id
on_delete: CASCADE
on_update: CASCADE
fk_post_tags_tag:
name: fk_post_tags_tag
type: foreign_key
table: post_tags
schema: public
columns:
- tag_id
referenced_table: tags
referenced_schema: public
referenced_columns:
- id
on_delete: CASCADE
on_update: CASCADE
relationships: {}