Skip to content

Commit

Permalink
Correct the SQLite schema for the exports table
Browse files Browse the repository at this point in the history
  • Loading branch information
arp242 committed Nov 10, 2020
1 parent 90e2e45 commit 9303ec0
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 2 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@ but not every minor bugfix.

The goatcounter.com service generally runs the latest master.

2020-11-10, v1.4.2
------------------

- Add a "visitor counter" image you can add to your website to display the
number of visitors, similar to old-style counters back in the ’90s (#398).

- Other than this, it's mostly contains a few minor bugfixes and the like. You
can see a list of changes in the git log:
https://github.com/zgoat/goatcounter/compare/v1.4.1...v1.4.2


2020-09-04 v1.4.1
-----------------

Expand Down
26 changes: 26 additions & 0 deletions db/migrate/sqlite/2020-11-10-1-correct-exports.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
begin;
create table exports2 (
export_id integer primary key autoincrement,
site_id integer not null,
start_from_hit_id integer not null,

path varchar not null,
created_at timestamp not null check(created_at = strftime('%Y-%m-%d %H:%M:%S', created_at)),

finished_at timestamp check(finished_at is null or finished_at = strftime('%Y-%m-%d %H:%M:%S', finished_at)),
last_hit_id integer,
num_rows integer,
size varchar,
hash varchar,
error varchar,

foreign key (site_id) references sites(id) on delete restrict on update restrict
);
insert into exports2
select export_id, site_id, start_from_hit_id, path, created_at, finished_at, last_hit_id, num_rows, size, hash, error from exports;
drop table exports;
alter table exports2 rename to exports;
create index "exports#site_id#created_at" on exports(site_id, created_at);

insert into version values('2020-11-10-1-correct-exports');
commit;
2 changes: 1 addition & 1 deletion db/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ create table exports (
path varchar not null,
created_at timestamp not null check(created_at = strftime('%Y-%m-%d %H:%M:%S', created_at)),

finished_at timestamp check(finished_at is null or finished_at = strftime('%Y-%m-%d %H:%M:%S', created_at)),
finished_at timestamp check(finished_at is null or finished_at = strftime('%Y-%m-%d %H:%M:%S', finished_at)),
last_hit_id integer,
num_rows integer,
size varchar,
Expand Down
34 changes: 33 additions & 1 deletion pack/pack.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions tpl/api.html
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,8 @@ <h3 id="goatcounter.SiteSettings">goatcounter.SiteSettings <a class="permalink"
<p class="info"></p>
<h4>public <sup>boolean</sup></h4>
<p></p>
<h4>allow_counter <sup>boolean</sup></h4>
<p></p>
<h4>twenty_four_hours <sup>boolean</sup></h4>
<p></p>
<h4>sunday_starts_week <sup>boolean</sup></h4>
Expand Down
3 changes: 3 additions & 0 deletions tpl/api.json
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,9 @@
"allow_admin": {
"type": "boolean"
},
"allow_counter": {
"type": "boolean"
},
"campaigns": {
"type": "array",
"items": {
Expand Down

0 comments on commit 9303ec0

Please sign in to comment.