Post Top Ad

Post Top Ad

Monday, 13 January 2020

How To Design Sqlite Db



                                             DB Structure:


CREATE TABLE `currency_detail` (
                `currency_id`     INTEGER,
                `name`  TEXT,
                `display_name` TEXT,
                `description`       TEXT,
                PRIMARY KEY(`currency_id`)
);


CREATE TABLE `deleted_order_detail` (
                `id`          INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
                `table_id`             TEXT,
                `seat_id`              INTEGER,
                `menu_item_id`               INTEGER,
                `menu_price_id`              INTEGER,
                `order_id`            INTEGER,
                `order_no`          INTEGER
);


CREATE TABLE `food_type` (
                `id`          INTEGER,
                `restaurant_id`  INTEGER,
                `name`  TEXT,
                PRIMARY KEY(`id`)
);


CREATE TABLE `menu_categories` (
                `category_id`     INTEGER,
                `name`  TEXT,
                `display_name` TEXT,
                `description`       TEXT,
                `restaurant_id`  INTEGER,
                `image` TEXT,
                `category_type`                INTEGER,
                `order_number`               TEXT,
                `modified_by`   TEXT,
                `created_date`  TEXT,
                `modified_date`               TEXT,
                PRIMARY KEY(`category_id`)
);

CREATE TABLE `menu_food_types` (
                `id`          INTEGER,
                `food_type_id` INTEGER,
                `menu_item_id`               INTEGER,
                `category_id`     INTEGER,
                PRIMARY KEY(`id`)
);

CREATE TABLE `menu_image` (
                `menu_image_id`            INTEGER,
                `menu_id`           INTEGER,
                `menu_image_name`    TEXT,
                PRIMARY KEY(`menu_image_id`)
);


CREATE TABLE `menu_price` (
                `menu_price_id`              INTEGER,
                `menu_id`           INTEGER,
                `quantity_name`              TEXT,
                `menu_price`     REAL,
                PRIMARY KEY(`menu_price_id`)
);

CREATE TABLE `menu_tags` (
                `tag_id` INTEGER,
                `menu_id`           INTEGER,
                `tag_name`         TEXT,
                PRIMARY KEY(`tag_id`)
);

CREATE TABLE `payments` (
                `id`          INTEGER,
                `company_id`    INTEGER,
                `merchant_id`   INTEGER,
                `restaurant_id`  INTEGER,
                `table_number`                TEXT,
                `batch_number`               TEXT,
                `batch_status`   TEXT,
                `payment_date`               DATE,
                `amount`             REAL,
                `discount_amount`         REAL,
                `total_amount` REAL,
                `discount_reason`           TEXT,
                `coupon_code` TEXT,
                `transaction_id`                TEXT,
                `approval_code`               TEXT,
                `approval_message`       TEXT,
                `payment_status`            INTEGER,
                `payment_type`               INTEGER,
                `def_currency_id`            INTEGER,
                `additional_info1`            TEXT,
                `additional_info2`            TEXT,
                `bill_number`     TEXT,
                `tax_details`       TEXT,
                `tips`      REAL,
                `tx_status`          TEXT,
                `tx_id`   TEXT,
                `pg_resp_code`                TEXT,
                `tx_msg`              TEXT,
                `paid_amount`  REAL,
                `auth_id_code` TEXT,
                `payment_mode`            TEXT,
                `pg_mobile_no`                TEXT,
                `txn_date_time`               TEXT,
                `transaction_reference`                TEXT,
                `pgCurrency`      TEXT,
                `user_id`              TEXT,
                `number_of_people`     TEXT,
                `order_no`          INTEGER,
                `created_date`  TEXT,
                `modified_by`   TEXT,
                `payment_time`               TEXT,
                `name`  TEXT,
                `country_code` TEXT,
                `user_phone`    TEXT,
                `user_email`       TEXT,
                `modified_date`               TEXT,
                PRIMARY KEY(`id`)
);



