DROP TABLE IF EXISTS markets;

CREATE TABLE markets
(
    id serial primary key,
    name varchar,
    locale_id integer
);

GRANT ALL ON TABLE markets TO root;
GRANT ALL ON TABLE markets TO photowall_user;
GRANT ALL ON TABLE markets TO public;

ALTER TABLE markets
    ADD CONSTRAINT locale_fkey
    FOREIGN KEY (locale_id)
    REFERENCES locales (id) MATCH SIMPLE;

INSERT INTO markets (name, locale_id) VALUES
    ('SE', 1),
    ('NO', 2),
    ('GB', 3),
    ('DK', 4),
    ('FI', 5),
    ('RU', 6),
    ('GLOBAL', 7),
    ('DE', 8),
    ('NL', 9),
    ('AT', 10),
    ('US', 11),
    ('ES', 12),
    ('FR', 13),
    ('PL', 14);
