Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: migration status for duckdb file is stored in postgres #12

Open
mindreframer opened this issue Sep 13, 2024 · 1 comment
Open

Bug: migration status for duckdb file is stored in postgres #12

mindreframer opened this issue Sep 13, 2024 · 1 comment
Assignees
Labels
discussion Potential feature request / change

Comments

@mindreframer
Copy link

First: great extension! I love having self-contained features, that can be dropped into a phoenix app with little configuration. Also, the way you integrated DuckDB is very good and it really wont cause any performance issues for small/medium apps.

Also, it goes into direction Feature -> own DB, which I think is an intriguing architecture pattern.

Now some concerns from my side:

I have tried to reset the analytics data by just deleting the DB, hoping it would be recreated automatically.
This was not the case, I had to re-run the migration (after deleting the according schema_migrations row) again.

Maybe it makes sense to let the migration information be kept in the DuckDB file, and run it automatically? That way the setup becomes simpler (not need to copy migrations to your phx app) and it becomes more robust overall.

Thoughts?

Best,
Roman

@lalabuy948
Copy link
Owner

Hi @mindreframer ,

Thank you so much for kind words and considering to use my library.

When I was doing a lot of testing I had to do a lot what you described in this issue.
That's why I mentioned in README this:

Tip

iex -S mix phx.server PhoenixAnalytics.Migration.up()

For current CREATE TABLE IF NOT EXISTS migration, you suggestion would work perfectly, I could just inject it to Repo.start_link and done.

But what if in the future we decide to extend/change duckdb schema and we would need to provide upgrade migration.
One way would be to create migrator functionality inside DuckDB, but I'm not sure yet if that's way to go.

The main reason I decided to store migrations in Postgres/Sqlite/Mysql/etc to keep DuckDB schema state and application state in one place.

I'm happy to compare pros/cons and based on it proceed with solution.

@lalabuy948 lalabuy948 self-assigned this Sep 14, 2024
@lalabuy948 lalabuy948 added the discussion Potential feature request / change label Sep 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Potential feature request / change
Projects
None yet
Development

No branches or pull requests

2 participants