# -*- coding: utf-8 -*-
"""change emoji shortcodes to characters

Revision ID: 232e68a03aa2
Revises: af3f5579c84d
Create Date: 2018-02-28 21:31:35.260704

"""
from __future__ import unicode_literals

from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '232e68a03aa2'
down_revision = 'af3f5579c84d'
branch_labels = ()
depends_on = None


_emoji_replacement_mapping = {
    # bowtie:               not in Unicode
    # neckbeard:            not in Unicode
    # shipit, squirrel:     GitHub inside joke? either way, not in Unicode
    # trollface:            ancient meme, not in Unicode
    # octocat:              that's a brand logo, of course it's not in Unicode
    # flaskbb:              that's our logo! sadly not in Unicode though
    # feelsgood:            doom reference, not in Unicode
    # finnadie:             doom reference, not in Unicode
    # goberserk:            doom reference, not in Unicode
    # godmode:              doom reference, not in Unicode
    # hurtrealbad:          doom reference, not in Unicode
    # rage1:                doom reference, not in Unicode
    # rage2:                doom reference, not in Unicode
    # rage3:                doom reference, not in Unicode
    # rage4:                doom reference, not in Unicode
    # suspect:              doom reference, not in Unicode
    '+1': '๐Ÿ‘',
    '-1': '๐Ÿ‘Ž',
    '100': '๐Ÿ’ฏ',
    '1234': '๐Ÿ”ข',
    '8ball': '๐ŸŽฑ',
    'a': '๐Ÿ…ฐ๏ธ',
    'ab': '๐Ÿ†Ž',
    'abc': '๐Ÿ”ค',
    'abcd': '๐Ÿ”ก',
    'accept': '๐Ÿ‰‘',
    'aerial_tramway': '๐Ÿšก',
    'airplane': 'โœˆ๏ธ',
    'alarm_clock': 'โฐ',
    'alien': '๐Ÿ‘ฝ',
    'ambulance': '๐Ÿš‘',
    'anchor': 'โš“๏ธ',
    'angel': '๐Ÿ‘ผ',
    'anger': '๐Ÿ’ข',
    'angry': '๐Ÿ˜ ',
    'anguished': '๐Ÿ˜ง',
    'ant': '๐Ÿœ',
    'apple': '๐ŸŽ',
    'aquarius': 'โ™’๏ธ',
    'aries': 'โ™ˆ๏ธ',
    'arrow_backward': 'โ—€๏ธ',
    'arrow_double_down': 'โฌ',
    'arrow_double_up': 'โซ',
    'arrow_down': 'โฌ‡๏ธ',
    'arrow_down_small': '๐Ÿ”ฝ',
    'arrow_forward': 'โ–ถ๏ธ',
    'arrow_heading_down': 'โคต๏ธ',
    'arrow_heading_up': 'โคด๏ธ',
    'arrow_left': 'โฌ…๏ธ',
    'arrow_lower_left': 'โ†™๏ธ',
    'arrow_lower_right': 'โ†˜๏ธ',
    'arrow_right': 'โžก๏ธ',
    'arrow_right_hook': 'โ†ช๏ธ',
    'arrow_up': 'โฌ†๏ธ',
    'arrow_up_down': 'โ†•๏ธ',
    'arrow_up_small': '๐Ÿ”ผ',
    'arrow_upper_left': 'โ†–๏ธ',
    'arrow_upper_right': 'โ†—๏ธ',
    'arrows_clockwise': '๐Ÿ”ƒ',
    'arrows_counterclockwise': '๐Ÿ”„',
    'art': '๐ŸŽจ',
    'articulated_lorry': '๐Ÿš›',
    'astonished': '๐Ÿ˜ฒ',
    'atm': '๐Ÿง',
    'b': '๐Ÿ…ฑ๏ธ',
    'baby': '๐Ÿ‘ถ',
    'baby_bottle': '๐Ÿผ',
    'baby_chick': '๐Ÿค',
    'baby_symbol': '๐Ÿšผ',
    'back': '๐Ÿ”™',
    'baggage_claim': '๐Ÿ›„',
    'balloon': '๐ŸŽˆ',
    'ballot_box_with_check': 'โ˜‘๏ธ',
    'bamboo': '๐ŸŽ',
    'banana': '๐ŸŒ',
    'bangbang': 'โ€ผ๏ธ',
    'bank': '๐Ÿฆ',
    'bar_chart': '๐Ÿ“Š',
    'barber': '๐Ÿ’ˆ',
    'baseball': 'โšพ๏ธ',
    'basketball': '๐Ÿ€',
    'bath': '๐Ÿ›€',
    'bathtub': '๐Ÿ›',
    'battery': '๐Ÿ”‹',
    'bear': '๐Ÿป',
    'bee': '๐Ÿ',
    'beer': '๐Ÿบ',
    'beers': '๐Ÿป',
    'beetle': '๐Ÿž',
    'beginner': '๐Ÿ”ฐ',
    'bell': '๐Ÿ””',
    'bento': '๐Ÿฑ',
    'bicyclist': '๐Ÿšด',
    'bike': '๐Ÿšฒ',
    'bikini': '๐Ÿ‘™',
    'bird': '๐Ÿฆ',
    'birthday': '๐ŸŽ‚',
    'black_circle': 'โšซ๏ธ',
    'black_joker': '๐Ÿƒ',
    'black_medium_small_square': 'โ—พ๏ธ',
    'black_medium_square': 'โ—ผ๏ธ',
    'black_nib': 'โœ’๏ธ',
    'black_small_square': 'โ–ช๏ธ',
    'black_square': 'โฌ›',  # i assume that's black large square
    'black_square_button': '๐Ÿ”ฒ',
    'blossom': '๐ŸŒผ',
    'blowfish': '๐Ÿก',
    'blue_book': '๐Ÿ“˜',
    'blue_car': '๐Ÿš™',
    'blue_heart': '๐Ÿ’™',
    'blush': '๐Ÿ˜Š',
    'boar': '๐Ÿ—',
    'boat': 'โ›ต๏ธ',
    'bomb': '๐Ÿ’ฃ',
    'book': '๐Ÿ“–',
    'bookmark': '๐Ÿ”–',
    'bookmark_tabs': '๐Ÿ“‘',
    'books': '๐Ÿ“š',
    'boom': '๐Ÿ’ฅ',
    'boot': '๐Ÿ‘ข',
    'bouquet': '๐Ÿ’',
    'bow': '๐Ÿ™‡',
    'bowling': '๐ŸŽณ',
    'boy': '๐Ÿ‘ฆ',
    'bread': '๐Ÿž',
    'bride_with_veil': '๐Ÿ‘ฐ',
    'bridge_at_night': '๐ŸŒ‰',
    'briefcase': '๐Ÿ’ผ',
    'broken_heart': '๐Ÿ’”',
    'bug': '๐Ÿ›',
    'bulb': '๐Ÿ’ก',
    'bullettrain_front': '๐Ÿš…',
    'bullettrain_side': '๐Ÿš„',
    'bus': '๐ŸšŒ',
    'busstop': '๐Ÿš',
    'bust_in_silhouette': '๐Ÿ‘ค',
    'busts_in_silhouette': '๐Ÿ‘ฅ',
    'cactus': '๐ŸŒต',
    'cake': '๐Ÿฐ',
    'calendar': '๐Ÿ“†',
    'calling': '๐Ÿ“ฒ',
    'camel': '๐Ÿซ',
    'camera': '๐Ÿ“ท',
    'cancer': 'โ™‹๏ธ',
    'candy': '๐Ÿฌ',
    'capital_abcd': '๐Ÿ” ',
    'capricorn': 'โ™‘๏ธ',
    'car': '๐Ÿš—',
    'card_index': '๐Ÿ“‡',
    'carousel_horse': '๐ŸŽ ',
    'cat': '๐Ÿฑ',
    'cat2': '๐Ÿˆ',
    'cd': '๐Ÿ’ฟ',
    'chart': '๐Ÿ’น',
    'chart_with_downwards_trend': '๐Ÿ“‰',
    'chart_with_upwards_trend': '๐Ÿ“ˆ',
    'checkered_flag': '๐Ÿ',
    'cherries': '๐Ÿ’',
    'cherry_blossom': '๐ŸŒธ',
    'chestnut': '๐ŸŒฐ',
    'chicken': '๐Ÿ”',
    'children_crossing': '๐Ÿšธ',
    'chocolate_bar': '๐Ÿซ',
    'christmas_tree': '๐ŸŽ„',
    'church': 'โ›ช๏ธ',
    'cinema': '๐ŸŽฆ',
    'circus_tent': '๐ŸŽช',
    'city_sunrise': '๐ŸŒ‡',
    'city_sunset': '๐ŸŒ†',
    'cl': '๐Ÿ†‘',
    'clap': '๐Ÿ‘',
    'clapper': '๐ŸŽฌ',
    'clipboard': '๐Ÿ“‹',
    'clock1': '๐Ÿ•',
    'clock10': '๐Ÿ•™',
    'clock1030': '๐Ÿ•ฅ',
    'clock11': '๐Ÿ•š',
    'clock1130': '๐Ÿ•ฆ',
    'clock12': '๐Ÿ•›',
    'clock1230': '๐Ÿ•ง',
    'clock130': '๐Ÿ•œ',
    'clock2': '๐Ÿ•‘',
    'clock230': '๐Ÿ•',
    'clock3': '๐Ÿ•’',
    'clock330': '๐Ÿ•ž',
    'clock4': '๐Ÿ•“',
    'clock430': '๐Ÿ•Ÿ',
    'clock5': '๐Ÿ•”',
    'clock530': '๐Ÿ• ',
    'clock6': '๐Ÿ••',
    'clock630': '๐Ÿ•ก',
    'clock7': '๐Ÿ•–',
    'clock730': '๐Ÿ•ข',
    'clock8': '๐Ÿ•—',
    'clock830': '๐Ÿ•ฃ',
    'clock9': '๐Ÿ•˜',
    'clock930': '๐Ÿ•ค',
    'closed_book': '๐Ÿ“•',
    'closed_lock_with_key': '๐Ÿ”',
    'closed_umbrella': '๐ŸŒ‚',
    'cloud': 'โ˜๏ธ',
    'clubs': 'โ™ฃ๏ธ',
    'cn': '๐Ÿ‡จ๐Ÿ‡ณ',
    'cocktail': '๐Ÿธ',
    'coffee': 'โ˜•๏ธ',
    'cold_sweat': '๐Ÿ˜ฐ',
    'collision': '๐Ÿ’ฅ',
    'computer': '๐Ÿ’ป',
    'confetti_ball': '๐ŸŽŠ',
    'confounded': '๐Ÿ˜–',
    'confused': '๐Ÿ˜•',
    'congratulations': 'ใŠ—',
    'construction': '๐Ÿšง',
    'construction_worker': '๐Ÿ‘ท',
    'convenience_store': '๐Ÿช',
    'cookie': '๐Ÿช',
    'cool': '๐Ÿ†’',
    'cop': '๐Ÿ‘ฎ',
    'copyright': 'ยฉ๏ธ',
    'corn': '๐ŸŒฝ',
    'couple': '๐Ÿ‘ซ',
    'couple_with_heart': '๐Ÿ’‘',
    'couplekiss': '๐Ÿ’',  # kiss
    'cow': '๐Ÿฎ',
    'cow2': '๐Ÿ„',
    'credit_card': '๐Ÿ’ณ',
    'crescent_moon': '๐ŸŒ™',
    'crocodile': '๐ŸŠ',
    'crossed_flags': '๐ŸŽŒ',
    'crown': '๐Ÿ‘‘',
    'cry': '๐Ÿ˜ข',
    'crying_cat_face': '๐Ÿ˜ฟ',
    'crystal_ball': '๐Ÿ”ฎ',
    'cupid': '๐Ÿ’˜',
    'curly_loop': 'โžฐ',
    'currency_exchange': '๐Ÿ’ฑ',
    'curry': '๐Ÿ›',
    'custard': '๐Ÿฎ',
    'customs': '๐Ÿ›ƒ',
    'cyclone': '๐ŸŒ€',
    'dancer': '๐Ÿ’ƒ',
    'dancers': '๐Ÿ‘ฏ',
    'dango': '๐Ÿก',
    'dart': '๐ŸŽฏ',
    'dash': '๐Ÿ’จ',
    'date': '๐Ÿ“…',
    'de': '๐Ÿ‡ฉ๐Ÿ‡ช',
    'deciduous_tree': '๐ŸŒณ',
    'department_store': '๐Ÿฌ',
    'diamond_shape_with_a_dot_inside': '๐Ÿ’ ',
    'diamonds': 'โ™ฆ๏ธ',
    'disappointed': '๐Ÿ˜ž',
    'disappointed_relieved': '๐Ÿ˜ฅ',
    'dizzy': '๐Ÿ’ซ',
    'dizzy_face': '๐Ÿ˜ต',
    'do_not_litter': '๐Ÿšฏ',
    'dog': '๐Ÿถ',
    'dog2': '๐Ÿ•',
    'dollar': '๐Ÿ’ต',
    'dolls': '๐ŸŽŽ',
    'dolphin': '๐Ÿฌ',
    'donut': '๐Ÿฉ',  # it's doughnut, you 'muricans
    'door': '๐Ÿšช',
    'doughnut': '๐Ÿฉ',
    'dragon': '๐Ÿ‰',
    'dragon_face': '๐Ÿฒ',
    'dress': '๐Ÿ‘—',
    'dromedary_camel': '๐Ÿช',
    'droplet': '๐Ÿ’ง',
    'dvd': '๐Ÿ“€',
    'e-mail': '๐Ÿ“ง',
    'ear': '๐Ÿ‘‚',
    'ear_of_rice': '๐ŸŒพ',
    'earth_africa': '๐ŸŒ',
    'earth_americas': '๐ŸŒŽ',
    'earth_asia': '๐ŸŒ',
    'egg': '๐Ÿฅš',
    'eggplant': '๐Ÿ†',
    'eight': '8๏ธโƒฃ',
    'eight_pointed_black_star': 'โœด๏ธ',
    'eight_spoked_asterisk': 'โœณ๏ธ',
    'electric_plug': '๐Ÿ”Œ',
    'elephant': '๐Ÿ˜',
    'email': 'โœ‰๏ธ',
    'end': '๐Ÿ”š',
    'envelope': 'โœ‰๏ธ',
    'es': '๐Ÿ‡ช๐Ÿ‡ธ',
    'euro': '๐Ÿ’ถ',
    'european_castle': '๐Ÿฐ',
    'european_post_office': '๐Ÿค',
    'evergreen_tree': '๐ŸŒฒ',
    'exclamation': 'โ—๏ธ',
    'expressionless': '๐Ÿ˜‘',
    'eyeglasses': '๐Ÿ‘“',
    'eyes': '๐Ÿ‘€',
    'facepunch': '๐Ÿ‘Š',
    'factory': '๐Ÿญ',
    'fallen_leaf': '๐Ÿ‚',
    'family': '๐Ÿ‘ช',
    'fast_forward': 'โฉ',
    'fax': '๐Ÿ“ ',
    'fearful': '๐Ÿ˜จ',
    'feet': '๐Ÿพ',
    'ferris_wheel': '๐ŸŽก',
    'file_folder': '๐Ÿ“',
    'fire': '๐Ÿ”ฅ',
    'fire_engine': '๐Ÿš’',
    'fireworks': '๐ŸŽ†',
    'first_quarter_moon': '๐ŸŒ“',
    'first_quarter_moon_with_face': '๐ŸŒ›',
    'fish': '๐ŸŸ',
    'fish_cake': '๐Ÿฅ',
    'fishing_pole_and_fish': '๐ŸŽฃ',
    'fist': 'โœŠ',
    'five': '5๏ธโƒฃ',
    'flags': '๐ŸŽ',
    'flashlight': '๐Ÿ”ฆ',
    'floppy_disk': '๐Ÿ’พ',
    'flower_playing_cards': '๐ŸŽด',
    'flushed': '๐Ÿ˜ณ',
    'foggy': '๐ŸŒ',
    'football': '๐Ÿˆ',
    'fork_and_knife': '๐Ÿด',
    'fountain': 'โ›ฒ๏ธ',
    'four': '4๏ธโƒฃ',
    'four_leaf_clover': '๐Ÿ€',
    'fr': '๐Ÿ‡ซ๐Ÿ‡ท',
    'free': '๐Ÿ†“',
    'fried_shrimp': '๐Ÿค',
    'fries': '๐ŸŸ',
    'frog': '๐Ÿธ',
    'frowning': '๐Ÿ˜ฆ',
    'fu': '๐Ÿ–•',
    'fuelpump': 'โ›ฝ๏ธ',
    'full_moon': '๐ŸŒ•',
    'full_moon_with_face': '๐ŸŒ',
    'game_die': '๐ŸŽฒ',
    'gb': '๐Ÿ‡ฌ๐Ÿ‡ง',
    'gem': '๐Ÿ’Ž',
    'gemini': 'โ™Š๏ธ',
    'ghost': '๐Ÿ‘ป',
    'gift': '๐ŸŽ',
    'gift_heart': '๐Ÿ’',
    'girl': '๐Ÿ‘ง',
    'globe_with_meridians': '๐ŸŒ',
    'goat': '๐Ÿ',
    'golf': 'โ›ณ๏ธ',
    'grapes': '๐Ÿ‡',
    'green_apple': '๐Ÿ',
    'green_book': '๐Ÿ“—',
    'green_heart': '๐Ÿ’š',
    'grey_exclamation': 'โ•',
    'grey_question': 'โ”',
    'grimacing': '๐Ÿ˜ฌ',
    'grin': '๐Ÿ˜',
    'grinning': '๐Ÿ˜€',
    'guardsman': '๐Ÿ’‚',
    'guitar': '๐ŸŽธ',
    'gun': '๐Ÿ”ซ',
    'haircut': '๐Ÿ’‡',
    'hamburger': '๐Ÿ”',
    'hammer': '๐Ÿ”จ',
    'hamster': '๐Ÿน',
    'hand': 'โœ‹',
    'handbag': '๐Ÿ‘œ',
    'hankey': '๐Ÿ’ฉ',
    'hash': '#๏ธโƒฃ',
    'hatched_chick': '๐Ÿฅ',
    'hatching_chick': '๐Ÿฃ',
    'headphones': '๐ŸŽง',
    'hear_no_evil': '๐Ÿ™‰',
    'heart': 'โค๏ธ',
    'heart_decoration': '๐Ÿ’Ÿ',
    'heart_eyes': '๐Ÿ˜',
    'heart_eyes_cat': '๐Ÿ˜ป',
    'heartbeat': '๐Ÿ’“',
    'heartpulse': '๐Ÿ’—',
    'hearts': 'โ™ฅ๏ธ',
    'heavy_check_mark': 'โœ”๏ธ',
    'heavy_division_sign': 'โž—',
    'heavy_dollar_sign': '๐Ÿ’ฒ',
    'heavy_exclamation_mark': 'โ—๏ธ',
    'heavy_minus_sign': 'โž–',
    'heavy_multiplication_x': 'โœ–๏ธ',
    'heavy_plus_sign': 'โž•',
    'helicopter': '๐Ÿš',
    'herb': '๐ŸŒฟ',
    'hibiscus': '๐ŸŒบ',
    'high_brightness': '๐Ÿ”†',
    'high_heel': '๐Ÿ‘ ',
    'hocho': '๐Ÿ”ช',
    'honey_pot': '๐Ÿฏ',
    'honeybee': '๐Ÿ',
    'horse': '๐Ÿด',
    'horse_racing': '๐Ÿ‡',
    'hospital': '๐Ÿฅ',
    'hotel': '๐Ÿจ',
    'hotsprings': 'โ™จ๏ธ',
    'hourglass': 'โŒ›๏ธ',
    'hourglass_flowing_sand': 'โณ',
    'house': '๐Ÿ ',
    'house_with_garden': '๐Ÿก',
    'hushed': '๐Ÿ˜ฏ',
    'ice_cream': '๐Ÿจ',
    'icecream': '๐Ÿฆ',
    'id': '๐Ÿ†”',
    'ideograph_advantage': '๐Ÿ‰',
    'imp': '๐Ÿ‘ฟ',
    'inbox_tray': '๐Ÿ“ฅ',
    'incoming_envelope': '๐Ÿ“จ',
    'information_desk_person': '๐Ÿ’',
    'information_source': 'โ„น๏ธ',
    'innocent': '๐Ÿ˜‡',
    'interrobang': 'โ‰๏ธ',
    'iphone': '๐Ÿ“ฑ',
    'it': '๐Ÿ‡ฎ๐Ÿ‡น',
    'izakaya_lantern': '๐Ÿฎ',
    'jack_o_lantern': '๐ŸŽƒ',
    'japan': '๐Ÿ—พ',
    'japanese_castle': '๐Ÿฏ',
    'japanese_goblin': '๐Ÿ‘บ',
    'japanese_ogre': '๐Ÿ‘น',
    'jeans': '๐Ÿ‘–',
    'joy': '๐Ÿ˜‚',
    'joy_cat': '๐Ÿ˜น',
    'jp': '๐Ÿ‡ฏ๐Ÿ‡ต',
    'key': '๐Ÿ”‘',
    'keycap_ten': '๐Ÿ”Ÿ',
    'kimono': '๐Ÿ‘˜',
    'kiss': '๐Ÿ’‹',
    'kissing': '๐Ÿ˜—',
    'kissing_cat': '๐Ÿ˜ฝ',
    'kissing_closed_eyes': '๐Ÿ˜š',
    'kissing_face': '๐Ÿ˜—',  # aparently, the shortcode is just 'kissing'
    'kissing_heart': '๐Ÿ˜˜',
    'kissing_smiling_eyes': '๐Ÿ˜™',
    'koala': '๐Ÿจ',
    'koko': '๐Ÿˆ',
    'kr': '๐Ÿ‡ฐ๐Ÿ‡ท',
    'large_blue_circle': '๐Ÿ”ต',
    'large_blue_diamond': '๐Ÿ”ท',
    'large_orange_diamond': '๐Ÿ”ถ',
    'last_quarter_moon': '๐ŸŒ—',
    'last_quarter_moon_with_face': '๐ŸŒœ',
    'laughing': '๐Ÿ˜†',
    'leaves': '๐Ÿƒ',
    'ledger': '๐Ÿ“’',
    'left_luggage': '๐Ÿ›…',
    'left_right_arrow': 'โ†”๏ธ',
    'leftwards_arrow_with_hook': 'โ†ฉ๏ธ',
    'lemon': '๐Ÿ‹',
    'leo': 'โ™Œ๏ธ',
    'leopard': '๐Ÿ†',
    'libra': 'โ™Ž๏ธ',
    'light_rail': '๐Ÿšˆ',
    'link': '๐Ÿ”—',
    'lips': '๐Ÿ‘„',
    'lipstick': '๐Ÿ’„',
    'lock': '๐Ÿ”’',
    'lock_with_ink_pen': '๐Ÿ”',
    'lollipop': '๐Ÿญ',
    'loop': 'โžฟ',
    'loudspeaker': '๐Ÿ“ข',
    'love_hotel': '๐Ÿฉ',
    'love_letter': '๐Ÿ’Œ',
    'low_brightness': '๐Ÿ”…',
    'm': 'โ“‚๏ธ',
    'mag': '๐Ÿ”',
    'mag_right': '๐Ÿ”Ž',
    'mahjong': '๐Ÿ€„๏ธ',
    'mailbox': '๐Ÿ“ซ',
    'mailbox_closed': '๐Ÿ“ช',
    'mailbox_with_mail': '๐Ÿ“ฌ',
    'mailbox_with_no_mail': '๐Ÿ“ญ',
    'man': '๐Ÿ‘จ',
    'man_with_gua_pi_mao': '๐Ÿ‘ฒ',
    'man_with_turban': '๐Ÿ‘ณ',
    'mans_shoe': '๐Ÿ‘ž',
    'maple_leaf': '๐Ÿ',
    'mask': '๐Ÿ˜ท',
    'massage': '๐Ÿ’†',
    'meat_on_bone': '๐Ÿ–',
    'mega': '๐Ÿ“ฃ',
    'melon': '๐Ÿˆ',
    'memo': '๐Ÿ“',
    'mens': '๐Ÿšน',
    'metal': '๐Ÿค˜',
    'metro': '๐Ÿš‡',
    'microphone': '๐ŸŽค',
    'microscope': '๐Ÿ”ฌ',
    'milky_way': '๐ŸŒŒ',
    'minibus': '๐Ÿš',
    'minidisc': '๐Ÿ’ฝ',
    'mobile_phone_off': '๐Ÿ“ด',
    'money_with_wings': '๐Ÿ’ธ',
    'moneybag': '๐Ÿ’ฐ',
    'monkey': '๐Ÿ’',
    'monkey_face': '๐Ÿต',
    'monorail': '๐Ÿš',
    'mortar_board': '๐ŸŽ“',
    'mount_fuji': '๐Ÿ—ป',
    'mountain_bicyclist': '๐Ÿšต',
    'mountain_cableway': '๐Ÿš ',
    'mountain_railway': '๐Ÿšž',
    'mouse': '๐Ÿญ',
    'mouse2': '๐Ÿ',
    'movie_camera': '๐ŸŽฅ',
    'moyai': '๐Ÿ—ฟ',
    'muscle': '๐Ÿ’ช',
    'mushroom': '๐Ÿ„',
    'musical_keyboard': '๐ŸŽน',
    'musical_note': '๐ŸŽต',
    'musical_score': '๐ŸŽผ',
    'mute': '๐Ÿ”‡',
    'nail_care': '๐Ÿ’…',
    'name_badge': '๐Ÿ“›',
    'necktie': '๐Ÿ‘”',
    'negative_squared_cross_mark': 'โŽ',
    'neutral_face': '๐Ÿ˜',
    'new': '๐Ÿ†•',
    'new_moon': '๐ŸŒ‘',
    'new_moon_with_face': '๐ŸŒš',
    'newspaper': '๐Ÿ“ฐ',
    'ng': '๐Ÿ†–',
    'nine': '9๏ธโƒฃ',
    'no_bell': '๐Ÿ”•',
    'no_bicycles': '๐Ÿšณ',
    'no_entry': 'โ›”๏ธ',
    'no_entry_sign': '๐Ÿšซ',
    'no_good': '๐Ÿ™…',
    'no_mobile_phones': '๐Ÿ“ต',
    'no_mouth': '๐Ÿ˜ถ',
    'no_pedestrians': '๐Ÿšท',
    'no_smoking': '๐Ÿšญ',
    'non-potable_water': '๐Ÿšฑ',
    'nose': '๐Ÿ‘ƒ',
    'notebook': '๐Ÿ““',
    'notebook_with_decorative_cover': '๐Ÿ“”',
    'notes': '๐ŸŽถ',
    'nut_and_bolt': '๐Ÿ”ฉ',
    'o': 'โญ•๏ธ',
    'o2': '๐Ÿ…พ๏ธ',
    'ocean': '๐ŸŒŠ',
    'octopus': '๐Ÿ™',
    'oden': '๐Ÿข',
    'office': '๐Ÿข',
    'ok': '๐Ÿ†—',
    'ok_hand': '๐Ÿ‘Œ',
    'ok_woman': '๐Ÿ™†',
    'older_man': '๐Ÿ‘ด',
    'older_woman': '๐Ÿ‘ต',
    'on': '๐Ÿ”›',
    'oncoming_automobile': '๐Ÿš˜',
    'oncoming_bus': '๐Ÿš',
    'oncoming_police_car': '๐Ÿš”',
    'oncoming_taxi': '๐Ÿš–',
    'one': '1๏ธโƒฃ',
    'open_file_folder': '๐Ÿ“‚',
    'open_hands': '๐Ÿ‘',
    'open_mouth': '๐Ÿ˜ฎ',
    'ophiuchus': 'โ›Ž',
    'orange_book': '๐Ÿ“™',
    'outbox_tray': '๐Ÿ“ค',
    'ox': '๐Ÿ‚',
    'package': '๐Ÿ“ฆ',
    'page_facing_up': '๐Ÿ“„',
    'page_with_curl': '๐Ÿ“ƒ',
    'pager': '๐Ÿ“Ÿ',
    'palm_tree': '๐ŸŒด',
    'panda_face': '๐Ÿผ',
    'paperclip': '๐Ÿ“Ž',
    'parking': '๐Ÿ…ฟ๏ธ',
    'part_alternation_mark': 'ใ€ฝ',
    'partly_sunny': 'โ›…๏ธ',
    'passport_control': '๐Ÿ›‚',
    'paw_prints': '๐Ÿพ',
    'peach': '๐Ÿ‘',
    'pear': '๐Ÿ',
    'pencil': '๐Ÿ“',
    'pencil2': 'โœ๏ธ',
    'penguin': '๐Ÿง',
    'pensive': '๐Ÿ˜”',
    'performing_arts': '๐ŸŽญ',
    'persevere': '๐Ÿ˜ฃ',
    'person_frowning': '๐Ÿ™',
    'person_with_blond_hair': '๐Ÿ‘ฑ',
    'person_with_pouting_face': '๐Ÿ™Ž',
    'phone': 'โ˜Ž๏ธ',
    'pig': '๐Ÿท',
    'pig2': '๐Ÿ–',
    'pig_nose': '๐Ÿฝ',
    'pill': '๐Ÿ’Š',
    'pineapple': '๐Ÿ',
    'pisces': 'โ™“๏ธ',
    'pizza': '๐Ÿ•',
    'plus1': '๐Ÿ‘',  # an alias to +1
    'point_down': '๐Ÿ‘‡',
    'point_left': '๐Ÿ‘ˆ',
    'point_right': '๐Ÿ‘‰',
    'point_up': 'โ˜๏ธ',
    'point_up_2': '๐Ÿ‘†',
    'police_car': '๐Ÿš“',
    'poodle': '๐Ÿฉ',
    'poop': '๐Ÿ’ฉ',
    'post_office': '๐Ÿฃ',
    'postal_horn': '๐Ÿ“ฏ',
    'postbox': '๐Ÿ“ฎ',
    'potable_water': '๐Ÿšฐ',
    'pouch': '๐Ÿ‘',
    'poultry_leg': '๐Ÿ—',
    'pound': '๐Ÿ’ท',
    'pouting_cat': '๐Ÿ˜พ',
    'pray': '๐Ÿ™',
    'princess': '๐Ÿ‘ธ',
    'punch': '๐Ÿ‘Š',
    'purple_heart': '๐Ÿ’œ',
    'purse': '๐Ÿ‘›',
    'pushpin': '๐Ÿ“Œ',
    'put_litter_in_its_place': '๐Ÿšฎ',
    'question': 'โ“',
    'rabbit': '๐Ÿฐ',
    'rabbit2': '๐Ÿ‡',
    'racehorse': '๐ŸŽ',
    'radio': '๐Ÿ“ป',
    'radio_button': '๐Ÿ”˜',
    'rage': '๐Ÿ˜ก',
    'railway_car': '๐Ÿšƒ',
    'rainbow': '๐ŸŒˆ',
    'raised_hand': 'โœ‹',
    'raised_hands': '๐Ÿ™Œ',
    'raising_hand': '๐Ÿ™‹',
    'ram': '๐Ÿ',
    'ramen': '๐Ÿœ',
    'rat': '๐Ÿ€',
    'recycle': 'โ™ป๏ธ',
    'red_car': '๐Ÿš—',
    'red_circle': '๐Ÿ”ด',
    'registered': 'ยฎ๏ธ',
    'relaxed': 'โ˜บ๏ธ',
    'relieved': '๐Ÿ˜Œ',
    'repeat': '๐Ÿ”',
    'repeat_one': '๐Ÿ”‚',
    'restroom': '๐Ÿšป',
    'revolving_hearts': '๐Ÿ’ž',
    'rewind': 'โช',
    'ribbon': '๐ŸŽ€',
    'rice': '๐Ÿš',
    'rice_ball': '๐Ÿ™',
    'rice_cracker': '๐Ÿ˜',
    'rice_scene': '๐ŸŽ‘',
    'ring': '๐Ÿ’',
    'rocket': '๐Ÿš€',
    'roller_coaster': '๐ŸŽข',
    'rooster': '๐Ÿ“',
    'rose': '๐ŸŒน',
    'rotating_light': '๐Ÿšจ',
    'round_pushpin': '๐Ÿ“',
    'rowboat': '๐Ÿšฃ',
    'ru': '๐Ÿ‡ท๐Ÿ‡บ',
    'rugby_football': '๐Ÿ‰',
    'runner': '๐Ÿƒ',
    'running': '๐Ÿƒ',
    'running_shirt_with_sash': '๐ŸŽฝ',
    'sa': '๐Ÿˆ‚',
    'sagittarius': 'โ™๏ธ',
    'sailboat': 'โ›ต๏ธ',
    'sake': '๐Ÿถ',
    'sandal': '๐Ÿ‘ก',
    'santa': '๐ŸŽ…',
    'satellite': '๐Ÿ“ก',
    'satisfied': '๐Ÿ˜†',
    'saxophone': '๐ŸŽท',
    'school': '๐Ÿซ',
    'school_satchel': '๐ŸŽ’',
    'scissors': 'โœ‚๏ธ',
    'scorpius': 'โ™๏ธ',
    'scream': '๐Ÿ˜ฑ',
    'scream_cat': '๐Ÿ™€',
    'scroll': '๐Ÿ“œ',
    'seat': '๐Ÿ’บ',
    'secret': 'ใŠ™',
    'see_no_evil': '๐Ÿ™ˆ',
    'seedling': '๐ŸŒฑ',
    'seven': '7๏ธโƒฃ',
    'shaved_ice': '๐Ÿง',
    'sheep': '๐Ÿ‘',
    'shell': '๐Ÿš',
    'ship': '๐Ÿšข',
    'shirt': '๐Ÿ‘•',
    'shit': '๐Ÿ’ฉ',
    'shoe': '๐Ÿ‘ž',
    'shower': '๐Ÿšฟ',
    'signal_strength': '๐Ÿ“ถ',
    'simple_smile': '๐Ÿ™‚',  # slightly smiling face
    'six': '6๏ธโƒฃ',
    'six_pointed_star': '๐Ÿ”ฏ',
    'ski': '๐ŸŽฟ',
    'skull': '๐Ÿ’€',
    'sleeping': '๐Ÿ˜ด',
    'sleepy': '๐Ÿ˜ช',
    'slot_machine': '๐ŸŽฐ',
    'small_blue_diamond': '๐Ÿ”น',
    'small_orange_diamond': '๐Ÿ”ธ',
    'small_red_triangle': '๐Ÿ”บ',
    'small_red_triangle_down': '๐Ÿ”ป',
    'smile': '๐Ÿ˜„',
    'smile_cat': '๐Ÿ˜ธ',
    'smiley': '๐Ÿ˜ƒ',
    'smiley_cat': '๐Ÿ˜บ',
    'smiling_imp': '๐Ÿ˜ˆ',
    'smirk': '๐Ÿ˜',
    'smirk_cat': '๐Ÿ˜ผ',
    'smoking': '๐Ÿšฌ',
    'snail': '๐ŸŒ',
    'snake': '๐Ÿ',
    'snowboarder': '๐Ÿ‚',
    'snowflake': 'โ„๏ธ',
    'snowman': 'โ›„๏ธ',
    'sob': '๐Ÿ˜ญ',
    'soccer': 'โšฝ๏ธ',
    'soon': '๐Ÿ”œ',
    'sos': '๐Ÿ†˜',
    'sound': '๐Ÿ”‰',
    'space_invader': '๐Ÿ‘พ',
    'spades': 'โ™ ๏ธ',
    'spaghetti': '๐Ÿ',
    'sparkle': 'โ‡๏ธ',
    'sparkler': '๐ŸŽ‡',
    'sparkles': 'โœจ',
    'sparkling_heart': '๐Ÿ’–',
    'speak_no_evil': '๐Ÿ™Š',
    'speaker': '๐Ÿ”ˆ',
    'speech_balloon': '๐Ÿ’ฌ',
    'speedboat': '๐Ÿšค',
    'star': 'โญ๏ธ',
    'star2': '๐ŸŒŸ',
    'stars': '๐ŸŒ ',
    'station': '๐Ÿš‰',
    'statue_of_liberty': '๐Ÿ—ฝ',
    'steam_locomotive': '๐Ÿš‚',
    'stew': '๐Ÿฒ',
    'straight_ruler': '๐Ÿ“',
    'strawberry': '๐Ÿ“',
    'stuck_out_tongue': '๐Ÿ˜›',
    'stuck_out_tongue_closed_eyes': '๐Ÿ˜',
    'stuck_out_tongue_winking_eye': '๐Ÿ˜œ',
    'sun_with_face': '๐ŸŒž',
    'sunflower': '๐ŸŒป',
    'sunglasses': '๐Ÿ˜Ž',
    'sunny': 'โ˜€๏ธ',
    'sunrise': '๐ŸŒ…',
    'sunrise_over_mountains': '๐ŸŒ„',
    'surfer': '๐Ÿ„',
    'sushi': '๐Ÿฃ',
    'suspension_railway': '๐ŸšŸ',
    'sweat': '๐Ÿ˜“',
    'sweat_drops': '๐Ÿ’ฆ',
    'sweat_smile': '๐Ÿ˜…',
    'sweet_potato': '๐Ÿ ',
    'swimmer': '๐ŸŠ',
    'symbols': '๐Ÿ”ฃ',
    'syringe': '๐Ÿ’‰',
    'tada': '๐ŸŽ‰',
    'tanabata_tree': '๐ŸŽ‹',
    'tangerine': '๐ŸŠ',
    'taurus': 'โ™‰๏ธ',
    'taxi': '๐Ÿš•',
    'tea': '๐Ÿต',
    'telephone': 'โ˜Ž๏ธ',
    'telephone_receiver': '๐Ÿ“ž',
    'telescope': '๐Ÿ”ญ',
    'tennis': '๐ŸŽพ',
    'tent': 'โ›บ๏ธ',
    'thought_balloon': '๐Ÿ’ญ',
    'three': '3๏ธโƒฃ',
    'thumbsdown': '๐Ÿ‘Ž',
    'thumbsup': '๐Ÿ‘',
    'ticket': '๐ŸŽซ',
    'tiger': '๐Ÿฏ',
    'tiger2': '๐Ÿ…',
    'tired_face': '๐Ÿ˜ซ',
    'tm': 'โ„ข๏ธ',
    'toilet': '๐Ÿšฝ',
    'tokyo_tower': '๐Ÿ—ผ',
    'tomato': '๐Ÿ…',
    'tongue': '๐Ÿ‘…',
    'top': '๐Ÿ”',
    'tophat': '๐ŸŽฉ',
    'tractor': '๐Ÿšœ',
    'traffic_light': '๐Ÿšฅ',
    'train': '๐Ÿš‹',
    'train2': '๐Ÿš†',
    'tram': '๐ŸšŠ',
    'triangular_flag_on_post': '๐Ÿšฉ',
    'triangular_ruler': '๐Ÿ“',
    'trident': '๐Ÿ”ฑ',
    'triumph': '๐Ÿ˜ค',
    'trolleybus': '๐ŸšŽ',
    'trophy': '๐Ÿ†',
    'tropical_drink': '๐Ÿน',
    'tropical_fish': '๐Ÿ ',
    'truck': '๐Ÿšš',
    'trumpet': '๐ŸŽบ',
    'tshirt': '๐Ÿ‘•',
    'tulip': '๐ŸŒท',
    'turtle': '๐Ÿข',
    'tv': '๐Ÿ“บ',
    'twisted_rightwards_arrows': '๐Ÿ”€',
    'two': '2๏ธโƒฃ',
    'two_hearts': '๐Ÿ’•',
    'two_men_holding_hands': '๐Ÿ‘ฌ',
    'two_women_holding_hands': '๐Ÿ‘ญ',
    'u5272': '๐Ÿˆน',
    'u5408': '๐Ÿˆด',
    'u55b6': '๐Ÿˆบ',
    'u6307': '๐Ÿˆฏ',
    'u6708': '๐Ÿˆท',
    'u6709': '๐Ÿˆถ',
    'u6e80': '๐Ÿˆต',
    'u7121': '๐Ÿˆš',
    'u7533': '๐Ÿˆธ',
    'u7981': '๐Ÿˆฒ',
    'u7a7a': '๐Ÿˆณ',
    'uk': '๐Ÿ‡ฌ๐Ÿ‡ง',
    'umbrella': 'โ˜”๏ธ',
    'unamused': '๐Ÿ˜’',
    'underage': '๐Ÿ”ž',
    'unlock': '๐Ÿ”“',
    'up': '๐Ÿ†™',
    'us': '๐Ÿ‡บ๐Ÿ‡ธ',
    'v': 'โœŒ๏ธ',
    'vertical_traffic_light': '๐Ÿšฆ',
    'vhs': '๐Ÿ“ผ',
    'vibration_mode': '๐Ÿ“ณ',
    'video_camera': '๐Ÿ“น',
    'video_game': '๐ŸŽฎ',
    'violin': '๐ŸŽป',
    'virgo': 'โ™๏ธ',
    'volcano': '๐ŸŒ‹',
    'vs': '๐Ÿ†š',
    'walking': '๐Ÿšถ',
    'waning_crescent_moon': '๐ŸŒ˜',
    'waning_gibbous_moon': '๐ŸŒ–',
    'warning': 'โš ๏ธ',
    'watch': 'โŒš๏ธ',
    'water_buffalo': '๐Ÿƒ',
    'watermelon': '๐Ÿ‰',
    'wave': '๐Ÿ‘‹',
    'wavy_dash': 'ใ€ฐ๏ธ',
    'waxing_crescent_moon': '๐ŸŒ’',
    'waxing_gibbous_moon': '๐ŸŒ”',
    'wc': '๐Ÿšพ',
    'weary': '๐Ÿ˜ฉ',
    'wedding': '๐Ÿ’’',
    'whale': '๐Ÿณ',
    'whale2': '๐Ÿ‹',
    'wheelchair': 'โ™ฟ๏ธ',
    'white_check_mark': 'โœ…',
    'white_circle': 'โšช๏ธ',
    'white_flower': '๐Ÿ’ฎ',
    'white_large_square': 'โฌœ๏ธ',
    'white_medium_small_square': 'โ—ฝ๏ธ',
    'white_medium_square': 'โ—ป๏ธ',
    'white_small_square': 'โ–ซ๏ธ',
    'white_square_button': '๐Ÿ”ณ',
    'wind_chime': '๐ŸŽ',
    'wine_glass': '๐Ÿท',
    'wink': '๐Ÿ˜‰',
    'wolf': '๐Ÿบ',
    'woman': '๐Ÿ‘ฉ',
    'womans_clothes': '๐Ÿ‘š',
    'womans_hat': '๐Ÿ‘’',
    'womens': '๐Ÿšบ',
    'worried': '๐Ÿ˜Ÿ',
    'wrench': '๐Ÿ”ง',
    'x': 'โŒ',
    'yellow_heart': '๐Ÿ’›',
    'yen': '๐Ÿ’ด',
    'yum': '๐Ÿ˜‹',
    'zap': 'โšก๏ธ',
    'zero': '0๏ธโƒฃ',
    'zzz': '๐Ÿ’ค',
}


def _replace_emoji(line):
    for shortcode, characters in _emoji_replacement_mapping.items():
        line = line.replace(':{}:'.format(shortcode), characters)
    return line


def _unreplace_emoji(line):
    # replace sequences before single characters
    for shortcode, character in sorted(
            _emoji_replacement_mapping.items(),
            key=lambda t: len(t[1]),
            reverse=True
    ):
        line = line.replace(character, ':{}:'.format(shortcode))
    return line


def do_the_thing(func):
    conn = op.get_bind()

    for table_name, column_name in (('posts', 'content'),
                                    ('messages', 'message')):
        table = sa.Table(
            table_name,
            sa.MetaData(),
            sa.Column('id', sa.Integer, primary_key=True),
            sa.Column(column_name, sa.String)
        )
        for row in conn.execute(table.select()):
            content = getattr(row, column_name)
            new_content = func(content)
            if not new_content == content:
                conn.execute(
                    table.update().where(
                        table.c.id == row.id
                    ).values(**{column_name: new_content})
                )


def upgrade():
    do_the_thing(_replace_emoji)


def downgrade():
    do_the_thing(_unreplace_emoji)