Skip to content

Instantly share code, notes, and snippets.

@hooopo
Created July 2, 2020 18:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hooopo/f9353f6e10cf31dc4e7593d6b56c1617 to your computer and use it in GitHub Desktop.
Save hooopo/f9353f6e10cf31dc4e7593d6b56c1617 to your computer and use it in GitHub Desktop.

LearnSQL

schemas

name column_type ext_info ref default comment
id bigint [pk, increment, not null] items.schema_id
version_id bigint [null] versions.id
name varchar [null]
description text [null]

tables

name column_type ext_info ref default comment
id bigint [pk, increment, not null]
name varchar [null]

columns

name column_type ext_info ref default comment
id bigint [pk, increment, not null]
name varchar [null]
table_id bigint [null] tables.id
nullable boolean [null]
column_type varchar [null]
auto_increment boolean [null]
default_value varchar [null]
is_pk boolean [null]

relationships

name column_type ext_info ref default comment
id bigint [pk, increment, not null]
relation_type varchar [null] many,one,m2m
table_id bigint [null] tables.id
relation_table_id bigint [null] tables.id
column_id bigint [null] columns.id
relation_column_id integer [null] columns.id
schema_id bigint [null] schemas.id

items

name column_type ext_info ref default comment
id bigint [pk, increment, not null]
title varchar [null]
description text [null]
version_id bigint [null]
schema_id bigint [null]
skill_level_id bigint [null] skill_levels.id
item_type_id bigint [null] item_types.id
user_id bigint [null] users.id

collections

name column_type ext_info ref default comment
id bigint [pk, increment, not null]
title varchar [null]
description text [null]
collection_type_id bigint [null] collection_types.id
sort_order integer [null]
views_count integer [null]
items_count integer [null]
skill_level_id bigint [null] skill_levels.id
version_id bigint [null] versions.id

wikis

name column_type ext_info ref default comment
id bigint [pk, increment, not null]
name varchar [null]
body text [null]
version_id bigint [null] versions.id

users

name column_type ext_info ref default comment
id bigint [pk, increment, not null]
email varchar [not null]
encrypted_password varchar [null]
reset_password_token varchar [null]
reset_password_sent_at timestamp [null]
remember_created_at timestamp [null]
created_at timestamp [null]
updated_at timestamp [null]

solutions

name column_type ext_info ref default comment
id bigint [pk, increment, not null]
code text [null]
comment text [null]
user_id bigint [null] users.id
item_id bigint [null] items.id
result text [null]

seeds

name column_type ext_info ref default comment
id bigint [pk, increment, not null]
table_id bigint [null] tables.id
column_id bigint [null] columns.id
value text [null]

sections

name column_type ext_info ref default comment
id bigint [pk, increment, not null]
title varchar [null]
sort_order integer [null]
collection_id bigint [null] collections.id

votes

name column_type ext_info ref default comment
id bigint [pk, increment, not null]
user_id bigint [not null] users.id
solution_id bigint [not null] solutions.id

user_stats

name column_type ext_info ref default comment
user_id bigint [pk, null] users.id

item_types

name column_type ext_info ref default comment
id bigint [pk, increment, not null]
name varchar [not null] 问答,课程

collection_types

name column_type ext_info ref default comment
id bigint [pk, increment, not null]
name varchar [not null] 课程,问答

skill_levels

name column_type ext_info ref default comment
id bigint [pk, increment, not null]
name varchar [not null] 基础,初级,中级,高级

db

name column_type ext_info ref default comment
id bigint [pk, increment, not null]
name varchar [not null]

versions

name column_type ext_info ref default comment
id bigint [pk, increment, not null]
name varchar [not null]
db_id bigint [not null] db.id

collection_items

name column_type ext_info ref default comment
id bigint [pk, increment, not null]
item_id bigint [null] items.id
collection_id bigint [null] collections.id

section_items

name column_type ext_info ref default comment
id bigint [pk, increment, not null]
section_id bigint [null] sections.id
item_id bigint [null] items.id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment