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

Make running the example a trivial process #112

Merged
merged 3 commits into from
Mar 22, 2021
Merged

Make running the example a trivial process #112

merged 3 commits into from
Mar 22, 2021

Conversation

mesaugat
Copy link
Member

@mesaugat mesaugat commented Mar 21, 2021

Following changes have been made to make the example easier to run.

  • Bump sync-db version to ^1.0.0-beta.10
  • Remove babel and unwanted dev dependencies
  • Include PostgreSQL database credentials in docker-compose.yml for ease of use
  • Remove connections.sync-db.json.docker.example
  • Use postgres:13-alpine and node:14-slim to reduce container size
  • Bump knex and pg to latest versions
  • Update index.js to support new return values from upgraded version of knex
  • Update SQL functions to work properly with PostgreSQL database
  • Add README.md with details on how to run the example

Sample output with docker:

example-app | yarn run v1.22.5
example-app | $ /app/node_modules/.bin/sync-db synchronize
example-app | Synchronizing...
example-app |
example-app |  ▸ db1
example-app |    [✓] Synchronization - started
example-app |    [✓] Synchronization - pruned (0s)
example-app |    [✓] Migrations - up to date (0.02s)
example-app |    [✓] Synchronization - completed (0.13s)
example-app |
example-app | Synchronization complete for 1 / 1 connection(s). (0.25s)
example-app |
example-app | Done in 0.54s.
example-app | yarn run v1.22.5
example-app | $ node src/index.js
example-app |
example-app | List of table names in the database:
example-app |  [ 'knex_migrations', 'knex_migrations_lock', 'users', 'todos' ]
example-app |
example-app | List of user names in the database:
example-app |  [ 'sync' ]
example-app |
example-app | Calculations:
example-app |  { 'Sum of 6 and 7': 13, 'Square of 6': 36, 'Product of 6 and 7': 42 }
example-app |
example-app | Current date time: 2021-03-21T00:00:00.000Z
example-app | Done in 0.11s.
example-app exited with code 0

client: 'postgresql',
connection: connections.find(({ id }) => id === 'db1')
// PostgreSQL connection only works with a connection string.
// Time wasted = 60 minutes
Copy link
Collaborator

Choose a reason for hiding this comment

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

😆

@cham11ng cham11ng merged commit 522ef57 into master Mar 22, 2021
@cham11ng cham11ng deleted the node-app-pg-ts branch March 22, 2021 05:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants