2019年7月11日木曜日

MariaDB 思いっきりドーンとtable 作成


#!/bin/bash

DB=DB名
USER=ユーザ名
PW=パスワード

#CLMS1="tana, date, hinc, kata, katad"
#select count(*) from $TBL1 where $1 like "$2";
#select $CLMS1 from $TBL1 where $1 like "$2";
#show columns from zaiko;

mysql -u$USER $DB -p$PW << EOS
create table counters (name char(16), value int);
create table seibans (
seiban_id int,
seiban char(8),
seiban_name varchar(120),
hd_kpn int,
hd_end_id char(5),
hd_end_at char(14),
person_id char(5),
create_at char(14));
create table units (part_number int,rev_cnt int,hinc char(32),hink char(3),updata_header_count int,update_data_count int,drawing_name char(30),parts_numbers int,effect_records int,model_name varchar(120),unit_name varchar(120),model_code char(12),target_roth char(10),drawing_number_old char(30),quantity int,approval_id char(5),approval_at char(14),update_design_id char(5),update_design_at char(14),drawer_id char(5),update_drawing_at char(14),start_at char(14),end_at char(14),disabled_at char(14),regist_id char(5),regist_at char(14),update_id char(5),update_at char(14),delete_id char(5),delete_at char(14));
create table hd (
seiban char(8),
seiban_id int,
pos int,
update_info varchar(120),
code char(10),
layout_no varchar(120),
sharp varchar(6),
name varchar(120),
kata varchar(120),
spec varchar(120),
maker varchar(60),
members int,
total_members int,
payout_flag char(1),
remarks varchar(120),
update_reason varchar(120),
del_flag char(1),
kpn int,
tana char(32),
part_number int,
hinc char(32),
hink char(3),
regist_id char(5),
regist_at char(14));
insert into counters values('payouts', 0);
insert into counters values('seibans', 0);

EOS

Peace!!



unit 無い場合 changed 190722


#!/bin/bash

DB=DB名
USER=ユーザ名
PW=パスワード

#CLMS1="tana, date, hinc, kata, katad"
#select count(*) from $TBL1 where $1 like "$2";
#select $CLMS1 from $TBL1 where $1 like "$2";
#show columns from zaiko;

mysql -u$USER $DB -p$PW << EOS
drop table counters, seibans, hd;
create table counters (name char(16), value int);
create table seibans (
seiban_id int,
seiban char(8),
seiban_name varchar(120),
hd_kpn int,
hd_quantity int,
hd_dest char(64),
hd_fjkn char(4),
hd_end_id char(5),
hd_end_at char(14),
person_id int,
create_at char(14));
create table hd (
seiban char(8),
seiban_id int,
pos int,
update_info varchar(120),
code char(10),
layout_no varchar(120),
sharp varchar(6),
name varchar(120),
kata varchar(120),
spec varchar(120),
maker varchar(60),
members int,
total_members int,
payout_flag char(1),
remarks varchar(120),
update_reason varchar(120),
del_flag char(1),
kpn int,
tana char(32),
part_number int,
hinc char(32),
hink char(3),
regist_id char(5),
regist_at char(14),
regist_end_at char(14));
insert into counters values('payouts', 1);
insert into counters values('seibans', 1);
EOS



0 件のコメント:

コメントを投稿