Skip to content

Conversation

@atopala
Copy link

@atopala atopala commented Oct 28, 2025

Fixes #312:

  • wraps Postgrator execSqlScript() around sqlite3 exec

Tested locally before/after (sqlite3 local db):

  • before: creates only person table
  • after: creates both person and animal tables

@perrin4869
Copy link
Collaborator

I'm wondering if this should instead be fixed upstream? Any idea why postgrator isn't already doing this?

@atopala
Copy link
Author

atopala commented Oct 30, 2025

I'm wondering if this should instead be fixed upstream? Any idea why postgrator isn't already doing this?

Not sure that postgrator needs the fix here. There's no sqlite3 db function that can do it all.
The sqlite3 client in postgrator-cli is calling sqlite3 db.all() - this function can only execute 1st statement in a sql script.

postgrator/postgrator-cli still need this to fetch the migration records.
sqlite3 db.exec() is the one that can fully execute a sqlite3 script.

@atopala atopala closed this Oct 30, 2025
@atopala atopala reopened this Oct 30, 2025
@perrin4869
Copy link
Collaborator

ok I see what's going on! sorry for the confusion. If you can add a test I'll merge! thanks

/node_modules
.eslintcache
coverage
/.idea
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm... I think these ignore rules can be added to a .gitignore_global in a user's config to reflect the environment they are using

@coveralls
Copy link

Pull Request Test Coverage Report for Build 18937704252

Details

  • 7 of 9 (77.78%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.3%) to 92.527%

Changes Missing Coverage Covered Lines Changed/Added Lines %
lib/clients/sqlite3.js 6 8 75.0%
Totals Coverage Status
Change from base Build 18514918470: -0.3%
Covered Lines: 544
Relevant Lines: 578

💛 - Coveralls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[sqlite3] SQL script files only execute the first command

3 participants