zipperer / migrate_database_with_michael

0 stars 0 forks source link

Implement table `file_timestamped_entry_book_chapter_verse` and make process to populate it #44

Closed zipperer closed 5 months ago

zipperer commented 5 months ago

See this comment.

Copied below:

-- Table from content of files in directory of files ‘Bible Display App CSV txt files’ after 
--  (a) split days with two sessions into two files and 
--  (b) convert to csv.
-- tablename: timestamped_entry_book_chapter_verse

filename                  | filename_date | morning_or_night | entry_timestamp     | book     | chapter | verse
BDA 2014 1 05_morning.txt | 2014-01-05    | morning          | 2014-01-05 00:01:49 | Romans   | 8       | 29
BDA 2014 1 05_night.txt   | 2014-01-05    | night            | 2014-01-05 00:04:45 | 1Timothy | 4       | 1

To get a table like this I propose:

zipperer commented 5 months ago

At first I will go directly from

So, in the case where there is no restart at 12am, will still write new file b/c will write as csv.

zipperer commented 5 months ago

Note on filename_date:

Current version uses entry_timestamp to determine this date rather than extracting the date from the filename. Better name for that column, given how current version determines it, is entry_date.

zipperer commented 5 months ago
postgres=# CREATE TABLE bible_display_app_file_entries_with_morning_or_night (
postgres(#   filename VARCHAR NOT NULL,
postgres(#   entry_date DATE NOT NULL,
postgres(#   morning_or_night VARCHAR NOT NULL,
postgres(#   entry_timestamp TIMESTAMP NOT NULL,
postgres(#   book VARCHAR NOT NULL,
postgres(#   chapter VARCHAR NOT NULL,
postgres(#   verse VARCHAR NOT NULL);
zipperer commented 5 months ago

I perform initial experiment and tests with this commit