Created
November 5, 2012 05:02
-
-
Save flakyfilibuster/4015435 to your computer and use it in GitHub Desktop.
Dummy Database
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'sqlite3' | |
require 'faker' | |
$db =SQLite3::Database.new( "test.db" ) | |
$db.execute <<-SQL | |
create table dummy ( | |
id INTEGER PRIMARY KEY, | |
first_name varchar(30), | |
last_name varchar(30), | |
email VARCHAR, | |
phone VARCHAR, | |
created_at datetime DEFAULT CURRENT_TIMESTAMP, | |
updated_at datetime DEFAULT CURRENT_TIMESTAMP | |
); | |
SQL | |
1000.times do | |
$db.execute("INSERT INTO dummy ('first_name', 'last_name', 'email', 'phone') | |
VALUES (?, ?, ?, ?)", [Faker::Name.first_name, Faker::Name.last_name, Faker::Internet.email,Faker::PhoneNumber.phone_number, ]) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment