ikuwow
12/6/2015 - 12:28 PM

スプレッドシートでCSV吐き出して小さなDBのテストデータを作ると結構楽だった ref: http://qiita.com/ikuwow/items/a783a83924f88c48a1b5

スプレッドシートでCSV吐き出して小さなDBのテストデータを作ると結構楽だった ref: http://qiita.com/ikuwow/items/a783a83924f88c48a1b5

1,test1@example1.com,testname1,password1
2,test2@example2.com,testname2,password2
3,test3@example3.com,testname3,password3
4,test4@example4.com,testname4,password4
#!/bin/bash

mysql -u root --execute="drop database application"
mysql -u root --execute="source schema.sql"


mysql -u root --local-infile=1 application --execute="\
    load data local infile './users.csv' into table users fields terminated by ','
"
$ mysql -u root application --local-infile=1
mysql > load data local infile './users.csv' into table users fields terminated by ','
create table if not exists users (
    id serial not null primary key,
    email varchar(255) not null,
    name varchar(255) not null,
    password varchar(255) not null,
    created datetime not null default now()
) engine=innodb;