CREATE TABLE connections_tracks (
    id VARCHAR(64) PRIMARY KEY DEFAULT uuid_generate_v4(),
    connection_id VARCHAR(64) REFERENCES connections(id) ON DELETE CASCADE,
    instrument_id VARCHAR(64) REFERENCES instruments(id) ON DELETE CASCADE,
    sound VARCHAR(64) NOT NULL,
    created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);

UPDATE genres set id = lower(description);

DELETE FROM instruments;

--popularity: 3 High, 2 Mid, 1 Low, 0 user-defined
ALTER TABLE instruments ADD COLUMN popularity INTEGER NOT NULL DEFAULT 0;

INSERT INTO instruments (id, description, popularity) VALUES 
                        ('acoustic guitar', 'Acoustic Guitar', 3),
                        ('bass guitar', 'Bass Guitar', 3),
                        ('computer', 'Computer', 3),
                        ('drums', 'Drums', 3),
                        ('electric guitar', 'Electric Guitar', 3),
                        ('keyboard', 'Keyboard', 3),
                        ('voice', 'Voice', 3),
                        ('flute', 'Flute', 2),
                        ('clarinet', 'Clarinet', 2),
                        ('saxophone', 'Saxophone', 2),
                        ('trumpet', 'Trumpet', 2),
                        ('violin', 'Violin', 2),
                        ('trombone', 'Trombone', 2),
                        ('banjo', 'Banjo', 2),
                        ('harmonica', 'Harmonica', 2),
                        ('accordion', 'Accordion', 2),
                        ('french horn', 'French Horn', 1),
                        ('euphonium', 'Euphonium', 1),
                        ('tuba', 'Tuba', 1),
                        ('oboe', 'Oboe', 1),
                        ('ukulele', 'Ukulele', 1),
                        ('cello', 'Cello', 1),
                        ('viola', 'Viola', 1),
                        ('mandolin', 'Mandolin', 1);
