set names utf8mb4;

drop database if exists nsrcc;
create database nsrcc;
use nsrcc;

drop table if exists banner_image;
create table banner_image(
    banner_image_id int unsigned auto_increment,
    image_base64 text,
    app_category varchar(255),
    create_at timestamp default current_timestamp,
    remove_at timestamp null,
    primary key (banner_image_id)
)character set utf8mb4 collate utf8mb4_unicode_520_ci;


drop table if exists home_items;
create table home_items(
    home_items_id int unsigned auto_increment,
    title text null,
    description text null,
    type varchar(255),
    create_at timestamp default current_timestamp,
    remove_at timestamp null,
    primary key (home_items_id)
)character set utf8mb4 collate utf8mb4_unicode_520_ci;


drop table if exists items;
create table items(
    items_id int unsigned auto_increment,
    description text null,
    website_url text null,
    category_name varchar(255),
    app_category varchar(255),
    create_at timestamp default current_timestamp,
    remove_at timestamp null,
    primary key (items_id)
)character set utf8mb4 collate utf8mb4_unicode_520_ci;


drop table if exists card_items;
create table card_items(
    card_items_id int unsigned auto_increment,
    title text null,
    description text null,
    category_name varchar(255),
    app_category varchar(255),
    create_at timestamp default current_timestamp,
    remove_at timestamp null,
    primary key (card_items_id)
)character set utf8mb4 collate utf8mb4_unicode_520_ci;


drop table if exists card_item_image;
create table card_item_image(
    card_items_id int unsigned,
    image_base64 text,
    create_at timestamp default current_timestamp,
    remove_at timestamp null,
    foreign key (card_items_id) references card_items (card_items_id)
)character set utf8mb4 collate utf8mb4_unicode_520_ci;


drop table if exists notifications;
create table notifications(
    type text,
    create_at timestamp default current_timestamp,
    remove_at timestamp null
)character set utf8mb4 collate utf8mb4_unicode_520_ci;


drop table if exists user_notifications;
create table user_notifications(
    device_token text,
    types text,
    create_at timestamp default current_timestamp,
    remove_at timestamp null
)character set utf8mb4 collate utf8mb4_unicode_520_ci;