CREATE TABLE `restaurant` (
                `restaurant_id`  INTEGER,
                `name`  TEXT,
                `company_id`    INTEGER,
                `merchant_id`   INTEGER,
                `address`             TEXT,
                `contact_email` TEXT,
                `contact_name`                TEXT,
                `admin_password`          TEXT,
                `phone`                TEXT,
                `logo`     TEXT,
                `url`        TEXT,
                `latitude`              TEXT,
                `longitude`          TEXT,
                `currency_id`     TEXT,
                `status` TEXT,
                `modified_by`   TEXT,
                `tin`        TEXT,
                `auth_token`     TEXT,
                `created_date`  TEXT,
                `modified_date`               TEXT,
                PRIMARY KEY(`restaurant_id`)
);


CREATE TABLE `restaurant_menu` (
                `menu_id`           INTEGER,
                `name`  TEXT,
                `company_id`    INTEGER,
                `merchant_id`   INTEGER,
                `restaurant_id`  INTEGER,
                `image` TEXT,
                `description`       TEXT,
                `ingredients`      TEXT,
                `prep_time`        TEXT,
                `price`   TEXT,
                `def_currency_id`            TEXT,
                `video_link`        TEXT,
                `rating`  TEXT,
                `order_number`               TEXT,
                `last_changed`  TEXT,
                `kitchen_id`        INTEGER,
                `category_id`     INTEGER,
                `menu_type`     TEXT,
                `status` TEXT,
                `modified_by`   TEXT,
                `created_date`  TEXT,
                `modified_date`               TEXT,
                PRIMARY KEY(`menu_id`)
);

CREATE TABLE `restaurant_orders` (
                `id`          INTEGER,
                `order_id`            TEXT,
                `company_id`    INTEGER,
                `merchant_id`   INTEGER,
                `restaurant_id`  INTEGER,
                `menu_item_id`               INTEGER,
                `menu_item_name`       TEXT,
                `table_number`                TEXT,
                `batch_number`               TEXT,
                `batch_status`   TEXT,
                `order_date`      TEXT,
                `price`   TEXT,
                `item_quantity`                INTEGER,
                `served_status`                INTEGER,
                `pending_status`              INTEGER,
                `def_currency_id`            TEXT,
                `user_id`              INTEGER,
                `bill_number`     TEXT,
                `order_no`          INTEGER,
                `seat_id`              INTEGER,
                `menu_price_id`              INTEGER,
                `order_item_no`              TEXT,
                `modified_by`   TEXT,
                `created_date`  TEXT,
                `take_away`       TEXT,
                `name`  TEXT,
                `country_code` TEXT,
                `user_phone`    TEXT,
                `user_email`       TEXT,
                `confirm_delivery`           TEXT,
                `order_status`   TEXT,
                `modified_date`               TEXT,
                PRIMARY KEY(`id`)
);

CREATE TABLE `restaurant_table` (
                `table_id`             INTEGER,
                `table_name`     TEXT,
                `company_id`    INTEGER,
                `merchant_id`   INTEGER,
                `restaurant_id`  INTEGER,
                `device_id`          TEXT,
                `ip_address`       TEXT,
                `number_of_seats`         TEXT,
                `table_number`                TEXT,
                `status` TEXT,
                `modified_by`   TEXT,
                `created_date`  TEXT,
                `modified_date`               TEXT,
                PRIMARY KEY(`table_id`)
);

CREATE TABLE `seat_details` (
                `seat_id`              INTEGER,
                `table_id`             INTEGER,
                `seat_name`      TEXT,
                `seat_status`      TEXT,
                `created_at`       TEXT,
                PRIMARY KEY(`seat_id`)
);

CREATE TABLE `tax_detail` (
                `tax_id` INTEGER,
                `name`  TEXT,
                `display_name` TEXT,
                `description`       TEXT,
                `tax`       INTEGER,
                PRIMARY KEY(`tax_id`)
);

CREATE TABLE `user` (
                `user_id`              INTEGER,
                `user_type_id`  INTEGER,
                `name`  TEXT,
                `user_name`      TEXT,
                `user_password`              TEXT,
                `restaurant_id`  INTEGER,
                `created_at`       TEXT,
                `modified_at`    TEXT,
                PRIMARY KEY(`user_id`)
);

No comments:

Post a Comment