alter table accept_orders change column delivery_id delivery_id int(11) comment '営業店止';
alter table accept_orders change column trucking_id trucking_id int(11) comment '配送業者';

alter table orders change column delivery_id delivery_id int(11) comment '営業店止';
alter table orders change column trucking_id trucking_id int(11) comment '配送業者';

alter table shippings change column delivery_id delivery_id int(11) comment '営業店止';
alter table shippings change column trucking_id trucking_id int(11) comment '配送業者';

alter table shipping_orders change column trucking_id trucking_id int(11) comment '配送業者';

alter table accept_orders change column operate_date operate_date date comment '使用日';
alter table orders change column operate_date operate_date date comment '使用日';
alter table sales change column operate_date operate_date date comment '使用日';
alter table samples change column operate_date operate_date date comment '使用日';

alter table accept_orders change column user_position_id user_position_id int(11) comment '営業担当者';
alter table accept_orders change column sales_user_id sales_user_id int(11) comment '担当者';

alter table adjustments change column user_position_id user_position_id int(11) comment '営業担当者';
alter table adjustments change column sales_user_id sales_user_id int(11) comment '担当者';

alter table orders change column user_position_id user_position_id int(11) comment '営業担当者';
alter table orders change column sales_user_id sales_user_id int(11) comment '担当者';

alter table purchases change column user_position_id user_position_id int(11) comment '営業担当者';
alter table purchases change column sales_user_id sales_user_id int(11) comment '担当者';

alter table restorations change column user_position_id user_position_id int(11) comment '営業担当者';
alter table restorations change column sales_user_id sales_user_id int(11) comment '担当者';

alter table sales change column user_position_id user_position_id int(11) comment '営業担当者';
alter table sales change column sales_user_id sales_user_id int(11) comment '担当者';

alter table samples change column user_position_id user_position_id int(11) comment '営業担当者';
alter table samples change column sales_user_id sales_user_id int(11) comment '担当者';

alter table shipping_orders change column user_position_id user_position_id int(11) comment '営業担当者';
alter table shipping_orders change column sales_user_id sales_user_id int(11) comment '担当者';

alter table shippings change column user_position_id user_position_id int(11) comment '営業担当者';
alter table shippings change column sales_user_id sales_user_id int(11) comment '担当者';

alter table accept_orders change column warehouse_id warehouse_id int(11) comment '納品先';
alter table adjustments change column warehouse_id warehouse_id int(11) comment '納品先';
alter table arrivings change column warehouse_id warehouse_id int(11) comment '納品先';
alter table orders change column warehouse_id warehouse_id int(11) comment '納品先';
alter table purchases change column warehouse_id warehouse_id int(11) comment '納品先';
alter table restorations change column warehouse_id warehouse_id int(11) comment '納品先';
alter table sales change column warehouse_id warehouse_id int(11) comment '納品先';
alter table samples change column warehouse_id warehouse_id int(11) comment '納品先';
alter table shipping_orders change column warehouse_id warehouse_id int(11) comment '納品先';
alter table shippings change column warehouse_id warehouse_id int(11) comment '納品先';
alter table stocks change column warehouse_id warehouse_id int(11) comment '納品先';


alter table master_app_production.warehouses add sales_area_id int(11) after user_position_id;
update master_app_production.warehouses as w left join master_app_production.user_positions as u on w.user_position_id=u.id set w.sales_area_id=u.sales_area_id;

alter table master_app_production.products add ubd_flag_code smallint(6) after spec5;
update master_app_production.products set ubd_flag_code=1;

update menus set disp_name = "納品先・製品別売上" where id= 3;
update menus set disp_name = "納品先・製品別売上" where id = 7;
update menus set disp_name = "納品先・製品型番別売上" where id = 8;
update menus set disp_name = "納品先" where id = 42;
update menus set disp_name = "納品先・得意先紐付" where id = 43;
update menus set disp_name = "納品先別売上" where id = 90;
update menus set disp_name = "エリア・製品別売上" where id = 4;

#メニューの追加
INSERT INTO menus SET id=91, menu_category_id=7, name='stocks_books_dealers_lists', disp_name='医療機器出納記録', disp_sort=66, created_at=NOW(), updated_at=NOW(), invalid_flag_code=0;
#メニューの修正
UPDATE menus SET disp_name="営業店止" WHERE id=48;

