Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
fragments-postgres
Advanced tools
postgres for fragments: migration commands, auto generated mesa tables, data accessor functions and more
the documentation in this readme is work in progress and currently unfinished !
postgres for fragments: migration commands, auto generated mesa tables, data accessor functions and more
you should probably first read what fragments is all about !
also see fragments-user as an example app that uses fragments-postgres extensively.
just add fragments-postgres as a source to your fragments application. for example like this:
#!/usr/bin/env node
var hinoki = require('hinoki');
var fragments = require('fragments');
var fragmentsPostgres = require('fragments-postgres');
var source = hinoki.source([
__dirname,
fragments.source,
fragments.umgebung,
fragmentsPostgres
]);
source = hinoki.decorateSourceToAlsoLookupWithPrefix(source, 'fragments_');
module.exports = fragments(source);
if (require.main === module) {
module.exports.runCommand();
}
migrations:create {migration-name} - create a new migration in directory that is in envvar `MIGRATION_PATH`
pg:create - create database whose name is in envvar `POSTGRES_DATABASE`
pg:drop - drop database whose name is in envvar `POSTGRES_DATABASE`
pg:drop-create - drop and then create database whose name is in in envvar `POSTGRES_DATABASE`
pg:drop-create-migrate - drop and then create database whose name is in in envvar `POSTGRES_DATABASE` and then apply all migrations in directory that is in envvar `MIGRATION_PATH` to database whose url is in envvar `DATABASE_URL`
pg:migrate [--verbose] [--dry] - migrate: apply all migrations in directory that is in envvar `MIGRATION_PATH` to database whose url is in envvar `DATABASE_URL`
key mesa
maps to a mesa object that connects
to the database reachable under envvar DATABASE_URL
using a connection pool
of size envvar POSTGRES_POOL_SIZE
.
key userTable
maps to a mesa object
that is made from mesa
above to use table user
: mesa.table('user')
.
urlSnapshotTable
uses table url_snapshot
: mesa.table('url_snapshot')
.
you get the idea.
key firstUserWhereId
maps to a function which
returns a promise that will resolve to the first
record from table user
where column id
matches the argument id
in the database reachable under envvar DATABASE_URL
.
it runs the following mesa query: userTable.where({id: id}).first()
.
use any table name or column name. chain multiple where clauses.
selectUrlSnapshotWhereIsDead(false)
returns a promise that will resolve to all
records from table url_snapshot
where column is_dead
is false
.
it runs the following mesa query: urlSnapshotTable.where({is_dead: false}).select()
.
use any table name or column name. chain multiple where clauses.
deleteUserWhereId(id)
works as expected.
it runs the following mesa query: userTable.where({id: id}).delete()
.
use any table name or column name. chain multiple where clauses.
at least one where clause is required for delete.
if you need more complex queries use the mesa tables directly.
FAQs
postgres for fragments: migration commands, auto generated mesa tables, data accessor functions and more
The npm package fragments-postgres receives a total of 1 weekly downloads. As such, fragments-postgres popularity was classified as not popular.
We found that fragments-postgres demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.