Comments (4)
There isn't really a way to fix this without manually altering the IDs; the first site you create is the main "account", and the other sites are linked to that by setting the parent column to that site ID.
This should really be split out in to an "account" and "site" table, or something, but it's a fairly large refactor. It doesn't use the "parent → child" terminology in the UI any more, but it's still in the code.
At any rate, you can set a new "account site" with something like:
update sites set parent=2 where parent=1;
You'll need to restart goatcounter, as sites are cached in memory.
from goatcounter.
Oh, you'll also need to update the users table:
update users set site_id=2 where site_id=1;
from goatcounter.
Thanks for above info! Changes worked fine.
A bit more verbose/structured procedure for future reference.
- Stop Goatcounter
- Start container with SQLite (if you don't have SQLite available)
sudo docker run --rm -v ${PATH_TO_GOATCOUNTER_DB:?}:/db.sqlite3 -it alpine
apk add sqlite
sqlite3 /db.sqlite
- Update DB
-- Nicer output
.mode table
-- Find new parent id
select site_id, parent, cname from sites;
-- Replace "parent=3" with new parent id and "parent=1" with old parent id
update sites set parent=3 where parent=1;
-- Validate new parent id
select site_id, parent, cname from sites;
-- Check users before change of parent site id
select user_id, site_id, email from users;
-- Replace "site_id=3" with new parent id and "site_id=1" with old parent id
update users set site_id=3 where site_id=1;
-- Validate changes to users
select user_id, site_id, email from users;
- Start Goatcounter again
from goatcounter.
It can just be changed to do the above automatically on deletion; that's actually much easier than splitting out the tables.
from goatcounter.
Related Issues (20)
- ERROR when setting up my page HOT 1
- API for per-day stats HOT 1
- navigator.sendBeacon can fail, should be handled HOT 1
- Cannot Self Host Locally HOT 4
- utm_campaign and campaign seem to not work
- Disabling Sessions breaks GoatCounter HOT 4
- Someone else can send traffic from their website HOT 4
- Sending events from a backend HOT 2
- Enable use of subpath rather than domains for sites HOT 2
- everything is Loading forever
- API returns unreliable number of records when using unknown query parameters HOT 7
- "campaigns" - How to? HOT 1
- GoatCounter CSV exports – what are your use cases? HOT 6
- function "is_inf" not defined HOT 2
- Delete site shows data after adding it back HOT 4
- Full Referrer URL HOT 2
- [Bug] Gray bars appear on mouse hover when "view by day" is selected HOT 6
- Sort options for stats page HOT 3
- passing full url inside path with window.goatcounter.path = window.location.href HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from goatcounter.