diff --git a/.build.yml b/.build.yml index b739e12..cc55b35 100644 --- a/.build.yml +++ b/.build.yml @@ -95,6 +95,33 @@ tasks: duration=$SECONDS echo "Task completed in $(($duration / 60))m$(($duration % 60))s." + - version_bump_test: | + SECONDS=0 + + sudo apt install -y curl gnupg + sudo curl https://apt.playfulpachyderm.com/KEY.gpg | apt-key add - + sudo echo "deb https://apt.playfulpachyderm.com/ ./" > /etc/apt/sources.list.d/offline_twitter.list + sudo apt update + + sudo apt install -y offline-twitter-engine # Latest released version + which twitter # Ensure that it got installed + + cd twitter_offline_engine/cmd + twitter create_profile outdated_profile + cd outdated_profile + + # Create some sample data + twitter fetch_user michaelmalice + twitter get_user_tweets michaelmalice + + # Now test the upgrade using the newer version + cd .. # Now in `cmd` directory + which ./tw # Should be here from previous step + tw fetch_user michaelmalice # Any operation other than `create_profile` should trigger the upgrade + + duration=$SECONDS + echo "Task completed in $(($duration / 60))m$(($duration % 60))s." + - dpkg_build_and_upload: | SECONDS=0 diff --git a/CHANGELOG.txt b/CHANGELOG.txt new file mode 100644 index 0000000..5a0d993 --- /dev/null +++ b/CHANGELOG.txt @@ -0,0 +1,12 @@ +Changelog +========= + +v0.0.0 +------ + +- Initial release. + +v0.0.1 +------ + +- Added polls diff --git a/build/build_dpkg.sh b/build/build_dpkg.sh index 2ce0390..c99613b 100755 --- a/build/build_dpkg.sh +++ b/build/build_dpkg.sh @@ -35,8 +35,8 @@ Section: web Priority: optional Homepage: http://offline-twitter.com Description: This utility is the scraper engine that drives \`offline-twitter\`. - Download and browse content from twitter. - Save a local copy of everything you browse to a SQLite database. + Download and browse content from twitter. Everything you browse gets saved as + a local copy into a SQLite database on your computer. " > dpkg_tmp/DEBIAN/control diff --git a/persistence/profile_test.go b/persistence/profile_test.go index 27ee0ab..d74943b 100644 --- a/persistence/profile_test.go +++ b/persistence/profile_test.go @@ -111,8 +111,8 @@ func TestNewProfile(t *testing.T) { if err != nil { panic(err) } - if version != 0 { - t.Errorf("Expected database version %d, but got %d", 0, version) + if version != persistence.ENGINE_DATABASE_VERSION { + t.Errorf("Expected database version %d, but got %d", persistence.ENGINE_DATABASE_VERSION, version) } } diff --git a/persistence/versions.go b/persistence/versions.go index c3bfc3e..cacec0a 100644 --- a/persistence/versions.go +++ b/persistence/versions.go @@ -6,7 +6,7 @@ import ( ) -const ENGINE_DATABASE_VERSION = 0 +const ENGINE_DATABASE_VERSION = 1 type VersionMismatchError struct { @@ -26,7 +26,27 @@ Please upgrade this application to a newer version to use this profile. Or down * The Nth entry is the migration that moves you from version N to version N+1 */ var MIGRATIONS = []string{ +`create table polls (rowid integer primary key, + id integer unique not null check(typeof(id) = 'integer'), + tweet_id integer not null, + num_choices integer not null, + choice1 text, + choice1_votes integer, + choice2 text, + choice2_votes integer, + choice3 text, + choice3_votes integer, + choice4 text, + choice4_votes integer, + + voting_duration integer not null, -- in seconds + voting_ends_at integer not null, + + last_scraped_at integer not null, + + foreign key(tweet_id) references tweets(id) +);`, } /**