1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303
| -- -- -- -- skipping definition of enum [ability_word], since SQLite does not support custom types -- skipping definition of enum [border], since SQLite does not support custom types -- skipping definition of enum [card_type], since SQLite does not support custom types -- skipping definition of enum [color], since SQLite does not support custom types -- skipping definition of enum [color_combo], since SQLite does not support custom types -- skipping definition of enum [deck_location], since SQLite does not support custom types -- skipping definition of enum [deck_type], since SQLite does not support custom types -- skipping definition of enum [finish], since SQLite does not support custom types -- skipping definition of enum [frame], since SQLite does not support custom types -- skipping definition of enum [frame_effect], since SQLite does not support custom types -- skipping definition of enum [identifier_type], since SQLite does not support custom types -- skipping definition of enum [keyword_ability], since SQLite does not support custom types -- skipping definition of enum [keyword_action], since SQLite does not support custom types -- skipping definition of enum [lang], since SQLite does not support custom types -- skipping definition of enum [layout], since SQLite does not support custom types -- skipping definition of enum [legal_status], since SQLite does not support custom types -- skipping definition of enum [provider], since SQLite does not support custom types -- skipping definition of enum [rarity], since SQLite does not support custom types -- skipping definition of enum [ruling_source], since SQLite does not support custom types -- skipping definition of enum [security_stamp], since SQLite does not support custom types -- skipping definition of enum [set_type], since SQLite does not support custom types -- skipping definition of enum [subtype], since SQLite does not support custom types -- skipping definition of enum [supertype], since SQLite does not support custom types -- skipping definition of enum [sync_status], since SQLite does not support custom types -- skipping definition of enum [watermark], since SQLite does not support custom types -- -- create table if not exists "artist" ( "id" uuid not null, "name" text not null, "aka" jsonb not null, primary key ("id") ); -- -- create table if not exists "audit" ( "id" uuid not null, "message" text not null, "created" timestamp not null default current_timestamp, primary key ("id") ); -- -- create table if not exists "set" ( "id" text not null, "name" text not null, "icon" text not null, "set_type" set_type not null, "released_at" timestamp not null, "block_code" text not null, "block" text not null, "parent_set_code" text not null, "mtgo_code" text not null, "arena_code" text not null, "scryfall_id" uuid not null, "tcgplayer_id" int not null, "card_count" int not null, "printed_size" int not null, "digital" boolean not null, "foil_only" boolean not null, "nonfoil_only" boolean not null, "scryfall_uri" text not null, "scryfall_api" text not null, "icon_svg_uri" text not null, "search_uri" text not null, primary key ("id") ); -- -- create table if not exists "card" ( "id" uuid not null, "name" text not null, "text" text not null, "card_types" jsonb not null, "type_line" text not null, "subtypes" jsonb not null, "supertypes" jsonb not null, "color_identity" jsonb not null, "color_indicator" jsonb not null, "colors" jsonb not null, "mana_cost" text not null, "mana_value" double precision not null, "cmc" double precision not null, "keywords" jsonb not null, "power" text not null, "toughness" text not null, "loyalty" text not null, "life" text not null, "defense" text not null, "layout" layout not null, "hand" text not null, "first_printing" text not null, "leadership_skills" jsonb not null, "alt_deck_limit" text not null, "reserved" boolean not null, "has_foil" boolean not null, "has_non_foil" boolean not null, "starter" boolean not null, "funny" boolean not null, "edhrec_rank" int not null, "edhrec_saltiness" int not null, foreign key ("first_printing") references "set" ("id"), primary key ("id") );
create index if not exists "card__first_printing_idx" on "card" ("first_printing"); -- -- create table if not exists "deck" ( "id" text not null, "name" text not null, "set_id" text not null, "release_date" timestamp not null, "deck_type" deck_type not null, "source" text not null, foreign key ("set_id") references "set" ("id"), primary key ("id") );
create index if not exists "deck__set_id_idx" on "deck" ("set_id"); -- -- create table if not exists "variant" ( "id" uuid not null, "set_id" text not null, "collector_number" text not null, "card_id" uuid not null, "artist" text not null, "illustration_id" uuid not null, "card_back" text not null, "rarity" rarity not null, "border" border not null, "frame" frame not null, "frame_effects" jsonb not null, "finishes" jsonb not null, "security_stamp" security_stamp not null, "watermark" watermark not null, "attraction_lights" jsonb not null, "lang" lang not null, "flavor_name" text not null, "flavor_text" text not null, "name" text not null, "text" text not null, "type_line" text not null, "explicit" boolean not null, "released_at" timestamp not null, "reprint" boolean not null, "full_art" boolean not null, "story_spotlight" boolean not null, "oversized" boolean not null, "digital" boolean not null, "booster" boolean not null, "promo" boolean not null, "promo_types" text not null, foreign key ("set_id") references "set" ("id"), foreign key ("card_id") references "card" ("id"), primary key ("id") );
create index if not exists "variant__set_id_idx" on "variant" ("set_id");
create index if not exists "variant__card_id_idx" on "variant" ("card_id"); -- -- create table if not exists "deck_variant" ( "deck_id" text not null, "idx" int not null, "location" deck_location not null, "variant_id" uuid not null, foreign key ("deck_id") references "deck" ("id"), foreign key ("variant_id") references "variant" ("id"), primary key ("deck_id", "idx") );
create index if not exists "deck_variant__deck_id_idx" on "deck_variant" ("deck_id");
create index if not exists "deck_variant__idx_idx" on "deck_variant" ("idx");
create index if not exists "deck_variant__location_idx" on "deck_variant" ("location");
create index if not exists "deck_variant__variant_id_idx" on "deck_variant" ("variant_id"); -- -- create table if not exists "face" ( "card_id" uuid not null, "key" text not null, "name" text not null, "text" text not null, "flavor_text" text not null, "card_types" jsonb not null, "type_line" text not null, "subtypes" jsonb not null, "supertypes" jsonb not null, "color_identity" jsonb not null, "color_indicator" jsonb not null, "colors" jsonb not null, "mana_cost" text not null, "mana_value" double precision not null, "cmc" double precision not null, "keywords" jsonb not null, "power" text not null, "toughness" text not null, "loyalty" text not null, "life" text not null, "defense" text not null, "illustration_id" text not null, "layout" layout not null, foreign key ("card_id") references "card" ("id"), primary key ("card_id", "key") );
create index if not exists "face__card_id_idx" on "face" ("card_id");
create index if not exists "face__key_idx" on "face" ("key"); -- -- create table if not exists "legality" ( "variant_id" uuid not null, "alchemy" legal_status not null, "brawl" legal_status not null, "commander" legal_status not null, "duel" legal_status not null, "explorer" legal_status not null, "future" legal_status not null, "gladiator" legal_status not null, "historic" legal_status not null, "historic_brawl" legal_status not null, "legacy" legal_status not null, "modern" legal_status not null, "oathbreaker" legal_status not null, "old_school" legal_status not null, "pauper" legal_status not null, "pauper_commander" legal_status not null, "penny" legal_status not null, "pioneer" legal_status not null, "predh" legal_status not null, "premodern" legal_status not null, "standard" legal_status not null, "timeless" legal_status not null, "vintage" legal_status not null, foreign key ("variant_id") references "variant" ("id"), primary key ("variant_id") ); -- -- create table if not exists "ruling" ( "id" uuid not null, "card_id" uuid not null, "source" ruling_source not null, "published_at" timestamp not null, "comment" text not null, foreign key ("card_id") references "card" ("id"), primary key ("id") );
create index if not exists "ruling__card_id_idx" on "ruling" ("card_id"); -- -- create table if not exists "status" ( "filename" text not null, "provider" provider not null, "status" sync_status not null, "comment" text not null, "data" jsonb not null, "created" timestamp not null default current_timestamp, "updated" timestamp default current_timestamp, primary key ("filename") ); -- -- create table if not exists "variant_artist" ( "variant_id" uuid not null, "artist_id" uuid not null, foreign key ("variant_id") references "variant" ("id"), foreign key ("artist_id") references "artist" ("id"), primary key ("variant_id", "artist_id") );
create index if not exists "variant_artist__variant_id_idx" on "variant_artist" ("variant_id");
create index if not exists "variant_artist__artist_id_idx" on "variant_artist" ("artist_id"); -- -- -- -- insert into "audit" ( "id", "message", "created" ) values ( '10000000-0000-0000-0000-000000000000', 'The very first audit log!', current_timestamp ) on conflict do nothing; -- -- insert into "set" ( "id", "name", "icon", "set_type", "released_at", "block_code", "block", "parent_set_code", "mtgo_code", "arena_code", "scryfall_id", "tcgplayer_id", "card_count", "printed_size", "digital", "foil_only", "nonfoil_only", "scryfall_uri", "scryfall_api", "icon_svg_uri", "search_uri" ) values ( 'none', 'None', 'star', 'unknown', '2023-10-31', '', '', '', '', '', '', 0, 0, 0, false, false, false, '', '', '', '' ) on conflict do nothing; -- -- --
|