Skip to content

Instantly share code, notes, and snippets.

@phreakin
Last active March 1, 2023 11:51
Show Gist options
  • Save phreakin/5c86b79cf7283668c6e0559a2e440d42 to your computer and use it in GitHub Desktop.
Save phreakin/5c86b79cf7283668c6e0559a2e440d42 to your computer and use it in GitHub Desktop.
create table
alternative_medium (
id bigint unsigned auto_increment,
medium int not null,
alternative_release int not null,
name varchar(255) null,
constraint id unique (id),
constraint name check (`name` <> '')
) collate utf8_unicode_ci charset = utf8 engine = InnoDB;
create table
alternative_medium_track (
alternative_medium int not null,
track int not null,
alternative_track int not null
) collate utf8_unicode_ci charset = utf8 engine = InnoDB;
create table
alternative_release (
id bigint unsigned auto_increment,
gid char(36) not null,
`release` int not null,
name varchar(255) null,
artist_credit int null,
type int not null,
language int not null,
script int not null,
comment varchar(255) default '' not null,
constraint id unique (id),
constraint comment check (`name` <> '')
) collate utf8_unicode_ci charset = utf8 engine = InnoDB;
create table
alternative_release_type (
id bigint unsigned auto_increment,
name text not null,
parent int null,
child_order int default 0 not null,
description text null,
gid char(36) not null,
constraint id unique (id)
) collate utf8_unicode_ci charset = utf8 engine = InnoDB;
create table
alternative_track (
id bigint unsigned auto_increment,
name varchar(255) null,
artist_credit int null,
ref_count int default 0 not null,
constraint id unique (id),
constraint ref_count check (
`name` <> ''
and (
`name` is not null
or `artist_credit` is not null
)
)
) collate utf8_unicode_ci charset = utf8 engine = InnoDB;
create table
annotation (
id bigint unsigned auto_increment,
editor int not null,
text text null,
changelog varchar(255) null,
created timestamp default current_timestamp() not null on update current_timestamp(),
constraint id unique (id)
) collate utf8_unicode_ci charset = utf8 engine = InnoDB;
create table
application (
id bigint unsigned auto_increment,
owner int not null,
name text not null,
oauth_id text not null,
oauth_secret text not null,
oauth_redirect_uri text null,
constraint id unique (id)
) collate utf8_unicode_ci charset = utf8 engine = InnoDB;
create table
area (
id bigint unsigned auto_increment,
gid char(36) not null,
name varchar(255) not null,
type int null,
edits_pending int default 0 not null,
last_updated timestamp default current_timestamp() not null on update current_timestamp(),
begin_date_year smallint null,
begin_date_month smallint null,
begin_date_day smallint null,
end_date_year smallint null,
end_date_month smallint null,
end_date_day smallint null,
ended varchar(1) default '0' not null,
comment varchar(255) default '' not null,
constraint id unique (id),
constraint edits_pending check (`edits_pending` >= 0),
constraint ended check (
(
`end_date_year` is not null
or `end_date_month` is not null
or `end_date_day` is not null
)
and `ended` = 1
or `end_date_year` is null
and `end_date_month` is null
and `end_date_day` is null
)
) collate utf8_unicode_ci charset = utf8 engine = InnoDB;
create table
area_alias (
id bigint unsigned auto_increment,
area int not null,
name varchar(255) default '' not null,
locale text null,
edits_pending int default 0 not null,
last_updated timestamp default current_timestamp() not null on update current_timestamp(),
type int null,
sort_name varchar(255) not null,
begin_date_year smallint null,
begin_date_month smallint null,
begin_date_day smallint null,
end_date_year smallint null,
end_date_month smallint null,
end_date_day smallint null,
primary_for_locale char default '0' not null,
ended char default '0' not null,
constraint id unique (id),
check (
(
`end_date_year` is not null
or `end_date_month` is not null
or `end_date_day` is not null
)
and `ended` = 1
or `end_date_year` is null
and `end_date_month` is null
and `end_date_day` is null
),
constraint edits_pending check (`edits_pending` >= 0),
constraint primary_check check (
`locale` is null
and `primary_for_locale` is false
or `locale` is not null
)
) collate utf8_unicode_ci charset = utf8 engine = InnoDB;
create table
area_alias_type (
id bigint unsigned auto_increment,
name text not null,
parent int null,
child_order int default 0 not null,
description text null,
gid char(36) not null,
constraint id unique (id)
) collate utf8_unicode_ci charset = utf8 engine = InnoDB;
create table
area_annotation (area int not null, annotation int not null) collate utf8_unicode_ci charset = utf8 engine = InnoDB;
create table
area_gid_redirect (
gid char(36) not null,
new_id int not null,
created timestamp default current_timestamp() not null on update current_timestamp()
) collate utf8_unicode_ci charset = utf8 engine = InnoDB;
create table
area_tag (
area int not null,
tag int not null,
count int not null,
last_updated timestamp default current_timestamp() not null on update current_timestamp()
) collate utf8_unicode_ci charset = utf8 engine = InnoDB;
create table
area_tag_raw (
area int not null,
editor int not null,
tag int not null,
is_upvote char default '1' not null
) collate utf8_unicode_ci charset = utf8 engine = InnoDB;
create table
area_type (
id bigint unsigned auto_increment,
name varchar(255) not null,
parent int null,
child_order int default 0 not null,
description text null,
gid char(36) not null,
constraint id unique (id)
) collate utf8_unicode_ci charset = utf8 engine = InnoDB;
create table
artist (
id bigint unsigned auto_increment,
gid char(36) not null,
name varchar(255) not null,
sort_name varchar(255) not null,
begin_date_year smallint null,
begin_date_month smallint null,
begin_date_day smallint null,
end_date_year smallint null,
end_date_month smallint null,
end_date_day smallint null,
type int null,
area int null,
gender int null,
comment varchar(255) default '' not null,
edits_pending int default 0 not null,
last_updated timestamp default current_timestamp() not null on update current_timestamp(),
ended char default '0' not null,
begin_area int null,
end_area int null,
constraint id unique (id),
constraint artist_ended_check check (
(
`end_date_year` is not null
or `end_date_month` is not null
or `end_date_day` is not null
)
and `ended` = 1
or `end_date_year` is null
and `end_date_month` is null
and `end_date_day` is null
),
constraint edits_pending check (`edits_pending` >= 0)
) collate utf8_unicode_ci charset = utf8 engine = InnoDB;
create table
artist_alias (
id bigint unsigned auto_increment,
artist int not null,
name varchar(255) not null,
locale text null,
edits_pending int default 0 not null,
last_updated timestamp default current_timestamp() not null on update current_timestamp(),
type int null,
sort_name varchar(255) not null,
begin_date_year smallint null,
begin_date_month smallint null,
begin_date_day smallint null,
end_date_year smallint null,
end_date_month smallint null,
end_date_day smallint null,
primary_for_locale char default '0' not null,
ended char default '0' not null,
constraint id unique (id),
constraint edits_pending check (`edits_pending` >= 0),
constraint ended check (
(
`end_date_year` is not null
or `end_date_month` is not null
or `end_date_day` is not null
)
and `ended` = 1
or `end_date_year` is null
and `end_date_month` is null
and `end_date_day` is null
),
constraint primary_check check (
`locale` is null
and `primary_for_locale` is false
or `locale` is not null
),
constraint search_hints_are_empty check (
`type` <> 3
or `type` = 3
and `sort_name` = `name`
and `begin_date_year` is null
and `begin_date_month` is null
and `begin_date_day` is null
and `end_date_year` is null
and `end_date_month` is null
and `end_date_day` is null
and `primary_for_locale` is false
and `locale` is null
)
) collate utf8_unicode_ci charset = utf8 engine = InnoDB;
create table
artist_alias_type (
id bigint unsigned auto_increment,
name text not null,
parent int null,
child_order int default 0 not null,
description text null,
gid char(36) not null,
constraint id unique (id)
) collate utf8_unicode_ci charset = utf8 engine = InnoDB;
create table
artist_annotation (artist int not null, annotation int not null) collate utf8_unicode_ci charset = utf8 engine = InnoDB;
create table
artist_credit (
id bigint unsigned auto_increment,
name varchar(255) not null,
artist_count smallint not null,
ref_count int default 0 null,
created timestamp default current_timestamp() not null on update current_timestamp(),
constraint id unique (id)
) collate utf8_unicode_ci charset = utf8 engine = InnoDB;
create table
artist_credit_name (
artist_credit int not null,
position smallint not null,
artist int not null,
name varchar(255) not null,
join_phrase text not null
) collate utf8_unicode_ci charset = utf8 engine = InnoDB;
create table
artist_gid_redirect (
gid char(36) not null,
new_id int not null,
created timestamp default current_timestamp() not null on update current_timestamp()
) collate utf8_unicode_ci charset = utf8 engine = InnoDB;
create table
artist_ipi (
artist int not null,
ipi char(11) not null,
edits_pending int default 0 not null,
created timestamp default current_timestamp() not null on update current_timestamp(),
constraint edits_pending check (`edits_pending` >= 0),
constraint ipi check (`ipi` regexp '^\\d{11}$')
) collate utf8_unicode_ci charset = utf8 engine = InnoDB;
create table
artist_isni (
artist int not null,
isni char(36) not null,
edits_pending int default 0 not null,
created timestamp default current_timestamp() not null on update current_timestamp(),
constraint edits_pending check (`edits_pending` >= 0),
constraint isni check (`isni` regexp '^\\d{15}[\\dX]$')
) collate utf8_unicode_ci charset = utf8 engine = InnoDB;
create table
artist_meta (
id int not null,
rating smallint null,
rating_count int null,
constraint rating check (
`rating` >= 0
and `rating` <= 100
)
) collate utf8_unicode_ci charset = utf8 engine = InnoDB;
create table
artist_rating_raw (
artist int not null,
editor int not null,
rating smallint not null,
constraint rating check (
`rating` >= 0
and `rating` <= 100
)
) collate utf8_unicode_ci charset = utf8 engine = InnoDB;
create table
artist_tag (
artist int not null,
tag int not null,
count int not null,
last_updated timestamp default current_timestamp() not null on update current_timestamp()
) collate utf8_unicode_ci charset = utf8 engine = InnoDB;
create table
artist_tag_raw (
artist int not null,
editor int not null,
tag int not null,
is_upvote char default '1' not null
) collate utf8_unicode_ci charset = utf8 engine = InnoDB;
create table
artist_type (
id bigint unsigned auto_increment,
name varchar(255) not null,
parent int null,
child_order int default 0 not null,
description text null,
gid char(36) not null,
constraint id unique (id)
) collate utf8_unicode_ci charset = utf8 engine = InnoDB;
create table
autoeditor_election_vote (
id bigint unsigned auto_increment,
autoeditor_election int not null,
voter int not null,
vote int not null,
vote_time timestamp default current_timestamp() not null on update current_timestamp(),
constraint id unique (id),
constraint vote check (`vote` in (-1, 0, 1))
) collate utf8_unicode_ci charset = utf8 engine = InnoDB;
create table
cdtoc (
id bigint unsigned auto_increment,
discid char(28) not null,
freedb_id char(8) not null,
track_count int not null,
leadout_offset int not null,
track_offset binary(36) not null,
degraded char default '0' not null,
created timestamp default current_timestamp() not null on update current_timestamp(),
constraint id unique (id)
) collate utf8_unicode_ci charset = utf8 engine = InnoDB;
create table
cdtoc_raw (
id bigint unsigned auto_increment,
`release` int not null,
discid char(28) not null,
track_count int not null,
leadout_offset int not null,
track_offset longtext collate utf8mb4_bin not null,
constraint id unique (id),
constraint track_offset check (json_valid (`track_offset`))
) collate utf8_unicode_ci charset = utf8 engine = InnoDB;
create table
country_area (area int null) collate utf8_unicode_ci charset = utf8 engine = InnoDB;
create table
deleted_entity (
gid char(36) not null,
data longtext collate utf8mb4_bin not null,
deleted_at timestamp default current_timestamp() not null on update current_timestamp(),
constraint data check (json_valid (`data`))
) collate utf8_unicode_ci charset = utf8 engine = InnoDB;
create table
edit_area (edit int not null, area int not null) collate utf8_unicode_ci charset = utf8 engine = InnoDB;
create table
edit_artist (
edit int not null,
artist int not null,
status smallint not null
) collate utf8_unicode_ci charset = utf8 engine = InnoDB;
create table
edit_data (
edit int not null,
data longtext collate utf8mb4_bin not null,
constraint data check (json_valid (`data`))
) collate utf8_unicode_ci charset = utf8 engine = InnoDB;
create table
edit_event (edit int not null, event int not null) collate utf8_unicode_ci charset = utf8 engine = InnoDB;
create table
edit_instrument (edit int not null, instrument int not null) collate utf8_unicode_ci charset = utf8 engine = InnoDB;
create table
edit_label (
edit int not null,
label int not null,
status smallint not null
) collate utf8_unicode_ci charset = utf8 engine = InnoDB;
create table
edit_note (
id bigint unsigned auto_increment,
editor int not null,
edit int not null,
text text not null,
post_time timestamp default current_timestamp() not null on update current_timestamp(),
constraint id unique (id)
) collate utf8_unicode_ci charset = utf8 engine = InnoDB;
create table
edit_note_recipient (recipient int not null, edit_note int not null) collate utf8_unicode_ci charset = utf8 engine = InnoDB;
create table
edit_place (edit int not null, place int not null) collate utf8_unicode_ci charset = utf8 engine = InnoDB;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment