diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | README.md | 31 | ||||
-rw-r--r-- | populate.sqlite3 | 7 |
3 files changed, 15 insertions, 24 deletions
diff --git a/.gitignore b/.gitignore index aa7648cec692..ebea556fe5b6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ *.db *.sqlite3 +!populate.sqlite3 *.db-shm *.db-wal \ No newline at end of file diff --git a/README.md b/README.md index 2e5f2f18de0e..bf81a772b2ea 100644 --- a/README.md +++ b/README.md @@ -34,34 +34,17 @@ Create a new database named `db.sqlite3` with: $ sqlite3 db.sqlite3 ``` -Initialize the schema with: +Populate the database with: ``` -sqlite> .read src/init.sql +sqlite3> .read populate.sqlite3 ``` -You can verify that you successfully initialized the database by running: +You can verify that everything is setup with: ``` -sqlite> .tables -sqlite> .schema Accounts -sqlite> .schema Trips -``` - -Populate the database with some dummy values using the following: - -``` -sqlite> PRAGMA foreign_keys = on; -sqlite> .mode csv -sqlite> .import data/accounts.csv Accounts -sqlite> .import data/trips.csv Trips -``` - -You can verify you successfully populated the tables with: - -``` -sqlite> .mode columns -sqlite> .headers on -sqlite> SELECT * FROM Accounts; -sqlite> SELECT * FROM Trips; +sqlite3> .tables +sqlite3> .schema +sqlite3> SELECT * FROM Accounts; +sqlite3> SELECT * FROM Trips; ``` diff --git a/populate.sqlite3 b/populate.sqlite3 new file mode 100644 index 000000000000..e200d2b49c02 --- /dev/null +++ b/populate.sqlite3 @@ -0,0 +1,7 @@ +PRAGMA foreign_keys = on; +.read src/init.sql +.mode csv +.import data/accounts.csv Accounts +.import data/trips.csv Trips +.mode column +.headers on \ No newline at end of file |