123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- CREATE TABLE
- menu_cate (
- id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
- name TEXT DEFAULT '',
- logo TEXT DEFAULT '',
- local_logo TEXT DEFAULT '',
- description TEXT,
- create_time DATETIME DEFAULT CURRENT_TIMESTAMP,
- update_time DATETIME DEFAULT CURRENT_TIMESTAMP,
- sort INTEGER DEFAULT 0,
- status TEXT DEFAULT 'A'
- );
- CREATE TABLE
- menu_commodity (
- id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
- type TEXT DEFAULT 'product',
- name TEXT DEFAULT '',
- cate_id INTEGER DEFAULT 0,
- goods_no TEXT DEFAULT '',
- is_single_spec TEXT DEFAULT 'Y',
- logo TEXT DEFAULT '',
- images TEXT DEFAULT '',
- price REAL DEFAULT 0.00,
- line_price REAL DEFAULT 0.00,
- stock INTEGER DEFAULT 0,
- weight REAL DEFAULT 0.00,
- coupon_ids TEXT DEFAULT '',
- service_time INTEGER DEFAULT 0,
- init_sale INTEGER DEFAULT 0,
- sale_point TEXT DEFAULT '',
- can_use_point TEXT DEFAULT 'N',
- is_member_discount TEXT DEFAULT 'Y',
- sort INTEGER DEFAULT 0,
- description TEXT,
- create_time DATETIME DEFAULT CURRENT_TIMESTAMP,
- update_time DATETIME DEFAULT CURRENT_TIMESTAMP,
- operator TEXT DEFAULT NULL,
- status TEXT DEFAULT 'A',
- FOREIGN KEY (cate_id) REFERENCES menu_cate (id)
- );
- CREATE TABLE
- menu_sku (
- id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
- sku_no TEXT DEFAULT '',
- logo TEXT DEFAULT '',
- goods_id INTEGER NOT NULL DEFAULT 0,
- stock INTEGER NOT NULL DEFAULT 0,
- price REAL NOT NULL DEFAULT 0.00,
- line_price REAL NOT NULL DEFAULT 0.00,
- weight REAL DEFAULT 0.00,
- status TEXT NOT NULL DEFAULT 'A',
- FOREIGN KEY (goods_id) REFERENCES menu_commodity (id)
- );
- CREATE TABLE
- menu_spec (
- id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
- goods_id INTEGER NOT NULL DEFAULT 0,
- name TEXT NOT NULL DEFAULT '',
- value TEXT NOT NULL DEFAULT '',
- status TEXT DEFAULT 'A',
- FOREIGN KEY (goods_id) REFERENCES menu_commodity (id)
- );
- CREATE TABLE
- menu_sku_spec (
- sku_id INTEGER NOT NULL,
- spec_id INTEGER NOT NULL,
- PRIMARY KEY (sku_id, spec_id),
- FOREIGN KEY (sku_id) REFERENCES menu_sku (id),
- FOREIGN KEY (spec_id) REFERENCES menu_spec (id)
- );
- CREATE TRIGGER trg_menu_cate_update_time AFTER
- UPDATE ON menu_cate FOR EACH ROW WHEN NEW.update_time = OLD.update_time BEGIN
- UPDATE menu_cate
- SET
- update_time = CURRENT_TIMESTAMP
- WHERE
- id = OLD.id;
- END;
- CREATE TRIGGER trg_menu_commodity_update_time AFTER
- UPDATE ON menu_commodity FOR EACH ROW WHEN NEW.update_time = OLD.update_time BEGIN
- UPDATE menu_commodity
- SET
- update_time = CURRENT_TIMESTAMP
- WHERE
- id = OLD.id;
- END;
|